.jsp页面中请求action的几种方式

方式1.javascriptlocation.href    -------(实现整个页面刷新)
<table width="95%" border="0" align="center" cellspacing="1"
            cellpadding="4">
            <tr>
                <td align="right">
                    <input name="button" type="button" class="button01"
                        onmouseover="makevisible(this,0)" onmouseout="makevisible(this,1)"
                        onclick="add()" value="增加style="cursor: hand;">
                </td>
            </tr>
        </table>
 
    </body>
    <SCRIPT>
function add(){
    location.href="<c:out value='${cpath}'/>/proposal/managesortaddAction.action?id=<c:out value='${item.id}'/>"
}
</SCRIPT>
2. <a>
2.1<s:param>
<td>
<a
    href='<s:url action="mydraftmodiAction.action" namespace="politics">
                    <s:param name="peinfouseraccount" value="useraccount" />
                    <s:param name="sflag" value="sflag" />
                    </s:url>'><img
                                src="<%=request.getContextPath()%>/images/icon/modify.gif"
        width="16" height="16" border="0" alt="">
</a>
</td>
 
2.2用"?id="(我比较赞成)
<td>
<href="<c:out value='${cpath}'/>/proposal/managesortdeleteAction.action?id=<c:out value='${item.id}'/>">
<img src="<c:out value='${cpath}'/>/images/icon/delete.gif"
    width="16" height="16" border="0" alt="删除">
 </a>
</td>
 
3. ext.实现链接进行局部刷新
<td><input type="button" style="cursor: hand" value="维护小类"
    onclick="minisort()" />
</td>
<script type="text/javascript">
        function minisort()
        {
            var el = Ext.get("minisort");          
            var mgr = el.getUpdater();
            mgr.update({
            url:'<c:out value='${cpath}'/>/proposal/manageminisortAction.action',
                scripts:true
                     });
        }   
</script>
 
4..< from >实现表单提交(使用struts2中框架时,inputname
<input name="proposalBig.name" bean对象的属性,inputvalue
value='${proposalBig.name}')为输出bean对象的属性的值)
------------------------------------------------------------------------------------------------------------------------------------------
<form action="<c:out value='${cpath}'/>/proposal/managesortsaveAction.action"
                method="post">
                <table width="95%" border="0" align="center" cellspacing="1"
                    cellpadding="4" class="contentTable">
                    <tr>
<td width="25%" class="low">名称</td>
    td width="75%" class="lowest">                 
    <input name="proposalBig.name" type="text" class="button01" id=""
        width="100%" value='${proposalBig.name}'/>
            </td>
            <td width="25%" class="lowest"></td>
                    </tr>
                </table>
<table width="95%" border="0" align="center" cellspacing="1"cellpadding="4">
            <tr>
                <td align="right">
    <input name="sortsave" type="submit" class="button01"
        onmouseover="makevisible(this,0)" onmouseout="makevisible(this,1)"  value="保存style="cursor: hand;">
        </td>
</tr>
</table>
</form>



     本文转自 gaochaojs 51CTO博客,原文链接:http://blog.51cto.com/jncumter/166697,如需转载请自行联系原作者


上一篇:Apache Flink流作业提交流程分析


下一篇:将视图查询出来的结果存入数据库表中。