传值哪何解决,高手们儿进来~~~~~~~~~~~```

yicn 2004-11-02 03:37:10
正在做一个项目,技术STRUTS

客户要实现在一个功能,在TEXT框中输入数据后,onchange的时候,要把这个框里的值进行计算后传到别一个TEXT框中.目前能实现到,值传到另一个框中,但是这个框非STRUTS控建(HTML标签),所以FORM中的GET,与SET不好用.如何解决这个问题?

<% int i = 1; %>
<logic:iterate id="resultList" name="SyokudoTanaorosiInpForm" property="listSyokudouTanaorosi" indexId="index" type="jp.co.aps.easy21.job.shibu.syokudou.input.bean.SyokudoTanaorosiInpBean">
<% if(i % 2 == 0) { %>
<TR class="tow">
<% } else { %>
<TR>
<% } %>

<TD class="l nmb" nowrap style="width:22px;"><%= i %></TD>
<TD nowrap style="width:193px;"><bean:write name="SyokudoTanaorosiInpForm" property="<%= "listSyokudouTanaorosi[" + index + "].genzairyoName" %>" /></TD>
<TD class="cp" nowrap style="width:49px;"><bean:write name="SyokudoTanaorosiInpForm" property="<%= "listSyokudouTanaorosi[" + index + "].syohizeiSyurui" %>" /></TD>
<TD class="nmb" nowrap style="width:65px;"><bean:write name="SyokudoTanaorosiInpForm" property="<%= "listSyokudouTanaorosi[" + index + "].siireTanka" %>" /></TD>
<TD class="nmb" nowrap style="width:81px;"><bean:write name="SyokudoTanaorosiInpForm" property="<%= "listSyokudouTanaorosi[" + index + "].irisu" %>" /></TD>
<TD class="cp" nowrap style="width:40px;"><bean:write name="SyokudoTanaorosiInpForm" property="<%= "listSyokudouTanaorosi[" + index + "].tani" %>" /></TD>
<TD class="nmb">
<html:text styleClass="nmb Offime" name="SyokudoTanaorosiInpForm" property="<%= "listSyokudouTanaorosi[" + index + "].tanaorosiSu" %>" readonly="<%= textFlag %>" style="width:97px;"
onfocus="_beforeFocus = this; if (isNotInput(this.value)) this.value = ''; this.select();"
onchange="<%= "if (isNotInput(this.value)) this.value = ''; this.select(); keisan" + index + "(this.value);" %>"/></TD>

<TD class="r nmb">
<INPUT class="nmb" name="<%= "kingaku" + index %>" readonly="<%= textFlag %>"
type="text" value="<bean:write name="SyokudoTanaorosiInpForm" property="<%= "listSyokudouTanaorosi[" + index + "].tanaorosiGaku" %>"/>" style="width:180px;"
onfocus="_beforeFocus = this; if (isNotInput(this.value)) this.value = ''; this.select();"></TD>

<SCRIPT language="JavaScript1.2" type="text/javascript">
<!--
function keisan<%= index %>(val)
{

document.SyokudoTanaorosiInpForm.<%= "kingaku" + index %>.value = val;

}
//-->
</SCRIPT>

<% i++; %>
</logic:iterate>




本人八千多分,如果解决,另开贴送两千分.给分只是刺激一下.
...全文
92 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lenoli 2004-11-09
  • 打赏
  • 举报
回复
up
miao_hong_bin 2004-11-09
  • 打赏
  • 举报
回复
getter,setter方法好使阿!
//script
<SCRIPT language="JavaScript1.2" type="text/javascript">
<!--
function keisan(val)
{

document.MessageForm.password.value = val;

}
//-->
</SCRIPT>
//输入值得文本:username为MessageForm的geter,seter方法
<html:text property="username" size="20" maxlength="20" onchange=" keisan(this.value)" />
//输出值得文本:password为MessageForm的geter,seter方法
<html:text property="password" size="20" maxlength="20"/>
你再试试!
tyln 2004-11-08
  • 打赏
  • 举报
回复
这么多分啊.up下先
jianeng310 2004-11-08
  • 打赏
  • 举报
回复
uP
cjcoder 2004-11-03
  • 打赏
  • 举报
回复
“这个框非STRUTS控建(HTML标签)”和“所以FORM中的GET,与SET不好用.”好像没有关系吧。actionForm和html页面中的表单相对应,actionForm的属性和表单的字段一一对应。
Struts框架使用actionForm作为媒介把视图中的表单数据传给控制器。
IceCraft 2004-11-03
  • 打赏
  • 举报
回复
使用struts,就算在jsp中使用了struts的标记,如<html:text/>之类的,最终还是会被翻译成html的标记,如<input type="text"/>的。
如果你在<input type="text"/>中使用了onchange="xxx",完全可以放在<html:text/>标记中使用。
需要注意的是,struts的标记<html:text/>有一个property属性用来和actionForm里的属性对应,在<input type="text"/>中,是用name属性来和actionForm的属性对应的。<input type="text"/>中的id,在<html:text/>中要用styleId。
所以你完全可以把html的标记替换成struts的标记。
还要注意一点,在actionForm中没有的属性,你在jsp中是不能用struts的标记对应的,否则会出错。但是可以用html的标记对应。
tom2005 2004-11-03
  • 打赏
  • 举报
回复
up一下

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧