struts JSP报错

xs.jsp<%@pagelanguage="java"pageEncoding="gb2312"%><%@tagliburi="http://struts.apache... xs.jsp
<%@ page language="java" pageEncoding="gb2312"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%>
<html>
<head>
<title>JSP for XsForm form</title>
</head>
<body>
<html:form action="/xs">
name : <html:text property="name"/><html:errors property="name"/><br/>
<html:submit/><html:cancel/>
</html:form>
<logic:present name="al">
<logic:iterate id="t" name="al">
<logic:present name="t">
<bean:write name="al" property="id"/>
<bean:write name="al" property="name"/>
</logic:present>
</logic:iterate>
</logic:present>
<logic:notPresent name="al">
无记录</logic:notPresent>
</body>
</html>

package com.yourcompany.struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.yourcompany.struts.form.XsForm;
import java.sql.*;
import java.util.*;

public class XsAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
XsForm xsForm = (XsForm) form;// TODO Auto-generated method stub
try{
java.lang.Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();

String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=XSCJ";
String user="sa";
String password="";

Connection con;
Statement sql;
ResultSet rs;

con=DriverManager.getConnection(url,user,password);
sql=con.createStatement();

//定义查询字符串
String s="select * from 学生基本信息表 where 姓名='"+bm(xsForm.getName())+"'";

rs=sql.executeQuery(s);
ArrayList al = new ArrayList();
while(rs.next())
{
XsForm XS =new XsForm();
XS.setId(rs.getString(1));
XS.setName(rs.getString(2));
al.add(XS);
}
request.setAttribute("al", al);
con.close();}
catch(Exception e)
{
System.out.print(e);
}
return mapping.findForward("XS");
}
public String bm(String s){
if(s==null){
s="";
}
try{
byte [] b = s.getBytes("iso-8859-1");
s = new String(b);
}catch(Exception e){
System.out.println(e);
}
return s;
}
}

报了org.apache.jasper.JasperException: An exception occurred processing JSP page /form/xs.jsp at line 17

14: <logic:present name="al">
15: <logic:iterate id="t" name="al">
16: <logic:present name="t">
17: <bean:write name="al" property="id"/>
18: <bean:write name="al" property="name"/>
19: </logic:present>
20: <logic:notPresent name="t">
展开
 我来答
sokoo108
2010-07-05 · TA获得超过470个赞
知道小有建树答主
回答量:481
采纳率:0%
帮助的人:378万
展开全部
<bean:write name="al" property="id"/>
<bean:write name="al" property="name"/> 这两句的name名字从al改成t
xiaoliangbhb
2010-07-06 · TA获得超过104个赞
知道答主
回答量:56
采纳率:0%
帮助的人:24.3万
展开全部
<logic:present name="al">
15: <logic:iterate id="t" name="al">
16: <logic:present name="t">
17: <bean:write name="al" property="id"/>
18: <bean:write name="al" property="name"/>
改为
----------------------------------------------
17: <bean:write name="t" property="id"/>
18: <bean:write name="t" property="name"/>
----------------------------------------------
19: </logic:present>
20: <logic:notPresent name="t">
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
wb1101684244
2010-07-06 · 超过11用户采纳过TA的回答
知道答主
回答量:37
采纳率:0%
帮助的人:0
展开全部
是不是没导包?
asp 页面好象没有加导入包的语句或者没有将 .java生成.class
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式