You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Caroline Jen <ji...@yahoo.com> on 2006/07/06 02:02:12 UTC

How to Retrieve Parameters Passed Along with c:url in a Struts Action Class?

In my JSP, I passed a number of parameters inside the
JSTL core c:url tag.  This is the way I coded:

<c:url value="/myAction.do" var="theUrl">
<c:param name="param1" value="${user.fullName}"/>
<c:param name="param2" value="${user.hashID}"/>
</c:url>
<a href='<c:out value="${theUrl}"/>'>Click</a>

How do I retrieve the respective values of param1 and
param2 in MyAction.java?

String parameter1 = request.getParameter( "param1" );
String parameter2 = request.getParameter( "param2" );

It does not seem to be working.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[SOLVED]Re: How to Retrieve Parameters Passed Along with c:url in a Struts Action Class?

Posted by Caroline Jen <ji...@yahoo.com>.
Hi Laurie,
 
     Thanks for your continuing support.

     The code that I showed was correct.

     It turned out that the problem stems from
somewhere else.  I apologize for wasting your time.

-Caroline

--- Laurie Harper <la...@holoweb.net> wrote:

> Caroline Jen wrote:
> > In my JSP, I passed a number of parameters inside
> the
> > JSTL core c:url tag.  This is the way I coded:
> > 
> > <c:url value="/myAction.do" var="theUrl">
> > <c:param name="param1" value="${user.fullName}"/>
> > <c:param name="param2" value="${user.hashID}"/>
> > </c:url>
> > <a href='<c:out value="${theUrl}"/>'>Click</a>
> > 
> > How do I retrieve the respective values of param1
> and
> > param2 in MyAction.java?
> > 
> > String parameter1 = request.getParameter( "param1"
> );
> > String parameter2 = request.getParameter( "param2"
> );
> > 
> > It does not seem to be working.
> 
> How is it failing? Here are some things to check:
> 
> - is there a non-null bean in some scope under the
> key 'user'?
> - are the fullName and hashID properties on that
> bean non-null?
> - what does theUrl get set to? (i.e. what is the
> generated link)
> - what happens if you browse to
> .../myAction.do?param1=1&param2=2
> 
> L.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to Retrieve Parameters Passed Along with c:url in a Struts Action Class?

Posted by Laurie Harper <la...@holoweb.net>.
Caroline Jen wrote:
> In my JSP, I passed a number of parameters inside the
> JSTL core c:url tag.  This is the way I coded:
> 
> <c:url value="/myAction.do" var="theUrl">
> <c:param name="param1" value="${user.fullName}"/>
> <c:param name="param2" value="${user.hashID}"/>
> </c:url>
> <a href='<c:out value="${theUrl}"/>'>Click</a>
> 
> How do I retrieve the respective values of param1 and
> param2 in MyAction.java?
> 
> String parameter1 = request.getParameter( "param1" );
> String parameter2 = request.getParameter( "param2" );
> 
> It does not seem to be working.

How is it failing? Here are some things to check:

- is there a non-null bean in some scope under the key 'user'?
- are the fullName and hashID properties on that bean non-null?
- what does theUrl get set to? (i.e. what is the generated link)
- what happens if you browse to .../myAction.do?param1=1&param2=2

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org