user07
user07

Reputation: 670

GET request from a jsp to controller and send a string value with action

hi i am getting list value from controller and displaying it on jsp as shown below:

 <c:forEach items="${listobj.empDetails}"  var="empValue">  ${empValue.Name} </c:forEach> 

Now i want to give one more action using href and pass the above value empValue.Name as parameter and that will be used in my controller as per my requirement and in controller i m giving it as GET method.

  <a href="${contextPath}/empInfo?name="<%= %>>Emp Details </a> 

My question is what should i give in above scriplets so that i can send this info to my controller. Or is their any other way to do the same.

Please let me know if any one knows the way to do this

thanks in advance

Upvotes: 0

Views: 739

Answers (1)

Pravin
Pravin

Reputation: 1147

Try this

     <c:forEach items="${listobj.empDetails}"  var="empValue">  

        <a href="${contextPath}/empInfo?name=${empValue.Name}">Emp Details </a> 

   </c:forEach>

There is no needs to use <%= %> you can not access ${empValue.Name} out side <c:forEach> as ${empValue.Name} is local to your <c:forEach> loop

Upvotes: 1

Related Questions