Solved

<jsp:include> not working properly

Posted on 2010-08-12
13
673 Views
Last Modified: 2012-06-21
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

0
Comment
  • 6
  • 4
  • 2
  • +1
13 Comments
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
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
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
Ten how can be design the page?
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Just make sure the included jsp doesn't contain tags that duplicate major page tags (e.g. body, head)
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
i can use <html></html> more than one html tag in a page right ?
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
<%@ 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
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>i can use <html></html> more than one html tag in a page right ?

No. There should be only one
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 92

Expert Comment

by:objects
Comment Utility
> i can use  more than one html tag in a page right ?

you should avoid it, biut it won't stop it displaying.
0
 
LVL 4

Expert Comment

by:ProgSysAdmin
Comment Utility
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
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
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
 
LVL 92

Expert Comment

by:objects
Comment Utility
> . Calling it 'header' implies that it should probably be included immediately after the opening  in the parent page

header comes before the body
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>header comes before the body

Nothing comes before body that's not metadata
0
 
LVL 20

Accepted Solution

by:
Sathish David  Kumar N earned 0 total points
Comment Utility
<link rel="stylesheet" type="text/css" href="../css/bioOrigin.css">
 
i change ../ or  in front i put request.contextpath() its working fine ..
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Yes, a missing stylesheet would certainly do it ;)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now