• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing parameters to the next action using html:button or html:submit

 
Sunitha Mudidani
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have a jsp where a list of customers will be displayed in table. Each row in the table has a button that enables to view the customer details.
The table rows are displyed by iterating through a list which holds each customer row information(different from the customer details to be displayed).

My problem is how do I pass the customer id to the next action which gets invoked when the button is pressed. The customer id values are available as a bean property.

I need to work on this soon.. so pls respond asap.

Thanks
Sunitha
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest you use a link rather than a button. With a link, you can simply pass a parameter. Something like this:

<html:link action="/customerDetails" paramId="custId" paramName="customer" paramProperty="id" >customer details</html:link>
 
Sunitha Mudidani
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to use a button instead of a link .. it is according to the design.
Any suggestions pls.
Can it be worked out using a java script function?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it has to be a button, here are some options:
  • Make the onclick event of the button execute the link using the JavaScript location.replace(URL)
  • Embed a custom image you've created that looks like a button in the link. That way it looks like a button, but it's really a link
  • Leave it as a regular submit button, but make a separate <html:form> for each row of the table. Then put the ID field in an <html:hidden> field just before the submit button
  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic