Search code examples
jspstruts2strutsognl

How to use s:set as param to s:push making static method call in Struts 2


I tried :

<s:set name="ordersymbol" value="EURUSD" var="ordersymbol"/>
    <s:push value="@dao.positions@positionsO(%{#ordersymbol})">

<s:set name="ordersymbol" value="EURUSD" var="ordersymbol"/>
    <s:push value="@dao.positions@positionsO(#ordersymbol)">

<s:set name="ordersymbol" value="EURUSD" var="ordersymbol"/>
    <s:push value="@dao.positions@positionsO(ordersymbol)">

<s:set name="ordersymbol" value="EURUSD" var="ordersymbol"/>
    <s:push value="@dao.positions@positionsO(%{ordersymbol})">

Neither of the above four worked, the method always get null parameter.

Although if I try

<s:push value="@dao.positions@positionsO('EURUSD')">

it works fine.


Solution

  • I realize it's an old question... But:

    The reason in doesn't work is that "value is an object." The correct <s:set/> would be:

    <s:set var="ordersymbol" value="'EURUSD'" />
    

    and the correct <s:push/> is the second one.