说实话偶作的时候
一个jsp会对应若干个 jbean 可能如果你做的东西比较小
mvc 有点得不偿失,不用也行。
如果是大项目,还得不断修改的……
那就很有必要了。

解决方案 »

  1.   

    <% %>
    里面写代码就可以了。
      

  2.   

    JSP里如何用javabean的结果集阿!
      

  3.   

    给你个例子吧,希望你早日成功!
    <%@ page language="java" %>
    <%@ page import="java.sql.*" %>
    <jsp:useBean id="connDB" scope="session" class="classlib.DB" />
     <html>
    <head>
    <title>
    Department Information
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style type="text/css">
    <!--
    .font {  font-size: 14px; font-weight: bolder; text-decoration: none}
    A:link { TEXT-DECORATION: none
    }
    A:visited { text-decoration: none
    }
    A:active { TEXT-DECORATION: none
    }
    A:hover { TEXT-DECORATION: none
    }
    -->
    </style>
    </head>
    <body bgcolor="A9EDFC" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <form name="DepFrm" method="post">
    <table border=0 cellpadding=0 cellspacing=0 width="580" class="font1">
      
    <%
    ResultSet rs;
    String SQLstr="SELECT * FROM T_DEP";
    String Dep_ID="";
    String Dep_Name="";
    try{
         rs=connDB.Query(SQLstr);
         while(rs.next()){
         Dep_ID=rs.getString(1);
         Dep_Name=rs.getString(2);
    %><tr align="center"> 
        <td bgcolor="A9EDFC" nowrap height="23" width="250" class=font><a href="t_busho_edit.jsp?&Dep_ID=<%=Dep_ID%>" target="mainFrame"><%=Dep_ID%></a></td>
        <td bgcolor="A9EDFC" nowrap height="23" width="330" class=font><%=Dep_Name%></td>
      </tr>  <tr><td colspan="2" bgcolor="#000e94"><img src="image/spacer.gif"></td></tr>
    <%
    }
    rs.close();
    }
    catch(Exception e)
    {}
    %>
    </table>
    </form>
    </body>
    </html>