JSP:loop:
rs.movenext
String strName = rs.getString(...);
<html:text property="<%=strName%>"> 
end loop

解决方案 »

  1.   

    我想不使用<%%>代码,只用struts的libtag来做
    请问怎么做才好呢
    <logic:iterate id="element" name="munumanageactionform" property="messlist" type="org.xwtec.struts.sms_input.actionform.MenuManageActionForm">
      <tr> 
        <td width="6%"><div align="center"> 
            <input type="checkbox" name="checkbox" value="checkbox">
          </div></td>
        <td width="15%"><div align="center">     
        
            <html:text property="s_name" size="16" value="<bean:write name="element" property="s_name"/>"/>
          </div></td>    
      </tr>
      </logic:iterate>
    可是报错,没有这个:<bean:write name="element" property="s_name"/>,一切正常,可是text就没的value了
      

  2.   

    你那样肯定不行,标签里面嵌套标签会报错的。我也碰到过这种问题,但是用<%%>解决的。
      

  3.   

    可能,但是你要做点其它的。<html:text>无非就是接受一些属性,输出一个文本框。你可以从定义一个标签,类似与<html:text>但是,他对body进行处理。但是,你在做这个标签之前,一点要搞懂struts中自带的util包中提供的API。
      

  4.   

    “<html:text property="s_name" size="16" value="<bean:write name="element" property="s_name"/>"/>”
    是什么东西?
    写成:
    <html:text name="element" property="s_name"/>
      

  5.   

    I dont see much benefit of struts <html> tag. why not just use a normal html <input> tag? that you dont have embedded struts tags.  the critial thing is to make your VO follow java bean protocol, so that you can use embedded bean structure representation.
      

  6.   

    p.s. for a form property with multiple values:-- input (jsp to action): import BeanUtils package.
    -- output (action to jsp): use <log:iterate> tag.
      

  7.   

    <input type="text" name="s_name" size="16"  value='<bean:write name="element" property="s_name"/>'>
    这么做可以,我就这么干的,至于下面的
    <html:text property="s_name" size="16" value='<bean:write name="element" property="s_name"/>'/>
    我就没试过了
      

  8.   

    <input type="text" name="s_name" size="16"  value="<bean:write name="element" property="s_name"/>">
    一样吧,我试过了没什么区别,高人指教!~
      

  9.   

    <bean:define id="messlist" name="munumanageactionform" property="messlist" scope="request" />
    <logic:iterate id="element" collection="<%=messlist%>" name="messlist" indexId="indexLine">
    <tr> 
        <td width="6%"><div align="center"> 
            <input type="checkbox" name="checkbox" value="checkbox">
          </div></td>
        <td width="15%"><div align="center">
            <html:text name ="element" property="s_name" size="16" />
          </div></td>    
      </tr>
      </logic:iterate>你试试看这样行不行,我觉得你的代码写得有问题
      

  10.   

    如果你要往value="..."加值的话可以这样处理
    <bean:define id="name" type="java.lang.String" name="element" property="s_name"/>
    <html:text property="s_name" size="16" value="<%=name%>"/>
    一切ok了
      

  11.   

    nicholasdu()'s solution works for resolving nested struts tags, especially if the nest happens at multiple levels on different java beans.  <bean:define> gives a intermidiate bean, like a java local variable.with all the benifits, i still suggest use one bean in a jsp page, using nested representaion format (bean.propertyLevel1.propertyLevel2...).  it is simpler and more concise.
      

  12.   

    Most of Struts Tag can be replaced with Struts EL(Expression Language, part of JSP1.2 specification) Tag, these tags help u to reduce "<%%>" code in jsp pages. such as:<html-el:text property="${beanName}"/>same as:<html:text property="<%=beanName%>"/>for more information, pls refer to jakarta web site