I have such custom JSP tag file:
/WEB-INF/tags/formField.tag
--
%@ taglib prefix=s uri=/struts-tags %
%@ tag language=java pageEncoding=UTF-8 %
%@ attribute name=fieldName %
%@ attribute name=inputId %
%@ attribute name=label %
%@
OK, I figured out how to get value of tag attribute in JSP:
%= jspContext.getAttribute(fieldName, PageContext.PAGE_SCOPE) %
Now I need to put this value into some OGNL variable, say '#ognlFieldName',
to get access to this value from Struts2 tags.
So, how to get access to jspContext
Why not use this?
http://struts.apache.org/2.1.6/docs/set.html
-Original Message-
From: Alex Siman [mailto:aleksandr.si...@gmail.com]
Sent: Tuesday, October 13, 2009 9:25 AM
To: user@struts.apache.org
Subject: Re: How to get value of tag attribute from OGNL?
OK, I figured out how to get
Message-
From: Alex Siman [mailto:aleksandr.si...@gmail.com]
Sent: Tuesday, October 13, 2009 9:25 AM
To: user@struts.apache.org
Subject: Re: How to get value of tag attribute from OGNL?
OK, I figured out how to get value of tag attribute in JSP:
%= jspContext.getAttribute(fieldName
The answer is easier if this .tag file contains no recursive calls.
The issue is that the .tag file receives attributes through jstl-el, not
ognl. You can use the jstl-el c:set tag to promote that value into a
namespace that's also accessible from ognl.
Alex Siman wrote:
Alex Siman wrote:
Thanx you Dave for your advice!
Sure, Alix.
I switched off the JSTL-EL (as it was recomended in Struts2 wiki)
Can you please point me to that? Seems quite strange to me...
so I wrote another working code:
snippets of java inside your .jsp seems like a step back about
on top of that, you can use the the struts set tag to set stuff in
any of the contexts. Scriptlets are evil.
musachy
On Tue, Oct 13, 2009 at 9:41 AM, Dale Newfield d...@newfield.org wrote:
Alex Siman wrote:
Thanx you Dave for your advice!
Sure, Alix.
I switched off the JSTL-EL (as it was
I switched off the JSTL-EL (as it was recomended in Struts2 wiki)
Can you please point me to that? Seems quite strange to me...
Read the section JSP 2.1 here:
http://struts.apache.org/2.1.8/docs/ognl.html
The answer is easier if this .tag file contains no recursive calls.
I think this
Why are scriptlets an evil? Is it relates to an architectural aspect that
View (JSP) must contain no business logic? Or something else? BTW sometimes
OGNL also contains little complex code. What about this one:
s:set var=label value=%{#attr.labelKey != null ?
getText(#attr.labelKey) :
trust me, that is nothing compared to what I have seen in scriptlets.
That expression could be broken down into an if block, even the
original is not that hard to read. Assuming you don't put any business
logic in scriplets, which is evil by definition (an axiom I guess),
pages containing
Alex Siman wrote:
I switched off the JSTL-EL (as it was recomended in Struts2 wiki)
Can you please point me to that? Seems quite strange to me...
Read the section JSP 2.1 here:
http://struts.apache.org/2.1.8/docs/ognl.html
That was added by Ted Husted on 3/23/2007.
What are the problems
that's only a problem for defining maps in ognl, which used the
#{a:b} syntax, which made the jstl el complain. The solution is just
to use the alternative map syntax:
#...@java.util.linkedhashmap@{ foo : foo value, bar : bar value }
Alex Siman wrote:
I switched off the JSTL-EL (as it was recomended in Struts2 wiki)
Can you please point me to that? Seems quite strange to me...
Since we've removed the possibility of including JSTL-EL expressions in
struts tag attributes, this advice is no longer appropriate. If that's
Cool, welcome back, JSTL-EL!
DNewfield wrote:
Alex Siman wrote:
I switched off the JSTL-EL (as it was recomended in Struts2 wiki)
Can you please point me to that? Seems quite strange to me...
Since we've removed the possibility of including JSTL-EL expressions in
struts tag
I am not sure I understand what you mean. Is someTagAttribute set in
the context by your custom tag?
musachy
On Mon, Oct 12, 2009 at 2:57 PM, Alex Siman aleksandr.si...@gmail.com wrote:
I have created JSP file tag as it is described here
15 matches
Mail list logo