cancel
Showing results for 
Search instead for 
Did you mean: 

Servlet Post Not working

Former Member
0 Kudos

I've created a simple jsp containing a form with two text fields as follows:


<%@ page language="java" %>
<html>
<body>
	<form action="formtest" name="test_form" method="post">
		<input type="text" name"field1"/><br>
		<input type="text" name"field2"/><br>
		<input type="Submit" value="Submit"/>
	</form>
</body>
</html>

I pass the request to a servlet, and in the doPost() method I try to print out the two parameters. However, the request doesn't seem to contain any information. I printed the parameter names and the attribute names and the only thing I get is one attribute name "com.sap.servlet.separator.zone".

Any ideas as to why the information is not being passed to the servlet?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Is the name of your servlet formtest? Are you sure the action on your form is correct?

Take a look at this link:

<a href="http://www.apl.jhu.edu/hall/java/Servlet-Tutorial/Servlet-Tutorial-Form-Data.html">http://www.apl.jhu.edu/hall/java/Servlet-Tutorial/Servlet-Tutorial-Form-Data.html</a>

regards,

Dion

Answers (3)

Answers (3)

Former Member
0 Kudos

I have traced the problem to another servlet. I'm using NTLM authentication to retreive the Users NT login. The code is a slightly modified version of the following <a href="http://www.rgagnon.com/javadetails/java-0441.html">http://www.rgagnon.com/javadetails/java-0441.html</a>

I find that once this code runs it disables my ability to call the doPost() method from a form.

Any ideas as to how I can fix this?

Thanks.

Former Member
0 Kudos

Hi Mat Zitnik,

<b>Solution:</b>

I think you have not specified the correct formtest.java in your source code.

For more information see this link...

This link gives how to specify packageless & packaged servlets in your code ...

http://courses.coreservlets.com/Course-Materials/pdf/struts/Servlet+JSP-Review.pdf

Path information

http://www-306.ibm.com/software/webservers/appserv/doc/v30/se/web/doc/whatis/icsrvlet.html#defaultap...

or

Mapping servlet with the url in web.xml...

Refer this site....

Sample XML.

http://www.adp-gmbh.ch/java/web_application/web_xml.html

Web.xml Elements.

http://e-docs.bea.com/wls/docs81/webapp/web_xml.html

Servlet Mapping & More.

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc...

<b>Alternate Solution:</b>

JSP has specific tags to call a servlet from jsp.

Use <jsp:forward.../> & <jsp:include.../>

For More information refer this link...

http://www.javaskyline.com/learnjsp.html

(Search for "Using JSP with Servlets" in this page).

Hope it helps.

Reward Points for useful answers.

Regards,

Maheswaran.B

Former Member
0 Kudos

hello mat,

is your servlet mapped in your web descriptor?

much better if you could post your web descriptor

and your doPost method code.

regards

jo