我想做一个点击一个下拉框中的选项,然后在这个页面的下方显示该选项下的一些字段信息。高手帮帮忙,搞了快两天了。在线等啊!!!!

解决方案 »

  1.   

    onchange出发js,用ajax发送下拉框选中选项的value给struts,返回一段文字,回调函数写进div
      

  2.   

    能具体点吗?我刚学这玩意
    function redirect(){
      alert("000000000");
       $.ajax({
            type:"get",
            url:"../CategoryFileManagerO/cfmaction8.action",
            data:{achid:$("#cglb").val()},
            dataType:"json",        
            success: function(data) {
      
              $.each(data,function(apptargetlist, apptarget) { 
               alert(apptarget.tarname);                                       
         })
                             
     }
    },"json");
     }
    我得到了后台的数据,但怎么显示到页面?还有得到的可能是字符串形式的
      

  3.   

    我的qq是774087258,你能不能加qq详细给我说一下,我这时间比较紧
      

  4.   


    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>My JSP 't.jsp' starting page</title>
        
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->  <script type="text/javascript" src="jquery-1.4.min.js"></script>
      <script type="text/javascript">
       $(document).ready(function(){
       $("#test").click(function(){
       $.ajax({
       url:"testAction!ajax.action",
       type:"post",
       data:{id:1},
       success:function(result){
       $("#div").html(result);
       }
       });
       });
       });
      </script>
      </head>
      
      <body>
        <input type="button" id="test" value="show">
        <div id="div"></div>
      </body>
    </html>
      

  5.   


    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>My JSP 't.jsp' starting page</title>
        
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->  <script type="text/javascript" src="jquery-1.4.min.js"></script>
      <script type="text/javascript">
       $(document).ready(function(){
       $("#test").click(function(){
       $.ajax({
       url:"testAction!ajax.action",
       type:"post",
       data:{id:1},
       success:function(result){
       $("#div").html(result);
       }
       });
       });
       });
      </script>
      </head>
      
      <body>
        <input type="button" id="test" value="show">
        <div id="div"></div>
      </body>
    </html>
      

  6.   

    result是什么数据类型?String还是list?如果是list的话,我想用迭代器在页面上显示出来,该怎么写?
      

  7.   

    public String querryAppTarget(){
    System.out.println("进入action的querryAppTarget方法");
    System.out.println("01");
    System.out.println(achid);
    apptargetlist = new ArrayList<AppTarget>();
    apptargetlist = cfmdao.querryAppTarget(achid);
    jsonrusult=JSONArray.fromObject(apptargetlist);
    System.out.println("02");
    return this.SUCCESS;
    }
    ---------------------这是我后台的action-------------------------------
      

  8.   

     function redirect(){
      alert("000000000");   $.ajax({
            type:"get",
            url:"../CategoryFileManagerO/cfmaction8.action",
            data:{achid:$("#cglb").val()},
            dataType:"json",        
            success: function(data) {
     
            alert(data);
            $("#resultId").html(data);        
                       }});                            
    }
     --------------前台的jquery------------------
    [com.hanet.sip.pojo.AppTarget@5fe9c4, com.hanet.sip.pojo.AppTarget@ec5584]
    ------------------这是alert出来的data-----------------
      

  9.   

    可以把你的List拼成json字符串,再转成js对象操作
      

  10.   

    能不能具体点?我从后台得到的数据和前台打印出来的完全一样,但是我在前台想输出对象的属性时报defined。