copy data from JSTL tag to Java Variable.

S

shaji

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: <c:eek:ut 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
 
S

shaji

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

JSTL: getting a map's keys 19
JSTL 0
JSTL 1
JSTL Question 10
Access variables in JSTL tag 2
JSTL error 1
JSTL c:out not printing value 5
JSTL config question 10

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top