Hi Campos,
Hope this helps
I think the parse post data function returns a hash table of key pair values
. Now the values for each key are stored as a string array . so U shud
expect a String[] fron a get and not a string as U have done
Somebody caorrect me if I am wrong
Manu
----- Original Message -----
From: Rui Campos <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 21, 1999 4:15 PM
Subject: Getting Input Data from a Form.
> Hi to all!!
>
> When i get user input data from a form by using :
>
> public void doPost(HttpServletRequest req, HttpServletResponse res) throws
> ServletException, java.io.IOException
> {
> ...
>
> ServletOutputStream out = res.getOutputStream();
>
> Hashtable postedData =
> HttpUtils.parsePostData(req.getContentLength(),req.getInputStream());
>
> String sn = (String) postedData.get("SN");
>
> out.print(SN);
>
> ....
> }
>
> I get the error
>
> java.lang.ClassCastException: java.lang.Object
>
> when I submit the data.
>
> The "SN" is the name of a text-box that allows user input, in a HTML Form.
>
> I have confirm that the value associated with the key "SN" is a String, by
> doing :
>
> ...
> Object sn = postedData.get("SN");
>
> out.print( sn.getClass().getName().);
>
> ...
>
> I don't see were the problem is since the method "get" from Hastable
returns
> an Object, and String is a subclass of Object.
> Maybe it as something to do with the classloader of the servlet?
>
> Does anyone know whats's the problem?
>
> Tanks in advance,
>
> RJCampos.
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html