Access variables in JSTL tag

J

Jon Rasmussen

JSP/JSTL:
I have a JSP page with some sciptlets

<%
String title="My page";
%>

I want to use
<c:eek:ut value='${title}' />
JSTL tag to output the result.

How can I access the Java variable in the tag?

Cheers,

Jon Rasmussen
 
R

Ryan Stewart

Jon Rasmussen said:
JSP/JSTL:
I have a JSP page with some sciptlets

<%
String title="My page";
%>

I want to use
<c:eek:ut value='${title}' />
JSTL tag to output the result.

How can I access the Java variable in the tag?
X.setAttribute("title", title);
where "X" is one of pageContext, request, session, or application. This kind
of thing is typically done in a Struts Action though.
 
R

Roman Seibold

Jon Rasmussen said:
JSP/JSTL:
I have a JSP page with some sciptlets

<%
String title="My page";
%>

I want to use
<c:eek:ut value='${title}' />
JSTL tag to output the result.

How can I access the Java variable in the tag?

By using

<c:set var="title" value="My page"/>

instead of a scriptlet.


Greets,

Roman
 

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


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top