日期:2014-05-16 浏览次数:20545 次
package com.gslsoft.dao; /*通过父类Id查找子类目*/ @SuppressWarnings("finally") public List<VideoCategory> getChildCategoryByParentId(int id) { String sql="select * from video_category where parentId='"+id+"'"; List<VideoCategory> list=new ArrayList(); VideoCategory Category=null; try{ CachedRowSet rs = DBConnection.getResultSet(sql); while(rs.next()) { Category= new VideoCategory(); Category.setName(rs.getString("name")); Category.setRemark(rs.getString("remark")); Category.setLevel(rs.getInt("level")); Category.setImage(rs.getString("image")); Category.setCategoryId(rs.getInt("id")); list.add(Category); } rs.close(); } catch (java.sql.SQLException e) { Logger.log(Logger.ERROR, "DataRepository_getVideoFileByCategoryId: with CategoryId=" + id); Logger.log(Logger.ERROR, e.toString()); } finally { return list; } } 本文来自CSDN博客,转载请标明出处:file:///C:/Documents%20and%20Settings/Administrator/桌面/我的文件夹/我下载的学习网页/JSP的那些事儿(4)----DWR实现级联%20%26%20JSP页面的查询%20-%20薛敬明的专栏%20-%20CSDN博客.htm
<?xml version="1.0" encoding="GBK"?> <dwr> <allow> <create creator="new" javascript="videocategoryservice"> <param name="class" value="com.gslsoft.service.VideoCategoryService" /> </create> </allow> </dwr>
view plaincopy to clipboardprint? <%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> <%@ page import="java.util.*" %> <%@ page import="com.gslsoft.service.*" %> <%@ page import="com.gslsoft.model.*" %> <html> <head> <title>文件上传</title> <link rel="stylesheet" href="../../css/x_css1.css" mce_href="css/x_css1.css" type="text/css"> <mce:script type='text/javascript' src="/app/dwr/interface/videocategoryservice.js" mce_src="app/dwr/interface/videocategoryservice.js"></mce:script> <mce:script type='text/javascript' src="/app/dwr/interface/VideoCategory.js" mce_src="app/dwr/interface/VideoCategory.js"></mce:script> <mce:script type='text/javascript' src="/app/dwr/engine.js" mce_src="app/dwr/engine.js"></mce:script> <mce:script type='text/javascript' src="/app/dwr/util.js" mce_src="app/dwr/util.js"></mce:script> <mce:script type='text/javascript'><!-- //根据年级id获取上下学期 function queryterm() { //var gradeid=$("selectgrade").value; var gradeid=window.document.getElementById("selectgradea").value; //默认不选择 if(gradeid==0) { window.document.getElementById("selectterma").options.length=0; window.document.getElementById("selectsubjecta").options.length=0; } else { videocategoryservice.getChildCategoryByParentId(gradeid,termCallBack); } } function termCallBack(data) { window.document.getElementById("selectterma").options.length=0;