*
The moose likes JSP and the fly likes How to get the session values into another jsp's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to get the session values into another jsp Watch "How to get the session values into another jsp New topic
Author

How to get the session values into another jsp's

lokesh pushpa
Greenhorn

Joined: Nov 21, 2011
Posts: 23
Hi
I have one DropDown box in One jsp, it is having some accounts. When ever user selects the account it will show some transactions on that account.
Now my requirement is : i have get that "Account name" (which is selected by user) into another jsp.
So i have to put that dyanamic value into session and get that value into another jsp.
How to use the session in jsp and how to set the value into session and how to get that value into another jsp.

Please guide me on this requirement.

Sorry for my bad english....

Thanks
Lokeshpushpa

lokesh pushpa
Greenhorn

Joined: Nov 21, 2011
Posts: 23
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<c:set var="names" scope="session" value="${filegen.name}"/>
<cut value="${names}"/> <%-- Output: names--%>



(OR)

<%= session.getAttribute("names") %> <%-- Output: value of user name--%>
<% String user = session.getAttribute("names"); %>
<c:remove var="names" scope="session"/>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60803
    
  65

Never use Java scriptlets in a JSP.

You should store the value in the session in the controller that obtains the value. Then you can simply use the EL to fetch the value.

For example: in the controller: session.setAttribute("accountName",variableWithAccountName);

In the JSP: ${accountName}


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the session values into another jsp's
 
Similar Threads
Call a forward or a redirect inside an interceptor
How to get the users current object after session time out
JSF Edit Page
How to open another browser window in a jsp
Help Regarding about Session in jsp