Discussions

Web tier: servlets, JSP, Web frameworks: Newbie - Simulating a POST

  1. Newbie - Simulating a POST (3 messages)

    Hello, all
    I need to have an app recieve a post from a web page process the data and then repost it to another web page. I've done this in perl - and I want to use java for this... Perl has LWP to handle this sort of thing - what tools would I use to do the same thing in java?

    Threaded Messages (3)

  2. Newbie - Simulating a POST[ Go to top ]

    I hope I understood your question correctly. Here is one approach to do what "I think" you are asking:

    Presuming a servlet handles the initial post from the first page, you could have the following in the doPost() method of the servlet:

     ... doPost(...) {

    // do whatever you want with the request here

     RequestDispatcher dispatcher =
    getServletContext().getRequestDispatcher("/secondPage.jsp");
     dispatcher.forward(request,response);

    }

    Thus the firstPage.jsp(html) will post to the servlet, the servlet can examine the request and do whatever is appropriate and then forward the request to a second page.

    Is this what you are attempting to do?

    Regards
  3. Newbie - Simulating a POST[ Go to top ]

    Yes - that is fantastic!!
    Wondering though - If I dont have a servlet enabled webserver, can I still use servlets? Maybe I should make this question a formal post instead of a reply...
  4. Newbie - Simulating a POST[ Go to top ]

    You would need a servlet engine at the minimum to utilize servlets. Please take a look at resin (www.caucho.com) or orion (www.orionserver.com). There is also Tomcat.

    Regards