Home  >  Article  >  Web Front-end  >  Problem with form submit submission mapping Servlet in jsp_html/css_WEB-ITnose

Problem with form submit submission mapping Servlet in jsp_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:09:531125browse

The jsp file of my form below is under D:Program FilesTomcat 6.0webappsssMainProtectDiary









Why do I open this page like this http://localhost:8080/ss/Main/Protect/Diary/WriteDiary .jsp
But after submission, the path becomes http://localhost:8080/ss/WriteDiaryServlet and it prompts 404 path error problem

Then I will

Change action="WriteDiaryServlet" to action="Main/Protect/Diary/WriteDiaryServlet" to access it....
Why~~

My xml configuration is like this


                                                                                                                 ;display-name>This is the display name of my J2EE component
WriteDiaryServlet
.servlet.WriteDiaryServlet



WriteDiaryServlet
;url-pattern>/Main/Protect/Diary/WriteDiaryServlet



Reply to the discussion ( Solution)

/Main/Protect/Diary/WriteDiaryServlet

Use this path to access

But my current path is already It's http://localhost:8080/ss/Main/Protect/Diary/

just like me

another


. . . .

XML

RegisterServlet
/Main/Register/RegisterServlet


The road ahead is http://localhost:8080/ss/Main/Register/Register.jsp
The path after submission is http: //localhost:8080/ss/Main/Register/RegisterServlet


The problem is why the first address has changed, resulting in the need to use
/Main/Protect/Diary /WriteDiaryServlet
Come visit~~~

Please tell me more details. Thank you~~

! ! ! ~~I hope seniors don’t think the code is messy, I really need your help~~Thank you~~

!!!~~~~~~~~~Please explain

Change the path This problem will not occur if the due path is written starting from the project root path.

Specifically how to form the above phenomenon, you can look at the difference between the two, slowly eliminate them, and find out where the writing is different.

Oh oh, I understand, thank you~~I’m sorry for you,,,thank you very much~

This is actually very simple, that is, the path configured in your action and the path configured in the XML must be maintained Consistent, the main thing is to remember that "WriteDiaryServlet" and "/WriteDiaryServlet" are different

I am also researching this problem, but I haven't found the answer yet

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn