File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp and javascript

 
unna kumar
Greenhorn
Posts: 11
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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