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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

urgent help in jsp

Reply to Message Icon

Name: mythri
Date: May 5, 2004 at 23:08:31 Pacific
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



Sponsored Link
Ads by Google

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

Missing semicolon..?

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


0

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

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.


0

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

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>


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







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


Sponsored links

Ads by Google


Results for: urgent help in jsp

urgent help in jsp www.computing.net/answers/programming/urgent-help-in-jsp/10248.html

Urgent help www.computing.net/answers/programming/urgent-help/7895.html

urgent help in html www.computing.net/answers/programming/urgent-help-in-html/10467.html