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

using request parameters to set up a bean via servlet

 
muktesh tripathi
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well there is a
<jsp:useBean id="retire" scope="application" class="com.MyBean" />
<jsp:setProperty name="retire" property="*" />


This sets up all the bean properties which have matching names in submitted form automatically.

My question is that is there any such great method in servlets to set up a bean using request parameters automatically???
I want to send form parameters to a servlet that should set up the bean as attribute to be used by full application...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not per se. But it's pretty easy to do it using the bean methods. There are also a lot of 3rd party bean-handling libraries out there that might have something similar.

P.S. Submitting to a servlet is a much better practice than submitting to a JSP, even if it does seem like more work at first.
 
muktesh tripathi
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But it's pretty easy to do it using the bean methods.


Thanks , But can you please give little more detail..may be an example..Thanks again..

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the classes and methods in the java.beans package, and perhaps the Commons BeanUtils library.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic