Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pass parameters into servlet

 
jaya sudha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..........

can i pass Parameters to servlets ? how can i read those ?

please can any one answer this...THANKS
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34835
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaya,
You can pass http parameters (from a form or url) or initialization parameters (from the web.xml.)
 
siva krishnan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Parameters can be passed in many ways..one of the most common usage is passing the value from a front-end FORM.
Each FORM element will have a NAME and a VALUE.
By specifying request.getParameter(<FORM-ELEMENT-NAME> you can get the value which was entered for that element.
eg: To get the employee number enetered in a textbox named "EmpNum" in the front-end FORM, you can use:
request.getParameter("EmpNum");
This will give the value entered for emp number.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds to me like you could use a good old fasioned tutorial on Servlets and maybe JSP.

Sun's J2EE Tutorial is pretty good. Chapter 11 is on Java Servlets and Chapter 12 is on JSP.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic