mirror of
https://github.com/apache/struts.git
synced 2026-08-05 22:56:59 +00:00
Fixes translating id in Form tag
This commit is contained in:
@@ -221,7 +221,7 @@ public class Form extends ClosingUIBean {
|
||||
@Override
|
||||
protected void populateComponentHtmlId(Form form) {
|
||||
if (id != null) {
|
||||
addParameter("id", escape(id));
|
||||
super.populateComponentHtmlId(null);
|
||||
}
|
||||
|
||||
// if no id given, it will be tried to generate it from the action attribute
|
||||
|
||||
@@ -189,6 +189,25 @@ public class FormTagTest extends AbstractUITagTest {
|
||||
verify(FormTag.class.getResource("Formtag-1.txt"));
|
||||
}
|
||||
|
||||
public void testFormId() throws Exception {
|
||||
|
||||
request.setupGetServletPath("/testAction");
|
||||
|
||||
TestAction testAction = (TestAction) action;
|
||||
testAction.setFoo("bar");
|
||||
|
||||
FormTag tag = new FormTag();
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setMethod("post");
|
||||
tag.setAction("myAction");
|
||||
tag.setId("myid-%{foo}");
|
||||
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
verify(FormTag.class.getResource("Formtag-29.txt"));
|
||||
}
|
||||
|
||||
public void testFormNoNameOrId() throws Exception {
|
||||
|
||||
request.setupGetServletPath("/testAction");
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<form id="myid-bar" name="myid-bar" action="myAction" method="post">
|
||||
<table class="wwFormTable"></table>
|
||||
</form>
|
||||
Reference in New Issue
Block a user