jump to navigation

Struts mapping actions September 21, 2006

Posted by javafoo in javanotes, struts basic.

In this latest project of mine I was thinking about the various ways to map struts actions. I had done this, a couple of different ways and was wondering if there was a classification out there. And sure enough someone had already done this and instead of paraphrasing, I will just provide the link, here at TSS. Another thing/caveat about using named form-beans accross actions For ex, in your struts-config.xml, if you have a form-bean:

<form-bean name=”xyzForm” type=”package.web.XYZForm” />

and you want to use the same form accross two actions:

<action path=”/processAction” type=”package.web.action.ProcessAction”
name=”xyzForm” validate=”true”…..

<action path=”/displayAction” type=”package.web.action.DisplayAction”
name=”xyzForm” validate=”false”….

Notice here, I am using the same named form-bean for two actions, in the display action I don’t want to validate the form, but in the process action I want to validate the form. In this case I was in for a surprise, the validate=”true” wasn’t working for the process action. This is because the form params are set only once per form-bean. To overcome this, define two different named form-beans of the same type or if you still want to reuse the form-bean, set validate to true for both actions and within the validate method, based on a parameter decide if you want to validate or not.



1. tailgate struts - August 7, 2008

Default Struts mapping action to action???

greetings. I want to go from a logon page to an action page that
decides whether the user gets an edit page, or a new page with blank

form action=”/ResponseInit” method=”get”


In the action execute i will check the DB for logon and password, and
then foward to an Edit register page.

But, i seem to get fowarded to my page with nothing in the fields.

What do I do?
How do I do it?

Is there a good example of this. The one built into the struts
downloade example 1.2.7 was a bit confusing.

2. http://grapevineguitarworks.jimdo.com - January 27, 2013

I am curious to find out what blog system you’re working with? I’m experiencing some small security issues with my latest site
and I would like to find something more safe. Do you have any suggestions?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: