Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 5th, 2007, 01:32 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default Response.Write doesn't work?

This javascript code in the html below does nothing and provides no error message for why it isn't working:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <head>
        <meta content="JavaScript" name="vs_defaultClientScript">
    </head>
    <body id="bdySurvey" MS_POSITIONING="FlowLayout" style="color:;font-family:Arial;font-size:10pt;">
        <form name="frmSurvey" id="frmSurvey">
My text before the script<br/>

<script language="javascript">Response.Write("TEST TEXT");</script><br/>

my text after the script
        </form>
    </body>
</HTML>

If I replace the Response.Write with alert, I get a message box, so I know it's running the script. But I cannot seem to get any text to appear on my form. What am I doing wrong?
 
Old March 27th, 2007, 02:03 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

There is no Response object in java script, if you try it in IE [java script validation enabled]you might get a script error.

You can use jsp scriplets [<%%>] or assignment tag [<%=%>] and use out object and call print() method to out put string. if you want to use only script the use innerHTML attribute to set the text.

Regards,
Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Response.Write won't work? Ron Howerton JSP Basics 1 March 23rd, 2007 07:39 AM
response.write(hyperlink) adolphus ASP.NET 1.0 and 1.1 Basics 7 September 11th, 2006 03:05 AM
response.write crmpicco Classic ASP Basics 1 January 27th, 2005 06:31 PM
response.write netcrawler Classic ASP Databases 4 September 29th, 2004 10:13 AM
Response.write Sach Classic ASP Components 5 March 19th, 2004 06:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.