[ 
https://issues.apache.org/jira/browse/WW-2556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukasz Lenart closed WW-2556.
-----------------------------
    Resolution: Won't Fix

> Ajax validation does not work in portlets.
> ------------------------------------------
>
>                 Key: WW-2556
>                 URL: https://issues.apache.org/jira/browse/WW-2556
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, XML Validators
>    Affects Versions: 2.1.0
>         Environment: Struts 2.0.1 struts2-portlet-plugin 
> struts2-dojo-plugin-2.1.0 xwork-2.1.0
>            Reporter: Vladimir Limansky
>            Assignee: Lukasz Lenart
>            Priority: Major
>
> Consider the following configuration.
> 1. EditTest.jsp:
> <sx:head/>
> <s:form action="Test!save" theme="xhtml" id="myFormId" >
>     <s:textfield name="testProperty" label="test input"></s:textfield>
>     
>     <s:hidden name="testAction" value=""/>
>     
>     <sx:submit 
>      validate="true" 
>      ajaxAfterValidation="true" 
>      targets="response" 
>      showLoadingText="false"
>      label="Submit it!"
>      formId="myFormId"/>
>         
> </s:form>
> 2. TestAction.java
> public class TestAction extends BaseActionSupport {
>       
>       private String testProperty = null;
>       
>       @Override
>       public String render() throws Exception {
>               return SUCCESS;
>       }
>       
>       @Transactional
>       public String save() {
>               return NONE;
>       }
>       public String getTestProperty() {
>               return testProperty;
>       }
>       public void setTestProperty(String testProperty) {
>               this.testProperty = testProperty;
>       }
>       
> }
> 3. TestAction-validation.xml 
> <validators>
>   <field name="testProperty">
>       <field-validator type="requiredstring">
>           <message key="calendar:TitleIsRequired"/>
>       </field-validator>
>   </field>
> </validators>
> 4. struts.xml
>  <struts>
>     <include file="struts-default.xml"/>
>     <include file="struts-portlet-default.xml"/>
>     <include file="sibutu-default.xml"/>
>         
>     <package name="calendar" extends="sibutu-default">
>         <action name="Test" 
> class="org.sibutu.module.calendar.action.TestAction">
>             <interceptor-ref name="jsonValidationWorkflowStack"/>
>             <result>/WEB-INF/jsp/Test.jsp</result>
>             <result name="input">/WEB-INF/jsp/EditTest.jsp</result>
>             <result name="none">/WEB-INF/jsp/Test.jsp</result>
>         </action>        
>     </package>
>     
> </struts>
> Currently I have the following behavior:
> 1. The expected error message appears just emmidiately on the page startup, 
> NOT after submit button had been pushed.
> 2.  When submit button had been pressed error message disappears - even if we 
> assume that validation fails (the field was left blank with "requiredstring" 
> validator).
> 3. http://struts.apache.org/2.x/docs/ajax-validation.html says the following:
> "Remember to set struts.enableJSONValidation=true in the request to enable 
> AJAX validation"
> But trying to debug JSONValidationInterceptor I noticed that 
> struts.enableJSONValidation parameter is null. Where this parameter should be 
> set? An attempt to put it to struts.properties gives nothing. But even when I 
> tried to set this parameter manually during debug session, it did not cause 
> the desired result.
> In the struts2-showcase-2.1.0.war struts example validation works pretty fine.
> Please let me know whether you need any additional info.
> Please 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to