my dog learned polymorphism*
The moose likes Struts and the fly likes Populating text box from values in Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Populating text box from values in Action class" Watch "Populating text box from values in Action class" New topic
Author

Populating text box from values in Action class

Shailesh Pillai
Ranch Hand

Joined: Jan 24, 2006
Posts: 78
Hello Ranchers,
I have some values stored in session variables in my Action class.

And as i am forwarded to a JSP Page i would like those values to be displayed in the text box on the page.

<bean:write name="...." /> is an alternative. But how to display the values inside the text box.

Pls do reply.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The solution is to write a JavaBean class that extends ActionForm and associate that form to the Action mappping in your struts-config file. In your Action class, you would then populate the property of this bean with the value you want displayed in the text box. you would then use the Struts custom tag <html:text> to display the text box with the value.

If you don't understand the relationship between a Struts Action, an ActionForm, and a JSP that uses <html:xxx> tags, I'd suggest you take a moment to do one of the tutorials in this link.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating text box from values in Action class
 
Similar Threads
get database values based on text entered
Unable to fetch values
Null Pointer in struts
Minor problem with ActionForm
problem when the jsp get refreshed