日期:2014-05-16  浏览次数:20376 次

struts2+jquery +json 中遇见问题总结

1、最近使用? struts2+jquery +json 来实现无刷新的效果

,但遇见不少小问题;

1、页面

? <div class="index_right_2" >
????? <div? style="float:right">
??????? <input class="index_right_2_1"? type="button" name="add" id="add" value="新增"/>
??????? <input class="index_right_2_1"? type="button" name="update" id="update" value="修改"/>
??????? <input class="index_right_2_1"? type="button" name="delete" id="delete" value="删除"/>
????? </div>
?? </div>
??
?? <div class="index_right_3">
?? ??<table id="table2" width="100%" border="0px" cellspacing="2px" cellpadding="0px" style="table-layout:fixed;">
?? ???
?? ???<tr class="table_one_title">
?? ???? <th style="width:5%">选择</th>
?? ???? <th style="width:5%">序号</th>
?? ???? <th style="width:20%">编码</th>
?? ???? <th style="width:30%">名称</th>
?? ???? <th>备注</th>
?? ???</tr>
?? ??
?? ?? <s:iterator value="list"? status="st">
?? ???<tr class="table_one_content" id="showTr" >
?? ????? <td>
??? ?????? <input style="width:100%;height:23px"? id="checkbox" name="checkbox" type="checkbox" value="<s:property value="unitId" />" />
??? ???</td>
?? ????<td>
??? ?????? <input style="width:100%;height:23px"? id="indexNum" name="indexNum" type="text" value="<s:property value="num" />" />
??? ???</td>
??? ???<td>
??? ?????? <input style="width:100%;height:23px"? id="vCode" name="vCode" type="text" value="<s:property value="vCode" />" />
??? ???</td>
??? ???<td>
??? ?????? <input style="width:100%;height:23px"? id="vName" name="vName" type="text" value="<s:property value="vName" />" />
??? ???</td>
??? ???<td>
??? ?????? <input style="width:100%;height:23px" id="sMemo" name="sMemo" type="text" value="<s:property value="sMemo" />" />
??? ???</td>
??? ??</tr>
??? ??</s:iterator>
?? ???
?? ??</table>
??
?? </div>
?? </form>
?? </div>
??
?? <div id="unitedit" class="index_right_unitedit_middle" style="display:none">
??? <form id="editform" name="editform" >
????? <div class="index_right_unitedit_input">
????? ???? <input type="hidden" id="edit_unitId" name="baseVo.unitId" value="" maxlength="16" size="20" >
????? ??<label>编码:</label><input type="text" id="edit_vCode" name="baseVo.vCode" value="" maxlength="16" size="20">&nbsp;&nbsp;&nbsp;
????? ??<label>名称:</label><input type="text" id="edit_vName" name="baseVo.vName" value="" maxlength="50" size="39">
??????? </div>?

??????? <div class="index_right_unitedit_input">
????? ??<label>备注:</label><textarea rows="3" cols="75" id="edit_sMemo"? name="baseVo.sMemo"></textarea>
????? ?</div>
????? ?
????? ? <div class="index_right_unitedit_input" style="text-align:center">
????? ? ? <input class="index_right_2_1"? type="button" name="save" id="save" value="保存"/>
???????????? <input class="index_right_2_1"? type="reset" name="reset" id="reset" value="重置"/>
???????????? <input class="index_right_2_1"? type="button" name="editdel" id="editdel" value="取消"/>
????? ? <div>
????? </form>?
?? </div>

?

2、jq代码