我页面要显示数据库信息 
我jsp页面 HTML code
<table>
        <tr>
            <td>真实姓名:</td>
            <td>用户权限:</td>
            <td>所在部门:</td>
        </tr>
    <c:forEach items="aa" var="user">
          <tr>
            <td>${user.usertruename}</td>
            <td>${user.userable}</td>
            <td>${user.userbranch}</td>
            <td>${user.useremail}</td>
          </tr>
    </c:forEach>
    </table>
Action代码“
Java codepublic ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) throws InstantiationException, IllegalAccessException, SQLException {
        
        String username="liukai";
        System.out.print(username);
        List users = new ArrayList();
        DB db = new DB();
        String sql="select user_password,user_truename,user_useable,user_branch, user_email from "+Content.TB_USER+" where "+Content.USERNAME+"='"+username+"'";
        ResultSet rs=(ResultSet) db.getRs(sql);
        while(rs.next()){
            UserForm user = new UserForm();
            user.setUsertruename(rs.getString("user_truename"));
            user.setUserable(rs.getInt("user_useable"));
            user.setUserbranch(rs.getString("user_branch"));
            user.setUseremail(rs.getString("user_email"));
            users.add(user);            
        }
        request.setAttribute("aa",users); 
        System.out.print(users);
        return mapping.findForward("success");
    }配置文件Struts-config.xml HTML code        <action 
            name="UserForm"
            path="/test"
            scope="request" 
            validate="false"
            type="com.liukai.struts.action.TestAction">
              <forward name="success" path="MyTest.jsp" />
        </action>
为什么在页面执行的时候后台没有反应 
是配置文件的问题吗 
还是说jsp页面没有关联到后台来 
请指点!!! 

解决方案 »

  1.   

    1.看看配置文件是否写好;
    2.action中是否从数据库中取出了值;是否执行了;
    3.看看错误信息。
      

  2.   

    看你的配置文件感觉没什么错误,你看看上一个页面的提交form路径与path="/test" 是否一致。
    你的代码运行时报什么错误了?看一下程序是否能进到Action,然后我们才可以知道怎么帮你解决啊!
      

  3.   

    现在我修改了一下直接http://localhost:8080/task/test.do
    这样就能调用Action了 而且也能查询到数据库信息 ,可现在这些信息不能输出到页面中
    我把配置文件修改为这样了
    <action 
         name="UserForm"
         path="/test"
         scope="request" 
         validate="false"
         type="com.liukai.struts.action.TestAction">
           <forward name="success" path="/MyJsp001.jsp" />
         </action>
    我要在MyJsp001.jsp显示我查询到的信息  这些信息显示不出来啊
      

  4.   

    1,保证action里已经有值;
    2,看jsp页面标签是不是写错了,特别是值对应,注意大小写!
      

  5.   

    UserForm 实体类还是你定义的form?如果是form的话你一开始就用错了。。
    假如你的实体类是User ,你就写User user=new User();然后再set。而不是通过form来set!
      

  6.   

    你可以通过form得到页面上的内容。但不能通过form将你的内容保存到页面。页面的内容是你的实体中的内容
      

  7.   

    问题解决了
    不是用的实体类 
    主要原因是没有引入C标签
    现在换成logic标签了就能显示数据了
    谢谢大家的帮助
    给分