JSP页面
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!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=UTF-8">
<base href="<%=basePath%>">
<title>部门</title>
</head>
<body>
<form action="zy/find.action" method="post">
<table width="100%" border=1 cellspacing="0" >
<tr>
<th colspan="4" align="center">部门信息</th>
</tr>
<tr>
<th width="25%">部门编号</th>
<th width="25%" id="deptid">${deptid}</th>
<th width="25%">部门名称</th>
<th width="25%" id="deptname"><s:property value="deptname" /></th>
<tr>
</table>
<font size="3">员工信息:</font>
<a href="zy/dept_queryEmployeer?deptid=${deptid}&deptname=${deptname}"><font size="3">查询</font></a>
<a href="zy/dept_addEmployeer?deptid=${deptid}&deptname=${deptname}"><font size="3">增加</font></a>
<table width="100%" border=1 cellspacing="0">
<tr>
<th colspan="7" align="center">员工列表</th>
</tr>
<tr>
<th>员工编号</th>
<th>员工姓名</th>
<th>员工年龄</th>
<th>员工性别</th>
<th>员工薪资</th>
<th>部门标号</th>
<th>操作</th>
</tr>
<s:iterator value="list" var="employeer">
<tr>
<td align="center"><s:property value="#employeer.id" /></td>
<td align="center"><s:property value="#employeer.name" /></td>
<td align="center"><s:property value="#employeer.sex" /></td>
<td align="center"><s:property value="#employeer.age" /></td>
<td align="center"><s:property value="#employeer.salary" /></td>
<td align="center"><s:property value="#employeer.dept.id" /></td>
<td align="center">
<a href="zy/dept_updateEmployeer?employeer.id=${employeer.id}&deptid=${deptid}&deptname=${deptname}">修改</a>
<a href="zy/dept_deleteEmployeer?employeer.id=${employeer.id}&deptid=${deptid}&deptname=${deptname}">删除</a>
</td>
</tr>
</s:iterator>
</table>
</form>
<s:debug></s:debug>
</body>
</html>
----------------------------------------------------------------------------------------struts
-----------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="myPackage" namespace="/zy" extends="struts-default">
<action name="*_*" class="com.sansan.action.MyAction" method="{2}">
<result name="saveEmployeer">/index.jsp</result>
<result name="finddept">/WEB-INF/jsp/dept.jsp</result>
<result name="department">/WEB-INF/jsp/department.jsp</result>
<result name="departmentAndEmployeer">/WEB-INF/jsp/department.jsp</result>
<result name="updateEmployeer" >/WEB-INF/jsp/employeer.jsp</result>
</action>
<!-- <action name="save_employeer" class="com.sansan.action.MyAction" method="save_employeer">
<result name="saveEmployeer">/index.jsp</result>
</action> -->
</package>
</struts>----------------------------------------------------------------------------------------
public String saveEmployeer()
{
System.out.println(6666);
return "saveEmployeer";
}----------------------------------------------------------------------------------------
HTTP Status 404 - No result defined for action com.sansan.action.MyAction and result inputtype Status reportmessage No result defined for action com.sansan.action.MyAction and result inputdescription The requested resource is not available.
Apache Tomcat/7.0.77
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!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=UTF-8">
<base href="<%=basePath%>">
<title>部门</title>
</head>
<body>
<form action="zy/find.action" method="post">
<table width="100%" border=1 cellspacing="0" >
<tr>
<th colspan="4" align="center">部门信息</th>
</tr>
<tr>
<th width="25%">部门编号</th>
<th width="25%" id="deptid">${deptid}</th>
<th width="25%">部门名称</th>
<th width="25%" id="deptname"><s:property value="deptname" /></th>
<tr>
</table>
<font size="3">员工信息:</font>
<a href="zy/dept_queryEmployeer?deptid=${deptid}&deptname=${deptname}"><font size="3">查询</font></a>
<a href="zy/dept_addEmployeer?deptid=${deptid}&deptname=${deptname}"><font size="3">增加</font></a>
<table width="100%" border=1 cellspacing="0">
<tr>
<th colspan="7" align="center">员工列表</th>
</tr>
<tr>
<th>员工编号</th>
<th>员工姓名</th>
<th>员工年龄</th>
<th>员工性别</th>
<th>员工薪资</th>
<th>部门标号</th>
<th>操作</th>
</tr>
<s:iterator value="list" var="employeer">
<tr>
<td align="center"><s:property value="#employeer.id" /></td>
<td align="center"><s:property value="#employeer.name" /></td>
<td align="center"><s:property value="#employeer.sex" /></td>
<td align="center"><s:property value="#employeer.age" /></td>
<td align="center"><s:property value="#employeer.salary" /></td>
<td align="center"><s:property value="#employeer.dept.id" /></td>
<td align="center">
<a href="zy/dept_updateEmployeer?employeer.id=${employeer.id}&deptid=${deptid}&deptname=${deptname}">修改</a>
<a href="zy/dept_deleteEmployeer?employeer.id=${employeer.id}&deptid=${deptid}&deptname=${deptname}">删除</a>
</td>
</tr>
</s:iterator>
</table>
</form>
<s:debug></s:debug>
</body>
</html>
----------------------------------------------------------------------------------------struts
-----------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="myPackage" namespace="/zy" extends="struts-default">
<action name="*_*" class="com.sansan.action.MyAction" method="{2}">
<result name="saveEmployeer">/index.jsp</result>
<result name="finddept">/WEB-INF/jsp/dept.jsp</result>
<result name="department">/WEB-INF/jsp/department.jsp</result>
<result name="departmentAndEmployeer">/WEB-INF/jsp/department.jsp</result>
<result name="updateEmployeer" >/WEB-INF/jsp/employeer.jsp</result>
</action>
<!-- <action name="save_employeer" class="com.sansan.action.MyAction" method="save_employeer">
<result name="saveEmployeer">/index.jsp</result>
</action> -->
</package>
</struts>----------------------------------------------------------------------------------------
public String saveEmployeer()
{
System.out.println(6666);
return "saveEmployeer";
}----------------------------------------------------------------------------------------
HTTP Status 404 - No result defined for action com.sansan.action.MyAction and result inputtype Status reportmessage No result defined for action com.sansan.action.MyAction and result inputdescription The requested resource is not available.
Apache Tomcat/7.0.77
解决方案 »
- JTextPane 如何读取和写入图文混排的内容(类似QQ聊天窗口)
- 想和大家讨论一正则,请进来看一!!
- 如何验证jTextField里面是不是数字
- 各位前辈,怎么办呀!!!小弟迷茫呀....
- java 能连上 sql server2000 ,但数据写不进数据库,求助高手!
- 在java applet中调用matlab函数库?
- 两行数据重名,查询的时候只能显示其中一个,怎么处理?
- 不问不行了!JFrame怎么去掉热咖啡图标?
- java如何取系统环境变量?
- 给JFrame加背景图片之后,怎么菜单栏看不见了,鼠标放上去,可以选择!
- xml转word之后再转xml丢失数据
- 关于String类实例方法判断字符是否为汉字;
检查表单提交参数是否正确。
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!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=UTF-8">
<base href="<%=basePath%>">
<title>设置</title>
</head>
<body><form action="zy/index_findDept" method="post">
<table width="100%" border=1 cellspacing="0">
<tr>
<th colspan="6" align="center">员工信息</th>
</tr>
<tr >
<th>员工编号</th>
<th>员工姓名</th>
<th>员工年龄</th>
</tr>
<tr>
<td align="center"><input type="text" name="id" value="${employeer.id}" /></td>
<td align="center"><input type="text" name="name" value="${employeer.name}" /></td>
<td align="center"><input type="text" name="age" value="${employeer.age}" /></td>
</tr>
<tr>
<th>员工性别</th>
<th>员工薪资</th>
<th>部门标号</th>
</tr>
<tr>
<td align="center"><input type="text" name="sex" value="${employeer.sex}" /></td>
<td align="center"><input type="text" name="salary" value="${employeer.salary}" /></td>
<td align="center"><input type="text" name="dept" value="${employeer.dept.id}" /></td>
</tr>
<tr>
<td colspan="2" align="center">修改信息</td>
<td align="center">
<input type="submit" value="保存">
</td>
</tr>
</table></form><s:debug></s:debug>
</body>
</html>
有input输入框呀,这是为什么呢?
注意表单中字段属性与后台取值的字段属性是一致的。
有input输入框呀,这是为什么呢?
这里说的input 不是说的input 输入框
struts中,如果表单提交验证没过就返回input
struts默认常量返回集中的一种。