Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > copy data from JSTL tag to Java Variable.

Reply
Thread Tools

copy data from JSTL tag to Java Variable.

 
 
shaji
Guest
Posts: n/a
 
      01-17-2006
I have a JSP page with some sciptlets.

<% String myname = "";
pageContext.setAttribute("myname",myname);
%>
<c:set var="myname" value="sherlok" />

Now I have copied the value "sherlok" to variable myname.
I can see the setting by
set value is: <cut value='${myname}'/>
This works fine as it prints out jstl variable myname.

But below statement doesnt work.
set value is: <%=myname%>

How can I get the value into a java variable from a jstl variable?


-Regards,
spa

 
Reply With Quote
 
 
 
 
shaji
Guest
Posts: n/a
 
      01-17-2006
FYI:

Solution is:

Depending upon the context of the binding of jstl variable, you can
get the value from the appropriate context.
Mainly they are application, request, session and page

In my case it was page:
<% String myname = pageContext.getAttribute("myname"); %>

-thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(struts/JSTL) Setting bean property value with jstl choose compoundresults DaFoot Java 1 10-23-2008 12:42 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
Custom JSTL that accepts JSTL expression Robert Mark Bram Java 0 12-15-2004 12:26 AM
Using JSTL for JSP Custom Tag Boolean Attributes Crowther Java 0 11-19-2003 10:43 PM
using param or out tag inside sql tag (jsp/jstl/tomcat) shahbaz Java 0 10-27-2003 02:46 AM



Advertisments