pt., 21 lut 2020 o 04:05 M Huzaifah <mhuzaifah.i...@gmail.com> napisał(a): > <s:iterator value="displayColumnList" var="a"> > <s:textfield name="${a.formcolumnName}" cssClass="form-control > form-control-md text-md" style="simple" placeholder="Value 1" /> > </s:iterator> > the jsp has error: > > Struts Problem Report > > Struts has detected an unhandled exception: > > Messages: > /pages/common/genericform/genericMain.jsp (line: 165, column: 24) According > to TLD or attribute directive in tag file, attribute name does not accept any > expressions > File: org/apache/jasper/compiler/DefaultErrorHandler.java > Line number: 41
Yes, this is by design, we didn't want to base on ${} which is out of Struts control and evaluated by a servlet container (Tag support layer). That's why we used %{} instead, but ... > cause the error above, then i state attribute name on struts tag does not > accept any expressions. if i test to just print like code bellow thats no > problem: > > <s:iterator value="displayColumnList" var="a"> > ${a.formcolumnName} > </s:iterator> > so, i read your documentation about the expression, then i change my code > bellow: > > <s:iterator value="displayColumnList" var="a"> > <s:textfield name="%{formcolumnName}" cssClass="form-control > form-control-md text-md" style="simple" placeholder="Value 1" /> > </s:iterator> > it works perfectly, thank you Lucas. ... in such a case you don't have to use %{} at all, the "name" attribute will be evaluated against ValueStack as an expression. <s:iterator/> tag pushes value into ValueStack (named "a" in your case, but this is not required if not used), all the object's properties are available in scope (inside) of the iterator by their names, so this can be reduced to <s:iterator value="displayColumnList"> <s:textfield name="formcolumnName" ... /> </s:iterator> Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org