Home > FAQs > Cookbook > How do I populate a form bean and get the value using the taglib |

Apache Struts 2 Documentation
How do I populate a form bean and get the value using the taglib
Edit Page Browse Space Add Page Add News

First off, if you're coming from Struts 1, you may feel more comfortable using FormBeans instead of using the Action as your form bean. Be aware, though, that in Webwork you DO have the option of having the properties directly in the Action class. If you want to use a FormBean, here's an example:

Then, in your success.jsp, which is mapped as the success result of TestAction in the views.properties or actions.xml (see the docs for how to configure actions and view mappings), you can do this:

This is a good way to do it if you have several parameters from the TestBean that you want to display, but, if you have just one, like in this case, it's probably better to do this:

NOTE:
As of WW2.2, the following should be used

Which will call getMyBean.getName() and print that out to the page.