Computing.Net > Forums > Programming > urgent help in jsp

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

urgent help in jsp

Reply to Message Icon

Original Message
Name: mythri
Date: May 5, 2004 at 23:08:31 Pacific
Subject: urgent help in jsp
OS: windows xp
CPU/Ram: p 3 128 ram
Comment:

Hi,
iam getting error in the below code plz check.

I am trying to access the jsp variables in script which exists in the same page.
the code is as follows

<%String name="something";%>
<script>
window.alert("bbbbbbb");
var x="<%=name%>"
window.alert("aaaa"+x);
</script>


iam able to get the first alert box but not the second one & at the same time error ios appearing in the starus bar like
"done with errors on the page"

ITS URGENT CAN ANY BODY HELP PLZ.

kowsalya


Report Offensive Message For Removal


Response Number 1
Name: gpp
Date: May 6, 2004 at 05:21:40 Pacific
Reply: (edit)

Missing semicolon..?

var x="<%=name%>";


Report Offensive Follow Up For Removal

Response Number 2
Name: Don Arnett
Date: May 6, 2004 at 11:43:38 Pacific
Reply: (edit)

I'm pretty sure that semicolon's are option in JavaScript.

How about spaces in the JSP tag?

<%= name %>

rather than

<%=name%>


It seems to be that the spaces were required, but I'm not sure.


Report Offensive Follow Up For Removal

Response Number 3
Name: Don Arnett
Date: May 6, 2004 at 13:52:31 Pacific
Reply: (edit)

The following worked fine for me. I see both alerts and the second displays "aaaasomething".

<%String name="something";%>
<HTML>
<HEAD>
<SCRIPT>
window.alert("bbbbbbb");
var x="<%=name%>"
window.alert("aaaa"+x);
</SCRIPT>
</HEAD>
<BODY bgcolor="#FCFEF0">
hi
</BODY>
</HTML>


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software