File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

convert struts form value to an integer value

 
Kim Kantola
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Kim Kantola
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()));
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic