Ajax中二级联动菜单的实现原理是什么
Ajax中二级联动菜单的实现原理是什么,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:空间域名、网页空间、营销软件、网站建设、黎城网站维护、网站推广。
index.jsp:
<%@ page language="java" pageEncoding="UTF-8"%>二级菜单联动演示
SelectServlet:
package com; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /*** * * @author zdw * */ public class SelectServlet extends HttpServlet { private static final long serialVersionUID = 1L; public SelectServlet() { super(); } public void destroy() { super.destroy(); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // response.setCharacterEncoding("GBK"); response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); request.setCharacterEncoding("GBK"); response.setCharacterEncoding("UTF-8"); String targetId = request.getParameter("id").toString(); System.out.println(targetId); // 获得请求中参数为id的值 String xml_start = ""; String xml_end = " "; String xml = ""; if (targetId.equalsIgnoreCase("0")) { xml = ""; } else if (targetId.equalsIgnoreCase("1")) { xml = ""; xml += ""; xml += ""; xml += ""; } else if (targetId.equalsIgnoreCase("2")) { xml = ""; xml += ""; xml += ""; xml += ""; } else {// 如果是3,则返回下面的字符 xml = ""; xml += ""; xml += ""; xml += ""; } String last_xml = xml_start + xml + xml_end; response.getWriter().write(last_xml); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } public void init() throws ServletException { } }
web.xml:
SelectServlet com.SelectServlet SelectServlet /select index.jsp
看完上述内容,你们掌握Ajax中二级联动菜单的实现原理是什么的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注创新互联行业资讯频道,感谢各位的阅读!
网站栏目:Ajax中二级联动菜单的实现原理是什么
转载来源:http://myzitong.com/article/ghedod.html