mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
WW-2106 HTML loaded by the ajax tags is parsed for dojo widgets, this should be optional and there should be a "parseContent" attribute to control it
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@565512 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -51,6 +51,7 @@ public abstract class AbstractRemoteBean extends ClosingUIBean implements Remote
|
||||
protected String highlightDuration;
|
||||
protected String separateScripts;
|
||||
protected String transport;
|
||||
protected String parseContent;
|
||||
|
||||
public AbstractRemoteBean(ValueStack stack, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
@@ -100,6 +101,10 @@ public abstract class AbstractRemoteBean extends ClosingUIBean implements Remote
|
||||
addParameter("separateScripts", findValue(separateScripts, Boolean.class));
|
||||
if (transport != null)
|
||||
addParameter("transport", findString(transport));
|
||||
if (parseContent != null)
|
||||
addParameter("parseContent", findValue(parseContent, Boolean.class));
|
||||
else
|
||||
addParameter("parseContent", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -233,4 +238,9 @@ public abstract class AbstractRemoteBean extends ClosingUIBean implements Remote
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Parse returned HTML for Dojo widgets", defaultValue="true", type="Boolean")
|
||||
public void setParseContent(String parseContent) {
|
||||
this.parseContent = parseContent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,4 +66,6 @@ public interface RemoteBean {
|
||||
void setSeparateScripts(String separateScripts);
|
||||
|
||||
void setTransport(String transport);
|
||||
|
||||
void setParseContent(String parseContent);
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ public class Submit extends FormButton implements RemoteBean {
|
||||
protected String ajaxAfterValidation;
|
||||
protected String separateScripts;
|
||||
protected String transport;
|
||||
protected String parseContent;
|
||||
|
||||
public Submit(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
@@ -242,6 +243,8 @@ public class Submit extends FormButton implements RemoteBean {
|
||||
addParameter("separateScripts", findValue(separateScripts, Boolean.class));
|
||||
if (transport != null)
|
||||
addParameter("transport", findString(transport));
|
||||
if (parseContent != null)
|
||||
addParameter("parseContent", findValue(parseContent, Boolean.class));
|
||||
|
||||
Boolean validateValue = false;
|
||||
if (validate != null) {
|
||||
@@ -455,4 +458,9 @@ public class Submit extends FormButton implements RemoteBean {
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Parse returned HTML for Dojo widgets", defaultValue="true", type="Boolean")
|
||||
public void setParseContent(String parseContent) {
|
||||
this.parseContent = parseContent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public abstract class AbstractRemoteTag extends AbstractClosingTag {
|
||||
protected String highlightDuration;
|
||||
protected String separateScripts;
|
||||
protected String transport;
|
||||
protected String parseContent;
|
||||
|
||||
protected void populateParams() {
|
||||
super.populateParams();
|
||||
@@ -65,6 +66,7 @@ public abstract class AbstractRemoteTag extends AbstractClosingTag {
|
||||
remote.setHighlightDuration(highlightDuration);
|
||||
remote.setSeparateScripts(separateScripts);
|
||||
remote.setTransport(transport);
|
||||
remote.setParseContent(parseContent);
|
||||
}
|
||||
|
||||
public void setHref(String href) {
|
||||
@@ -142,4 +144,8 @@ public abstract class AbstractRemoteTag extends AbstractClosingTag {
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
|
||||
public void setParseContent(String parseContent) {
|
||||
this.parseContent = parseContent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public class SubmitTag extends AbstractUITag {
|
||||
protected String ajaxAfterValidation;
|
||||
protected String separateScripts;
|
||||
protected String transport;
|
||||
protected String parseContent;
|
||||
|
||||
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
|
||||
return new Submit(stack, req, res);
|
||||
@@ -97,6 +98,7 @@ public class SubmitTag extends AbstractUITag {
|
||||
submit.setAjaxAfterValidation(ajaxAfterValidation);
|
||||
submit.setSeparateScripts(separateScripts);
|
||||
submit.setTransport(transport);
|
||||
submit.setParseContent(parseContent);
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
@@ -206,4 +208,8 @@ public class SubmitTag extends AbstractUITag {
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
|
||||
public void setParseContent(String parseContent) {
|
||||
this.parseContent = parseContent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,3 +101,6 @@
|
||||
<#if parameters.transport?if_exists != "">
|
||||
transport="${parameters.transport?html}"<#rt/>
|
||||
</#if>
|
||||
<#if parameters.parseContent?exists>
|
||||
parseContent="${parameters.parseContent?string?html}"<#rt/>
|
||||
</#if>
|
||||
@@ -155,6 +155,11 @@
|
||||
<#if !firstField>,</#if><#t/>
|
||||
<#assign firstField=false ><#t/>
|
||||
"transport": "${parameters.transport?html}"<#t/>
|
||||
</#if>
|
||||
<#if parameters.parseContent?exists>
|
||||
<#if !firstField>,</#if><#t/>
|
||||
<#assign firstField=false ><#t/>
|
||||
"parseContent": ${parameters.parseContent?string?html}<#t/>
|
||||
</#if>
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.apache.struts2.dojo.TestAction;
|
||||
*/
|
||||
public class AnchorTest extends AbstractUITagTest {
|
||||
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
TestAction testAction = (TestAction) action;
|
||||
testAction.setFoo("bar");
|
||||
@@ -54,6 +53,7 @@ public class AnchorTest extends AbstractUITagTest {
|
||||
tag.setAjaxAfterValidation("true");
|
||||
tag.setSeparateScripts("true");
|
||||
tag.setTransport("o");
|
||||
tag.setParseContent("false");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class BindTest extends AbstractUITagTest {
|
||||
tag.setValidate("true");
|
||||
tag.setSeparateScripts("true");
|
||||
tag.setTransport("q");
|
||||
tag.setParseContent("false");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public class DivTest extends AbstractUITagTest {
|
||||
tag.setHighlightColor("o");
|
||||
tag.setHighlightDuration("p");
|
||||
tag.setTransport("q");
|
||||
tag.setParseContent("false");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class SubmitAjaxTest extends AbstractUITagTest {
|
||||
tag.setSeparateScripts("true");
|
||||
tag.setTabindex("1");
|
||||
tag.setTransport("p");
|
||||
tag.setParseContent("false");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
"validate": true,
|
||||
"ajaxAfterValidation":false,
|
||||
"scriptSeparation": true,
|
||||
"transport": "q"
|
||||
"transport": "q",
|
||||
"parseContent" : false
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -22,5 +22,6 @@
|
||||
highlightColor="o"
|
||||
highlightDuration="p"
|
||||
scriptSeparation="false"
|
||||
transport="q">
|
||||
transport="q"
|
||||
parseContent="false">
|
||||
</div>
|
||||
|
||||
@@ -19,5 +19,6 @@
|
||||
highlightColor="m"
|
||||
highlightDuration="n"
|
||||
scriptSeparation="true"
|
||||
transport="o">
|
||||
transport="o"
|
||||
parseContent="false">
|
||||
</a>
|
||||
|
||||
@@ -23,4 +23,5 @@
|
||||
highlightDuration="o"
|
||||
scriptSeparation="true"
|
||||
transport="p"
|
||||
parseContent="false"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user