错误信息:
"cymxleftcx.jsp": org.apache.jasper.JasperException: file:E:/hp_Touch/hp_Touch/fycx/cymxleftcx.jsp(16,0) Plugin: Mandatory attribute type missing
'try' without 'catch' or 'finally'
illegal start of type
<identifier> expected
'class' or 'interface' expected
'class' or 'interface' expected
"_zymxleftcx.jsp": cannot find symbol; symbol  : class string, location: class org.apache.jsp.fycx._005fzymxleftcx_jsp
"zymxleft.jsp": cannot find symbol; symbol  : class string, location: class org.apache.jsp.fycx.zymxleft_jsp
源文件如下:
<%@page contentType="text/html; charset=GBK" language="java" import="java.sql.*,DBBean.*" errorPage=""%>
<%
  Connection con = ConnectDB.connectCon();
  Yjxmcost cost1 = new Yjxmcost();
  Brinfo info = new Brinfo();
  request.setCharacterEncoding("GBK");
%>
<html>
<head>
<title>触摸屏系统</title>
<link rel="stylesheet" type="text/css" href="../css/touch.css">
</head>
<body style="overflow-y:hidden;overflow-y:hidden" ONMOUSEDOWN="DepressButton();" ONMOUSEOVER="RaiseButton();" ONMOUSEUP="RaiseButton();">
<script language="JavaScript"
src="../js/button.js" type=""></script>
<jsp:plugin code="" codebase=""></jsp:plugin>
<%
  String zyh = (String) session.getAttribute("zyh");
  String zycs = (String) session.getAttribute("zycs");
  String colvalue[] = new String[6];
  colvalue = info.selectValue(con, "zycybrjbxxb where zyh ='" + zyh + "' and  zycs='" + zycs + "'");
  ResultSet rs1 = null;
  rs1 = cost1.selectValue(con, "ZYBB_ALLFY_cur  a, ZDzysfxmyjkmb b where  a.yjxmdm=b.dm and  a.zyh='" + zyh + "' and  a.zycs='" + zycs + "' group by a.yjxmdm,b.mc");
%>
<TABLE cellSpacing=0 cellPadding=0 width="265" align="left" border="0" bgcolor="#003663">
  <TBODY>
    <TR>
      <td valign="top" height="525" bgcolor="3366cc">
        <table width="100%" align="center" BORDER="0" CELLSPACING="0" CELLPADDING="0">
          <tr>
            <td width="100%" bgcolor="#3366cc" valign="top">
              <img SRC="../image/line.gif" WIDTH="250" HEIGHT="2" BORDER="0" alt="">
              <br>
              <font SIZE="2" FACE="VERDANA,ARIAL,HELVETICA" STYLE="COLOR:#FFFFFF" COLOR="#FFFFFF">
                <span CLASS="LeftNavOff">住院号:&nbsp;&nbsp;&nbsp;&nbsp;<%=zyh%></span>
              </font>
              <br>
              <font SIZE="2" FACE="VERDANA,ARIAL,HELVETICA" STYLE="COLOR:#FFFFFF" COLOR="#FFFFFF">
                <span CLASS="LeftNavOff">姓&nbsp;名:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=colvalue[5] %></span>
              </font>
              <br>
              <font SIZE="2" FACE="VERDANA,ARIAL,HELVETICA" STYLE="COLOR:#FFFFFF" COLOR="#FFFFFF">
                <span CLASS="LeftNavOff">第几次住院:&nbsp;&nbsp;<%=zycs %></span>
              </font>
              <br>
              <img SRC="../image/line.gif" WIDTH="250" HEIGHT="2" BORDER="0" alt="">
              <br>
              <font SIZE="2" FACE="VERDANA,ARIAL,HELVETICA" STYLE="COLOR:#FFFFFF" COLOR="#FFFFFF">
                <span CLASS="LeftNavOff">费用名称</span>
              </font>
              <font SIZE="2" FACE="VERDANA,ARIAL,HELVETICA" STYLE="COLOR:#FFFFFF" COLOR="#FFFFFF">金额(元)</font>
              <br>
            <%
              while (rs1.next()) {
                String je = rs1.getString("je");
            %>
              <a href="cymxfy.jsp?dm=<%=rs1.getString("yjxmdm")%>" target="mainFrame">
                <font SIZE="2" FACE="VERDANA,ARIAL,HELVETICA" STYLE="COLOR:#FFFFFF" COLOR="#FFFFFF">
                  <span buttonType="LeftNav" CLASS="LeftNavOff"><%=rs1.getString("mc")%></span>
                </font>
              </a>
              <font SIZE="2" FACE="VERDANA,ARIAL,HELVETICA" STYLE="COLOR:#FFFFFF" COLOR="#FFFFFF"><%=je.substring(0,je.trim().length()-2)%></font>
              <br>
            <%
              }
                  con.close();
            %>
              <img SRC="../image/line.gif" WIDTH="250" HEIGHT="2" BORDER="0" alt="">
              <br>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </tbody>
</table>
</body>
</html>

解决方案 »

  1.   

    missing
    'try' without 'catch' or 'finally'
    可能是没攘来捕获异常吧。
    为什么逻辑都写在jsp页面里呢??
      

  2.   

    数据库操作那块,用try{}catch抓异常
      

  3.   

    用到的一个java文件package DBBean;import java.sql.*;
    import java.util.List;
    import java.util.LinkedList;public class Yjxmcost {
        private String zyh;
        private String zycs;
        private String brxm;
        private String Yjxmdm;
        private String Mc;
        private String Je;    public Yjxmcost() {
        }    public void setZyh(String zyh) {
            this.zyh = zyh;
        }    public void setZycs(String zycs) {
            this.zycs = zycs;
        }    public void setBrxm(String brxm) {
            this.brxm = brxm;
        }    public void setYjxmdm(String Yjxmdm) {
            this.Yjxmdm = Yjxmdm;
        }    public void setMc(String Mc) {
            this.Mc = Mc;
        }    public void setJe(String Je) {
            this.Je = Je;
        }    public String getZyh() {
            return zyh;
        }    public String getZycs() {
            return zycs;
        }    public String getBrxm() {
            return brxm;
        }    public String getYjxmdm() {
            return Yjxmdm;
        }    public String getMc() {
            return Mc;
        }    public String getJe() {
            return Je;
        }    static public ResultSet selectValue(Connection conn, String where) throws
                SQLException {
            String query = "select a.yjxmdm,b.mc,sum(a.je) je from " + where;
            Statement st = conn.createStatement();
            ResultSet rs = st.executeQuery(query);
            return rs;
        }    static public ResultSet selectCol(Connection conn, String where) throws
                SQLException {
            String query = "SELECT * FROM " + where;
            Statement st = conn.createStatement();
            ResultSet rs = st.executeQuery(query);
            return rs;
        }    static public String count(Connection conn, String where) throws
                SQLException {
            String query = "SELECT COUNT (*) AS 'exit' FROM " + where;
            Statement st = conn.createStatement();
            ResultSet rs = st.executeQuery(query);
            String exit = "";
            if (rs.next()) {
                exit = rs.getString("exit");
            }
            rs.close();
            st.close();
            return exit;
        }    static private Yjxmcost getFromResultSet(ResultSet rs) throws
                SQLException {
            Yjxmcost cost = new Yjxmcost();
            cost.setZyh(rs.getString("zyh"));
            cost.setZycs(rs.getString("zycs"));
            cost.setBrxm(rs.getString("brxm"));
            cost.setYjxmdm(rs.getString("Yjxmdm"));
            cost.setMc(rs.getString("Mc"));
            cost.setJe(rs.getString("Je"));        return cost;
        }    static public List select(Connection conn, String where) throws
                SQLException {
            List returnRows = new LinkedList();
            Yjxmcost currentRow;
            String query = "SELECT * FROM " + where;
            Statement st = conn.createStatement();
            ResultSet rs = st.executeQuery(query);
            while (rs.next()) {
                currentRow = getFromResultSet(rs);
                returnRows.add(currentRow);
            }
            rs.close();
            st.close();
            return returnRows;
        }}
      

  4.   

    是不是这里的问题
    ResultSet rs1 = null;
      rs1 = cost1.selectValue(con, "ZYBB_ALLFY_cur  a, ZDzysfxmyjkmb b where  a.yjxmdm=b.dm and  a.zyh='" + zyh + "' and  a.zycs='" + zycs + "' group by a.yjxmdm,b.mc");调用的
     static public ResultSet selectValue(Connection conn, String where) throws
                SQLException {
            String query = "select a.yjxmdm,b.mc,sum(a.je) je from " + where;
            Statement st = conn.createStatement();
            ResultSet rs = st.executeQuery(query);
            return rs;
        }
    请问如果写try{}catch{}应该写在哪里?