The easiest way to do this isn't with a Struts tag, per se, but with a JSTL tag, I think - just use the JSTL 1.0 (or 1.1) tag library like so:

<% taglib uri="http://java.sun.com/jstl/core"; prefix="c" %>

<c:out value="${c}"/>

That *should* work for either a session-scoped variable or a request-scoped variable.

If you need to print out a value from a scriptlet (which is where keyValue is being defined) - you should store that value in pageContext, like so:

<%
pageContext.setAttribute("keyValue", keyValue); // first parameter can be anything you want to name it
%>


<c:out value="${keyValue}"/>

That should be it!

Caroline Jen wrote:

My servlet has a String called 'category'.  I want to
pass the String to a JSP.  Therefore, I have the code
shown below in the servlet:

session.setAttribute( "c", category );
OR
request.setAttribute( "c", category );

And, I do the following in my JSP:

<% String keyValue = (String)session.getAttribute( "c"
); %>
OR
<% String keyValue = (String)request.getAttribute( "c"
); %>

How do I write out keyValue in my JSP in Struts?


__________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to