Struts的简单问题:怎么写数据修改页面? 我是在action中查找到记录,然后写入request,然后到了视图中再取出来。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你怎么能用<bean:write>呢?你在action中将查询出来的数据放入formbean中,然后再修改页面中自动就有了对应于formbean相应字段的信息了 可以利用一个标志把修改与添加动作区别开来。这样就可以把两个功能页合成了。下面代码范例:<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的不同,页面自动编译成所需格式。祝你好运! To:雨寒风我先单独做了个修改页面,但<input type="text" name="user_username" value="<bean:write name="userForm" property="user_username" size="10" />">里没有数据,这是为什么呢? 用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> java 4中框架组合有什么有点和缺点? 如何访问远程文件夹文件?和本地的区别 WebContent的工程怎么运行? hibernate中无法使用非主键作为外键? OSGI框架学习 使用Struts的标签库的JSP页面总是出错 请各位指点,我想学JAVA,不知从何做起,我很迷惘,求求大家了!!! Bean class出错!求救! 再问:如何在一个普通的类中获取在struts-config.xml中定义的datasource? 怎样配制j2ee的开发环境? Spring mvc和Velocity访问session,request等对象的问题 在线等高手进来看看!!解决立刻给分结贴!100分!
这样就可以把两个功能页合成了。下面代码范例:
<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的不同,页面自动编译成所需格式。祝你好运!
...
<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>