本人是新手来的。。刚学JSP
情况是这样的,我想把表单的内容传给servlet,每次提交的时候都404错误,以下是错误信息HTTP Status 404 - /UserLogin--------------------------------------------------------------------------------type Status reportmessage /UserLogindescription The requested resource (/UserLogin) is not available.
------------------------------------------------------------------------------------我是这样写的 <form action ="/UserLogin" method="post">
------------------------------------------------------
web.xml部署
<display-name>UserLogin</display-name>
<servlet-name>UserLogin</servlet-name>
<servlet-class>jsp_servlet_javabean.UserLogin</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UserLogin</servlet-name>
<url-pattern>/UserLogin</url-pattern>
</servlet-mapping>
-----------------------------------------------------
提交前地址:
http://localhost:8080/test/JSP_Servlet_JavaBean/login.jsp
提交后地址:
http://localhost:8080/UserLogin
这帖子我第3次发了,每次解决后又发现有新的问题- -!
上次有个大神帮我解决了上面的问题
-------------------------------------------------------------------------------------
把Web应用的ContextPath给漏了,提交后的路径应该是:http://localhost:8080/test/UserLogin<form action ="UserLogin" method="post">修改为<form action ="/test/UserLogin" method="post">或者用 <%=request.getContextPath()%> 自动获取 Web应用的contextpath
------------------------------------------------------------------------------------
确实,按照他说的做,在eclipse上运行,问题解决了。
但后来发现在浏览器上运行,遇到了同样的问题
------------------------------------------------------------------------------------
type Status reportmessage /test/UserLogindescription The requested resource (/test/UserLogin) is not available.
-----------------------------------------------------------------------------------现在问题是,可以在eclipse上运行,但浏览器上运行出错,难道是要把XML配置到浏览器上???

解决方案 »

  1.   

    404, 就是找不到这个页面, 根据你的情况就是找不到servlet, 如果有堆栈信息, 最好帖出来, 这样更好解决问题。
      

  2.   

    问题是,为什么在eclipse上运行就可以,在浏览器上运行就不行了?难道浏览器不会自动用eclipse配置好的XML的路径???
      

  3.   

    所有的浏览器都不行吗?
    但是eclipse的浏览器却可以正常运行?
      

  4.   

    我用了IE浏览器和搜狗浏览器都不行,在eclipse的浏览器上运行可以感觉是因为eclipse上有运行xml配置的路径
      

  5.   

    重新安装了一次eclipse然后配置了一次tomcat,问题就解决了,现在可以用同一个tomcat在eclipse中运行网站和在IE浏览器上运行网站