Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp and javascript  RSS feed

 
unna kumar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ThankYou Hemanth.
It is working.
unna
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!