aspose file tools*
The moose likes JSP and the fly likes how to make information within a form accessible to multiple jsp or java classes. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to make information within a form accessible to multiple jsp or java classes." Watch "how to make information within a form accessible to multiple jsp or java classes." New topic
Author

how to make information within a form accessible to multiple jsp or java classes.

vincentfasf tan
Greenhorn

Joined: Feb 25, 2012
Posts: 2
How to make a username within a form inside login.jsp accessible to multiple jsp or java classes.
I wish to make it available to a authentication java class as well as a jsp that set the username as session attribute for solving logout problem.

Right now, i just send the form to either one of them. Any way around it? I am new.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Once you have the value, you can store it in a scope (session, application, etc) as an attribute. That will make it available to other parts if the application. You may want to read up on these.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Frederick Atabo
Greenhorn

Joined: Feb 29, 2012
Posts: 1
you can put the username in a session like this:

<%
String username2 = request.getParameter( "username" );
session.setAttribute( "user", username2 );
%>

you can get the value in another page as shown below:

<%= session.getAttribute( "user" ) %>

you can use the value in a finder method in another page as shown below
<% p=rsl.findEmlpoyeeNameandId(session.getAttribute("use").toString()); %>

where findEmlpoyeeNameandId() is a finder method in session bean, p is an object of a helper class


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61421
    
  67

Except of course that no Java code should even be placed inside modern JSPs. Perform Java actions in a Java class, not a JSP.


[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 make information within a form accessible to multiple jsp or java classes.