• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

How to separate pages with dynamic content

I have a question on how to accomplish the following:
I have a war file that has a jsp file called business.jsp.
This page has dynamic content that is filled in with jstl xml.

So i have the following page example:
<%@ page language="java" import="java.lang.*,java.util.*,com.customer.care.constants.*" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<x:parse var="xmlDoc">
      <%=(String)request.getSession().getAttribute( Constants.SESSION_ATTRIB_XML_DATA_FOR_APPLICATION ) %>
</x:parse>

<x:parse var="xmlAppModeDoc">
      <%=(String)request.getSession().getAttribute( Constants.SESSION_ATTRIB_XML_DATA_FOR_APPLICATION_MODE ) %>
</x:parse>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
...
...

<td bgcolor='#3DC8C4'>
            <x:choose>
                  <x:when select="$xmlDoc//QuestionLists[@accountId != '0']">
                        Customer Account #&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<x:out select="$xmlDoc//QuestionLists/@accountId" />
                  </x:when>
                  <x:when select="$xmlDoc//QuestionLists[@accountId = '0']">
                        <x:choose>
                              <x:when select="$xmlDoc//QuestionLists[@anonymousId != '0']">
                                    Anonymous Account #&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;<x:out select="$xmlDoc//QuestionLists/@anonymousId" />
                              </x:when>
                              <x:otherwise>
                                    Cannot be tracked
                              </x:otherwise>
                        </x:choose>
                  </x:when>
            </x:choose>
..
..
</html>


This page has allot of content and from time to time the business
wants to change the content and some changes are so simple but b/c
we have had problems of deploying a new war file (after deploying
x number of times we can no longer deploy).  We have to stop and
start the servlet container.

What i was thinking of doing but not quite sure if this is something
that can be done is as follows:

Create either a web folder in our apache front end or a directory folder
and strip all the content in business.jsp page and put it into business.html
which will reside in either the web folder  on apache or a regular directory
folder.

When i say move everything i also mean all the jstl tags, etc.  I dont want
to create individual pages to go around the jstl tags b/c it may be harder
to manage.

So when i call the business.jsp through the browser, the business.jsp will
call the html page then build the dynamic content.

My question is can this be done and if so what is the best way of doing it?
How would you call business.html to business.jsp  from the apache folder
or the regular directory folder?

Thanks in advance
0
borg48
Asked:
borg48
  • 3
  • 2
1 Solution
 
petmagdyCommented:
I not quite sure ur exact requirment but I think u need something like <jsp:include > to separate ur static portions into html on apache and include it from ur dynamic Jsp
0
 
borg48Author Commented:
Since all the jstl is on the html when i do an include will it then be processed properly:
Will it follow these steps?
1.  call business.jsp
2.  jsp page does an include to business.html
3.  jstl and dynamic content is then build
4.  new html page is displayed.

0
 
petmagdyCommented:
please note that u can also include another JSP than contains jstl and other dynamic content, but if u will include html, it will only contain static content, usually web applications that has header and footer repeated in every jsp page, separate the header and footer into 2 htmls or jsps and included in all jsp pages
0
 
borg48Author Commented:
Can i include the jsp page from outside the servlet container?  As in my examples and when i load it  from the call of the business.jsp it will process all the jstl properly?
0
 
petmagdyCommented:
Apache has a tag to scrab pages out side ur container u can download this from:

http://jakarta.apache.org/taglibs/doc/scrape-doc/intro.html

and read the Tag Library documentation at

http://jakarta.apache.org/taglibs/doc/scrape-doc/index.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now