Hi all,
 
  I have a problem in including files dynamically using jsp:include.
 Below i have placed the code.Please go thru this..and tell me am i doing something wrong.
 
Thanks & Regards
Veena
=========================================================================
<%-- TestInclude.jsp --%>
<%@ page language="java"%>
<% String a="Veena"; %>
<%! String m="VIDHYA"; %>
 
<%
if (session.getValue("staticPage")==null)
session.putValue("staticPage","b.jsp");
 

String newPage=request.getParameter("staticPage");
if (newPage!=null) session.putValue("staticPage",newPage);
 
String p= (String)session.getValue("staticPage");
%>
 
<HTML>
<BODY>
<BR><BR>
<B>Page <%=p%>:(<%= request.getMethod() %>)</B><BR><BR>
<BR><BR><BR>
<FORM method="post" action="/TestInclude.jsp">
<input type="hidden" name="staticPage" value="c.jsp">
<input type="submit">
</FORM>
 
The current date and time are
<%-- here iam including static file --%>
<%@ include file="Date.jsp" %>
 
<%--
 here iam including file dynamically based on the condition which is not being included
do u have any idea of why this is happening
--%>
<jsp:include page="<%= p %>" flush="true" />
</BODY>
</HTML>
 
===================================================
 
<%-- b.jsp --%>
 
<HTML>
<BODY>
This is page B
</BODY>
</HTML>
=======================================
<%-- c.jsp --%>
 
<HTML>
<BODY>
This is page C
</BODY>
</HTML>
===============================
<%-- date.jsp: --%>
<%@ page import="java.util.*" %>
<%= (new java.util.Date() ).toLocaleString() %>
<% System.out.println("the value is ="+a); %>
<% out.println("<br>"); %>
<% out.println(a); %>
=========================
 

Reply via email to