使用struts出现的问题

06-04-04 lxglgh
/test.jsp(57,2) According to TLD or attribute directive in tag file, attribute test does not accept any expressions

test.jsp运行时出现以上错误的

test.jsp的源代码如下:

<%@page contentType="text/html; charset=GBK"%>

<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>

<%@taglib uri="/WEB-INF/sql.tld" prefix="sql"%>

<%

int i = 7;

%>

<html>

<head>

<title>select</title>

<script type="javaScript">

function submitForm()

{

if(document.form1.selectValue.value=="")

{

alert("请输入查找关键字");

document.form1.selectValue.focus();

return false;

}else

{

return true;

}

}

function toPage()

{

if(document.form1.pageText.value=="")

{

alert("请输入要前往的页数");

document.form1.pageText.focus();

return false;

}else

{

a=document.form1.pageText.value;

if(a<=0||a>=${requestScope.pagecount})

a=${requestScope.page}

document.form1.action = "selectAction.do?page="+a+"&selectValue=${requestScope.selectValue}";

return true;

}

}

</script>

</head>

<body bgcolor="#ffffff">

<jsp:include flush="false" page="index.jsp"/>

<center>

<form name="form1" action="selectAction.do" method="POST">

<table>

<tr>

<td>输入查询的关键字</td>

<td>

<input type="text" name="selectValue" value="${requestScope.selectValue}"/>

</td>

<td>

<input type="submit" onclick="submitForm()" value="查询"/>

</td>

</tr>

</table>

<c:if test="${i>5}">

<table border="1" cellpadding="3" cellspacing="3">

<tr>

<th>编号</th>

<th>名字</th>

<th>公司</th>

<th>歌手</th>

<th>类型</th>

<th>操作</th>

</tr>

<c:forEach var="cddate" items="${sessionScope.selectList}">

<tr>

<td>${cddate.cdId} </td>

<td>${cddate.cdName} </td>

<td>${cddate.cdCompany} </td>

<td>${cddate.cdAlbum} </td>

<td>${cddate.cdType} </td>

<td>

<a onclick="javascript:window.open('editAction.do?id=${cddate.cdId}','jszx','width=650,height=500,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');">编辑</a>

 

<a onclick="javascript:window.open('del.jsp?id=${cddate.cdId}','jszx','width=200,height=300,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');">删除</a>

</td>

</tr>

</c:forEach>

</table>

<table>

<tr>

<td>

<a href="selectAction.do?action=frist&selectValue=${requestScope.selectValue}">首页</a>

</td>

<td>

</td>

<td>

</td>

<td>

<a href="selectAction.do?action=last&selectValue=${requestScope.selectValue}">尾页</a>

</td>

<td>${requestScope.page} /

${requestScope.pagecount} </td>

<td> 转到

<input type="text" size="2" name="pageText" onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="${requestScope.page}"/>

<input type="submit" onclick="toPage()" value="GO"/>

</td>

</tr>

</table>

</c:if>

</form>

</center>

</body>

</html>

请问到底问题出在哪,多谢指教阿

lxglgh
2006-04-05 09:47
咋没人回复呢,我的用法是这样的

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>

<%@ page contentType="text/html;charset=gb2312" language="java"%>

<%

int i = 7;

%>

<html>

<head>

<title>c:if的使用</title>

</head>

<body bgcolor="#ffffff">

<c:if test="${i>5}">

i>5

</c:if>

</body>

</html>

哪位达人指点下阿

lxglgh
2006-04-05 09:49
源代码出不来,没有过滤阿

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ page contentType="text/html;charset=gb2312" language="java"%>
<%
int i = 7;
%>
<html>
<head>
  <title>c:if的使用</title>
</head>
<body bgcolor="#ffffff">
<c:if test="${i>5}">
  i>5
</c:if>
</body>
</html>
<p>

jdon_sun
2006-04-05 13:07
/test.jsp(57,2) According to TLD or attribute directive in tag file, attribute test does not accept any expressions

说得很清楚 你下面的jsp有问题

<html>
<head>  
<title>c:if的使用</title>
</head>
<body bgcolor="#ffffff">
<c:if test="${i>5}">  
i>5
</c:if>
</body>
</html>
<p>

在test里参数有误 好好看看jstl 

猜你喜欢