• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
vincentfasf tan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Frederick Atabo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except of course that no Java code should even be placed inside modern JSPs. Perform Java actions in a Java class, not a JSP.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic