Results 1 to 4 of 4
- 05-31-2012, 09:19 AM #1
Member
- Join Date
- May 2012
- Posts
- 2
- Rep Power
- 0
pass multiple button value on same action but different data..?
hello..im new in java..im just confused..how can we know which button is click to display in the next page..?
for example..when i click PackageA button,it will display Package A details,when i click PackageB button,it will display Package B details..
tq...
Package.jsp
<Script LANGUAGE="JavaScript">
function button1()
{
document.booking.username.value = "Package A"
booking1.submit()
}
function button2()
{
document.booking.username.value = "Package B"
booking2.submit()
}
function button3()
{
document.booking.username.value = "Package C"
booking3.submit()
}
</Script>
<form name="booking1" action="bookingform.jsp" method="post">
</dl>
<input name="username" type="hidden" id="packageid" value="Package A"/>
<input type="submit" name="book1" value="Book Now!" onClick="button1()"></input>
</li></div></form>
<form name="booking2" action="bookingform.jsp" method="post">
</dl>
<input name="username" type="hidden" id="packageid" value="PACKAGE B" />
<input type="submit" name="book2" value="Book Now!" onClick="button2()"></input>
</li></div></form>
<form name="booking3" action="bookingform.jsp" method="post">
<input name="username" type="hidden" id="packageid" value="PACKAGE C" />
<input type="submit" name="book3" value="Book Now!" onClick="button3()"></input>
</li></div>
</form>
bookingform.jsp
<%
String id = (String)session.getAttribute("packageid");
String id2 = request.getParameter("packageid");
String pid="";
String pname = "";
String pprice = "";
String pact1 = "";
String pact2 = "";
String pact3 = "";
String pact4 = "";
String pact5 = "";
try{
Statement st2=conn.createStatement();
ResultSet rs2=st2.executeQuery("SELECT * FROM PACKAGE WHERE PACKAGE_ID= '"+ id2 +"' ");
while(rs2.next()){
pid= rs2.getString(1);
pname = rs2.getString(2);
pprice = rs2.getString(3);
pact1 = rs2.getString(4);
pact2 = rs2.getString(5);
pact3 = rs2.getString(6);
pact4 = rs2.getString(7);
pact5 = rs2.getString(8);
}
}catch(Exception e1)
{}
%>
- 05-31-2012, 03:10 PM #2
Member
- Join Date
- May 2012
- Posts
- 18
- Rep Power
- 0
Re: pass multiple button value on same action but different data..?
Looks like another one of the java to javascript is like ham to apples posts, expect it to get locked by admin soon.
- 05-31-2012, 04:37 PM #3
Re: pass multiple button value on same action but different data..?
Off topic. Find a JavaScript forum.
db
edit: On review, this question may be related to JSP. Reopened the thread and moved to the appropriate section.Last edited by DarrylBurke; 05-31-2012 at 06:03 PM. Reason: Moved and reopened thread
Why do they call it rush hour when nothing moves? - Robin Williams
- 05-31-2012, 06:04 PM #4
Re: pass multiple button value on same action but different data..?
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Action-Listener with multiple Arguments? (Button Listener, specifically)
By Kevinw778 in forum AWT / SwingReplies: 2Last Post: 12-11-2011, 10:44 PM -
Action button HELP?
By utoptas in forum New To JavaReplies: 3Last Post: 08-27-2010, 10:40 PM -
pass value to action.do struts
By munish in forum Web FrameworksReplies: 1Last Post: 11-13-2009, 02:58 PM -
pass value to action.do struts
By munish in forum Web FrameworksReplies: 1Last Post: 11-13-2009, 02:51 PM -
Please help on Button action
By michaelxiao in forum New To JavaReplies: 4Last Post: 04-24-2009, 10:55 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks