zoukankan      html  css  js  c++  java
  • 一直以来有个问题我没有解决,现在知道了

    我想用Struts 2的 s:url 标签生成链接,但是要传递参数

    以前一直不会,我各种方法尝试过,总结一下,用动态Action不行,用${name}取值不行,用 s:param 也不行

    最后还是用js吧

    一个文本框

    <input type="text" id="query_name">

    一个按钮

    <input type="button" class=btn_mouseout onmousedown="this.className='btn_mousedown'" onmouseup="this.className='btn_mouseup'" onmouseover="this.className='btn_mouseover'" onmouseout="this.className='btn_mouseout'" value="按条件查询" onclick="query();"> 

    相应的js函数

    function query(){
                 
                var query=document.getElementById('query_name').value;
                window.location.href='queryClient?query_name='+query;
                }

    然后就可以了,用GET方法,参数传递之后,Action处理

    String    idea = new String(query_name.getBytes("ISO-8859-1"), "GB2312");

    查找即可

    Query query = s.createQuery("from Client client where client.client_name like'%"+idea+"%'");

    为什么不用form呢?是因为已经在form了,但是我直接sumbit时改Action不行


    能弄成感觉还不错

  • 相关阅读:
    docker network
    mongodb索引
    docker中管理数据
    mysql表备份及还原
    Find and run the whalesay image
    Learn about images & containers
    docker installation on ubuntu
    【转载】熟练利用google hacking来辅助我们快速渗透
    xmind常用快捷键
    漏洞挖掘基础
  • 原文地址:https://www.cnblogs.com/bq12345/p/3204663.html
Copyright © 2011-2022 走看看