You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Vladimir Limansky (JIRA)" <ji...@apache.org> on 2008/03/17 13:38:59 UTC
[jira] Created: (WW-2556) Ajax validation does not work in
portlets.
Ajax validation does not work in portlets.
------------------------------------------
Key: WW-2556
URL: https://issues.apache.org/struts/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
Priority: Critical
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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-2556) Ajax validation does not work in
portlets.
Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43521#action_43521 ]
Nils-Helge Garli commented on WW-2556:
--------------------------------------
Ajax in portlets are not supported by the framework. It has been discussed a couple of times already and you can find some background information if you search the mailing lists. The main problem is that a portlet only renders fragments, and the s:head tag which includes the required javascripts does so in a <head> tag. Also, there are challenges with namespacing of the id of html elements. However, it's possible to roll your own ajax stuff if you don't want to wait.
> Ajax validation does not work in portlets.
> ------------------------------------------
>
> Key: WW-2556
> URL: https://issues.apache.org/struts/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
> Priority: Critical
> Fix For: Future
>
>
> 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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-2556) Ajax validation does not work in
portlets.
Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nils-Helge Garli updated WW-2556:
---------------------------------
Priority: Major (was: Critical)
Fix Version/s: Future
Reducing this to "major" as with the other ajax/portlet issues.
> Ajax validation does not work in portlets.
> ------------------------------------------
>
> Key: WW-2556
> URL: https://issues.apache.org/struts/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
> Fix For: Future
>
>
> 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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.