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

Members online

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top