The Artima Developer Community
Sponsored Link

Java Answers Forum
Parameter error!

2 replies on 1 page. Most recent reply: Feb 17, 2004 2:24 AM by Mickey

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Mickey

Posts: 7
Nickname: internment
Registered: Feb, 2004

Parameter error! Posted: Feb 16, 2004 10:25 AM
Reply to this message Reply
Advertisement
Hi folks,
Slight problem here, i have a form in a HTML page linking to a servlet. The servlet's checking the parameters and using the requestDispatcher to redirect to a JSP page. The servlet is compiling fine, but when after i enter details into the form and click on the submit button, i'm getting a Parameter error. I'll show u the e-mail address i'm adding, then the error checking method (which is compling ok) and then the error it returns, and see if you can shed light on the prob.

e-mail................

seargentpepper@police.com



checking the parameter..............................

public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
// Check e-mail parameter parameter
String[] values = req.getParameterValues("emailAddress");
if (values == null || values.length != 1 || values[0].trim().length() == 0)
{
this.parameterError1(res);
return;
}
String par_email = values[0].trim();
}


the error it returns............................................

private void parameterError1(HttpServletResponse res) throws IOException
{
res.setContentType("text/plain");
PrintWriter writer = res.getWriter();
writer.print("Parameter error 1.\n");
writer.close();
}



Any help would be appreciated, thank you!


mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: Parameter error! Posted: Feb 16, 2004 10:53 PM
Reply to this message Reply
In the html name of the email field should be "emailAddress".

Mickey

Posts: 7
Nickname: internment
Registered: Feb, 2004

Re: Parameter error! Posted: Feb 17, 2004 2:24 AM
Reply to this message Reply
Thanks..............

Flat View: This topic has 2 replies on 1 page
Topic: parameters getting dropped from request object Previous Topic   Next Topic Topic: Putting multiple images into one component

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use