天天看点

Struts中s:url的应用

js脚本

<script type="text/javascript">

  function modify(id)

  {

   location.replace("<%=basepath%><s:url value='stu_tomodify?id='/>"+id);

  }

  function add()

   location.replace("<%=basepath%><s:url value='stu_toadd'/>");

 </script>

jsp页面

<s:iterator value="stulist.datas" var="stu" status="index">

     <tr

      onmouseover="this.style.backgroundcolor='#dbe4ff';this.style.cursor='hand'"

      onmouseout="this.style.backgroundcolor='#ffffff';this.style.cursor='default'"

      ondblclick="modify(<s:property value="#stu.stuid"/>)">

      <td>

       <s:checkbox name="stuids" fieldvalue="%{#stu.stuid}" />

      </td>

       <s:property value="#stu.stuid" />

       <s:property value="#stu.stuname" />

       <s:if test="#stu.stusex==1">男</s:if>

       <s:else>女</s:else>

       <s:property value="#stu.stuage" />

       <s:date name="#stu.stubirth" format="yyyy年mm月dd日" />

        

       <s:property value="#stu.classes.classname" />

       <s:if test="#stu.stustatus==1">在职</s:if>

       <s:else>离职</s:else>

       <a href='stu_todel?id=<s:property value="#stu.stuid" />'>删除</a> // 普通方式

     </tr>

    </s:iterator>