⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qask.jsp

📁 在线教育平台: 从小学
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=gb2312"
	pageEncoding="GB2312"%>
<%@page import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<jsp:useBean id="grades" scope="page" class="edu.GradeBean" />
<jsp:useBean id="classs" scope="page" class="edu.ClassBean" />
<jsp:useBean id="subjects" scope="page" class="edu.SubjectBean" />
<jsp:useBean id="user" scope="page" class="edu.UserBean" />
<jsp:useBean id="teacher" scope="page" class="edu.TeacherBean" />
<title>快速提问</title>
<style type="text/css">
<!--
.STYLE2 {font-size: 12px; font-weight: bold; }
-->
</style>
</head>
<script language="javascript">
<!--
function usercheck(){
var title,content;
title=document.myform.title.value;
content=document.myform.content.value;

if(title==""){
alert("标题不能为空!");
return false;}
if(content==""){
alert("内容不能为空!");
return false;}
if(document.myform.subject_id.options[document.myform.subject_id.selectedIndex].value==""){
alert("请选择科目!");
return false;}
}
//-->
</script>
<%
ResultSet rs_class=classs.getClasses();
ResultSet rs_subject=subjects.getSubjects();
int grade_id=0,u_id=0;
String grade=null,sort=null;
boolean allow=false;
try{
u_id=Integer.valueOf(session.getAttribute("userid").toString()).intValue();
sort=session.getAttribute("sort").toString();


if(sort.equalsIgnoreCase("user")){
	allow=user.isallow(u_id)&&!user.isforbid(u_id);
}
if(sort.equalsIgnoreCase("teacher")){
	allow=teacher.isallow(u_id);
}
if(sort.equalsIgnoreCase("admin")){
	allow=true;
}
}catch(NullPointerException e){}	
if(u_id==0||!allow)
	response.sendRedirect("error.jsp");
String time = java.text.DateFormat.getDateTimeInstance().format(new java.util.Date());
%>
<script type="text/javascript"> 
var countes; 
countes=0; 
subc = new Array();
        <% 
        int counts = 0; 
        try{
        while(rs_subject.next()){ 
        %> 
subc[<%=counts%>] = new Array("<%=rs_subject.getString("subject")%>","<%=rs_subject.getInt("subject_id")%>","<%=rs_subject.getInt("class_id")%>"); 
        <% 
        counts++; 
        } }catch(NullPointerException e){}
        rs_subject.close(); 
        %> 
countes=<%=counts%>;
function change1(locationid) 
    { 
    document.myform.subject_id.length = 1; 
    var locationid=locationid; 
    var i;
     document.myform.subject_id.options[0] = new Option("选择科目", ""); 
    for (i=0;i < countes; i++) 
        { 
            if (subc[i][2] == locationid) 
            { 
                document.myform.subject_id.options[document.myform.subject_id.length] = new Option(subc[i][0], subc[i][1]); 
            }        
        } 
    }   
var onecount; 
onecount=0; 
subcat = new Array(); 
        <% 
        int count = 0; 
        try{
        while(rs_class.next()){ 
        %> 
subcat[<%=count%>] = new Array("<%=rs_class.getString("class")%>","<%=rs_class.getInt("class_id")%>","<%=rs_class.getInt("grade_id")%>"); 
        <% 
        count++; 
        } }catch(NullPointerException e){}
        rs_class.close(); 
        %> 
onecount=<%=count%>; 
 

function changelocation(locationid) 
    { 
    document.myform.class_id.length = 1; 

    var locationid=locationid; 
    var i;
    document.myform.class_id.options[0] = new Option("选择年级", ""); 
    for (i=0;i < onecount; i++) 
        { 
            if (subcat[i][2] == locationid) 
            { 
                document.myform.class_id.options[document.myform.class_id.length] = new Option(subcat[i][0], subcat[i][1]); 
            }        
        } 
        
    }    
</script>
<body>


<div align="center">
<table width="750" height="25" border="0" cellpadding="0"
	cellspacing="0">
	<tr>
		<td width="770" height="155"><iframe name="top" height="155"
			width="770" scrolling="no" src="top.jsp" frameborder="0"></iframe></td>
	</tr>
</table>
</div>
<FORM method="POST" name="myform"
	onSubmit="javascript:return usercheck();" action="Servletask"><input
	type="hidden" name="action" value="new"> <input type="hidden"
	name="u_id" value="<%=u_id %>"> <input type="hidden"
	name="time" value="<%=time %>"> <input type="hidden"
	name="sort" value="<%=sort %>"> <input type="hidden"
	name="answer_id" value=0>
<div align="center">
<table width="750" border="0" align="center" cellspacing="1"
	bgcolor="#EBEBEB">
	<tr bgcolor="#F8F8F8">
		<td width="10%" align="right">
		<div align="center" class="STYLE2">类&nbsp;&nbsp;别:</div>
		</td>
		<td>
		<TABLE align="lift">

			<TR>
				<TD><SELECT name="grade_id"
					onChange="changelocation(document.myform.grade_id.options[document.myform.grade_id.selectedIndex].value)"
					size="1">
					<option selected>选择学历</option>
					<%ResultSet rs = grades.getGrades();
          try{
        while(rs.next())
        {	grade_id=rs.getInt("grade_id");
        	grade=rs.getString("grade");
			
        	%>
					<option value="<%=grade_id %>"><%=grade %></option>
					<%}}catch(NullPointerException e){} %>
				</SELECT></TD>
				<TD>年级:</TD>
				<TD><SELECT name="class_id"
					onChange="change1(document.myform.class_id.options[document.myform.class_id.selectedIndex].value)"
					size="1">
					<option selected>选择年级</option>
				</SELECT></TD>
				<TD>科目:</TD>
				<TD><SELECT name="subject_id" size="1">
					<option selected>选择科目</option>
				</SELECT></TD>
			</TR>
		</TABLE>
		</td>
	</tr>
	<tr bgcolor="#F8F8F8">
		<td align="right">
		<div align="center" class="STYLE2"><strong>问&nbsp;&nbsp;题:</strong></div>
		</td>
		<td width="90%"><label> <input name="title" type="text"
			id="title" size="60" /> </label></td>
	</tr>
	<tr bgcolor="#F8F8F8">
		<td>
		<div align="center" class="STYLE2">内&nbsp;&nbsp;容:</div>
		</td>
		<td><input type="hidden" name="content" value=" " /><iframe
			id="eWebEditor1"
			src="editor/eWebEditor.jsp?id=content&amp;style=standard"
			frameborder="0" scrolling="no" width="650" height="350"></iframe></td>
	</tr>
	<tr bgcolor="#F8F8F8">
		<td>
		<div align="center" class="STYLE2">操&nbsp;&nbsp;作:</div>
		</td>
		<td class="STYLE1"><label> <input type="submit"
			name="Submit" onClick="javascript:return usercheck();" value="提问" />
		<input type="reset" name="Submit2" value="重置" /> </label></td>
	</tr>
</table>
</div>
</FORM>

<div align="center">
<table height="155" width="750" border="0" cellspacing="1"
	align="center">
	<tr>
		<td class="STYLE1"><iframe name="bottom" height="155" width="750"
			scrolling="no" src="bottom.jsp" frameborder="0"></iframe></td>
	</tr>
</table>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -