还是关于我的毕业设计例如保存操作,想停留在原页面,或者只是弹出“保存成功”而不需跳转页面要怎么做?谢谢各位为小弟指点迷津
解决方案 »
- 用spring时beans.xml如何写入static final常量
- struts2 javascript 验证问题
- 锁定用户,限制修改指定的数据表字段值
- JDIC BROWSER
- struct标签无法正常显示页面 哪位高手请指点下
- struts中html:link的问题
- 请问org.apache.jetspeed.portlet包在哪里可以下载啊,一定给分
- 如何转换entity?高分请教!
- 在Linux上java.io.File对象访问win2k server目录和在win2k server结果不一样(急,在线等)
- IDEA创建lib文件夹无论是设置libraries还是从depend那边添加库的文件夹,复制黏贴包不会跟eclipse一样自动导入
- 90分跪求java学习资料学习视频
- java 获取到数组之后在进行判断疑问
第一个jsp用到一个下拉框,里面innerHTML是第二个jsp<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="cc.model.Room"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>管理员登录</title> <script type="text/javascript">
function save() {
alert("I am an alert box!!")
} function loadXMLDoc(str) {
var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "admin/Admin!listRoom2?buildInfo=" + str, true);
xmlhttp.send();
}
</script> </head>
<%
List<String> buildList = (List<String>) session
.getAttribute("buildList");
List<Room> roomList = (List<Room>) session.getAttribute("roomList");
%>
<body> draftAdd.jsp <select id="s1" onchange="loadXMLDoc(this.value)" style="font-family:Verdana, Arial, Helvetica, sans-serif;">
<option>
选择一个栋号
</option>
<%
for (int i = 0; i < buildList.size(); i++) {
%>
<option value="<%=buildList.get(i)%>">
<%=buildList.get(i)%>
</option>
<%
}
%>
</select>
<div id="txtHint"></div> </body>
</html>
这是第二个jsp,里面有个action,我想点这个action之后页面不变
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="cc.model.Room"%>
<%@page import="cc.dto.DraftInfo"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>管理员登录</title> <script type="text/javascript">
function come() {
alert("I am an alert box!!")
} function loadXMLDoc(str) {
var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "admin/Admin!listRoom?buildInfo=" + str, true);
xmlhttp.send();
}
</script> </head>
<%
List<String> buildList = (List<String>) session
.getAttribute("buildList");
List<Room> roomList = (List<Room>) session.getAttribute("roomList");
%>
<body>
<form action="admin/Admin!saveDraft">
<%
if (roomList != null) {
%>
<table width="200" border="1">
<tr>
<td>
宿舍号
</td>
<td>
水费
</td>
<td>
电费
</td>
</tr>
<%
for (Room r2 : roomList) {
DraftInfo d = new DraftInfo();
%>
<tr> <td><%=r2.getName()%></td>
<td>
<input type="text" name="water">
</td>
<td>
<input type="text" name="electricity">
</td>
</tr>
<%
}
%>
<input type="submit" value="保存草案" />
</form>
</table>
<%
}
%>
</body>
</html>继续请教,ajax不太懂