aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JSP page with buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JSP page with buttons" Watch "JSP page with buttons" New topic
Author

JSP page with buttons

JC Bismark
Greenhorn

Joined: Jun 27, 2008
Posts: 29
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:
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

In the submit handler for the form, check which button invoked the handler and set the form's action accordingly.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
JC Bismark
Greenhorn

Joined: Jun 27, 2008
Posts: 29
Hello Bear,

Can you be more specific about the handler?

Thanks
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

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.


GenRocket - Experts at Building Test Data
JC Bismark
Greenhorn

Joined: Jun 27, 2008
Posts: 29
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP page with buttons