Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

servlet read immediately, befor input

Status
Not open for further replies.

henryhandle

Programmer
Feb 19, 2005
56
DE
ServletA create a form and will get input from form
and analyse it:
ServletA:
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException
{


out.println(" <form action=\"/servletA" method=\"POST\">");
out.println("<input type=text name=\"name\" size=20>
<input type=text name=\"addr\" size=20></TD>" +
//" <TD> <input type=submit Value=\"Submit\" </TD");

.............

String name = request.getParameter("name");
String addr= request.getParameter("addr");

I call this servlet from ServletB.
The problem is as soon as i call ServletA
the Servlet try to read input
(because of addr= request.getParameter("addr"); and name = request.getParameter("name");)
and it aborts with error message.
how could servletA wait for input ??
i tried with this:
while( !request.getParameter("name").equals(""))
{ name = request.getParameter("name");
addr= request.getParameter("addr");
}
but it does'nt work
?
thanks
 
this is my solution:
String name;
if( (name = request.getParameter("name"))!=null){
{ name = request.getParameter("name");
String addr= request.getParameter("addr");
}

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top