Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  •  
    reply
      Bookmark Topic Watch Topic
    • New Topic