Hi Raj,
I have created many CGI scripts that deal with something like this.
What seems like you are asking is how to make a "multi-part" form. There's
many ways to do so I'm just going to show you the technique that I use.
I use the method GET to initially develop this and then switch it to
POST later on.
I usually have a "modify" or "delete" icon/image at the end or beginning
of each row, with the link to the servlet that does the "modify" or "delete"
action.
If I click on the "modify" image, the link would be:
http://youraddress/MyServlet?action="modifyform&id=<rowid>"
If I click on the "delete" image, the link would be:
http://youraddress/MyServlet?action="confirmdelete&id=<rowid>"
This will display the delete confirmation link
For creating multi-part forms.
1. Define the modes that you have
- display mode (for each record I would have a "delete" and "modify"
images with a link to http://MyServlet?action=<action>
- update mode
a. display update form and data
b. update the table data
- delete mode
a. delete confirmation form
b. delete the table data
I usually use 1 parameter to figure out the method I want to execute.
For example I would use "action"
If I want to display all the records:
http://youraddress/MyServlet?action=display
If I want to modify records:
http://youraddress/MyServlet?action="modifyform"
1. The first thing to do is display the existing records
2. Then click a "modify" button to update the data
Then the action would be:
http://youraddress/MyServlet?action="modify"
If I want to delete:
1. First confirm the deletion
http://youraddress/MyServlet?action="confirmdelete"
2. Then actually perform the deletion
http://youraddress/MyServlet?action="delete"
This way you control what is displayed by the "action" parameter.
Here's the pseudo code:
if "action" is "display"
call the Display() method
else if "action" is "modifyform"
call the DisplayModifyForm() method
else if "action" is "modify"
call the ModifyForm() method
else if "action" is "confirmdelete"
call the ConfirmDelete() method
else if "action" is "delete"
call the Delete() method
--
Antonio W. Lagnada
[EMAIL PROTECTED] - email
This email address is specifically
for JSP-Interest email list
---- Raj S <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a few questions about forms.
> 1) Can I redisplay a form?That is when I enter values in textfields
> and
> click the button,the methods should be executed after the button click,and
> results should be displayed on the same JSP.
>
> 2)I am making an address book.So I am displaying search results in
> a
> table.Is there another way I could use to display results?
> How can I select a value from the table?
> Or how can I select a row of a table,and perform some method like delete
> or
> modify?
>
> Thanks,
> Raj
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
___________________________________________________________________
To get your own FREE ZDNet Onebox - FREE voicemail, email, and fax,
all in one place - sign up today at http://www.zdnetonebox.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets