关于window.open()请求servlet的问题 servlet需要完整的路径?我不太懂,麻烦楼上的大虾能解释的更清楚一下吗?我新手,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 servlet路径不是在xml里面指明了? <a href=# onClick="javascript:window.open('dingdanxiangxiziliao','','width=710,height=388,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;">但是错误显示是:HTTP Status 404 - /index/stage/userlogin/dingdanxiangxiziliao--------------------------------------------------------------------------------type Status reportmessage /index/stage/userlogin/dingdanxiangxiziliaodescription The requested resource (/index/stage/userlogin/dingdanxiangxiziliao) is not available.--------------------------------------------------------------------------------Apache Tomcat/5.5.15那个servlet我就没放在/stage/userlogin这个文件夹下 汗。。你在web.xml里面是怎样声明并映射这个servlet的? 在xml里面路径没问题,都可以用,我的QQ88518782 路径不对window.open 跟点个超链的url 没啥区别的你拿超链试下 如果能用 window.open也可以的 <%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>改成document.location.replace("<%=path%>/……");//……是你servlet的路径,//例如你的servlet在包stage下面叫userlogin就写成stage/userlogin试试。 最好在以后的开发中不要去用window.open()这样的方式,因为在现在的情况下,弹出窗口已经很难再弹出来了 你这个window.open()直接打开一个页面了,404错误就是页面不存在,你要指向一个servlet,直接window.open('http://XXX.do')或者其他的,这里是您的servlet的启动请求就可以了 非常感谢楼上的ProvidenceZY,也同样感谢大家,在这里谢谢了,问题解决了 java中的添加背景图片 在向数据库查询时,传入的中文变成乱码,求解决方案 tomcat安装问题 Java学习从入门到精通 怎么样算精通Hibernate 类型转换异常:java.lang.ClassCastException webService方法调用问题 如何实现地址本的功能 求一hibernate 语句 急急 整合JBPM问题,找不到流程定义 高手请教:向数据库里插入数据发生异常 Hibernate的一对多问题???
但是错误显示是:
HTTP Status 404 - /index/stage/userlogin/dingdanxiangxiziliao--------------------------------------------------------------------------------type Status reportmessage /index/stage/userlogin/dingdanxiangxiziliaodescription The requested resource (/index/stage/userlogin/dingdanxiangxiziliao) is not available.
--------------------------------------------------------------------------------Apache Tomcat/5.5.15
那个servlet我就没放在/stage/userlogin这个文件夹下
window.open 跟点个超链的url 没啥区别的
你拿超链试下 如果能用 window.open也可以的
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
改成document.location.replace("<%=path%>/……");//……是你servlet的路径,
//例如你的servlet在包stage下面叫userlogin就写成stage/userlogin试试。