在js里有一个数组,传到java里,怎么去解析
1个回答
展开全部
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
String [][]str = {{"40000","09401","09402"},{"40001","09403","09404"}};
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>add score</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">
<script. language="javascript">
function select(){
var bj=document.getElementById('class');<!--删除前一次创建的option-->
obj.options.length=0;
var course = document.getElementById("course").value;
alert(course);
<%
for(int i=0;i<str.length;i++){%>
if(course == "<%=str[i][0]%>"){
<%
for(int j=1;j<str[i].length;j++){%>
var ption = document.createElement("option");
oOption.innerHTML = "<%=str[i][j]%>"
oOption.value = "<%=str[i][j]%>"
document.getElementById("class").options.add(oOption);
<%}%>
}
<%}%>
var arr = "<%=str[0][1]%>";
alert(arr);
}
</script>
<script. type="text/javascript">
</script>
</head>
<body id="level1">
<form. action="delete!deleteStudent.action" method="post">
<font size="2px" color="red"><s:property value="#request.sexistError"/></font>
课程:<select id="course" name="course" > <%for(int i=0;i<str.length;i++){ %>
<option nclick="select()"><%=str[i][0]%></option>
<%} %>
</select>
班级:<select id="class" name="cla"> </select>
<div id="score_menu">
<input type="submit" name="submit" class="submit" value="提交"/>
<input type="reset" name="reset" class="reset" value="重置"/><br />
</form>
</body>
</html>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
String [][]str = {{"40000","09401","09402"},{"40001","09403","09404"}};
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>add score</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">
<script. language="javascript">
function select(){
var bj=document.getElementById('class');<!--删除前一次创建的option-->
obj.options.length=0;
var course = document.getElementById("course").value;
alert(course);
<%
for(int i=0;i<str.length;i++){%>
if(course == "<%=str[i][0]%>"){
<%
for(int j=1;j<str[i].length;j++){%>
var ption = document.createElement("option");
oOption.innerHTML = "<%=str[i][j]%>"
oOption.value = "<%=str[i][j]%>"
document.getElementById("class").options.add(oOption);
<%}%>
}
<%}%>
var arr = "<%=str[0][1]%>";
alert(arr);
}
</script>
<script. type="text/javascript">
</script>
</head>
<body id="level1">
<form. action="delete!deleteStudent.action" method="post">
<font size="2px" color="red"><s:property value="#request.sexistError"/></font>
课程:<select id="course" name="course" > <%for(int i=0;i<str.length;i++){ %>
<option nclick="select()"><%=str[i][0]%></option>
<%} %>
</select>
班级:<select id="class" name="cla"> </select>
<div id="score_menu">
<input type="submit" name="submit" class="submit" value="提交"/>
<input type="reset" name="reset" class="reset" value="重置"/><br />
</form>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询