• 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

JSP page with buttons

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to design a Member.jsp page showing the writing "Fan Club" and two buttons "Add New" and "Delete".Each button will invoke different jsp pages:
"Add New" invoke JSPMemberDetails.jsp
"Delete" invoke JSPMemberList.jsp

I understand that in case of one button "Add New" in the page the action attribute will refer to the JSPMemberDetails.jsp destination.

How we create it in case of two buttons? do I put the two input tags (for buttons)in the same form, in that case there are both refer to the same page JSPMemberDetails.jsp .Please,advise...

Using Eclipse IDE,my jsp page with one button:
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the submit handler for the form, check which button invoked the handler and set the form's action accordingly.
 
JC Bismark
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Bear,

Can you be more specific about the handler?

Thanks
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by JC Bismark:
Hello Bear,

Can you be more specific about the handler?

Thanks



This talks about the handler Bear was speaking of. You'll need to use the technique as Bear suggested and determine which button triggered it.

You can also use the buttons onclick handler to help with this. Something like this.
 
JC Bismark
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gregg,

I'm not familiar with javascript, so by using the onClick event handler
<FORM onSubmit="alert(button + pressed")">


</FORM>
-How we use it within the form?I tried to write it like this but it within the form but it don't let me: input type="submit" onClik = "button=this.value" VALUE="Add New"
this other one is the same with VALUE="Delete"
- How we deal with the ACTION attribute? knowing that the 2 buttons go to two different jsp pages destination?
reply
    Bookmark Topic Watch Topic
  • New Topic