struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Crocker, Patrick" <Patrick.Croc...@bear.com>
Subject [S2] Validation alias
Date Mon, 02 Jul 2007 21:12:32 GMT
I'm using Struts-2.0.8 and the XWork validation xml files (Example:
MyActionClass-validation.xml).

I know that you can restrict the execution of the validation by
following the XWork alias naming convention:

MyActionClass-crud-validation.xml

This works just fine, and the validation only occurs for 'crud' actions.
I believe that I saw a recent post stating that the 'alias' part of the
naming convention can also specify the method being invoked on the
action so you could have configuration files like these:

MySpringAction-crudsave-validation.xml
MySpringAction-cruddelete-validation.xml
.. and so on.

Unfortunately, I can't get that (MySpringAction-crudsave-validation.xml)
to work.  The validation never fires.  Am I missing something, or just
barking up the wrong tree all-together?

Here's the pertinent configuration stuff:

struts.xml:
-----------
	<package name="myPackage" namespace="/myNamespace"
extends="struts-default">
		<action name="index" class="mySpringAction"
method="browse">
			<result
name="browse">/WEB-INF/jsp/browse.jsp</result>
			<interceptor-ref name="defaultStack" />
			<interceptor-ref name="store">
				<param
name="operationMode">RETRIEVE</param>
			</interceptor-ref>
		</action>
		<action name="crud" class="mySpringAction"
method="input">
			<result
name="input">/WEB-INF/jsp/form.jsp</result>
			<result name="success"
type="redirect-action">index</result>
			<result name="browse"
type="redirect-action">index</result>
			<result name="cancel"
type="redirect-action">index</result>
			<interceptor-ref name="defaultStack" />
			<interceptor-ref name="store">
				<param
name="operationMode">STORE</param>
			</interceptor-ref>
		</action>
	</package>

MySpringAction.save:
--------------------
Public String save() throws Exception {
  // do some stuff
  return SUCCESS;
}

form.jsp:
---------
<s:form action="crud">
  <!-- form stuff in here... -->
  <s:submit method="save" />
</s:form>



***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation, 
offer or agreement or any information about any transaction, customer 
account or account activity contained in this communication.
***********************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message