lxm_yl
ascendlin
2011-09-02 10:17

jquery触发select的change事件失效

  • jquery

jquery在页面第二次加载的时候触发不了下拉框的change事件,启动tomcat,地址栏输入http://localhost:8080/aa/list.jsp时能够触发下拉框的change事件,但是从servlet过来后就不起作用了,怎么回事?

list.jsp页面
[code="java"]
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



信息界面 $(document).ready(function(){ $("#sel_emp").live('change',function(){ var value = $('#sel_emp').val(); alert(value); window.location = "/aa/servlet/Test1Servlet"; }); });




编号
姓名











/c:forEach
编号 姓名
${element.uid } ${element.username }



[/code]
------------------------servlet
[code="java"]protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Employee employee_01 = new Employee();
    employee_01.setUid("1");
    employee_01.setUsername("张三");

    Employee employee_02 = new Employee();
    employee_02.setUid("2");
    employee_02.setUsername("李四");

    List<Employee> list = new ArrayList<Employee>();
    list.add(employee_01);
    list.add(employee_02);

    request.setAttribute("list", list);

    request.getRequestDispatcher("/list.jsp").forward(request, response);
    [/code]
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

9条回答

为你推荐