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 scriptlets are very hard to read, maintain, and of
course debug. Even reading your own scriptlets will be hard 6 months
after you write them. Whenever you think you need an scriptlet, double
check, there is a very high chance that you have other, cleaner, ways
of doing the same thing.

that's of course my very own personal opinion :)

musachy

On Tue, Oct 13, 2009 at 10:48 AM, Alex Siman <aleksandr.si...@gmail.com> wrote:
>
> 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) : (#attr.label != null ? #attr.label : '')}"/>
>
> It is not so kind to deal w/ code like that((. But what to do? Add one more
> function to *Action class?
>
> Musachy Barroso wrote:
>>
>> 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 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 8 years to
>>> me...
>>>
>>>> P.S. What did you mean by this?:
>>>>
>>>>        "The answer is easier if this .tag file contains no recursive
>>>> calls."
>>>
>>> If the location you're stashing the value in order to get to it from OGNL
>>> is
>>> not related to the call structure, then recursive calls will overwrite
>>> the
>>> values set by the parent.  My example shoved the values into the request.
>>>  Yours is putting them in the jspContext, but I believe that's also a
>>> shared
>>> jspContext for all the code that's generating that specific output.
>>>
>>> If you call <myTagDir:myTag />, within it set a passed value in a larger
>>> scope, then make a recursive call also to <myTagDir:myTag />, when that
>>> recursive call returns that larger scope will still contain the value
>>> passed
>>> into the the recursive call and *not* the value passed into the initial
>>> tag
>>> (and promoted to that larger scope location prior to the recursive call).
>>>
>>> -Dale
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>
>>
>>
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/How-to-get-value-of-tag-attribute-from-OGNL--tp25862967p25877596.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to