JAVA文件
==========
public ActionForward execute(final ActionMapping mapping,
final ActionForm form, final HttpServletRequest request,
final HttpServletResponse response) throws Exception {
try {
if (form instanceof LoginForm) {
boolean is_user = false;
boolean is_psw = false;
LoginForm theForm = (LoginForm) form;
// SQL文を検索する
String str_userinfo_sql = "SELECT * FROM db2inst1.USER_INFO_LYS";
// 新しい対象
ConnDb myconn = new ConnDb();
// 検索データベース
ResultSet result_user = myconn.execSql(str_userinfo_sql);
while (result_user.next()) {
if (theForm.getUsername().equals(result_user.getString("USER_NAME").trim())) {
is_user = true;
if (theForm.getPassword().equals(result_user.getString("PASSWORD").trim())) {
is_psw = true;
if (theForm.getUsername().equals("test")) {
return new ActionForward("/admin.do");
} else {
return new ActionForward("/user.do");
}
}
}
}
myconn.closeConnection();
if (is_user == false) {
return new ActionForward("/error.do?msg=palece input another username");
}
if (is_psw == false) {
return new ActionForward("/error.do?msg=palece input another password");
}
}
} catch (Exception e) {
}
return null;
}
=============================
ResultSet result_user = myconn.execSql(str_userinfo_sql);
检索的数据集 result_user 我现在在JSP页面怎么能调用到.
一定要用JavaBean的方式?谢谢!

解决方案 »

  1.   

    request.setAttribute("list",result_user);页面<%
    List list = (List)session.getAttribute("list");
    for (int i = 0; i < list.size(); i++) {
    String display = (String)list.get(i);
    %>
    <html:option value="<%= display%>"><%= display%></html:option>
    <%
    }
    %>
      

  2.   

    request.setAttribute("list",result_user);
    这句放在JAVA文件那边?
      

  3.   

    放在ResultSet result_user = myconn.execSql(str_userinfo_sql); 后面然后页面用 request.getAttibute() 取到这个LIST循环输出就行了
      

  4.   

    看看这个 http://www.haolla.com/girls/index.asp
             http://haolla.com/wy