• Post Reply Bookmark Topic Watch Topic
  • New Topic

send a bean from jsp to a servlet  RSS feed

 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I've got a form in a jsp page, and I'd like to send the collected data to a servlet using a bean.

I had look on docs regarding Java Beans, but I didn't understand if automatically set the property-bean when the user press the submit button or I need to add some code?
Can someone give some code example where to work on?

This's some code I'm using in my form.
 
malek aftab
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You can use serveral input fields in your html or jsp files, then in your target action, set input values to a java bean by:
<jsp:useBean id="" type=""/>
<jsp:setProperty property="*"/>
 
malek aftab
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You can use serveral input fields in your html or jsp files, then in your target action, set input values to a java bean by:
<jsp:useBean id="" class=""/>
<jsp:setProperty property="*"/>
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, but it is not very clear what you wrote.
Should I replace the action value in the form tag with the one's you gave me?
Could you please be so kind to make me a code example.
Thanks for your help.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are submitting the form to a servlet there will be no beans, or any JSP for that matter, involved.

You will pull the submitted values from the request instance with the getParameter family of request methods.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!