struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phan, Hienthuc T" <hienthuc_p...@merck.com>
Subject Struts 2: After validation fail, how to change the returning result name to other than INPUT?
Date Sat, 17 May 2008 01:40:50 GMT
Hi,

I have a CustomerAction class.  In CustomerAction, I have two methods:
add and update.  I have a CustomerAction-validation.xml to check for
required fields, etc.  My struts.xml looks something like this:

	<package name="customer">
		<action name="customer_*"
class="com.action.CustomerAction" method="{1}">
			<result
name="create">/customer_create.jsp</result>
			<result
name="update">/customer_update.jsp</result>
		</action>
	</package>

When the validation fail, I would like it to return to the previous page
(either cusomer_create.jsp or customer_update.jsp).  However, Struts
returns result = "input" automatically when the validation fail. How do
I change the result from "input" to either "add" or "update"?

A clunky way to solve this problem is to create two actions.  That would
generate too many classes.  Is there a good solution for this problem of
mine?  Thanks.

-Hien
Notice:  This e-mail message, together with any attachments, contains information of Merck
& Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates
(which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or
MSD and in Japan, as Banyu - direct contact information for affiliates is available at http://www.merck.com/contact/contacts.html)
that may be confidential, proprietary copyrighted and/or legally privileged. It is intended
solely for the use of the individual or entity named on this message. If you are not the intended
recipient, and have received this message in error, please notify us immediately by reply
e-mail and then delete it from your system.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message