File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes convert struts form value to an integer value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "convert struts form value to an integer value" Watch "convert struts form value to an integer value" New topic
Author

convert struts form value to an integer value

Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
Hi Gang,
I am trying to do the following within a jsp page:
1. get a String value from a struts form
2. convert the String to an int value
3. Use the int to construct a new object within a scriptlet.

Here is my code, can anyone tell me a way to make this work? Thanks so much in advance.

Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727



A good workman is known by his tools.
Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
Thank you so much Marc.

If you reference the Struts form with a <jsp:useBean> tag, can you use the form name directly without getting it from the session like this?

<jsp:useBean id="ResourceEditForm" class="com.bitpipe.bpES.struts.form.ResourceEditForm" />

User user = new User(Integer.parseInt(ResourceEditForm.getUserId()));
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convert struts form value to an integer value