本帖最后由 java2000_net 于 2008-08-05 09:22:17 编辑

解决方案 »

  1.   

    <div id="x"></div><input id="m">输出
    <input type=button value=输出 onclick='document.getElementById("x").innerHTML = document.getElementById("m").value'>
      

  2.   

    <%
       if(request.getParameter("xxx") != null)
       {
          out.print(request.getParameter("xxx"));
       }
    %><form>
       <input type = "text" name = "xxx">
       <input type = "submit" value="提交">
    </form>
      

  3.   

    <%
    request.setCharacterEncoding("utf-8");
    当点击搜索按钮是,需要取得文本框的值进行查询
    String sql = "select * from products where cname like '%"+name+"' order by cid desc";
    ArrayList list = Connshangpin.chaxun(sql);
    %>
    <input type="text" name="textfield" id="id2"/>
    <input type="button" name="button" value="搜索" />
    再一个JSP页面中
      

  4.   

    后台处理完了再把当前的JSP再调用一次了。显示的地方用<logic:notEmpty>判断一下。
      

  5.   


    1楼方法可以
     <div id="x"> </div> <input id="m"> 输出 
    <input type=“text” onblur='document.getElementById("x").innerHTML = document.getElementById("m").value'> 
     
      

  6.   

    不知道这样可以吗??
    function getName(){
    var name = document.getElementById("id2").value;
    if(name==""){
    alert("输入为空,重新输入!");
    }
    else{
    window.location.href = "fshopping.jsp?name="+name;//链接到当前页面
    }
    } <input type="text" name="textfield" id="id2"/>
     <input type="button" name="button" value="搜索" onclick="javascript:getName()" /><%
    request.setCharacterEncoding("utf-8");
    String name = request.getParameter("name");//name为文本框中的name
    String sql = "select * from products where cname like '%"+name+"' order by cid desc";
    ArrayList list = Connshangpin.chaxun(sql);
    %>
      

  7.   

    没学过ajax  不知道上面的方法可行吗
      

  8.   

    如果不做什么处理,仅仅是取值和输出的话,用JS就可以的。
    <input name="aaa" value="原始值"/>
    <span name="bbb" onclick="change()">改变</span>
    <js(省略)>
    function changer(){
      var s=document.getElementById("aaa").value;
      document.getElementById("bbb").innerHTML="改变后的值";
    }
    </js>
      

  9.   

    <%
       if(request.getParameter("xxx") != null)
       {
         String name=(String)request.getParameter("xxx");
         String sql = "select * from products where cname like '%"+name+"' order by cid desc";
         ArrayList list = Connshangpin.chaxun(sql); 
          out.print(request.getParameter("xxx"));
       }
    %><form>
       <input type = "text" name = "xxx">
       <input type = "submit" value="提交">
    </form>
    直接这样就是默认提交到本页面,然后上面就能获得值,当不为空的时候就运行里面的代买