<jsp:include> not working properly

Hi ,

I have header.jsp that have menu thats have .
i inculd in one page it working fine but in another page its not workinng. it not picking the JS file correctly i dont why ?

 I attach 3 jsp plz look at this
1 st Jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>


<html:html>
<link rel="stylesheet" type="text/css" href="css/bioOrigin.css.css">
<head>
<title>Report Generation</title>
<div>
<jsp:include page="/header.jsp" />
</div>
<table style="WIDTH: 1224px; HEIGHT: 65px" height="45" cellspacing="1"
	cellpadding="1" width="1240" summary="" border="0">
	<tbody>
		<tr>
			<td bgcolor="#006666"><font face="Arial">
			<h3 align="center"><b><font face="Arial" size="5"><bean:message
				key="title.report" /></font></b></h3>
			</font></td>
		</tr>
	</tbody>
</table>

</head>

<body bgcolor="white">
<fieldset align="center" style="width: 50%;"><form
 method="post">

	<table border="0" width="100%" align="Center" bgcolor="4A9586">
		<tr>
			<td align="center" width="80%">&nbsp;</td>
			<td align="right" width="30%"><font face="Arial" size="1"><input
				type="button" onClick="returntoHome()"
				value="<bean:message key="button.report.back"/>" /></font></td>
		</tr>
	</table>
	<fieldset style="border-color: BDFFEA">
	<table border="0" width="100%" align="left">
		<tr>
			<td bgcolor="skyblue"><strong><font face="Arial"><font
				size="2"><bean:message key="leble.report.wholesalerselect" />:</font></font></strong></td>
			<td>
			<input type="radio" name="selected_Wholesaler" value="ALL" checked /><font face="Arial" size="2"><bean:message
				key="radio.report.allwholesaler" />&nbsp;&nbsp;&nbsp;</font>
			 <input	type="radio" name="selected_Wholesaler" value=" " /> 
			 <%--  <input type="radio" name="disb" value="true" onClick="DisBox(this,document.Distbox.txta)" checked/> --%>
			<input type="text" disabled  name="selected_Wholesaler" value="" size="28" />
			<input type="button" onClick="myPopup()" name ="search" value="...." /></td>
		</tr>
		<tr>
			<td bgcolor="skyblue">
			<p align="left"><strong><font face="Arial"><font
				size="2"><bean:message key="dropmenu.report.year" />:</font></font></strong></p>
			</td>
			<td><select name ="yearselection">
				<option value="2010" selected="selected"><bean:message
					key="report.2010" /></option>
				<option value="2011"><bean:message key="report.2011" /></option>
				<option value="2012"><bean:message key="report.2012" /></option>
				<option value="2013"><bean:message key="report.2013" /></option>
				<option value="2014"><bean:message key="report.2014" /></option>
				<option value="2015"><bean:message key="report.2015" /></option>
			</select></td>
			<%--   <td>
          <bean:define id="yearList"  name="grnForm"  property="yearList"/>
          <html:select name="grnForm" property="selected_Year" >
    	  <html:options collection="yearList" property="code" labelProperty="description"/>
   		  </html:select> 
   		 </td>  --%>
		</tr>

		<tr>
			<td align="left" bgcolor="skyblue"><strong><font
				face="Arial" size="2"><bean:message
				key="lable.report.producttype" />:</font></strong></td>
			<td>
			<input type="radio" name="producttype" value="MSD" /> <font
				face="Arial" size="2"><bean:message key="radio.report.MSD" />&nbsp;</font> 
			<input type="radio" name="producttype" value="Ex-Oganon" /><font
				face="Arial" size="2"><bean:message
				key="radio.report.Exorganon" /> &nbsp;</font>
			<input type="radio" name="producttype" value="Both" checked /><font face="Arial"
				size="2"><bean:message key="radio.report.bothproduct" /></font></td>
		</tr>

		<tr>
			<td align="left" bgcolor="skyblue"><strong><font
				face="Arial" size="2"><bean:message
				key="leble.report.totalsumflag" />:</font></strong></td>
			<td><input type="radio" name="totalsumflag"
				value="Onlyrelated" checked /><font face="Arial" size="2">
			<bean:message key="radio.report.onlyrelatedflag" /> &nbsp;</font> <input
				type="radio" name="totalsumflag" value="Both" /><font face="Arial"
				size="2"><bean:message key="radio.report.bothflag" /> &nbsp;</font></td>
		</tr>
	</table>
	</fieldset>

	<table border="0" width="50%" align="center">
		<tr>
			<td align="center" width="50%"><%-- <html:button property="download" ><bean:message key="report.download"/></html:button> --%>

			<%-- <a href="xlsSample.jsp" >convert XLS </a>   --%> <input
				type="button" onClick="downloadReport()"
				value="<bean:message key="button.report.download"/>" /></td>
		</tr>
	</table>
</form></fieldset>

</body>
</html:html>



2 Jsp 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<jsp:include page="/header.jsp" />
</body>
</html>

header.jsp

<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>¿¿¿¿¿¿</title>

<script type="text/javascript" src="ddtabmenufiles/ddtabmenu.js">
</script>


<link rel="stylesheet" type="text/css" href="ddtabmenufiles/ddcolortabs.css" />


<script type="text/javascript">
//SYNTAX: ddtabmenu.definemenu("tab_menu_id", integer OR "auto")
ddtabmenu.definemenu("ddtabs4",0);

</script>
</head>
<body>
<bean:message key="link.home.reportGeneration"/>

<div id="ddtabs4" class="ddcolortabs">
<ul>
<li><a href="#"><span>Home</span></a></li>
<li><a href="javascript:reportGeneration()"><span><bean:message key="link.home.reportGeneration"/></span></a></li>
<li><a href="javascript:manualInput()"><span><bean:message key="link.home.manualInput"/></span></a></li>
<li><a href="javascript:MDPSUpload()"><span><bean:message key="link.home.MDPSUpload"/></span></a></li>
<li><a href="javascript:ErrorDataCorrection()"><span><bean:message key="link.home.errorDataCorrection"/></span></a></li>
</ul>
</div>
<div class="ddcolortabsline">&nbsp;</div>
<br>
</br>
<br></br>
<div class="footerline">
<center>Copyright © 2010 <a href="buttonSample.jsp">Banyu</a>. All rights reserved.</center>
</div>

</body>

</html>

Open in new window

LVL 20
Sathish David  Kumar NArchitectAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Well, you're lucky that either of them is working ;) The html would be wildly wrong, e.g. having two body tags (which is contained in the include)
0
Sathish David Kumar NArchitectAuthor Commented:
Ten how can be design the page?
0
CEHJCommented:
Just make sure the included jsp doesn't contain tags that duplicate major page tags (e.g. body, head)
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Sathish David Kumar NArchitectAuthor Commented:
i can use <html></html> more than one html tag in a page right ?
0
Sathish David Kumar NArchitectAuthor Commented:
<%@ page language="java" contentType="text/html; charset=UTF-8"  
        pageEncoding="UTF-8" %>  
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>  
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>  
 
 
 
<jsp:include page="/header.jsp" />  
i put like this that time also its wont display y ??
0
CEHJCommented:
>>i can use <html></html> more than one html tag in a page right ?

No. There should be only one
0
objectsCommented:
> i can use  more than one html tag in a page right ?

you should avoid it, biut it won't stop it displaying.
0
ProgSysAdminCommented:
I concur with objects.  

Below is what I would put as header.jsp.

You might want to consider another jsp:include for footer.jsp as the code for the footer which would be the same concept as the header.jsp.
header.jsp

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>

<bean:message key="link.home.reportGeneration"/>

<div id="ddtabs4" class="ddcolortabs">
<ul>
<li><a href="#"><span>Home</span></a></li>
<li><a href="javascript:reportGeneration()"><span><bean:message key="link.home.reportGeneration"/></span></a></li>
<li><a href="javascript:manualInput()"><span><bean:message key="link.home.manualInput"/></span></a></li>
<li><a href="javascript:MDPSUpload()"><span><bean:message key="link.home.MDPSUpload"/></span></a></li>
<li><a href="javascript:ErrorDataCorrection()"><span><bean:message key="link.home.errorDataCorrection"/></span></a></li>
</ul>
</div>
<div class="ddcolortabsline">&nbsp;</div>
<br>
</br>
<br></br>

Open in new window

0
CEHJCommented:
What displays will be dictated by the stylesheet and stylesheets are not designed to work with invalid html.

Just make sure that the root node in the include file is no more important than <div> (it almost certainly should *be* div) and you should be ok. Calling it 'header' implies that it should probably be included immediately after the opening <body> in the parent page
0
objectsCommented:
> . Calling it 'header' implies that it should probably be included immediately after the opening  in the parent page

header comes before the body
0
CEHJCommented:
>>header comes before the body

Nothing comes before body that's not metadata
0
Sathish David Kumar NArchitectAuthor Commented:
<link rel="stylesheet" type="text/css" href="../css/bioOrigin.css">
 
i change ../ or  in front i put request.contextpath() its working fine ..
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
Yes, a missing stylesheet would certainly do it ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.