Re: multiple forms and one servlet

From: Madhur Ahuja (ef_at_df.com)
Date: 10/30/04

  • Next message: Lāʻie Techie: "Re: help with internationalization/localization"
    Date: Sat, 30 Oct 2004 11:28:30 +0530
    
    

    Yasaswi Pulavarti <yasaswi@encfor.com> wrote:
    > I have one servlet which has multiple forms. The action element of the
    > forms is pointing on one servlet. I want to process the different form
    > requests as different reponses in the same servlet. How can I do that
    > based on the form "Name" attribute.
    > Thanks,
    > Yasaswi

    You can do a post request and append a variable like this:
    <form method = post action = /servlet/process?pc1>
    <form method = post action = /servlet/process?pc2>

    Then, you write the code like this

    if(request.getQueryString.equals("pc1")
    {

        file://code for first form
    }
    else if (request.getQueryString.equals("pc2")
    {
        file://code for second form
    }
    else
    {
        //

    }

    --
    Madhur Ahuja [madhur<underscore>ahuja<at>yahoo<dot>com]
    Homepage
    http://madhur.netfirms.com
    

  • Next message: Lāʻie Techie: "Re: help with internationalization/localization"

    Relevant Pages

    • Re: multiple forms and one servlet
      ... "Yasaswi Pulavarti" wrote in message ... > I have one servlet which has multiple forms. ... > forms is pointing on one servlet. ... My guess is that you want the Front Controller Design Pattern (a J2EE blue ...
      (comp.lang.java.programmer)
    • Re: getting binary data from HTTP Request
      ... Can you post a sample of the POST request? ... Shlomi wrote: ... >>how binary data is being passed to the servlet? ... >>Best regards, ...
      (comp.lang.java.programmer)
    • Re: multiple forms and one servlet
      ... Not a java question ... Madhur Ahuja wrote: ... >>I have one servlet which has multiple forms. ... > You can do a post request and append a variable like this: ...
      (comp.lang.java.programmer)
    • Re: load servlet mappings at runtime in tomcat
      ... Moth wrote: ... What I want to do is run a web app with any number of paths all pointing to one servlet. ... So an example would be www.domain.com/sample and www.domain.com/anothersample would both execute the same servlet. ...
      (comp.lang.java.programmer)
    • multiple forms and one servlet
      ... I have one servlet which has multiple forms. ... The action element of the ... forms is pointing on one servlet. ... requests as different reponses in the same servlet. ...
      (comp.lang.java.programmer)