读书人

SSH2求帮忙

发布时间: 2013-06-25 23:45:42 作者: rapoo

SSH2求大虾帮忙:
department.jsp取出来的值怎么放到文本框里边 ?


<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


<title>添加部门</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>

<s:property value="#request.updateDep.dep_name" />

<s:form action="manage_update" namespace="/department" method="post">
<s:hidden name="department.dep_id" value=" ${updateDep.dep_id }"></s:hidden>
部门名称:<s:textfield name="department.dep_name"
value=" ${updateDep.dep_name }"></s:textfield>
<br />
部门简称:<s:textfield name="department.dep_shortname"
value=" ${updateDep.dep_shortname }"></s:textfield>
<br />

<input type="submit" value="保存" />
</s:form>

</body>
</html>

报错:
org.apache.jasper.JasperException: /WEB-INF/page/departmentUpdate.jsp (line: 31, column: 2) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
web.xml <web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

求大虾们帮忙了 怎么解决啊?是不是用其他标签? SSH2 JSTL?OGNL? HTML
[解决办法]
引用:
department.jsp取出来的值怎么放到文本框里边 ?

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


<title>添加部门</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">


<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>

<s:property value="#request.updateDep.dep_name" />

<s:form action="manage_update" namespace="/department" method="post">
<s:hidden name="department.dep_id" value=" ${updateDep.dep_id }"></s:hidden>
部门名称:<s:textfield name="department.dep_name"
value=" ${updateDep.dep_name }"></s:textfield>
<br />
部门简称:<s:textfield name="department.dep_shortname"
value=" ${updateDep.dep_shortname }"></s:textfield>
<br />

<input type="submit" value="保存" />
</s:form>

</body>
</html>


报错:
org.apache.jasper.JasperException: /WEB-INF/page/departmentUpdate.jsp (line: 31, column: 2) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
web.xml <web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

求大虾们帮忙了 怎么解决啊?是不是用其他标签?



struts2标签里不能嵌套别的标签,包括他自己
你可以这样
<input type="hidden" name="department.dep_id" value="${updateDep.dep_id}">

<s:textfield name="department.dep_name"></s:textfield>
[解决办法]
错误报告是这样的:attribute value does not accept any expressions
意思就是,在value属性中不能放任何的表达式。也就是说你用value="aaa"是可以的,但不能放任何描述性内容。
如果你想在java赋值传给画面,那么就赋值给department.dep_name,然后在jsp里如下写:
<s:textfield name="department.dep_name"></s:textfield>

[解决办法]
引用:
department.jsp取出来的值怎么放到文本框里边 ?

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


<title>添加部门</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>

<s:property value="#request.updateDep.dep_name" />

<s:form action="manage_update" namespace="/department" method="post">
<s:hidden name="department.dep_id" value=" ${updateDep.dep_id }"></s:hidden>


部门名称:<s:textfield name="department.dep_name"
value=" ${updateDep.dep_name }"></s:textfield>
<br />
部门简称:<s:textfield name="department.dep_shortname"
value=" ${updateDep.dep_shortname }"></s:textfield>
<br />

<input type="submit" value="保存" />
</s:form>

</body>
</html>


报错:
org.apache.jasper.JasperException: /WEB-INF/page/departmentUpdate.jsp (line: 31, column: 2) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
web.xml <web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

求大虾们帮忙了 怎么解决啊?是不是用其他标签?


哥们,好几天了,结个帖呗!!

读书人网 >Java Web开发

热点推荐