Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ahh, I didn't know that you could use annotation based validation on a specific method. I haven't used Struts that much. Thanks!</p> <p>However, I did have to modify my struts.xml to allow different validations on different methods (validateAnnotatedMethodOnly had to be true). Here is what it looks like:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"&gt; &lt;struts&gt; &lt;constant name="struts.convention.action.suffix" value="Controller" /&gt; &lt;constant name="struts.convention.action.mapAllMatches" value="true" /&gt; &lt;!-- Set to "default" instead of "rest-default" --&gt; &lt;constant name="struts.convention.default.parent.package" value="default" /&gt; &lt;constant name="struts.convention.package.locators" value="rest" /&gt; &lt;package name="default" extends="rest-default"&gt; &lt;interceptors&gt; &lt;interceptor-stack name="restDefaultStack"&gt; &lt;interceptor-ref name="exception" /&gt; &lt;interceptor-ref name="alias" /&gt; &lt;interceptor-ref name="servletConfig" /&gt; &lt;interceptor-ref name="messages"&gt; &lt;param name="operationMode"&gt;AUTOMATIC&lt;/param&gt; &lt;/interceptor-ref&gt; &lt;interceptor-ref name="prepare" /&gt; &lt;interceptor-ref name="i18n" /&gt; &lt;interceptor-ref name="chain" /&gt; &lt;interceptor-ref name="debugging" /&gt; &lt;interceptor-ref name="profiling" /&gt; &lt;interceptor-ref name="actionMappingParams" /&gt; &lt;interceptor-ref name="scopedModelDriven" /&gt; &lt;interceptor-ref name="modelDriven"&gt; &lt;param name="refreshModelBeforeResult"&gt;true&lt;/param&gt; &lt;/interceptor-ref&gt; &lt;interceptor-ref name="fileUpload" /&gt; &lt;interceptor-ref name="checkbox" /&gt; &lt;interceptor-ref name="staticParams" /&gt; &lt;interceptor-ref name="params"&gt; &lt;param name="excludeParams"&gt;dojo\..*&lt;/param&gt; &lt;/interceptor-ref&gt; &lt;interceptor-ref name="rest" /&gt; &lt;interceptor-ref name="conversionError" /&gt; &lt;interceptor-ref name="validation"&gt; &lt;param name="excludeMethods"&gt;input,back,cancel,browse,index&lt;/param&gt; &lt;!-- Modified! --&gt; &lt;param name="validateAnnotatedMethodOnly"&gt;true&lt;/param&gt; &lt;/interceptor-ref&gt; &lt;interceptor-ref name="restWorkflow"&gt; &lt;param name="excludeMethods"&gt;input,back,cancel,browse,index&lt;/param&gt; &lt;/interceptor-ref&gt; &lt;/interceptor-stack&gt; &lt;/interceptors&gt; &lt;/package&gt; &lt;/struts&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload