Aniket Kibe
Aniket Kibe

Reputation: 41

<html:link> pass parameters

I want to pass a single parameter with holds a username through a tag.

In the corrosponding action class I'm retreiving the parameter with request.getParameter() function, but I'm getting the value as null. here's my code

    <%
    String username="aniket";
    request.setAttribute("username",username);
    %>
 <html:link action="AllResidentInfo.do" paramName="username" paramProperty="username">All Resident's Info</html:link>

What am I doing wrong

Upvotes: 1

Views: 8999

Answers (1)

JB Nizet
JB Nizet

Reputation: 691655

Straight from the documentation:

paramId

The name of the request parameter that will be dynamically added to the generated hyperlink. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

So it should be

<html:link action="AllResidentInfo.do" paramId="username" paramName="username"/>

Upvotes: 2

Related Questions