I had the same problem, and someone pointed out to me that it does say in
the s:include reference page
(http://struts.apache.org/2.x/docs/include.html) that parameters passedvia
s:include are not available on the stack.  Well...it doesn't phrase it that
way, but that's basically it.

Yes, it's silly......but what to do about it?

I kludged it by using JSTL to insert that parameter into the page context.
Put this in your included page:

<c:set var="myParam" value="${param.myParam}"/>

Then #attr.myParam will work.

-B

PS: Your email was funny but I almost deleted it b/c it took four
paragraphs just to get to your issue.... :)



                                                                       
             Zoran Avtarovski                                          
             <[EMAIL PROTECTED]                                         
             ive.com>                                                   To
                                       Struts Users Mailing List       
             08/07/2008 12:28          <user@struts.apache.org>        
             PM                                                         cc
                                                                       
                                                                   Subject
             Please respond to         More OGNL Woes                  
               "Struts Users                                           
               Mailing List"                                           
             <[EMAIL PROTECTED]                                         
                  he.org>                                              
                                                                       
                                                                       




I¹m really starting to develop a love-hate (and fear) relationship with
OGNL. Please bear with my long winded explanation, it' therapeutic (for me
at least). And, please, I really do need help.

I'm finding using OGNL like dating a supermodel, who also suffers from
multiple personality disorder and Turrets. At first it's hello OGNL, your
having breakfast at some uptown café, expensive glossy mags littered around
the place, ordering eggs on some exotic bread and coffee that monkeys
excrete. You know the feeling. You're interacting with stack, calling
methods, the odd lambda expression. Your on top of the world. It's a case
of
JSP - who, expression language - what?

Next thing you know, BAM!! You're wearing your breakfast, feeling the pain
of 300 pages of last month's Italian Vogue across the back of your head and
longing for the security of a bagel and filtered coffee with JSP.


Take my current problem. A simple task of passing a parameter to an
included
page.

<s:include value="myPage.jsp>
    <s:param name="myParam">2</s:param>
</s:include>

And in myPage.jsp I have

<s:property value="#parameters.myParam/>

BAM!! There's that Italian Vogue again.

So I try:

<s:property value="#parameters['myParam']/>

and

<s:property value="%{#parameters.myParam}/>

and

<s:property value="myParam/>

and

<s:property value=%{myParam}/>

Now I'm reaching for the Ibuprofen. You also see where the Turrets comes
in.

If I now look at my once loved, then hated, now missed JSP:

<c:import url="myPage.jsp">
    <c:param name=myParam">2</c:param>
</c:import>

And in myPage.jsp I have ${params.myParam}. Bingo! Bagel and coffee.

Please somebody please point out my error as I know it must be MY ERROR,
but
I just can't see it.

I've read the stuff on the struts wiki which indicates that my example
should be working. The OGNL site is too generic to be of much use here.

As an aside, if any budding author wants to produce an InfoQ style guide to
OGNL and struts I'd happily spring for it.

I'm not asking a lot. We all have flaws. I'd just like to settle into a
little monogamy for a while - until the next supermodel at least.

Z.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
This message, together with any attachments, is
intended only for the use of the individual or entity
to which it is addressed. It may contain information
that is confidential and prohibited from disclosure.
If you are not the intended recipient, you are hereby
notified that any dissemination or copying of this
message or any attachment is strictly prohibited. If
you have received this message in error, please notify
the original sender immediately by telephone or by
return e-mail and delete this message, along with any
attachments, from your computer. Thank you.

---------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to