jason hunter, author of "Java Servlet Programming"
(O'Reilly tea kettle book), offers a nice servlet
request parameter parsing class in his com.oreilly.servlet
package. check out http://www.servlets.com/resources/index.html
for more details.
cheers,
p
// Paul Holser -- mailto:[EMAIL PROTECTED]
// ObjectSpace, Inc. -- http://www.objectspace.com
// 14850 Quorum Dr. Ste. 500, Dallas TX 75240 USA
// 972.726.4560 -- 1.800.OBJECT1 x4560
> -----Original Message-----
> From: Stephen Summerfield [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 13, 1999 4:16 AM
> To: [EMAIL PROTECTED]
> Subject: Re: String- Integer
>
>
> > -----Original Message-----
> > From: A mailing list about Java Server Pages specification
> > and reference
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Reeta Mittal
> >
> > I am having a text box in my jsp page which will always have Integer
> > values. Now by default all values from a text box are of type
> > strings. Now
> > how can I convert this to int type. I am using following line
> > but it is
> > giving error because we can not cast from primitive type to
> > reference type.
> >
> > Position=(int) request.getParameterValues("Position") + 1;
> >
> > Can anybody tell me the way of doing this ?
>
> I use constructs like this:
>
> int position;
> try {
> position = new
> Integer( request.getParameterValues("Position") ).intValue();
> } catch( MalformedNumberException mne ) {
> // Set value required if non-numeric value was entered
> position = -1;
> }
>
> Note the Java convention of lowercase for first letter of
> variable/object
> names and upper case first letter for classes.
>
> > I am facing a very basic problem.
>
> For future reference, I suggest you take a look at one of the
> general Java
> programming FAQs:
> eg
> http://www.afu.com/javafaq.html
>
>
> Steve S
>
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html