Otto, Frank wrote:
hi,

thanks for your answer.

how can I build a ognl variable dynamic? Example:

I have an iteration with different url-definitions, because
I need always another parameter (index):
<s:iterator value="myList" id="list" status="stat">

... <s:url id="myMethod%{#stat.index}"
action="test_myMethod.action">
            <s:param name="myParam" value="%{#stat.index}"/>
        </s:url>

        <s:autocompleter ...
href="%{myMethod%{#stat.index}}"/> <--- I need
here: %{myMethod0}, %{myMethod1}, ..., but it wasn't evaluated

</s:iterator>

Has someone an idea?
Firstly, it's not valid to nest OGNL expression (%{...%{...}}) but you can get the result you want something like this (untested):

   href="%{'myMethod'+#stat.index}"

This may also work:

   href="myMethod%{#stat.index}"

However, based on the code you posted, I suspect this isn't what you want; aren't you trying to set the autocompleter's href to the URL you built with s:url above? In that case, just simplify:

   <s:iterator ...>
     <s:url id="url" ...>
     <s:autocompleter href="%{#url}" ...

You don't need the identifier to be dynamic.

In my opinion I need the indifier. I have 2 or more (dynamic) autocompleter, 
and the first autocompleter refreshs the second, the second and so one. I have 
the same action for the refresh, but I need the index of the autcompleter, 
which sends the notfiyTopic. So I need a dynamic build url id, because there is 
different parameter for it. f.e.:

<s:url id="refresh0" ...>
        <s:param name="myParam" value="0"/>
</s:url>
<s:autocompleter href="refresh0" ...
<s:url id="refresh1" ...>
        <s:param name="myParam" value="1"/>
</s:url>
<s:autocompleter href="refresh0" ...
....
<s:url id="refreshX" ...>
        <s:param name="myParam" value="X"/>
</s:url>
<s:autocompleter href="refreshX" ...

I guess I just don't understand your question. You'd get the same result from the above if each s:url tag used the same id value, as in:

  <s:url id="href" ...><s:param name="myParam" value="0"/></s:url>
  <s:autocompleter href="%{#href}" .../>
  <s:url id="href" ...><s:param name="myParam" value="1"/></s:url>
  <s:autocompleter href="%{#href}" .../>

There's still no need for the id attribute to have a dynamic value.

L.


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

Reply via email to