• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp and javascript

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ThankYou Hemanth.
It is working.
unna
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic