我是在action中查找到记录,然后写入request,然后到了视图中再取出来。

解决方案 »

  1.   

    你怎么能用<bean:write>呢?你在action中将查询出来的数据放入formbean中,然后再修改页面中自动就有了对应于formbean相应字段的信息了
      

  2.   

    可以利用一个标志把修改与添加动作区别开来。
    这样就可以把两个功能页合成了。下面代码范例:
    <logic:equal name="userForm" property="action" scope="request" value="Create">
    我们把一个字段即action作为标志
    值为:Create时:
    <td width="80" height="25" align="right"><strong>用户名:</strong></td>
    <logic:equal name="userForm" property="action" scope="request" value="Create">
    <td height="25"><html:text styleClass="input" property="user_username" size="10" maxlength="10"/></td>
    </logic:equal>
    <logic:equal name="userForm" property="action" scope="request" value="Edit">
    <input type="text" name="user_username" value="<bean:write name="userForm" property="user_username" size="10" />">
    </logic:equal>这样可以根据action的不同,页面自动编译成所需格式。祝你好运!
      

  3.   

    To:雨寒风我先单独做了个修改页面,但<input type="text" name="user_username" value="<bean:write name="userForm" property="user_username" size="10" />">里没有数据,这是为什么呢?
      

  4.   

    用JavaScript,点击某一条数据时,将内容填到文本框中,<table>
    ...
    <td><span onclick="javascript:fill('<bean:write....../>')">
    <bean:write....../>
    </span></td>
    ...
    </table>// 这个文本框,用于输入新增的文本,点击数据后的文本也显示在这里
    <input type="text" name="val"><script>
    function fill(s) {
      document.all.val.value=s;
    }
    </script>