当前页面: 开发资料首页 → JSP 专题 → Servlet路径问题
Servlet路径问题
摘要: Servlet路径问题
在E:/webapp/web/WebMod/WEB-INF下有一web.xml及目录classes/web,web下有个类:FormGet.class,
web.xml如下
WebMod
formget
web.FormGet
formget
/formget
另一目录下有个html,里面有个FORM,
<form name="form" method="GET" action="http://localhost:8080/WebMod/FormGet">
...
当该FORM提交时,显示:The requested resource (/WebMod/FormGet) is not available.
我想应该是FormGet.class存放的路径不对造成的,是吗?那正确的路径呢?
<form name="form" method="GET" action="http://localhost:8080/FormGet">
url-pattern 中的是小写
你访问怎么用大写?
试过两位的方法.都不行啊
action="/formget"
还是没搞定,难道和web.xml的存放路径也有关?谁能说说他们之间的关系啊?
你放哪里的???要放在web-info/lib下面
不好意思 ,是web-info目录下面
formget.htm在E:/webapp/web/WebMod下,
<form name="form" method="GET" action="/web/FormGet">
在E:/webapp/web/WebMod/WEB-INF下,有web.xml,
在E:/webapp/web/WebMod/WEB-INF/classes/web下,有FormGet.class
package web
web.xml如下
formget
web.FormGet
提交FORM后,The requested resource (/web/FormGet) is not available
formget
web/FormGet
web/FormGet web前面少了 /
试过,还是不行啊
不清楚楼主的实际问题
这种问题我知道两种
1、很简单的 tomcat里区分大小写
2、访问servlet时 第一次访问失败不要紧
看提示信息 The requested resource (/WebMod/FormGet) is not available
他要找的是/WebMod/FormGet
而你的xml里写的是
formget
/formget
肯定不行
把二者改为一致就可以了
Good Luck :-)
路过,友情up...