这是登陆后的页面
<%@ page import="hbue.pojo.Teacher"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/eip2.css" rel="stylesheet" type="text/css">
<script src="../js/eip2.js" type=text/javascript></script>
<title>湖北经济学院教学辅助平台</title>
</head>
<%
//System.out.println("abcd");
//Teacher tea = (Teacher)session.getAttribute("tea");
//Teacher tea2 = (Teacher)request.getAttribute("tea");
//System.out.println("re "+tea.getTeaName());
//System.out.println("se "+tea2.getTeaName());
%>
<SCRIPT language=JScript></script>
<frameset name="subMainFrameSet" rows="*" cols="175,24,*" framespacing="0" frameborder="NO" border="0">
<frameset name="leftFrameSet" rows="77,*" cols="*" frameborder="no">
<frame src="include/user.jsp" name="userFrame" frameborder="no" scrolling="no" noresize id="userFrame">
<frame src="teacher/funcTree.htm" name="funcTreeFrame" frameborder="no" noresize id="treeframe" id="funcTreeFrame">
</frameset>
<frame src="include/control.htm" name="controlFrame" frameborder="no" scrolling="no" noresize id="controlFrame">
<frameset name="rightFrameSet" rows="26,*" cols="*" frameborder="no">
<frame src="include/place.htm" name="placeFrame" frameborder="no" scrolling="no" noresize id="placeFrame">
<frame src="teacher/teacherInfoManage/teacherInfo.jsp" name="contentFrame" frameborder="no" scrolling="auto" id="contentFrame">
</frameset>
</frameset>
<noframes><body>
</body></noframes>
</html>这个是<frame src="teacher/teacherInfoManage/teacherInfo.jsp" name="contentFrame" frameborder="no" scrolling="auto" id="contentFrame">所对应的页面<%@ page import="hbue.pojo.Teacher"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../css/eip2.css" rel="stylesheet" type="text/css">
<script src="../../js/eip2.js" type=text/javascript></script>
<title>湖北经济学院教学辅助平台</title>
<script language="javascript">
function update(id){
document.all.teacherId.readOnly=false;
document.all.teatherName.readOnly=false;
document.all.workCall.disabled=false;
document.all.school.disabled= false;
document.all.academy.disabled= false
document.all.briefIntrduction.disabled=false;
document.all.save.disabled= false;
document.all.update.disabled=true;
}
</script>
</head>
<body bgcolor='#003E88' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>
<script language="javascript">
writeTableTop('个人信息','../../');
</script><%
Teacher tea = (Teacher)session.getAttribute("tea");
%><table border="0" align="center" cellpadding="5" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td width="50"><td width="150">
</tr>
<tr>
<td align="right" nowrap><div align="center"><span class="style_required_red">* </span>工号</div></td>
<td width="150" colspan="2" align="left" nowrap>
<input name="teacherId" type="text" class="text_field" value="<%=tea.getTeaId()%>" size="25" readonly="ture"></td>
<td width="50" align="right" nowrap><span class="style_required_red">* </span>简介</td>
<td colspan="2" rowspan="5" align="right" nowrap>
<div align="center">
<textarea name="briefIntrduction" cols="60" rows="10" disabled>桃李满天下</textarea>
</div> </td>
</tr>
<tr>
<td align="right" nowrap><div align="center"><span class="style_required_red">* </span>姓名</div></td>
<td colspan="2" align="left" nowrap><input name="teatherName" type="text" value="<%=tea.getTeaName()%>" size="18" maxlength="12" readonly="ture"></td>
<td nowrap align="right"> </td>
</tr>
<tr>
<td align="center" nowrap><span class="style_required_red">*</span> 职称</td>
<td colspan="2" align="left" nowrap>
<select name="workCall" disabled="disabled">
<option selected><%=tea.getTeaCall()%></option>
<option>教授</option>
<option>副教授</option>
<option>博士</option>
<option>硕士</option>
<option>讲师</option>
</select> </td>
<td nowrap align="right"> </td>
</tr>
<tr>
<td align="center" nowrap><span class="style_required_red">* </span>学校</td>
<td colspan="2" align="left" nowrap><select name="school" disabled="disabled" >
<option>湖北经济学院</option>
<option>湖北经济学院</option>
<option>法商学院</option>
<option>管理技术学院</option>
</select></td>
<td nowrap align="right"> </td>
</tr>
<tr>
<td align="center" nowrap><span class="style_required_red">* </span>院系</td>
<td colspan="2" align="left" nowrap><select name="academy" disabled>
<option>计算机科学与技术学院</option>
<option>计算机科学与技术学院</option>
<option>会计学院</option>
<option>金融学院</option>
</select></td>
<td nowrap align="right"> </td>
</tr>
<tr>
<td align="right" nowrap> </td>
<td align="right" valign="top" nowrap><div align="center"></div></td>
<td colspan="4" align="right" valign="top" nowrap>
<input name="update" class="button_01" type="button" value="修改" onClick="update();">
<input name="save" class="button_01" type="button" value="保存"disabled> </td>
</tr>
</table><script language="javascript">
writeTableBottom('../../');
</script>
</body>
</html>上面的代码已经通过了,但是我存在2个问题第一,我用Session保存tea对象,在页面能个得到,但是为什么用request.setAttrubete()方法却不能在页面得到tea对象,是不是中间通过了一个frameset再到子页面teacherInfo.jsp,这已经是2个request对象了?第二,不知道大家有没有注意我的frame对象里面的src属性,拿最后一个frame对象做例子,
先和大家说一下我的文件路径,和teacherIndex.jsp同目录的有一个文件夹teacherInfoManage,在这个文件夹里面有包含页面teacherInfo.jsp
这里很奇怪,为什么src的值不是teacherInfoManage/teacherInfo.jsp,而是上面的那样?
更奇怪的是,如果我是从服务器访问,那就必须是 src="teacher/teacherInfoManage/teacherInfo.jsp",如我上面代码所写,如果我直接点击这个页面src就要写成teacherInfoManage/teacherInfo.jsp 谁知道这是为什么?还有就是,如果我在MyEclipse里面打开这个frameset的文件,MyEclipse老是弹出对话框说frame里面链接的子页面不存在,不停的弹对话框,随便输入一个字母就弹
<%@ page import="hbue.pojo.Teacher"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/eip2.css" rel="stylesheet" type="text/css">
<script src="../js/eip2.js" type=text/javascript></script>
<title>湖北经济学院教学辅助平台</title>
</head>
<%
//System.out.println("abcd");
//Teacher tea = (Teacher)session.getAttribute("tea");
//Teacher tea2 = (Teacher)request.getAttribute("tea");
//System.out.println("re "+tea.getTeaName());
//System.out.println("se "+tea2.getTeaName());
%>
<SCRIPT language=JScript></script>
<frameset name="subMainFrameSet" rows="*" cols="175,24,*" framespacing="0" frameborder="NO" border="0">
<frameset name="leftFrameSet" rows="77,*" cols="*" frameborder="no">
<frame src="include/user.jsp" name="userFrame" frameborder="no" scrolling="no" noresize id="userFrame">
<frame src="teacher/funcTree.htm" name="funcTreeFrame" frameborder="no" noresize id="treeframe" id="funcTreeFrame">
</frameset>
<frame src="include/control.htm" name="controlFrame" frameborder="no" scrolling="no" noresize id="controlFrame">
<frameset name="rightFrameSet" rows="26,*" cols="*" frameborder="no">
<frame src="include/place.htm" name="placeFrame" frameborder="no" scrolling="no" noresize id="placeFrame">
<frame src="teacher/teacherInfoManage/teacherInfo.jsp" name="contentFrame" frameborder="no" scrolling="auto" id="contentFrame">
</frameset>
</frameset>
<noframes><body>
</body></noframes>
</html>这个是<frame src="teacher/teacherInfoManage/teacherInfo.jsp" name="contentFrame" frameborder="no" scrolling="auto" id="contentFrame">所对应的页面<%@ page import="hbue.pojo.Teacher"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../css/eip2.css" rel="stylesheet" type="text/css">
<script src="../../js/eip2.js" type=text/javascript></script>
<title>湖北经济学院教学辅助平台</title>
<script language="javascript">
function update(id){
document.all.teacherId.readOnly=false;
document.all.teatherName.readOnly=false;
document.all.workCall.disabled=false;
document.all.school.disabled= false;
document.all.academy.disabled= false
document.all.briefIntrduction.disabled=false;
document.all.save.disabled= false;
document.all.update.disabled=true;
}
</script>
</head>
<body bgcolor='#003E88' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>
<script language="javascript">
writeTableTop('个人信息','../../');
</script><%
Teacher tea = (Teacher)session.getAttribute("tea");
%><table border="0" align="center" cellpadding="5" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td width="50"><td width="150">
</tr>
<tr>
<td align="right" nowrap><div align="center"><span class="style_required_red">* </span>工号</div></td>
<td width="150" colspan="2" align="left" nowrap>
<input name="teacherId" type="text" class="text_field" value="<%=tea.getTeaId()%>" size="25" readonly="ture"></td>
<td width="50" align="right" nowrap><span class="style_required_red">* </span>简介</td>
<td colspan="2" rowspan="5" align="right" nowrap>
<div align="center">
<textarea name="briefIntrduction" cols="60" rows="10" disabled>桃李满天下</textarea>
</div> </td>
</tr>
<tr>
<td align="right" nowrap><div align="center"><span class="style_required_red">* </span>姓名</div></td>
<td colspan="2" align="left" nowrap><input name="teatherName" type="text" value="<%=tea.getTeaName()%>" size="18" maxlength="12" readonly="ture"></td>
<td nowrap align="right"> </td>
</tr>
<tr>
<td align="center" nowrap><span class="style_required_red">*</span> 职称</td>
<td colspan="2" align="left" nowrap>
<select name="workCall" disabled="disabled">
<option selected><%=tea.getTeaCall()%></option>
<option>教授</option>
<option>副教授</option>
<option>博士</option>
<option>硕士</option>
<option>讲师</option>
</select> </td>
<td nowrap align="right"> </td>
</tr>
<tr>
<td align="center" nowrap><span class="style_required_red">* </span>学校</td>
<td colspan="2" align="left" nowrap><select name="school" disabled="disabled" >
<option>湖北经济学院</option>
<option>湖北经济学院</option>
<option>法商学院</option>
<option>管理技术学院</option>
</select></td>
<td nowrap align="right"> </td>
</tr>
<tr>
<td align="center" nowrap><span class="style_required_red">* </span>院系</td>
<td colspan="2" align="left" nowrap><select name="academy" disabled>
<option>计算机科学与技术学院</option>
<option>计算机科学与技术学院</option>
<option>会计学院</option>
<option>金融学院</option>
</select></td>
<td nowrap align="right"> </td>
</tr>
<tr>
<td align="right" nowrap> </td>
<td align="right" valign="top" nowrap><div align="center"></div></td>
<td colspan="4" align="right" valign="top" nowrap>
<input name="update" class="button_01" type="button" value="修改" onClick="update();">
<input name="save" class="button_01" type="button" value="保存"disabled> </td>
</tr>
</table><script language="javascript">
writeTableBottom('../../');
</script>
</body>
</html>上面的代码已经通过了,但是我存在2个问题第一,我用Session保存tea对象,在页面能个得到,但是为什么用request.setAttrubete()方法却不能在页面得到tea对象,是不是中间通过了一个frameset再到子页面teacherInfo.jsp,这已经是2个request对象了?第二,不知道大家有没有注意我的frame对象里面的src属性,拿最后一个frame对象做例子,
先和大家说一下我的文件路径,和teacherIndex.jsp同目录的有一个文件夹teacherInfoManage,在这个文件夹里面有包含页面teacherInfo.jsp
这里很奇怪,为什么src的值不是teacherInfoManage/teacherInfo.jsp,而是上面的那样?
更奇怪的是,如果我是从服务器访问,那就必须是 src="teacher/teacherInfoManage/teacherInfo.jsp",如我上面代码所写,如果我直接点击这个页面src就要写成teacherInfoManage/teacherInfo.jsp 谁知道这是为什么?还有就是,如果我在MyEclipse里面打开这个frameset的文件,MyEclipse老是弹出对话框说frame里面链接的子页面不存在,不停的弹对话框,随便输入一个字母就弹
解决方案 »
- jsp接受json串的问题
- 高手运行一下我的程序 为什么报错 啊 control.jsp这个页面报错
- 在eclipse 下面,为什么编写的C/S架构的软件编译后无法运行,是不是eclipse在编译C/S架构软件时需要一个插件呢?很急!!!!请教!!!
- JAVA菜鸟求助一个多线程程序
- 急急
- include的页面能不能有contentType?
- 请问weblogic集群下,指定server处理请求的问题
- 求:如何用java实现网站站点自动登陆功能 !!!!!!!!!!!
- 研究方向(选题)
- 我把一个xml文件解析成JTree显示出来,但是上面有一些特定节点我并不想显示,如何去做?注:并不是删掉节点,只是让它不显示在tree中
- Java calendar 时区的问题
- S+S+H应用中web.xml的配置,请教是否错误?
就OK啦,不论你用的struts 组件架构,都一样呀
<forward name="tea" path="/teacher/teacherIndex.jsp"/>
<frame src="teacher/teacherInfoManage/teacherInfo.jsp" name="contentFrame" frameborder="no" scrolling="auto" id="contentFrame">
我也纳闷你的怎么路径不一样的呢为什么会产生两个对像登录后-->Action(存放tea对像)-->转到JSP页面这里是同一个request对像,可以用request取得tea-->生成HTML代码,浏览器看到界面<至此这个request对像销毁>看到页面后-->点击链接-->访问服务器Action,产生新的request对像,没有存放tea对像-->转到JSP,这时候已经不能取得登录时候的tea对像.因为那个request不一样了.
问题二:是由于你访问一个Action后的问题.项目名/a/b/下边有三个JSP,a.jsp,b.jsp,c.jsp在a.jsp访问一个Action后.路径返回到了 项目名/这里来了.所以那个Action还想直接跳转到B.jsp里去的话就要加a/b/b.jsp这样的路径,而不是直接的b.jsp.后边的问题我就不清楚了.
貌似应该是request.getSession().getAttribute("tea")来得到你的tea对象
request.setAttribute()是设置而不是获取,而且只是保存在request范围内。问题二还在看,呵呵