去掉页面上面的 ${path} 试试看,或打印${path} 看是什么路径
解决方案 »
- hibernate拷贝
- 请教一个tomcat连接池的问题,达人请进
- 通过jsp将excel表格中的数据导入sql 2000数据库表中
- 求助,比較急。在頁面添加一個div 設置zindex=9999,這個div在頁面占位置嗎?為什么DIV show時,IE垂直滾動條會縮短一點?hiden時滾動條又變回(增長一點)?
- Hibernate中怎样获取一张表所有行的指定几个字段而不是全部字段
- 100分高手笑纳,帮我看看错误信息在那,顺问几个小问题!
- 问一个最基本的问题
- jsp中如何得到客户端的操作系统和浏览器版本????
- JBuilder如何配置mysql的驱动,为什么通过tols->enterprise setup 添加后
- JDBC问题 \sqlserver
- java调用远程shell问题
- 多线程编程,主线程怎么等待多接口数据返回
就是这样的,去掉它我也试过了,并没有用处
检查DriverAction 的class文件有没有成功部署到tomcat中
<s:submit name="submit" value="提交"/>
</s:form>
这么写我测试没有问题,你报404,就看一下访问出错的地址呀,是少了个“/'还是什么
这个是web,xml的文件
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
这个是sturts.xml文件
<struts> <package name="helloworld" namespace="/" extends="struts-default">
<!-- 配置一个action,一个struts2请求就是一个action
name 对应struts2的请求名字(或者对于一个servletPath,但去除/和扩展名),不包含扩展名
result:结果
-->
<action name="product_input">
<result>/WEB-INF/p1/input.jsp</result>
</action>
<action name="product_save" class="com.atguigu.struts2.helloworld.Product" method="save">
<result name="details">/WEB-INF/p1/details.jsp</result>
</action>
</package>
</struts>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="product_save.action" method="post">
productName:<input type="text" name="productName"></input>
<br> <br>
productDesc:<input type="text" name="productDesc"></input>
<br> <br>
productPrice:<input type="text" name="productPrice"></input>
<br> <br>
<input type="submit" value="提交"></input>
<br> <br>
</form>
</body>
</html>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
%>
<form action="<%=basePath%>/driverTest!xxx.action" method="post" >xxx表示action中的方法
${path}/driver/driverTest.action
楼上哥们正解
最好不用用你的什么path,这个
${context.request.contextPath}/driver/driverTest
如果你的form用的不是struts2标签,那么你的action就要加后缀,即driverTest.action。
还可以<s:form action="driverTest" ></s:form>