最近重新拾起J2EE,从配置servlet开始做起。结果配置的时候出了点问题,action的提交路径和web.xml里的servlet路径是完全一样的,怎么就老是报“。。。is not avaliable”的错呢?
后来在网上也找了很多的例子,都是这么配置的,为什么我的就报错呢?
接着继续找答案,在尚学堂的视频里找到了答案:
这是web.xml里的servlet配置:
<servlet>
<servlet-name>events</servlet-name>
<servlet-class>com.andy.ajax.EventServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>events</servlet-name>
<url-pattern>/events</url-pattern>
</servlet-mapping>
而jsp文件里的servlet路径是 "/AjaxProject/events " 才行。
原因分析:
web.xml里的<url-pattern>/events</url-pattern>里的/已经把/AjaxProject路径包含进去了,相当于地址:http://localhost/AjaxProject/events ,所以jsp里的servlet路径要包含/AjaxProject,否则指向的是http://localhost/events而找不到servlet。
终于找到问题所在了,加油。。。。
分享到:
相关推荐
HTTP Status 404 解决方案总结 HTTP Status 404 是一个常见的错误代码,它表示请求的资源不可用。在本文中,我们将讨论七种常见的解决方案,以帮助开发者快速解决该问题。 1. 未部署 Web 应用 如果您遇到了 HTTP ...
编译程序时候老是报module "src/utils/utils.js" is not defined的错,狂问度娘也没结果 后来静下来想才尝试弄正确: 我本来的页面地址是:"src/main/welcome/welcome" 在这个页面的基础上要加载utils.js,所以按照...
错误提示如下图: 出现这种情况的原因通常是因为先安装了Framework,后安装的IIS; 运行cmd,输入: 代码如下:C:\Windows\Microsoft.NET\Framework\V4.0.30319\aspnet...Win7中IIS出现“HTTP 错误 404.17 – Not Foun
### IIS访问ASP页面时报错“The requested resource is in use”的解决办法 在处理IIS(Internet Information Services)服务器上的ASP(Active Server Pages)页面时,可能会遇到一个常见的错误:“The requested ...
经过研究摸索终于解决了! 该开发包是解决 JavaMail 发送邮件报错:java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream错误 ava.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream ...
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. 这就是跨域问题。解决方案有不少,比较好的是服务器端配置CORS,但要求服务器端...
### Apache启动报错:“the requested operation has failed”的解决办法 #### 背景与问题描述 在使用Apache Web服务器的过程中,可能会遇到一个常见的错误提示:“the requested operation has failed”。这个错误...
// If the sub frame is transparent the background is not automatically // // restored, you must do so yourself if you want that. // // If you are using a TImage to display the gif you can use // // ...
在排除没有登录和网络的原因:我还是报的如下错误 原因镜像的名字没有按照...The push refers to repository [docker.io/langxuhao/my_redis] cd1b418d5a74: Pushed ddf2402ca3ea: Pushed 00352274272b: Pushed a0e3c
/// 2、“has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.”。 /// 3、“has been blocked by CORS policy: Response to preflight request...
当一个网页尝试从不同的源(协议、域名或端口)请求资源时,如果目标服务器没有允许这个源的权限,浏览器会阻止该请求,从而出现"No 'Access-Control-Allow-Origin' header is present on the requested resource"的...
5. The version of your subversion (client) is below 1.5.0, upgrade to 1.5.0 or above. 该错误提示的原因是客户端的软件版本低于 1.5.0。解决方法是升级本地的 Subversion 客户端软件到 1.5.0 或以上版本,以...
XMLHttpRequest cannot load http://192.168.2.12:8001/oss/api/version/check. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:8000’ is therefor
Amazon 卖家接口Demo,官方Demo一堆错误,千万不要被误导。 解决: 1、Access to requested resource is denied 2、The security token included in the request is invalid 有疑问可提问
git首次提交代码到远程仓库提示413错误,错误信息如下 git push --set-upstream origin master Enumerating objects: 153, done. ... HTTP 413 curl 22 The requested URL returned error: 413 Req
k8s的16版本安装的时候,dashboard 出现k8s dashboard the server could not find the requested resource的问题。重新换一个2.0版本的dashboard即可。
新手jsf问题。http://localhost:8080/jsfdemo/userLogin.faces 出现 The requested resource (/jsfdemo/userLogin.faces) is not available.
curl: (22) The requested URL returned error: 404 Not Found Error: Failed to download resource "libpng" Download failed: https://downloads.sf.net/project/libpng/libpng16/1.6.16/libpng-1.6.16.tar.xz ...
By setting the `preventCache` option to `true`, you ensure that the browser does not cache the response, which is useful for testing and development purposes. The `timeout` option sets a timeout for ...