You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by itay sahar <it...@gmail.com> on 2009/06/03 18:25:00 UTC

tiles with css issue ?

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...

Re: tiles with css issue ?

Posted by itay sahar <it...@gmail.com>.
The access is different in each way:for the first: The direct option:
(without tiles)
   http://localhost:8080/myapplication/tiles/createDummy.jsp

The second( using tiles):
   http://localhost:8080/myapplication/createDummy.jsp<http://localhost:8080/myapplication/tiles/createDummy.jsp>

There are two files names createDummy.jsp:
1. The content.
2. The tiles references.
These files are described in the first message. Thanks again


On Wed, Jun 3, 2009 at 8:11 PM, itay sahar <it...@gmail.com> wrote:

> thanks Greg I also think it related to this but let see, well the css
> and/or javascript files are both in the directories:
>  TOMCAT_HOME\webapps\myapplication\css
> TOMCAT_HOME\webapps\myapplication\js
> In both cases. (please see that i refer to this files different way in
> those cases.)
>
> And again the first works good while the other is not as good as the first.
> (The files are recognize in both ways- cause i see results... but the
> result is differnet
> --some images alignment etc).
> can figure out what i'm doing wrong. Or just Tiles make a mess in using
> advance css/javascript functionality.
>
>
> On Wed, Jun 3, 2009 at 7:51 PM, Greg Reddin <gr...@gmail.com> wrote:
>
>> Could it be an issue with your Javascript and CSS URLs? If you're
>> hitting both of those methods with the URL
>>
>>    http://localhost:8080/myapplication/tiles/createDummy.jsp
>>
>> then I don't see how it could work the way you coded it in the example
>> you showed.
>>
>> In your first method you have this:
>>
>> > <script language="javascript" type="text/javascript"
>> > src="mypage.js"></script>
>> > <link rel="stylesheet" type="text/css" media="all" href="mypage.css" />
>>
>> In your 2nd method you have this:
>>
>> > <script language="javascript" type="text/javascript"
>> > src="js/mypage.js"></script>
>> >
>> > <link rel="stylesheet" type="text/css" media="all" href="css/mypage.css"
>> />
>>
>> Unless you moved the Javascript and CSS into js/ and css/ directories
>> then the 2nd method would most definitely not work. If those files
>> were already in those directories, then the first method would not
>> work.
>>
>> Greg
>>
>
>

Re: tiles with css issue ?

Posted by itay sahar <it...@gmail.com>.
thanks Greg I also think it related to this but let see, well the css and/or
javascript files are both in the directories:
 TOMCAT_HOME\webapps\myapplication\css
TOMCAT_HOME\webapps\myapplication\js
In both cases. (please see that i refer to this files different way in those
cases.)

And again the first works good while the other is not as good as the first.
(The files are recognize in both ways- cause i see results... but the result
is differnet
--some images alignment etc).
can figure out what i'm doing wrong. Or just Tiles make a mess in using
advance css/javascript functionality.


On Wed, Jun 3, 2009 at 7:51 PM, Greg Reddin <gr...@gmail.com> wrote:

> Could it be an issue with your Javascript and CSS URLs? If you're
> hitting both of those methods with the URL
>
>    http://localhost:8080/myapplication/tiles/createDummy.jsp
>
> then I don't see how it could work the way you coded it in the example
> you showed.
>
> In your first method you have this:
>
> > <script language="javascript" type="text/javascript"
> > src="mypage.js"></script>
> > <link rel="stylesheet" type="text/css" media="all" href="mypage.css" />
>
> In your 2nd method you have this:
>
> > <script language="javascript" type="text/javascript"
> > src="js/mypage.js"></script>
> >
> > <link rel="stylesheet" type="text/css" media="all" href="css/mypage.css"
> />
>
> Unless you moved the Javascript and CSS into js/ and css/ directories
> then the 2nd method would most definitely not work. If those files
> were already in those directories, then the first method would not
> work.
>
> Greg
>

Re: tiles with css issue ?

Posted by Greg Reddin <gr...@gmail.com>.
Could it be an issue with your Javascript and CSS URLs? If you're
hitting both of those methods with the URL

    http://localhost:8080/myapplication/tiles/createDummy.jsp

then I don't see how it could work the way you coded it in the example
you showed.

In your first method you have this:

> <script language="javascript" type="text/javascript"
> src="mypage.js"></script>
> <link rel="stylesheet" type="text/css" media="all" href="mypage.css" />

In your 2nd method you have this:

> <script language="javascript" type="text/javascript"
> src="js/mypage.js"></script>
>
> <link rel="stylesheet" type="text/css" media="all" href="css/mypage.css" />

Unless you moved the Javascript and CSS into js/ and css/ directories
then the 2nd method would most definitely not work. If those files
were already in those directories, then the first method would not
work.

Greg