send XML Request string using POST

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt

    #1

    send XML Request string using POST

    The JSP page needs to send XML request string to another JSP page when the
    user clicks submit button, I wonder how to get started because when user
    click submit button, it will send the form to page2.jsp.

    <form action="page2.j sp" method="POST">
    Name: <input type="text" name="fname">
    //etc.. controls
    <input type="submit">
    </form>
  • Martin Honnen

    #2
    Re: send XML Request string using POST



    Matt wrote:
    [color=blue]
    > The JSP page needs to send XML request string to another JSP page when the
    > user clicks submit button, I wonder how to get started because when user
    > click submit button, it will send the form to page2.jsp.
    >
    > <form action="page2.j sp" method="POST">
    > Name: <input type="text" name="fname">
    > //etc.. controls
    > <input type="submit">
    > </form>[/color]

    I am not sure what the problem is, in page2.jsp you want to build an XML
    request string and post it to another page?

    If you expect the browser to build an XML request then you would neeed
    XForms not HTML forms.
    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • GIMME

      #3
      Re: send XML Request string using POST

      You can create XML (a JDOM Element) right from the request object ...


      <%@ page import="java.ut il.Enumeration" %>
      <%@ page import="org.jdo m.Element"%>
      <%!

      public Element Create( HttpServletRequ est request )
      {
      Element command = new Element("xml_da ta");
      Enumeration enum = request.getPara meterNames();
      while ( enum.hasMoreEle ments() ) {
      String sKey = (String) enum.nextElemen t();
      String [] temp = (String[]) request.getPara meterValues(sKe y);
      int iLen = temp.length;
      for ( int j=0 ; j < iLen ; j++ ){
      String sVal = temp[j] ;
      String sName = sKey;
      command.addCont ent(new Element(sName). addContent(sVal ));
      }
      }
      return command;
      }
      %>

      Comment

      Working...