David Newton wrote:Sure, write it as a JSP 2.0+ tag file.
David Newton wrote:JSP-based custom tags, not Java-based.
David Newton wrote:But S2 documentation seems to suggest that we disallow JSP EL due to the security risk. So use OGNL all the way; there's a FAQ entry on this I think.
Xolani Nkosi wrote:
David Newton wrote:But S2 documentation seems to suggest that we disallow JSP EL due to the security risk. So use OGNL all the way; there's a FAQ entry on this I think.
Right, I can get at the parameters made when calling my tag by using #attr.enabled, #attr.name etc etc.
However, as these are OGNL expressions, I need a way to evaluate them. e.g.
<s:if test="#attr.enabled"> needs to be something like <s:if test="%{#attr.enabled}"> as #attr.enabled itself contains an OGNL expression like "object.enabled" that should be resolved against the value stack. But, surprise surprise, this doesn't work. Nesting %{'s doesn't cause the inner result to get evaluated as if it were an OGNL expression.
So, where's the OGNL eval function?
Xolani Nkosi wrote:
Xolani Nkosi wrote:
David Newton wrote:But S2 documentation seems to suggest that we disallow JSP EL due to the security risk. So use OGNL all the way; there's a FAQ entry on this I think.
Right, I can get at the parameters made when calling my tag by using #attr.enabled, #attr.name etc etc.
However, as these are OGNL expressions, I need a way to evaluate them. e.g.
<s:if test="#attr.enabled"> needs to be something like <s:if test="%{#attr.enabled}"> as #attr.enabled itself contains an OGNL expression like "object.enabled" that should be resolved against the value stack. But, surprise surprise, this doesn't work. Nesting %{'s doesn't cause the inner result to get evaluated as if it were an OGNL expression.
So, where's the OGNL eval function?
Right, this thread seems to detail my problem: http://old.nabble.com/Attribute-OGNL-evaluation-issue-on-struts-tag-in-tag-file-td21732140.html
Someone claims to have found the solution at http://forums.opensymphony.com/thread.jspa?messageID=6278131 but it seems the opensymphony forums aren't around any more. Anyone got a lead on where this solution now is?
David Newton wrote:You can't double-evaluated OGNL (well, you can, by using OGNL's static eval method, but I seriously don't think it's the best solution).
Miguel Almeida wrote:Hey, I am having a similar issue (posted in http://old.nabble.com/How-can-one-use-OGNL-on-custom-.tag-files--td27880257.html ). Did you manage to find a solution to your problem?
David Newton wrote:Honestly, I'd use a JavaScript calendar widget, and use Apache Commons date utility to try a collection of date formats if JavaScript is disabled.
Thanks for the kind words :)
<s:textfield id="%{#attr.dateField}" name="%{#attr.dateField}.date" cssClass="calendar %{#attr.dateField}.format" />
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |