Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Alex Siman
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 % %@

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Alex Siman
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

RE: How to get value of tag attribute from OGNL?

2009-10-13 Thread Mike Baranski
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

RE: How to get value of tag attribute from OGNL?

2009-10-13 Thread Alex Siman
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

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Dale Newfield
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:

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Dale Newfield
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

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Musachy Barroso
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

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Alex Siman
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

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Alex Siman
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) :

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Musachy Barroso
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

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Dale Newfield
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

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Musachy Barroso
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 }

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Dale Newfield
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

Re: How to get value of tag attribute from OGNL?

2009-10-13 Thread Alex Siman
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

Re: How to get value of tag attribute from OGNL?

2009-10-12 Thread Musachy Barroso
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