是的.struts建议jsp页面上没有java代码.都要用标记.

解决方案 »

  1.   

    如果想传参数到jsp中,可以这样写(比如你想将class A的一个实例传到jsp中显示):
    在action中A a=new A();a.setId(1);request.setAttribute("a",a);
    在jsp中<bean:write name="a" property="id"/>。这样就将实例a的id属性显示到jsp页面上了。同样对于forward想传参数你也应该知道怎么样做了吧。如果a是一个简单的数据(如String)就可以这样写:<bean:write name="a"/>。
      

  2.   

    那那个a对象不需要在formbean中定义吗?我指的是在struts-config.xml中formbean的定义
      

  3.   

    我来回答第4个吧 *_*
    页面上:
    <html:radio property="sex" value="male">
    <html:radio property="sex" value="female">form里:
    private String sex="";
    public String getSex(){return sex;}
    public void setSex(String s){this.sex=s;}这样前后就可以对照起来,页面数据和form数据应该是保持一致的
    ps:刚开始学struts,恳请大家狠劲地批评 *^o~*
      

  4.   

    1.如果功能能由Struts标签来实现的尽量去用它实现
    2.<bean:define name="A" id="a" property="id"/>
    <logic:equal name="B" property="id" value="<%=a%>">
    <bean:write name="B" property="name"/>
    </logic:equal>
    3.在Action中:
    String page =request.getParameter("strPage");
    ActionForward forward = new ActionForward("/admin/index.jsp?page="+strPage);4.页面上:
    <html:radio property="sex" value="male">
    <html:radio property="sex" value="female">form里:
    private String sex=null;
    public String getSex(){return sex;}
    public void setSex(String s){this.sex=s;}
    在查询Action中,假如你查询显示页面对应的ActionFormBean的名字是customer,从数据库中性别的代码是male,那么
    customer.setSex("male");
    request.setAttribute("customer",customer);
    return mapping.findForward("success");
      

  5.   

    struts模式中,jsp主要用于显示,action,actionform(servlet)用于控制数据,bean用于数据封装,逻辑控制.M-V-C各个层面分得越清楚,维护移植方面,也就越好.但完全做到这一点,不容易,也没必要.
      

  6.   

    第三个问题:
    <forward name="success" path="/admin/index.jsp?page=<%=String.valueOf(1)%>"/>
      

  7.   

    Cnxiaowei:你这个贱货,从VB.NET区逃到这里来啦?可算被我找到了!你换ID吧!