Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating form bean in structs

 
Jobin Mathew
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to make a page or editing some information.
So at the first time I need to load the values from database and display it in the form. So how can I initialize that formbean. I am using these tags

<action forward="a" path="/a.jsp"/>
in structs-config.xml

and <html:link page="a">Click here</html:link>

so on clicking this link I want to go to the page a.jsp with the values from database. ie I need to initialize the form bean of a.jsp.


Thanks in advance
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jo,

We're glad you dropped by the Java Ranch. There aren't many rules here, but we do ask that you let us know who you are by giving us your actual first and last names. Please make sure the "publicly displayed name" in your profile meets the JavaRanch naming policy.

In good faith assuming you'll comply with my request and change your name, here is a response to your question:

Create an Action class, and in the execute method of that class put logic to populate your ActionForm bean and then forward to the JSP. Your Configuration file will look something like this:


Your execute method will look something like this:


Your link would look something like this:

<html:link action="/MyAction" >click here</html:link>
[ October 17, 2006: Message edited by: Merrill Higginson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic