This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Need help with req.getParameter ()method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Need help with req.getParameter ()method" Watch "Need help with req.getParameter ()method" New topic
Author

Need help with req.getParameter ()method

harpd dhillon
Greenhorn

Joined: Jun 03, 2003
Posts: 8
I'm trying to get the values from the form and update the corrosponding database record.
I know for String variable , i would use:
member.password = req.getParameter("password");
I need to know how to get variable of type int and timestamp object.
Any suggestions would be greatly appreciated. Thanks a lot
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
they're all strings so you gotta parse em.
harpd dhillon
Greenhorn

Joined: Jun 03, 2003
Posts: 8
Hello Simon,
I'm totally new to this. COuld you plz gimme an example??...I'd appreciate it greatly
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30068
    
149

Take a look in the API under the class you want. For example, to get an integer:

You may also want to check whether the parameter is null first, to avoid an exception.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Need help with req.getParameter ()method
 
Similar Threads
JDBC code with type 1 driver not working
Check String for null without error?
parsing
doubt regarding default values
Auto_Increment Primary Key