Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Re: servlets digest: October 28, 2002


Message #1 by "Paul Byford" <p_byford@h...> on Tue, 29 Oct 2002 12:01:05 +0000
re: html forms

one option is;

1. name each submit button on each form the same name e.g. mySubmitButton

2. give each button a different value e.g. postForm1Button, postForm2Button, 
postFormNButton etc...

3. determine within servlet what button was pressed e.g.
String buttonPressed = (String)request.getParameter("mySubmitButton");

4. use a control structure to adapt which code is executed e.g.

if(buttonPressed!=null){
if(buttonPressed.equals("postForm1Button")){
// specific but1 code here
}
else if(buttonPressed.equals("postForm2Button")){
// specific but2 code here
}
}
else{
// null error handling code here
}

hope it helps








>From: "Servlets digest" <servlets@p...>
>Reply-To: "Servlets" <servlets@p...>
>To: "servlets digest recipients" <servlets@p...>
>Subject: servlets digest: October 28, 2002
>Date: Tue, 29 Oct 2002 00:08:20 +0100
>
>-----------------------------------------------
>When replying to the digest, please quote only
>relevant material, and edit the subject line to
>reflect the message you are replying to.
>-----------------------------------------------
>
>The URL for this list is:
>http://p2p.wrox.com/list.asp?list=servlets
>SERVLETS Digest for Monday, October 28, 2002.
>
>1. java how to invok oracle packeages which return a RecordSet?
>2. html forms
>
>----------------------------------------------------------------------
>
>Subject: java how to invok oracle packeages which return a RecordSet?
>From: "billczwen" <billczwen@e...>
>Date: Mon, 28 Oct 2002 10:18:05
>X-Message-Number: 1
>
>java how to invok oracle packeages which return a RecordSet?
>
>packeage is
>
>create or replace package pkgzwTest is
>TYPE myrctype IS REF CURSOR;
>
>procedure P_zwTest(o_RecordSet OUT myrctype);
>end pkgzwTest;
>create or replace package body pkgzwTest is
>procedure P_zwTest(o_RecordSet OUT myrctype)
>as
>begin
>open o_RecordSet for
>select custname,summary from custinfo;
>return;
>end P_zwTest;
>end pkgzwTest;
>
>
>
>how to return all of the record?
>----------------------------------------------------------------------
>
>Subject: html forms
>From: gbilios@h...
>Date: Mon, 28 Oct 2002 15:56:40
>X-Message-Number: 2
>
>29th of October, 2002
>
>Hi,
>
>I know I can send information in a html form to the servlet's
>request.getParameter, but how can I send the form name to the servlet?
>The situation is that I want to post the information to the controller,
>which will be used to update data in a database.  I have in my displayUI a
>series of buttons and for each I have a method=\"post\" and the controller
>needs to know which update is posted.  Below is the code I am using to
>process the updates.
>
>String application_url = request.getParameter("ApplicationURL");
>/* I need to post the form name to the servlet controller */
>
>stmt.executeUpdate("..............");
>stmt.executeUpdate("..............");
>stmt.executeUpdate("..............");
>
>gbilios
>
>
>---
>
>END OF DIGEST
>


_________________________________________________________________
Unlimited Internet access for only $21.95/month.  Try MSN! 
http://resourcecenter.msn.com/access/plans/2monthsfree.asp


  Return to Index