Solved

How to separate pages with dynamic content

Posted on 2004-10-28
183 Views
Last Modified: 2013-11-24
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
Question by:borg48
    5 Comments
     
    LVL 13

    Expert Comment

    by:petmagdy
    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
     

    Author Comment

    by:borg48
    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
     
    LVL 13

    Expert Comment

    by:petmagdy
    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
     

    Author Comment

    by:borg48
    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
     
    LVL 13

    Accepted Solution

    by:
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: MongoDB Object-Document Mapper for NodeJS

    NodeJS (JavaScript on the server) is awesome, but some developers get confused about NoSQL when it comes to working in Node with MongoDB (NoSQL database). Do you need a better explanation of how to use Node.js with MongoDB? The most popular choice is the Mongoose library.

    Suggested Solutions

    Title # Comments Views Activity
    Using Tomcat as raspberry pi java app server 13 55
    struts spring hibernate example 12 45
    Help on HTML 1 47
    haveThree challenge 22 81
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    913 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

    12 Experts available now in Live!

    Get 1:1 Help Now