Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7008157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:41:56+00:00 2026-05-27T21:41:56+00:00

I have an HTML form like this: form.html: <html> <body> your name is :<br><br>

  • 0

I have an HTML form like this:

form.html:

<html>
<body>

 your name is :<br><br>

<form ACTION="../post2" METHOD="POST">
<input name="name" type="text" id="name"/>
<input name="send"  type="submit"  value="send"/>
</form>

</body>
<html>

The servlet to serve this request:

post2.class:

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.*;

    public class post2 extends HttpServlet
    {

protected void doDo(HttpServletRequest request,HttpServletResponse response) 
 throws IOException{

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

response.setContentType("text/html");
PrintWriter out = response.getWriter();

out.println("<HTML><BODY>");
out.println("<H2>hello "+name+"</H2>");
out.println("<BR><BR>");
out.println("info:");
out.println("<BR><BR>");
out.println("<H2>metoda GET</H2>");
out.println("<BR><BR>");
out.println("SERVER_NAME="+request.getServerName()+"<BR>");
out.println("REQUEST_METHOD="+request.getMethod()+"<BR>");
out.println("QUERY_STRING="+request.getQueryString()+"<BR>");
out.println("REMOTE_HOST="+request.getRemoteHost()+"<BR>");
out.println("REMOTE_ADDR="+request.getRemoteAddr());
out.println("</BODY></HTML>"); 
}


@Override
public void doGet(HttpServletRequest request,HttpServletResponse response) 
throws IOException {      
 doDo(request,response);
}

@Override
public void doPost(HttpServletRequest request,HttpServletResponse response) 
throws IOException {
 doDo(request,response);
}

}

and the result is :

hello null


info:

SERVER_NAME=localhost
REQUEST_METHOD=GET
QUERY_STRING=null
REMOTE_HOST=127.0.0.1
REMOTE_ADDR=127.0.0.1 

what is wrong ? For me it seems that the servlet don’t see post method from form. Please help, Im completly have no idea why it not working properly…

the result from the wireshark:

648 126.229267 87.105.184.89 192.168.1.100 HTTP 557 POST /post2
HTTP/1.1 (application/x-www-form-urlencoded)

953 379.456916 192.168.1.100 87.105.184.89 HTTP 239 HTTP/1.1 302 Moved
Temporarily

955 379.462518 192.168.1.100 87.105.184.89 HTTP 470 GET /post2/
HTTP/1.1

957 379.463979 192.168.1.100 87.105.184.89 HTTP 431 HTTP/1.1 200 OK
(text/html)

routing logic:

tomcat\webapps\ROOT\form.html –> \tomcat\webapps\post2\WEB-INF\classes\post2.class

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:41:57+00:00Added an answer on May 27, 2026 at 9:41 pm

    Could this be due to a redirect? If “/post2” redirects to “/post2/” your POST request would be transformed into a GET, losing all post data.

    Try accessing “/post2” directly in your browser and see what happens.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given HTML like this: <body> <form name=myForm action=savedata.php method=post> <input type=text name=myName /> </form>
I have a form in a .html files where input/select box looks like this
I have webpage with a form like this: <html> <head> ... </head> <body> <form
I have done something like this. <html> <head> <script type=text/javascript> <!-- function toggleTB(what){ if(what.checked){document.theForm.theTB.disabled=1}
I have a webpage that looks like: <html> <head> <title>Hi</title> </head> <body> <form name=mainForm
I have something like this in my AJAX application: <html> <head> <script type=text/javascript> var
I have a simple form with some plain html input like bellow using ASP.NET
I have a HTML form containing checkboxes in the form of .. <input type=checkbox
I have this code for Form Submit.. <input type=submit runat=server id=buttonSubmit value=Add style=width:100px; />
I have a form that I want to validate looks like this: <!DOCTYPE html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.