??xml version="1.0" encoding="utf-8" standalone="yes"?>中文字幕在线免费专区,精品日韩一区,久99久精品视频免费观看http://www.aygfsteel.com/dechon/zh-cnSun, 04 May 2025 22:28:00 GMTSun, 04 May 2025 22:28:00 GMT60不刷新页?切换表格的编辑状?/title><link>http://www.aygfsteel.com/dechon/archive/2005/12/08/22957.html</link><dc:creator>Terence</dc:creator><author>Terence</author><pubDate>Thu, 08 Dec 2005 03:46:00 GMT</pubDate><guid>http://www.aygfsteel.com/dechon/archive/2005/12/08/22957.html</guid><wfw:comment>http://www.aygfsteel.com/dechon/comments/22957.html</wfw:comment><comments>http://www.aygfsteel.com/dechon/archive/2005/12/08/22957.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/dechon/comments/commentRss/22957.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/dechon/services/trackbacks/22957.html</trackback:ping><description><![CDATA[<P>      前段旉做了一个简单的l护界面,包括d,变更与删除的功能.变更界面是在面中显CZ个TABLE(W一列ؓ(f)RadioButton),选中一行后该行变成可编辑状?切换到其它行后再恢复成文本显C?最初做的时候是点击单选项按钮后提交到后台h面来实现的,后来要求Ҏ(gu)在客L(fng)切换~辑状?<BR><BR><BR>1.首先需要解决的是由文本昄状态与TEXT框{换的问题.由文本显C到~辑框这个可以通过修改对应对象的innerHTML来解?q辑框切换到文本显C开始用的是outerHTML来修改的(后来发现有问?.<BR><BR><BR>2.行切换的问题:当选择的行做了变换?如果数据做了更改且未提交的话仍显C未修改前的?q个在页面中加入了一个隐藏域,保存选中行的数据.q部分数据只是用来(f)时保存数据的,不需要提交到后台,未包含在FORM?只是l了一个IDq行区分;<BR><BR><BR>3.选中的行q不是所有字D都更改为可~辑状?只有部分字段需要更?q里在修改innerHTML的时候进行了判断;<BR><BR><BR>4.如何与FORM中的属性匹配的问题:可以在修改innerHTML的时候指定name可以了;<BR><BR><BR>5.后来在接下来的测试中,如果字段中存在HTML字符,通过outerHTML来赋?览器会(x)对它q行解析,q不是想要显C的信息.开始查JS函数的时候发Cescape?unescape,以ؓ(f)?x)进行自动{换的,后来发现q如此.在经q几番修改之?发现修改outerText属性则不会(x)对赋的D行解?<BR><BR><BR>6.׃一些验证是定义在后台的,只有提交到服务器后才?x)进行校?如果验不通过q返回当前页?要保留提交前的状?q里是给RadioButton一个ID(后台数据表中的主键?.扑ֈ对应的行,再把把它|成选中状?同时相应的列改ؓ(f)~辑?<BR><BR><BR>7.应该说到q里基本已经完成?但在提交到服务器校验出错?q回的页面中昄的仍然是~辑前的?׃面做了h,隐藏域的值已l被重置.如果再切换到其它?昄的仍然是用户修改后的数据,q部分数据ƈ未成功更新到后台,应该昄成修改前的数?q里通过Request传回到页面中,在触发对应的RadioButton后再把D到隐藏域?<BR><BR>部分代码如下:<BR><BR><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000><script language="JavaScript" type="text/javascript"></FONT><BR>//Get parent node.<BR><FONT color=#a52a2a>window.SearchByTagName = function(e, TAG) {<BR>    while(e!=null && e.tagName){<BR>     if(e.tagName==TAG.toUpperCase()) {<BR>      return(e);<BR>     } <BR>     e = e.parentNode; <BR>    } <BR>    return null;<BR>}</FONT></P> <P>var <FONT color=#0000ff>selectedRow</FONT> = -1; //global</P> <P><FONT color=#0000ff>function selectChanged(e) {<BR>    var td = SearchByTagName(e, "TD");<BR>    var tr = td.parentNode;<BR>    var tab = SearchByTagName(tr, "TABLE");<BR>    var cellValue = "";<BR>    //Reset the cell's value.<BR>    if(selectedRow>=0) {<BR>     for(var i=td.cellIndex+1; i<tab.rows[selectedRow].cells.length; i++) {<BR>            var a = tab.rows[selectedRow].cells[i].getElementsByTagName("INPUT");<BR>            for(var k=0; k<a.length; k++) {<BR>                if(a[k].type=="text") {<BR>                 //Valid only in IE.<BR>                 a[k].outerText = document.getElementById(a[k].name).value;<BR>                }<BR>            }<BR>        }<BR>    } </FONT>  <BR>   <FONT color=#0000ff> selectedRow = tr.rowIndex;<BR> <BR> //Change the cell into text,and save the value into hidden field.<BR>    var hyoujijunCell = document.getElementById("hyoujijun" + selectedRow);<BR>    var ryakusyouCell = document.getElementById("ryakusyou" + selectedRow);<BR>    var nameCell = document.getElementById("name" + selectedRow);<BR>    <BR>    document.getElementById("hyoujijun").value=rtrim(hyoujijunCell.innerText);<BR>    document.getElementById("hyoujijun" + selectedRow).innerHTML = <BR>     "<input type='text' name='hyoujijun' maxlength='3' style='width:80px' value='" + <BR>      rtrim(hyoujijunCell.innerHTML) +"'>";<BR>    <BR>     document.getElementById("ryakusyou").value=rtrim(ryakusyouCell.innerText);<BR>     document.getElementById("ryakusyou" + selectedRow).innerHTML = <BR>      "<input type='text' name='ryakusyou' maxlength='4' style='width:60px' value='" + <BR>      rtrim(ryakusyouCell.innerHTML) +"'>";<BR>    <BR>    document.getElementById("name").value= rtrim(nameCell.innerText);<BR>    document.getElementById("name" + selectedRow).innerHTML = <BR>     "<input name='name' maxlength='100' style='width:300px' value='" + <BR>     rtrim(nameCell.innerHTML) +"'>";<BR>}</FONT></P> <P><FONT color=#a52a2a>function validReturn() {<BR> if ( <%=selectedMasterID%> > 0) {<BR>  //Get the selected row,and select it.<BR>  var radioSn = document.getElementById("masterid<%=selectedMasterID%>");<BR>  radioSn.click( );<BR>  //Save original value.If changed other row,restore data as before modified.<BR>  document.getElementById("hyoujijun").value = "<%=hyoujijunReturn%>";<BR>  document.getElementById("name").value = "<%=nameReturn%>";<BR>  document.getElementById("ryakusyou").value = "<%=ryakusyouReturn%>";<BR> }<BR>}</FONT></P> <P><FONT color=#0000ff>//Clear the last blank.<BR>function rtrim(cellValue) {<BR> if (cellValue.lastIndexOf(" ") >= 0) {<BR>  cellValue = cellValue.substr(0,cellValue.lastIndexOf(" "));<BR> }<BR> <BR> return cellValue; <BR>}<BR></FONT><FONT color=#006400></script></FONT><BR><BR><BR><body class="gyomu" onload="validReturn()"><BR><table><BR>  <logic:present name="masterList"><BR>   <logic:iterate id="element" indexId="index" name="masterList"><BR>    <tr><BR>     <td class="meisai" style="width: 50px"><BR>      <logic:notEqual name="element" property="sakujyo" value="DELETE"><BR>       <FONT color=#006400><input type="radio" name="masterid"<BR>        value="<bean:write name='element' property='masterid'/>"<BR>        onclick="selectChanged(this)" id="masterid<bean:write name='element' property='masterid'/>" /><BR></FONT>       <%rowCount++;%>  <BR>      </logic:notEqual><BR>     </td><BR>    <FONT color=#006400> <td class="meisai" style="width: 80px" id="hyoujijun<%=index%>"><BR>      <bean:write name="element" property="hyoujijun" /><BR>     </td><BR></FONT>     <FONT color=#800080><td class="meisai" style="width: 60px" id="cd<%=index%>"><BR>      <bean:write name="element" property="cd" /><BR>     </td><BR></FONT>     <FONT color=#ff0000><td class="meisai" style="width: 300px" id="name<%=index%>"><BR>      <bean:write name="element" property="name" /><BR>     </td><BR></FONT>     <FONT color=#000080><logic:equal name="needShortName" value="true"><BR>      <td class="meisai" style="width: 60px" id="ryakusyou<%=index%>"><BR>       <bean:write name="element" property="ryakusyou" /><BR>      </td><BR>     </logic:equal><BR></FONT>     <FONT color=#0000ff><td class="meisai" style="width: 70px" id="sakujyo<%=index%>"><BR>      <bean:write name="element" property="sakujyo" /><BR>     </td><BR></FONT>    </tr><BR>   </logic:iterate><BR>  </logic:present><BR> </table><BR></body><BR></P><img src ="http://www.aygfsteel.com/dechon/aggbug/22957.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/dechon/" target="_blank">Terence</a> 2005-12-08 11:46 <a href="http://www.aygfsteel.com/dechon/archive/2005/12/08/22957.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用函数computeURL( )实现同一FORM的多动作提交http://www.aygfsteel.com/dechon/archive/2005/11/24/21253.htmlTerenceTerenceThu, 24 Nov 2005 03:29:00 GMThttp://www.aygfsteel.com/dechon/archive/2005/11/24/21253.htmlhttp://www.aygfsteel.com/dechon/comments/21253.htmlhttp://www.aygfsteel.com/dechon/archive/2005/11/24/21253.html#Feedback2http://www.aygfsteel.com/dechon/comments/commentRss/21253.htmlhttp://www.aygfsteel.com/dechon/services/trackbacks/21253.html       computeURL( )是在org.apache.struts.util.RequestUtils(Struts Ver1.1)与org.apache.struts.taglib.TagUtils(Struts Ver1.2)cM的一个函?用来解析ZForward,Action,链接,面参数的URL可以用来动态改变页面中Form对应的Action.Ver1.1中有以下两种:
1.computeURL(javax.servlet.jsp.PageContext pageContext, java.lang.String forward, java.lang.String href, java.lang.String page, java.util.Map params, java.lang.String anchor, boolean redirect)
2.computeURL(javax.servlet.jsp.PageContext pageContext, java.lang.String forward, java.lang.String href, java.lang.String page, java.lang.String action, java.util.Map params, java.lang.String anchor, boolean redirect)
其中W一个是  Deprecated.W二个在新版本中得以保留,另外q提供了另外一U重?
computeURL(javax.servlet.jsp.PageContext pageContext, java.lang.String forward, java.lang.String href, java.lang.String page, java.lang.String action, java.lang.String module, java.util.Map params, java.lang.String anchor, boolean redirect, boolean encodeSeparator) 
参数说明如下:
Parameters:
pageContext - PageContext for the tag making this call
forward - Logical forward name for which to look up the context-relative URI (if specified)
href - URL to be utilized unmodified (if specified)
page - Module-relative page for which a URL should be created (if specified)
action - Logical action name for which to look up the context-relative URI (if specified)
params - Map of parameters to be dynamically included (if any)
anchor - Anchor to be dynamically included (if any)
redirect - Is this URL for a response.sendRedirect(

下面介绍一下详l的使用Ҏ(gu):
1.在JSP面中导入对应的?
<%@ page import= "org.apache.struts.util.RequestUtils"%>
?BR><%@ page import= "org.apache.struts.taglib.TagUtils"%>
2.创徏一个JAVASCRIPT函数:
<script language="JavaScript" type="text/javascript">
function search() {
 <%String searchUrl = RequestUtils.computeURL(
   pageContext,
   null,
   null,
   "/Search.do",
   null,
   null,
   null,
   false);
 %>
   
 document.form1.action = "<%=searchUrl%>";
 document.form1.submit();  
}
</script>
3.在JSP面中给对应的表单指定ID以便上面的函数进行确定提交的是哪个FORM(如果一个页面在存在多个FORM的话):
<html:form styleId="form1" action="/aotherSearch">
.........
</html:form>
4.在需要触发提交动作的地方,调用2中的JAVASCRIPT函数:
<html:button property="searchInfo" value="? onclick="search()" style="width:100px" />

对应的ACTION与FORM在配|文件中定义.q样,可以动态更改FORM的ACTION实现一个FORM对应多个ACTION?



Terence 2005-11-24 11:29 发表评论
]]>
l于贴出了第一文?/title><link>http://www.aygfsteel.com/dechon/archive/2005/11/24/21234.html</link><dc:creator>Terence</dc:creator><author>Terence</author><pubDate>Thu, 24 Nov 2005 02:29:00 GMT</pubDate><guid>http://www.aygfsteel.com/dechon/archive/2005/11/24/21234.html</guid><wfw:comment>http://www.aygfsteel.com/dechon/comments/21234.html</wfw:comment><comments>http://www.aygfsteel.com/dechon/archive/2005/11/24/21234.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/dechon/comments/commentRss/21234.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/dechon/services/trackbacks/21234.html</trackback:ping><description><![CDATA[        说是贴的W一?其实q不完全准确,文章前几天就贴上?但开始的时候放在了"文章"栏目下面而不是随W下?首页中显CZ出来,反复修改"选项"的设|也没有搞定.在BLOGJAVA上面也没有找到相关的使用说明,郁闷了好一D|?有点惛_其它地方甌个BLOG的想法了.早上的时候看别h的BLOG,发现都是随笔,猜测可能是只有随W才?x)在自己BLOG的首中昄出来.于是把必?文章"栏目中的一文章搬C随笔?果然昄在首了!<BR>       如果有遇到同样问题的朋友,h文章转脓(chung)?随笔"栏目中就可以?<img src ="http://www.aygfsteel.com/dechon/aggbug/21234.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/dechon/" target="_blank">Terence</a> 2005-11-24 10:29 <a href="http://www.aygfsteel.com/dechon/archive/2005/11/24/21234.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts中的下拉列表标签的?/title><link>http://www.aygfsteel.com/dechon/archive/2005/11/24/21230.html</link><dc:creator>Terence</dc:creator><author>Terence</author><pubDate>Thu, 24 Nov 2005 02:21:00 GMT</pubDate><guid>http://www.aygfsteel.com/dechon/archive/2005/11/24/21230.html</guid><wfw:comment>http://www.aygfsteel.com/dechon/comments/21230.html</wfw:comment><comments>http://www.aygfsteel.com/dechon/archive/2005/11/24/21230.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.aygfsteel.com/dechon/comments/commentRss/21230.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/dechon/services/trackbacks/21230.html</trackback:ping><description><![CDATA[<P>面中经常用C拉列?下面是个人对于STRUTS中标{用的一Ҏ(gu)ȝ:<BR>STRUTS中的下拉选择列表标签必须嵌套?lt;html:form>标签?包括:<BR><FONT color=#008000>1.<html:select><BR>2.<html:option><BR>3.<html:options><BR>4.<html:optionsCollection><BR></FONT><BR>使用时嵌套如?<BR><FONT color=#008000><html:select property="ationForm.property"><BR>    <html:option>?lt;html:options>?lt;html:optionsCollection><BR></html:select><BR></FONT>其中property为ActionForm中对应的一个属?<BR><BR><FONT color=#0000ff>1.<html:option></FONT><BR><FONT color=#008000><html:option value="value">displayName</html:option><BR></FONT>其中value为实际用的?赋值到ActionForm对应的属性中) displayName面中显C的信息.<BR><FONT color=#800080>?<html:option value=""></html:option>昄一个空白选择,gؓ(f)"".<BR></FONT><BR><FONT color=#0000ff>2..<html:options></FONT><FONT color=#008000><BR><html:options collection="collection" labelProperty="displayName" property="value"/><BR></FONT>其中collectionZ个集?一般是个ArrayList,displayName为前台显C的名称,value为后台实际用的?<BR><FONT color=#800080>?<html:options collection="arrayList" labelProperty="name" property="id" /><BR></FONT><BR><FONT color=#0000ff>3..<html:optionsCollection></FONT><FONT color=#008000><BR><html:optionsCollection property="actionForm.property" label="displayName" value="value"/><BR></FONT>其中property为ActionForm中的一个属?Z个集?displayName为前台显C的名称,value为后台实际用的?<BR><FONT color=#800080>?<html:optionsCollection property="listProperty" label="name" value="id" /><BR><BR></FONT><FONT color=#000000>补充一?如果要从 数据库去取数据,一般是?action 里调?DAO Q把l果存入一个ArrayList作ؓ(f) request 的一个属性传到页面上Q?q时一般用 <html:options .../> 标签.另外Q如果数据不从数据库dQ而是代码固定的,则一般把q种攑ֈ ActionForm 里,作ؓ(f)属性在面上取Q这时一般用 <html:optionsCollection ... /> .</FONT></P><img src ="http://www.aygfsteel.com/dechon/aggbug/21230.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/dechon/" target="_blank">Terence</a> 2005-11-24 10:21 <a href="http://www.aygfsteel.com/dechon/archive/2005/11/24/21230.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ຣʡ</a>| <a href="http://" target="_blank">˳</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ͱ</a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank">ڽ</a>| <a href="http://" target="_blank">찲</a>| <a href="http://" target="_blank">ʯ</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank">̫</a>| <a href="http://" target="_blank">˳</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">¡</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˫Ѽɽ</a>| <a href="http://" target="_blank">ຣʡ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ž</a>| <a href="http://" target="_blank">IJ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˳</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ϻ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">פ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ĭ</a>| <a href="http://" target="_blank">Ұ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ͭ</a>| <a href="http://" target="_blank">ʯɽ</a>| <a href="http://" target="_blank">Ȫ</a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>