aspose file tools*
The moose likes Servlets and the fly likes jsp and javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "jsp and javascript" Watch "jsp and javascript" New topic
Author

jsp and javascript

unna kumar
Greenhorn

Joined: Oct 13, 2000
Posts: 11
I want to alert some variables declared in JSP %>(scriptlet)
if I use
alert("<%var%>");
It is creating problem.
i read in some forums, it is given we have to create
JSObject for this.I am not clear.
Please help.
Thanx.
hemanth kumar
Ranch Hand

Joined: Mar 15, 2001
Posts: 55
Originally posted by unna kumar:
I want to alert some variables declared in JSP %>(scriptlet)
if I use
alert("<%var%>");
It is creating problem.
Thanx.

hi
i think u have missed "=" in ur alert.Here's a sample code that i created and it is working
<%@ page language="java" %>
<HTML>
<%
String svar="hemanth";
%>
<script language="JavaScript">
function check()
{
alert("<%=svar%>");
}
</script>
<body onLoad="check()">
hi there
</body>
</html>

Hope this helps
unna kumar
Greenhorn

Joined: Oct 13, 2000
Posts: 11
ThankYou Hemanth.
It is working.
unna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp and javascript
 
Similar Threads
Conditional alerts (was 'c:otherwise tag')
How to stop the execuation of jsp flow
passing a jsp variable as an argument to he javascript
Javascript code inside JSP (error in flushing)
display ActionErrors in JavaScript AlertBox