aspose file tools*
The moose likes Struts and the fly likes Sending more than one parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Sending more than one parameter" Watch "Sending more than one parameter" New topic
Author

Sending more than one parameter

Daniel Rosa
Greenhorn

Joined: May 22, 2013
Posts: 7
Hi all!!

I've got the following code in a hedear.jsp:

<s:url action="login.action" var="urlTag">
<s:param name="username"><s:property value="%{#session.username}"></s:property></s:param>
<s:param name="password"><s:property value="%{#session.password}"></s:property></s:param>
</s:url>
<a href="<s:property value="#urlTag" />" >Home</a>

I set a link, and I'm trying to pass to the loginAction.java file two parameters: username and password.
Only works username. The second parameter (password) is not loaded on the Action.

Of course, password has a correct value. I tried to pass only the parameter password, and it worked!

The issue is that in this way I've not been able to send more than one parameter...

May be this is not allowed, or I'm doing something wrong?

Thanks in advance!
Daniel Rosa
Greenhorn

Joined: May 22, 2013
Posts: 7
Hi again.

I just discovered the following: when I pass the mouse over the link on the navigator (without clicking over it), I can read the following at the bottom of the navigator:

http://localhost/si3/login.Action?username=EMP2&amp;passwrod=emp2

Of course, the trouble is that the string "amp;" is wrong. I don't know why it appears on the link. Obviously, is not going to work. In fact, only gets the first parameter.

Anyone knows how to avoid this?

With best regards,
Dani.
Daniel Rosa
Greenhorn

Joined: May 22, 2013
Posts: 7
Hello again.

I found the solution. Te attribute escapeAmp must be set to false. This solve the trouble.

<s:url action="login.action" var="urlTag" escapeAmp="false">
<s:param name="username"><s:property value="%{#session.username}"></s:property></s:param>
<s:param name="password"><s:property value="%{#session.password}"></s:property></s:param>
</s:url>
<a href="<s:property value="#urlTag" />" >Home</a>

Greets!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending more than one parameter