javascript 如何访问struts2标签中的参数

在javascript函数中需要传入一个参数addKickNum(id),id为文章的id号,需要从jsp文件中获取,见如下jsp文件

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%@ taglib prefix="s" uri="/struts-tags"%>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
 prefix="html"%>

<html>

 <head>
  <html:base />
  <title>mdxt_artic</title>
  <style type="text/css">
<!--
@import url("../css/xt.css");

a:link {
 text-decoration: none;
}

a:visited {
 text-decoration: none;
}

a:hover {
 text-decoration: none;
}

a:active {
 text-decoration: none;
}
-->
</style>
  <script type="text/javascript">
 function confirmed() {
  if (confirm("您确认删除该文章吗?"))
   return true;

  else
   return false;
 }
 function addKickNum(id)
 {
    alert(id);
   }
</script>
 </head>
 <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0"
  marginheight="0">
  <!-- ImageReady Slices (mdxt_artic.psd) -->
  <table width="770" height="629" border="0" align="center"
   cellpadding="0" cellspacing="0" id="__01">
   <tr>
    <td colspan="3">
     <img src="images/mdxt_artic_01.gif" width="770" height="52" alt="">
    </td>
   </tr>
   <tr>
    <td rowspan="2" background="images/mdxt_artic_02.gif" width="17"></td>
    <td>
     <img src="images/mdxt_artic_03.gif" width="737" height="35" alt="">
    </td>
    <td rowspan="2" background="images/mdxt_artic_04.gif" width="16"></td>
   </tr>
   <tr>
    <td width="737" height="507" valign="top">
     <s:form name="form1" method="post" action="searchArticleInfoAction" theme="simple">
      <table width="100%" height="516" border="1" cellpadding="0"
       cellspacing="0">
       <tr>
        <td height="58" align="center" class="style7">
         关键字
         <s:textfield name="key" size="12"></s:textfield>
         &nbsp;&nbsp;按照
         <s:select name="type" list="{'请选择','栏目','作者','标题','内容'}">

         </s:select>
         &nbsp;
         <s:submit value="查找"></s:submit>
         <br>
         (默认按时间倒序显示,时间格式为2009-01-01,00:00:00)
        </td>
       </tr>
       <tr>
        <td height="382" valign="top">
         <table width="100%" height="56" border="1" cellpadding="0"
          cellspacing="0">
          <tr bgcolor="#E3E3E3" class="style7">
           <td width="8%" height="27" align="center" valign="middle">
            选择
           </td>
           <td width="20%" align="center" valign="middle">
            标题
           </td>
           <td width="10%" align="center" valign="middle">
            作者
           </td>
           <td width="12%" align="center" valign="middle">
            所属栏目
           </td>
           <td width="15%" align="center" valign="middle">
            发表时间
           </td>
           <td width="7%" align="center" valign="middle">
            点击率
           </td>
           <td width="7%" align="center" valign="middle">
            编辑
           </td>
           <td width="7%" align="center" valign="middle">
            删除
           </td>
          </tr>

          <s:iterator id="articleInfo" status="st"
           value="pageBean.list">
           <tr>
            <td>
             <div align="center">

              <input type="checkbox" name="checkbox" value="checkbox">
             </div>
            </td>
            <td>
             <s:hidden id="index" value="%{#articleInfo.articleNum}"></s:hidden>
             <div align="center">
              <s:a
               href="previewMdxtArticleInfoAction.action?articInfo.articleNum=%{#articleInfo.articleNum}"
               
               οnclick="addKickNum('%{#articleInfo.articleNum}');">
               <s:property value="#articleInfo.title" />
              </s:a>
             </div>
            </td>
            <td>
             <s:property value="#articleInfo.publisher" />
            </td>
            <td>
             <s:property value="#articleInfo.partName" />
            </td>
            <td>
             <s:property value="#articleInfo.publisheTime" />
            </td>
            <td>
             <s:property value="#articleInfo.kickNum" />
            </td>
            <td>
             <div align="center">
              <s:a
               href="updateMdxtArticInfoActiongetArticInfoByArticNum.action?articInfo.articleNum=%{#articleInfo.articleNum}">编辑</s:a>
             </div>
            </td>
            <td>
             <div align="center">
              <s:a
               href="deleteMdxtArticleInfoAction.action?articInfo.articleNum=%{#articleInfo.articleNum}"
               οnclick="return confirmed()">删除</s:a>
             </div>
            </td>
           </tr>
          </s:iterator>
          
          

         </table>
         <table>
         <tr>
         <td>
          共<s:property value = "pageBean.allRow"/>条记录
          共<s:property value = "pageBean.totalPage"/>页
          当前第<s:property value="pageBean.currentPage"/>页
          <br>
          <s:if test="%{pageBean.currentPage==1}">
          第一页 上一页
          </s:if>
          <s:else>
           <a href ="getAllMdxtArticInfoAction.action?page=1">第一页</a>
           <a href ="getAllMdxtArticInfoAction.action?page=<s:property value ="%{pageBean.currentPage-1}"/> ">上一页</a>
           
          
          </s:else>
          <s:if test = "%{pageBean.currentPage!=pageBean.totalPage}">
           <a href="getAllMdxtArticInfoAction.action?page=<s:property value= "%{pageBean.currentPage+1}"/>"/>下一页</a>
           <a href="getAllMdxtArticInfoAction.action?page=<s:property value= "%{pageBean.totalPage}"/>"/>最后一页</a>
           
          </s:if>
          
          <s:else>
           下一页 最后一页
          </s:else>
          </td>
         </tr>
         </table>
        </td>
       </tr>
       
      </table>
     </s:form>
    </td>
   </tr>
   <tr>
    <td colspan="3">
     <img src="images/mdxt_artic_06.gif" width="770" height="35" alt="">
    </td>
   </tr>
  </table>
  <!-- End ImageReady Slices -->
 </body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值