有一个a页面,这页面是主菜单
有一个b页面,这页面是功能菜单
有一个c页面,这页面是显示数据的部分
功能菜单是主菜单的儿子,其中我想把a做为头,放在最上面,b放在左边,(1)当在a中选择不同的选项时候,在b中显示不同的功能,(2)当在b中选择不同的选项的时候,在c中显示对应的数据。
遇到的问题就是当完成(1)的时候b正常但是a中从数据库中出来的数据不显示,当完成(2)的时候c正常,当a,b中从数据库中出来的数据都不显示。请问高手此为何解?(前提,c包含a b使用<%@ include ....%>)
附代码
a
<html>
<head>
<title>left</title>
</head>
<body>
<br>
<form name="form1" action="">
<table>
<%List functList = (List)request.getAttribute("functList"); Funct f=null;
if(functList!=null)
{
System.out.println(functList.size());
for(int i=0;i<33;i++)
{
f=(Funct)functList.get(i);
%>
<a href="${pageContext.request.contextPath }/<%=f.getEnname()%>.do?menu=ShowAll"><font size="-2"><%=f.getEnname()%></font></a><br/>
<%}%>
<%}
%></table>
</body>
</html>b
c<body>
<form id="form1" name="form1" method="post" action="">
<table width="1075" height="678" border="1.5" align="center" bordercolor="#3270D5">
<tr>
<td width="1075" height="150"><%@ include file="top.jsp"%></td>
</tr> <tr>
<td width="132" rowspan="2"><%@ include file="left.jsp"%></td>
<td width="907" height="113"> <jsp:include page="Search/accreditorSearch.jsp"></jsp:include></td>
</tr>
<tr>
<td height="391"><table width="844" height="400" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCFFFF" frame=void>
<tr>
<td height="38" colspan="7"><div align="center"><span class="style1">消息提示:${msg}</span></div></td>
</tr>
<tr>
<td width="42" height="24">choose</td>
<td width="105" height="24">Id</td>
<td width="105" height="24">Name</td>
</tr>
<%
//循环输出用户基本信息
for (int i = 0; accreditorList != null && i < accreditorList.size(); i++) {
Accreditor accreditor = (Accreditor)accreditorList.get(i);
m++;
%>
<tr>
<td height="24"><input id="a" type="checkbox" name="multichoice" value="<%=i%>" readOnly></td>
<input type="hidden" id="b" name="Id<%=i%>" size="15" value="<%=accreditor.getId()%>" readOnly>
<td height="24"><input id="c" type="text" name="Id<%=i%>" size="15" value="<%=accreditor.getId()%>" readOnly></td>
<td height="24"><input id="d" type="text" name="name<%=i%>" size="15" value="<%=accreditor.getName()%>" readOnly></td>
</tr>
<%
}
%>
<!--始终保持一个空行以供输入-->
<tr>
<td height="24"><input id="1" type="checkbox" name="checkbox" value="<%=m%>" readOnly></td>
<input type="hidden" id="2" name="Id<%=m%>" size="15" value="" readOnly>
<td height="24"><input id="3" type="text" name="Id<%=m%>" size="15" value="" readOnly></td>
<td height="24"><input id="4" type="text" name="name<%=m%>" size="15" value="" readOnly></td>
</tr>
<tr>
</tr>
<tr>
<td colspan="7"><div align="center"></div> <div align="center">
<a href="DateAdd/employeeAdd.jsp">
<img src="../images/add.JPG">
</a>
<%
Accreditor accreditor = (Accreditor)accreditorList.get(0);
String id=accreditor.getId();
System.out.println("////");
System.out.println(id);
%>
<a href="javascript:doDelete('<%=id%>');"><img src="file:///D|/My Documents/未命名站点 1/refresh.jpg"></a>
<a href="javascript:doSubmit('${pageContext.request.contextPath}/accreditor.do?menu=modifyPage&id=<%=id%>')"><img src="file:///D|/My Documents/未命名站点 1/print.jpg"></a>
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>
有一个b页面,这页面是功能菜单
有一个c页面,这页面是显示数据的部分
功能菜单是主菜单的儿子,其中我想把a做为头,放在最上面,b放在左边,(1)当在a中选择不同的选项时候,在b中显示不同的功能,(2)当在b中选择不同的选项的时候,在c中显示对应的数据。
遇到的问题就是当完成(1)的时候b正常但是a中从数据库中出来的数据不显示,当完成(2)的时候c正常,当a,b中从数据库中出来的数据都不显示。请问高手此为何解?(前提,c包含a b使用<%@ include ....%>)
附代码
a
<html>
<head>
<title>left</title>
</head>
<body>
<br>
<form name="form1" action="">
<table>
<%List functList = (List)request.getAttribute("functList"); Funct f=null;
if(functList!=null)
{
System.out.println(functList.size());
for(int i=0;i<33;i++)
{
f=(Funct)functList.get(i);
%>
<a href="${pageContext.request.contextPath }/<%=f.getEnname()%>.do?menu=ShowAll"><font size="-2"><%=f.getEnname()%></font></a><br/>
<%}%>
<%}
%></table>
</body>
</html>b
c<body>
<form id="form1" name="form1" method="post" action="">
<table width="1075" height="678" border="1.5" align="center" bordercolor="#3270D5">
<tr>
<td width="1075" height="150"><%@ include file="top.jsp"%></td>
</tr> <tr>
<td width="132" rowspan="2"><%@ include file="left.jsp"%></td>
<td width="907" height="113"> <jsp:include page="Search/accreditorSearch.jsp"></jsp:include></td>
</tr>
<tr>
<td height="391"><table width="844" height="400" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCFFFF" frame=void>
<tr>
<td height="38" colspan="7"><div align="center"><span class="style1">消息提示:${msg}</span></div></td>
</tr>
<tr>
<td width="42" height="24">choose</td>
<td width="105" height="24">Id</td>
<td width="105" height="24">Name</td>
</tr>
<%
//循环输出用户基本信息
for (int i = 0; accreditorList != null && i < accreditorList.size(); i++) {
Accreditor accreditor = (Accreditor)accreditorList.get(i);
m++;
%>
<tr>
<td height="24"><input id="a" type="checkbox" name="multichoice" value="<%=i%>" readOnly></td>
<input type="hidden" id="b" name="Id<%=i%>" size="15" value="<%=accreditor.getId()%>" readOnly>
<td height="24"><input id="c" type="text" name="Id<%=i%>" size="15" value="<%=accreditor.getId()%>" readOnly></td>
<td height="24"><input id="d" type="text" name="name<%=i%>" size="15" value="<%=accreditor.getName()%>" readOnly></td>
</tr>
<%
}
%>
<!--始终保持一个空行以供输入-->
<tr>
<td height="24"><input id="1" type="checkbox" name="checkbox" value="<%=m%>" readOnly></td>
<input type="hidden" id="2" name="Id<%=m%>" size="15" value="" readOnly>
<td height="24"><input id="3" type="text" name="Id<%=m%>" size="15" value="" readOnly></td>
<td height="24"><input id="4" type="text" name="name<%=m%>" size="15" value="" readOnly></td>
</tr>
<tr>
</tr>
<tr>
<td colspan="7"><div align="center"></div> <div align="center">
<a href="DateAdd/employeeAdd.jsp">
<img src="../images/add.JPG">
</a>
<%
Accreditor accreditor = (Accreditor)accreditorList.get(0);
String id=accreditor.getId();
System.out.println("////");
System.out.println(id);
%>
<a href="javascript:doDelete('<%=id%>');"><img src="file:///D|/My Documents/未命名站点 1/refresh.jpg"></a>
<a href="javascript:doSubmit('${pageContext.request.contextPath}/accreditor.do?menu=modifyPage&id=<%=id%>')"><img src="file:///D|/My Documents/未命名站点 1/print.jpg"></a>
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>
你用ajax试试
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ include file="/commons/meta.jsp"%>
<title>成品检验</title>
</head>
<frameset rows="*" cols="196,*" frameborder="no" framespacing="0" name="Contenttop" id="Contenttop">
<frame src="<c:out value="${ctx}"/>/make/fqc/fqcLeft.do" name="left" scrolling="No" id="left" title="" />
<frame src='<c:out value="${ctx}"/>/make/util/utilPage.do' name="content" title="" id="content" />
</frameset>
<noframes><body></body></noframes>
</html><frameset>是a, 那两个<frame >就是你所说的b,c
这种东西就要用<frameset>,最外面的页面是个框架,把它其它3个子页面框在当前页面。点击子页面时,只是子页面状态变化,当前的页面状态不变,不会存在重新刷新状态的问题。<frameset>是另外一个新页面,就是个框架,用来框东西, 3个<frame >就是你所说的a,b,c你应该补一下最基本的html知识,frameset,div,之类的东西,还有适当补一下javascript.
这个是典型的<freamset>
在打开的页面中写三个
<freamset src="a.jsp" >
<freamset src="b.jsp" >
<freamset src="c.jsp" >
其中b.jsp 和 c.jsp设置tager做为跳转
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="template" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<html:html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head><frameset rows="75,*" border="0" bordercolor="#CCCCCC" frameborder="0" FRAMESPACING="3" TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">
<frame src="<%=request.getContextPath()%>/top.jsp" name="top" scrolling="NO" noresize width="1076" height="100">
<frame src="<%=request.getContextPath()%>/left.jsp" name="mainFrame" width="1076" height="100"></frameset>
<noframes>
<body style="border-style: solid; border-width: 3" topmargin="0" leftmargin="0">
</body>
</noframes>
</html:html>
我这样写的时候提示我="<%=request.getContextPath()%>/top.jsp和="<%=request.getContextPath()%>/left.jsp但是可以确定include的时候他们路径是正确的,纠结
用法:<div>
<iframe src="这里可放页面路径也可放请求" name="if" width="800" height="290" scrolling="auto" frameborder="0" marginWidth=0 marginHeight=0>
正在跳转 请稍候...
</iframe>
<div>
之后在页面写一个按钮<input type="button" value="点击" onclick="clickBut('参数');"/>下面是javascript代码<script>
function clickBut(obj){
window.frames["if"].location.href="这里可放页面路径或请求,要传参数的话也可以";
}
</script>
再补充一下 src=""里放的就是你功能的实现页面,可以直接为页面也可以为action请求,参数为拼链接方式传递ps:个人觉得iframe标签非常好用...