Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Populating form bean in structs

Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!