Re: Pass A String From Servlet And Write Out Its Value in JSP

2003-12-08 Thread Brice Ruth
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" %>



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
%>



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]


AW: Pass A String From Servlet And Write Out Its Value in JSP

2003-12-08 Thread Samuel . Opoku-Boadu






-Ursprungliche Nachricht-
Von: Caroline Jen [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 8. Dezember 2003 03:37
An: [EMAIL PROTECTED]
Betreff: Pass A String From Servlet And Write Out Its Value in JSP


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]

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



Pass A String From Servlet And Write Out Its Value in JSP

2003-12-07 Thread Caroline Jen
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]