Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics 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 February 27th, 2007, 12:06 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default Response.Write won'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 23rd, 2007, 07:39 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

I think there is no object Response in javascript thats why you are not getting any text on the page. if you see your java script console in FireFox or enable java script validation in IE you'll get a java script error.
If you want to use jsp then use scriptlets or if you want to use java script then use
<script language="javascript">
document.getElementById("frmSurvey").innerHTML = "Test Text";
</script>

Regards,
Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Response.Write doesn't work? Ron Howerton Pro JSP 1 March 27th, 2007 02:03 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.