• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic