Hi all,
Sorry again, I think, whenever we use both,
post.addRequestParameter("1","2");
post.addRequestParameter("3","4");
post.setRequsetEntity();
// These two will not work together,
But, settingRequestEntity,
Part[] parts = { new StringPart("sheetal",
"sheetalPassword") };
, This will not set the requestParameter.
As I see request.getParameter("sheetal"); will not work, When I use parts,
Again I need to use ObjectInopuStream and read accorndly, Could anybody tell me
whether my understanding is rihgt?
Is it should always read using OutputStream.
According to my previous reply, for now, Mutlitpart handling is not
mentioned by
the spec, we may need to do that explicitly,
Please , Could I know if my understanding is wrong.
Thanks,
Sheetal
Sheetal D <[EMAIL PROTECTED]> wrote:
Hi,
Thanks for the reply, I have one more doubt. As you said,
"Servlet/JSP specifications do not
handle multipart requests" Then, I am still confused why when I use
URLHttpConnection. It works, using POST, In jsp,
for (java.util.Enumeration enum= request.getHeaderNames();
enum.hasMoreElements();){
String s = (String)enum.nextElement();
System.out.println("s"+s);
}
There I take the outputstream and write paramname=value.
Thanks,
Sheetal
"Kadlabalu, Hareesh" wrote:
The reason this happens is because Servlet/JSP specifications do not
handle multipart requests, by design (I do not know why). Java
developers therefore have to either parse the stream in their programs
or use one of many libraries out there for this purpose.
Apache Commons FileUpload
(http://jakarta.apache.org/commons/fileupload/)
Cos (http://www.servlets.com/cos/)
-Hareesh
-----Original Message-----
From: Sheetal D [mailto:[EMAIL PROTECTED]
Sent: Friday, April 07, 2006 12:29 PM
To: [email protected]
Subject: Help on Requst Params in Post
Hi all,
I have seen some of the queries on this. I still could not
find the reason why I am not able to get request parameters in Post.
Because, I need to write both StringPart and Objects using
RequestEntities.
I have used the example given in the API,
PostMethod filePost = new PostMethod(url);
try{
Part[] parts = { new StringPart("sheetal",
"sheetalPassword") };
filePost.setRequestEntity(
new MultipartRequestEntity( parts,
filePost.getParams()) );
HttpClient client = new HttpClient();
int status = client.executeMethod(filePost);
System.out.println("The status code is
"+client.executeMethod(filePost));
StatusCode returns properly, But When I get the parameter in JSP.
It will print null, Could anybody tell me what mistake I am making.
Thanks,
Sheetal
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and
save big.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries for just 2¢/min
with Yahoo! Messenger with Voice.