Struts 2
  1. Struts 2
  2. WW-2556

Ajax validation does not work in portlets.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.1.0
    • Fix Version/s: Future
    • Labels:
      None
    • Environment:

      Struts 2.0.1 struts2-portlet-plugin struts2-dojo-plugin-2.1.0 xwork-2.1.0

      Description

      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

        Issue Links

          Activity

          Lukasz Lenart made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Won't Fix [ 2 ]
          Jeff Turner made changes -
          Project Import Mon Feb 01 01:17:42 UTC 2010 [ 1264987062082 ]
          Nils-Helge Garli made changes -
          Link This issue is duplicated by WW-2980 [ WW-2980 ]
          Antonio Petrelli made changes -
          Workflow Struts - editable closed status (temporary) [ 48932 ] Struts - editable closed status [ 49664 ]
          Antonio Petrelli made changes -
          Workflow Struts - editable closed status [ 45018 ] Struts - editable closed status (temporary) [ 48932 ]
          Nils-Helge Garli made changes -
          Link This issue is related to WW-1877 [ WW-1877 ]
          Nils-Helge Garli made changes -
          Link This issue contains WW-1877 [ WW-1877 ]
          Nils-Helge Garli made changes -
          Link This issue is related to WW-2149 [ WW-2149 ]
          Nils-Helge Garli made changes -
          Link This issue contains WW-1877 [ WW-1877 ]
          Nils-Helge Garli made changes -
          Link This issue is related to WW-1894 [ WW-1894 ]
          Nils-Helge Garli made changes -
          Field Original Value New Value
          Fix Version/s Future [ 21530 ]
          Priority Critical [ 2 ] Major [ 3 ]
          Vladimir Limansky created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Vladimir Limansky
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development