send XML Request string using POST

Matt (archive)

Usenet Archive
Joined
Jan 13, 2000
Messages
739
Reaction score
0
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>
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
Matt said:
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.
 

GIMME

Usenet Archive
Joined
Jun 3, 2003
Messages
107
Reaction score
0
You can create XML (a JDOM Element) right from the request object ...



<%!

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; } %>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top