Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > send XML Request string using POST

Reply
Thread Tools

send XML Request string using POST

 
 
Matt
Guest
Posts: n/a
 
      04-21-2004
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>
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      04-23-2004


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/

 
Reply With Quote
 
 
 
 
GIMME
Guest
Posts: n/a
 
      04-23-2004
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;
}
%>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pre-Send Request Headers, Pre-Send Request Content =?Utf-8?B?S2V2aW4gQnVydG9u?= ASP .Net 0 12-31-2004 06:29 PM
Pass XML Request String via HTTP POST Question Matt ASP General 5 05-04-2004 05:41 PM
send XML Request string using POST Matt Java 1 04-21-2004 05:22 PM
send xml request string using HTTP protocol? Matt ASP General 2 04-21-2004 03:34 AM
send xml request string Matt ASP General 0 04-20-2004 02:56 AM



Advertisments