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 JSP and the fly likes Passing an Int from JSP to java 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 » JSP
Bookmark "Passing an Int from JSP to java" Watch "Passing an Int from JSP to java" New topic
Author

Passing an Int from JSP to java

Larry Mater
Greenhorn

Joined: Aug 08, 2006
Posts: 2
For strings I have been using getParameter() to get values that were input in my jsp pages.

Now what i can't seem to do it the same for integers. 2 things.

How do i define an integer rowstart with the value of 1 as hidden so I can pass it to my java programs and then how do I request that value from the jsp in my java program. If it was a string i would do input rowstart then do the getparamter("rowstart") in my java. How do I do integers?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60763
    
  65

Originally posted by Larry Mater:

How do i define an integer rowstart with the value of 1 as hidden





how do I request that value from the jsp in my java program.


All request parameters are strings, so you'd get the value of "rowstart" the same way as any other; with request.getParameter(). After obtaining the string value, you can use Integer.parseInt() to convert the string to its integer equivalent.
[ August 08, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Larry Mater
Greenhorn

Joined: Aug 08, 2006
Posts: 2
thank you Bear. big help
 
Consider Paul's rocket mass heater.
 
subject: Passing an Int from JSP to java
 
Similar Threads
displaying next record in DB using ResultSet
How do i improve variable visibility?
Implementation of google charts in JSP
How to send comands to anoyther program
Write a method that can be called, that will initialize the seating plan.