Hi sidaty,

try this:

doPost(HttpServletRequest req, HttpServletResponse res)....{
    .....
    String form_text_one, form_text_two;

    try{
        // by indexing the array of strings ( ....[0] ) and
        // calling the .trim() method you will generate a
        // NullPointerException if the form did not contain
        // a field by the name given.
        // This is definitely an exceptional situation and is completely
        // within in your control to prevent.
        form_text_one =
req.getParameterValues("form_text_one_name")[0].trim();
        form_text_two =
req.getParameterValues("form_text_two_name")[0].trim();

        // for informational purposes only. remove when done.
        //System.out.println(form_text_one);
        //System.out.println(form_text_two);

    }catch(NullPointerException npe){
        //System.err.println("This is where the error is going on.");
        //System.err.println("Error: create_proposal.doPost() -
NullPointerException");
        // npe.printStackTrace(res.getWriter());
        res.sendRedirect("/error_mesg.html");
        return;
    } // this should take care of any null values (missing fields).
    ....
}

Good luck!,

Spencer Ridder
[EMAIL PROTECTED]


> sidaty wrote:
>
> HI all ,
> Please i have a POST FORM and want to provide 2 variables (say name
> and passwd) to a servlet
> i define my objets like this
> HttpServletRequest request ;
> BufferedReader       reader  = request.getReader() ;
>
> reader is the object that i want will permit me to access the 2 fields
> filled by the client .
>
> So what are the methods available for  this object reader (
> reader.XXXXXXX)  that let us get what the client type in name and
> passwd fields
> I tried reader.parseInt() , reader.getAttribute()
>
> Please Can anybody guide me .
>
> A lot of thanks
> Sidaty [EMAIL PROTECTED]
>
>
>
>
>
>
>

___________________________________________________________________________
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

Reply via email to