Hello, I will go direct to the point. I have tried to run a jsp in two ways:

   1. Direct Access:

 Access it directly (without using tiles). The jsp include all. (Html, body
etc:)

createDummy.jsp :  path: TOMCAT_HOME\webapps\myapplication\tiles

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title>MyPage</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" type="text/javascript"
src="mypage.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="mypage.css" />
</head>

<body bgcolor="#FFFFFF"><div id="container">
<form action="bla bla" method="post" class="mypageStyle">
<fieldset>
....
....

2. Using Tiles as follow:

tiles.xml (Tiles version: Tiles2  2.0.5   3 jars included). path:
TOMCAT_HOME\webapps\myapplication\WEB-INF

<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
       "http://tiles.apache.org/dtds/tiles-config_2_0.dtd";>
<tiles-definitions>
             .....
            <definition name=".myLayout"
template="/layouts/myLayout.jsp"></definition>
            ......
</tiles-definitions>

createDummy.jsp file: path: TOMCAT_HOME\webapps\myapplication\

<%@ taglib uri="http://tiles.apache.org/tags-tiles"; prefix="tiles" %>

<tiles:insertDefinition name=".myLayout">
<tiles:putAttribute name="title" value="Create Dummy Page"/>
<tiles:putAttribute name="body" value="/tiles/createDummy.jsp"/>
</tiles:insertDefinition>

myLayout.jsp file: path: TOMCAT_HOME\webapps\myapplication\layouts\

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"; %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"; %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles"; prefix="tiles" %>

<html>
<head>
<title><tiles:getAsString name="title"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" type="text/javascript"
src="js/mypage.js"></script>

<link rel="stylesheet" type="text/css" media="all" href="css/mypage.css" />
</head>

<body bgcolor="#FFFFFF">
   <f:view>
 <tiles:insertAttribute name="body" flush="false"/>
 </f:view>
</body>
</html>

createDummy.jsp path: TOMCAT_HOME\webapps\myapplication\tiles

<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"; %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"; %>
<%@ taglib prefix="a4j" uri="http://richfaces.org/a4j"; %>
<%@ taglib prefix="rich" uri="http://richfaces.org/rich"; %>

<f:loadBundle basename="...................." var="msg"/>

<f:subview id="editDummy">
<div id="container">
<form action="........." method="post" class="niceStyle">
<fieldset>
             .....
             .....


Till now looking good? Well not exactly. The first version is works fine
(while access to the following path:
http://localhost:8080/myapplication/tiles/createDummy.jsp<http://localhost:8080/ginvest/tiles/createFund.jsp>
 while the second case i encountered css style/javascript/design issue with
my page. It hard to explain what the problem exactly but i would say that
there exist a difference between two approaches. Can you figure it out ?
Thanks...

Reply via email to