send XML Request string using POST

Discussion in 'XML' started by Matt, Apr 21, 2004.

  1. Matt

    Matt Guest

    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.jsp" method="POST">
    Name: <input type="text" name="fname">
    //etc.. controls
    <input type="submit">
    </form>
    Matt, Apr 21, 2004
    #1
    1. Advertising

  2. Matt wrote:

    > 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.jsp" method="POST">
    > Name: <input type="text" name="fname">
    > //etc.. controls
    > <input type="submit">
    > </form>


    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/
    Martin Honnen, Apr 23, 2004
    #2
    1. Advertising

  3. Matt

    GIMME Guest

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


    <%@ page import="java.util.Enumeration"%>
    <%@ page import="org.jdom.Element"%>
    <%!

    public Element Create( HttpServletRequest request )
    {
    Element command = new Element("xml_data");
    Enumeration enum = request.getParameterNames();
    while ( enum.hasMoreElements() ) {
    String sKey = (String) enum.nextElement();
    String [] temp = (String[]) request.getParameterValues(sKey);
    int iLen = temp.length;
    for ( int j=0 ; j < iLen ; j++ ){
    String sVal = temp[j] ;
    String sName = sKey;
    command.addContent(new Element(sName).addContent(sVal));
    }
    }
    return command;
    }
    %>
    GIMME, Apr 24, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S2V2aW4gQnVydG9u?=

    Pre-Send Request Headers, Pre-Send Request Content

    =?Utf-8?B?S2V2aW4gQnVydG9u?=, Dec 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,045
    =?Utf-8?B?S2V2aW4gQnVydG9u?=
    Dec 31, 2004
  2. Matt
    Replies:
    1
    Views:
    4,056
    Bryce (Work)
    Apr 21, 2004
  3. kj
    Replies:
    4
    Views:
    448
  4. Matt

    send xml request string

    Matt, Apr 20, 2004, in forum: ASP General
    Replies:
    0
    Views:
    104
  5. Matt
    Replies:
    2
    Views:
    308
Loading...

Share This Page