• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

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: 67682
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.
 
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic