Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get parameters from servlet into jsp

 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a project wherein I have to perform the Attendance apply and approve scenario.I have made a jsp page which has textbox username and password.After that i have created a servlet where the database connectivity is done as well as the validation.Now i am making another jsp for the welcome page to the particular user, based on the username and password provided .My first jsp page is test.jsp,the servlet class is Helloserv.class and the third jsp is login.jsp.In the servlet i have used .But what code is needed in the jsp which will accept parameters through which a new page is seen as well as only the particular user details is seen throughout the session.
thanks in advance.Help will be highly appreciated.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shiju nair:
what code is needed in the jsp which will accept parameters through which a new page is seen as well as only the particular user details is seen throughout the session.


Well, you place the user details into the session in servlet using setAttribute("key","value")..(Before the RequestDispatcher)

then get the session value and display in liogin.jsp using getAttribute("key")
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answer,i needed.
I have a query on the same thing that is,once the setAttribute is placed in the servlet then through this the values are retrieved in jsp right.But should i make a bean or a normal jsp where in bean i have to specify the servlet class but i should be using the or the for the .so that the user goes ahead with a new page and does other activities for example leave apply. Which of course will need the database connectivity to update the database.so i should use the same servlet class or again i have to make a new one.
please suggest.help highly appreciated.
Thanks in advance.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

1.useBean is discourage nowadays
---------------------------------
use JSTL=customtags+EL
---------------------------------

2. you want to take userdetails entire web application right?....
then use session or application,why you want to use useBean
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion.
But i am not familiar with and because of that i wont be able to do proper coding .An example of that coding would be preferred.so I hope you would help me with it.
Thanks in advance.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shiju nair:

But i am not familiar with and because of that i wont be able to do proper coding .An example of that coding would be preferred.so I hope you would help me with it.


I hope HFSJ help you ;) ... please read the HFSJ
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion
but i am not able to view a clear picture of jstl
because hfsj is not available.We need to purchase it online.Isn't there any other way out as i said using bean to go ahead with the scenario.
Thanks in advance.Help will be appreciated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic