First, I'll point you to the Struts 2 documentation wiki: most of what you ask 
here is covered--spend some time with it, the payoff is huge.

http://struts.apache.org/2.x/docs/guides.html

--- On Wed, 12/10/08, Faraz Ali wrote:
> My action class name is MyAction. I define two string
> variables varA and varB and added its setter and getters.
> I added MyAction in struts.xml.
> 
> 1. I am creating the anchor tag as below:
>    <s:url id="myUrl"
> action="MyAction">
>  <s:param name="varA">6</s:param>
>  <s:param name="varB"
> value="%{myList[#myStat.index].myId}"></s:param>
>    </s:url>
>    <s:a href="%{myUrl}">delete</s:a>

Note that the <s:a...> tag is primarily for use with the "ajax" theme, as is 
stated on the documentation page for the <s:a...> tag [1].

> This is producing the url like
> http://localhost:8080/MyWebApp/web/MyAction.action?varA=6&amp;varB=12
> I am getting NumberFormatException at &amp;varB.

What do you mean you're "getting NumberFormatException at &amp;varB"? Without 
any contextual information about under the exact circumstances you get the 
error it's essentially impossible to help. Is it on page render? Action 
execution? In the Struts 2 code or in your code? I don't know--so I can't help. 
This is a valid URL and shouldn't cause any problems.

> 2. Truly speaking i am facing so many problems with these
> s:url and s:a tags. If i try to use html anchor <a tag, 
> than i am unable to construct href value, because i am in 
> <s:iterator, and <a href="" is not identifying that.

This confuses me. In the sample above you're creating the URL outside of the 
<s:a...> tag and giving the URL an ID. Using that value in a plain HTML anchor 
tag is as simple as using the <s:property...> tag:

<a href="<s:property value="#myUrl"/>">delete</a>

> 3. One action is overriding another action. For example, 
> i click a link with paramter action=2, a jsp is displayed, 
> than all the anchor tags in that jsp page are showing 
> action=2. Though i added a logic unique to> each record.

Again, this statement doesn't make any sense out of context. Without the 
configuration of the current and target action and (at *least*) the JSP code 
you're using to generate the link it's completely impossible to guess what 
might be happening.

Dave

[1] <s:a...> tag:
    http://struts.apache.org/2.x/docs/a.html


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

Reply via email to