RE: Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Dick Starr
Correction: Typo error in my example definition:

My example definition did not include slashes. I have used slashes
because navigation rules required them (although I seem to remember a
post saying that restriction has been removed - but I havn't tested
this) My example definition should be:


  


-Original Message-
From: Dick Starr 
Sent: Wednesday, October 11, 2006 8:42 AM
To: user@shale.apache.org
Subject: RE: Tiles Failure in GlassFish:
org.apache.tiles.NoSuchDefinitionException

I never did like the fact that my index.jsp couldn't just reference a
tile, but it was the only way I could make it work (all my other jsp's
could reference tiles). However, I have continued to upgrade to the
latest releases in the hopes of improving things, and I am now running
the 10/4/06 release of Shale.

My index.jsp now says  where
"systemLogon.faces" is a tile def as follows:


  


Dick

-Original Message-
From: Antonio Petrelli [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 11, 2006 6:50 AM
To: user@shale.apache.org
Subject: Re: Tiles Failure in GlassFish:
org.apache.tiles.NoSuchDefinitionException

Gregg Leichtman ha scritto:
> Sorry, I'm still confused as to how my original approach is different
> from Mr. Starr's. As far as I can see, he seems to be inserting tiles 
> in his /tiles/layouts/classicLayout _directly_ from the "puts" for
title
> and body, not from an extended definition wrapped around either the
> title or body. Is his approach correct because he is inserting from
> "puts" that are defined within an extended definition?
>   

No, it has nothing to do with extended definitions.
Again, your "index.jsp" pages says:

*snip*



*snap*

I suppose that siteLayout.faces points to siteLayout.jsp, right?
Ok, as far as I can see, your siteLayout.jsp is a layout page. A layout 
page is made of NOT FILLED attributes. You can fill them through the use

of definitions, as you did in:

*snip*












*snap*

But you forward to "siteLayout.faces" (that forwards to 
"siteLayout.jsp") that is used by "/mainLayout" definition. Instead you 
need to "forward" to the definition itself, not its layout page!
Therefore, prepare a JSP page containing:


HTH
Antonio

P.S.: I committed some code that corrects some misleading exception 
messages. Anyway to check it, you should download the source code from
SVN.




Re: Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Greg Reddin


On Oct 11, 2006, at 6:06 AM, Gregg Leichtman wrote:


I suppose that I could create a different definition like:











	



and then use



however, I have used the previous method for rendering the "put"  
described _within_ the definition successfully under Tomcat with  
shale-1.0.3. This is also described by Dick Starr at:


Antonio was correct, but I think his point somehow got lost.  You  
don't actually need another definition.  You need another JSP page.   
Let's break it down with a simple example:


Suppose you have a definition:


  
  
  


Then here's foobar.jsp:




  
  
  




If you just type "/foobar.jsp" into your browser Tiles is going to  
blow up saying you're trying to insert a definition called "header"  
which it can't find.  It doesn't realize you are already *in* a  
definition called "foobar" and you're trying to insert an *attribute*  
called "header" because you never invoked Tiles to get the definition  
called "foobar".  Therefore Tiles thinks you're looking for a  
definition called "header".


To make the above example work you need an intermediate JSP.  Let's  
call it intermediate.jsp.  Here's what it would look like in its  
entirety:


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


Then, instead of typing "/foobar.jsp" in your browser you'd type "/ 
intermediate.jsp" in your browser.  Tiles will go find the definition  
called "foobar", invoke the foobar.jsp template and process your  
header, body, and footer.


In JSF, by doing > you are calling /siteLayout.jsp directly - as if you simply typed  
the name of that page in your browser.  You are not using Tiles to  
invoke the template, you are invoking it directly.  Using the example  
above you need to do something like this:


index.jsp:



intermediate.jsp:

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


Or in your case, intermediate.jsp would look like this:

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


There are two reasons why this is confusing:

1)  Tiles has no controller.   You would like to be able to invoke  
Tiles by simply calling the template page, but you can't.  You have  
to either call an intermediate page that invokes the template using  
the  tag to insert the definition.  Or you have to use  
a controller architecture like Struts or JSF that knows how to  
forward to a Tiles definition.  In essence, Struts and JSF are doing  
the  for you in the  
TielsRequestProcessor and TilesViewHandler respectively.  Those  
components know how to call into Tiles, get a Tiles definition, and  
process it.


Perhaps you'd like Tiles to have a controller so you could type a URL  
like "http://mywebapp/mainLayout.tiles"; and a Servlet or something  
would insert the "mainLayout" definition.  But we probably won't do  
that because Tiles was not meant to be a controller, it was meant to  
work with other controllers like Struts or JSF.  In "standalone" mode  
it requires an intermediate JSP.


Another option for improvement would be to make Tiles work more like  
Facelets.  Facelets does not require the intermediate page.  In  
Facelets you define your template in a page called / 
siteLayout.xhtml".  Then, if you have a page called "foobar" that  
extends the template, you directly invoke "/foobar.xhtml"  This page  
then "includes" the template.  Tiles requires the intermediate page  
because it works the other way around.  Instead of having pages that  
include templates, Tiles has definitions that extend templates and  
include pages.  I could give an example but it would just make this  
post a lot longer.


2)  The  tag is overloaded to mean too many things.   
 can be used to insert definitions, attributes, pages,  
strings, and probably scrambled eggs :-)  So when you see a  
 tag you need to look further to see what context it is  
in.  Is it trying to insert an attribute?  a definition?  We're  
trying to figure out the best way to address this issue.  It will  
probably mean different tags to do different things.


I hope that clears it up.
Thanks,
Greg


RE: Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Dick Starr
I never did like the fact that my index.jsp couldn't just reference a
tile, but it was the only way I could make it work (all my other jsp's
could reference tiles). However, I have continued to upgrade to the
latest releases in the hopes of improving things, and I am now running
the 10/4/06 release of Shale.

My index.jsp now says  where
"systemLogon.faces" is a tile def as follows:


  


Dick

-Original Message-
From: Antonio Petrelli [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 11, 2006 6:50 AM
To: user@shale.apache.org
Subject: Re: Tiles Failure in GlassFish:
org.apache.tiles.NoSuchDefinitionException

Gregg Leichtman ha scritto:
> Sorry, I'm still confused as to how my original approach is different
> from Mr. Starr's. As far as I can see, he seems to be inserting tiles 
> in his /tiles/layouts/classicLayout _directly_ from the "puts" for
title
> and body, not from an extended definition wrapped around either the
> title or body. Is his approach correct because he is inserting from
> "puts" that are defined within an extended definition?
>   

No, it has nothing to do with extended definitions.
Again, your "index.jsp" pages says:

*snip*



*snap*

I suppose that siteLayout.faces points to siteLayout.jsp, right?
Ok, as far as I can see, your siteLayout.jsp is a layout page. A layout 
page is made of NOT FILLED attributes. You can fill them through the use

of definitions, as you did in:

*snip*












*snap*

But you forward to "siteLayout.faces" (that forwards to 
"siteLayout.jsp") that is used by "/mainLayout" definition. Instead you 
need to "forward" to the definition itself, not its layout page!
Therefore, prepare a JSP page containing:


HTH
Antonio

P.S.: I committed some code that corrects some misleading exception 
messages. Anyway to check it, you should download the source code from
SVN.



Re: Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Antonio Petrelli

Gregg Leichtman ha scritto:

Sorry, I'm still confused as to how my original approach is different
from Mr. Starr's. As far as I can see, he seems to be inserting tiles 
in his /tiles/layouts/classicLayout _directly_ from the "puts" for title

and body, not from an extended definition wrapped around either the
title or body. Is his approach correct because he is inserting from
"puts" that are defined within an extended definition?
  


No, it has nothing to do with extended definitions.
Again, your "index.jsp" pages says:

*snip*



*snap*

I suppose that siteLayout.faces points to siteLayout.jsp, right?
Ok, as far as I can see, your siteLayout.jsp is a layout page. A layout 
page is made of NOT FILLED attributes. You can fill them through the use 
of definitions, as you did in:


*snip*

   
   
   
   
   
   

   
   
   

*snap*

But you forward to "siteLayout.faces" (that forwards to 
"siteLayout.jsp") that is used by "/mainLayout" definition. Instead you 
need to "forward" to the definition itself, not its layout page!

Therefore, prepare a JSP page containing:


HTH
Antonio

P.S.: I committed some code that corrects some misleading exception 
messages. Anyway to check it, you should download the source code from SVN.


Re: Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Gregg Leichtman
I'm referring to the following post from Mr. Starr:


RE: Shale 1.0.3 and Tiles Question - Tag Question



Click to flag this post 

by Dick Starr  Sep
13, 2006; 12:06pm :: Rate this Message: Click to rate as Poor Post
Click
to rate as Below Average Post
Click
to rate as Average Post
Click
to rate as Above Average Post
Click
to rate as Excellent Post
Click
to clear rating

- Use ratings to moderate (? )

Reply  | Reply to
Author  |
View Threaded  |
Link to this Message



I installed the 20060911 version and got NullPointerExceptions. It is
working now however, with the following fixes:

(1) My index.jsp contained 

where my /tiles/system/SaLogon.jsp now contains

(to get it to work I added the type="definition").

(2)
In my tiles.xml I have

  put name="header" ...
  put name="menuBar" ...
  put name="body" value=""/>
  ...




(saLogon.jsp is an 
...

...

...

My tiles inserts work whether or not each insert is bracketed by a
subview.


Dick

Sorry, I'm still confused as to how my original approach is different
from Mr. Starr's. As far as I can see, he seems to be inserting tiles 
in his /tiles/layouts/classicLayout _directly_ from the "puts" for title
and body, not from an extended definition wrapped around either the
title or body. Is his approach correct because he is inserting from
"puts" that are defined within an extended definition?

  -=> Gregg <=-

Antonio Petrelli wrote:
> Gregg Leichtman ha scritto:
>> I suppose that I could create a different definition like:
>>
>> 
>> 
>> > value="/tiles/headerTile.jsp"/>
>> > value="/tiles/rightSideBarTile.jsp"/>
>> > value="/tiles/footerTile.jsp"/>
>> 
>>
>> 
>> > value="/tiles/htmlHeaderTile.jsp"/>
>> 
>>
>> and then use
>> 
>>   
>
> This is the *right* way!
>
>> however, I have used the previous method for rendering the "put"
>> described _within_ the definition successfully under Tomcat with
>> shale-1.0.3. This is also described by Dick Starr at:
>>
>> 
>> http://www.nabble.com/Shale-1.0.3-and-Tiles-Question---Tag-Question-t2204571.html#a6288731
>>
>>   
>
> I suppose that Dick describes an already fixed bug, since its NPE
> stack trace points to a line where there is no code.
>
>> Are both of use doing different things?
>
> Sure! You are trying to forward to a layout page without filling
> attributes, you have to forward to a page that contains a
> 
> Dick did the right thing.
>
>>  If so, can you point out what I'm doing that is different or
>> something that is now obsolete in shale-1.0.4?
>>   
>
> It has nothing to do with Shale, eventually it is a Tiles bug (though
> in this case is a bug of yours :-) ).
>
> Ciao
> Antonio
>



signature.asc
Description: OpenPGP digital signature


Re: Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Antonio Petrelli

Gregg Leichtman ha scritto:

I suppose that I could create a different definition like:












and then use 



  


This is the *right* way!


however, I have used the previous method for rendering the "put" described 
_within_ the definition successfully under Tomcat with shale-1.0.3. This is also 
described by Dick Starr at:


http://www.nabble.com/Shale-1.0.3-and-Tiles-Question---Tag-Question-t2204571.html#a6288731
  


I suppose that Dick describes an already fixed bug, since its NPE stack 
trace points to a line where there is no code.



Are both of use doing different things?


Sure! You are trying to forward to a layout page without filling 
attributes, you have to forward to a page that contains a name="definitionName" />

Dick did the right thing.


 If so, can you point out what I'm doing that is different or something that is 
now obsolete in shale-1.0.4?
  


It has nothing to do with Shale, eventually it is a Tiles bug (though in 
this case is a bug of yours :-) ).


Ciao
Antonio


Re: Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Gregg Leichtman
I suppose that I could create a different definition like:












and then use 



however, I have used the previous method for rendering the "put" described 
_within_ the definition successfully under Tomcat with shale-1.0.3. This is 
also described by Dick Starr at:


http://www.nabble.com/Shale-1.0.3-and-Tiles-Question---Tag-Question-t2204571.html#a6288731

where he inserts the title and body "puts" successfully. Are both of use doing 
different things? If so, can you point out what I'm doing that is different or 
something that is now obsolete in shale-1.0.4?

 -=> Gregg <=-





Antonio Petrelli wrote:
> Gregg Leichtman ha scritto:
>> /index.jsp:
>>
>> 
>>   
>
> The problem is that you are trying to forward to a layout page,
> without filling its attributes.
> You have to forward to a page that contains:
>
>  (I guess this is what you need)
>
> where "/welcomePage" is the name of the definition.
>
> Ciao
> Antonio
>



signature.asc
Description: OpenPGP digital signature


Re: Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Antonio Petrelli

Gregg Leichtman ha scritto:

/index.jsp:


  


The problem is that you are trying to forward to a layout page, without 
filling its attributes.

You have to forward to a page that contains:

 (I guess this is what you need)

where "/welcomePage" is the name of the definition.

Ciao
Antonio


Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Gregg Leichtman
Ok, let's try this again with proper English.

At Greg Reddin's suggestion I have moved to GlassFish v2_b20 in an
attempt to get past the need to use the verbatim tag around all non JSF
tags within a tile.

I have run into a problem that seems to be identical to the fixed
problem described in SB-37:  tag does not support
correctly the "name" attribute.

Here are what I believe to be pertinent snippets from various pieces of my
webapp.

/tiles-defs.xml:



 http://struts.apache.org/dtds/tiles-config_2_0.dtd";>




   













/web.xml:

...
  
  
index.jsp
  
...

/index.jsp:



/tiles/layouts/siteLayout.jsp

<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles"; prefix="tiles" %>





http://localhost:8080/TilesBug/tiles/layouts/siteLayout.jsp";>



   









/tiles/htmlHeaderTile.jsp

<%@ taglib uri="http://java.sun.com/jstl/core"; prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>





I am using the following libs:

commons-beanutils-1.7.0.jar
commons-chain-1.1.jar
commons-digester-1.7.jar
commons-logging-1.1.jar
javaee.jar
jsf-impl.jar
shale-core-1.0.4-SNAPSHOT.jar
shale-spring-1.0.4-SNAPSHOT.jar
shale-tiles-1.0.4-SNAPSHOT.jar
spring-beans-1.2.8.jar
spring-context-1.2.8.jar
spring-core-1.2.8.jar
spring-web-1.2.8.jar
tiles-core-2.0-SNAPSHOT-20060922.jar

The javaee and jsf-impl jars came directly from the latest j2ee 5
installation.

I have successfully gotten the siteLayout.jsp page to render, if the
tiles:insert tag is commented out, so I know that JSF is getting that
far. I have also used the tiles-defs.xml and web.xml files in my
previous Tomcat tests successfully albeit with the verbatim tags
peppered all over the place. Does anyone see why I should receive the
following exceptions:

[#|2006-10-11T05:47:11.145-0400|SEVERE|sun-appserver-pe9.1|javax.enterprise.system.container.web|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;_RequestID=b9de8883-434e-4aac-b919-73480e7c1a4b;|ApplicationDispatcher[/tilestest3]
PWC1231: Servlet.service() for servlet jsp threw exception
org.apache.tiles.NoSuchDefinitionException
at
org.apache.tiles.taglib.InsertTag.processDefinitionName(InsertTag.java:486)
at org.apache.tiles.taglib.InsertTag.processName(InsertTag.java:452)
...

[#|2006-10-11T05:47:11.222-0400|WARNING|sun-appserver-pe9.1|javax.enterprise.resource.webcontainer.jsf.lifecycle|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;_RequestID=b9de8883-434e-4aac-b919-73480e7c1a4b;|executePhase(RENDER_RESPONSE
6,[EMAIL PROTECTED]) threw exception
javax.faces.FacesException: javax.servlet.ServletException: Error -  Tag
Insert : Can't get definition 'null'. Check if this name exists in
definitions factory.
at
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:418)
at
com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:410)
at
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:112)
at
org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java:175)
...

   -=> Gregg <=-





signature.asc
Description: PGP signature


signature.asc
Description: OpenPGP digital signature


Tiles Failure in GlassFish: org.apache.tiles.NoSuchDefinitionException

2006-10-11 Thread Gregg Leichtman
At Greg Reddins suggestion I have moved to GlassFish v2_b20 in an
attempt to get past the need to use the verbatim tag around all non JSF
tags within a tile.

I have run into a problem that seems to be identical to the fixed
problem described in SB-37:  tag does not support
correctly the "name" attribute.

Here are what I believe are pertinent snippets from various pieces of my
webapp.

/tiles-defs.xml:



 http://struts.apache.org/dtds/tiles-config_2_0.dtd";>




   













/web.xml:

...
  
  
index.jsp
  
...

/index.jsp:



/tiles/layouts/siteLayout.jsp

<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles"; prefix="tiles" %>





http://localhost:8080/TilesBug/tiles/layouts/siteLayout.jsp";>



   









/tiles/htmlHeaderTile.jsp

<%@ taglib uri="http://java.sun.com/jstl/core"; prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>





I am using the following libs:

commons-beanutils-1.7.0.jar
commons-chain-1.1.jar
commons-digester-1.7.jar
commons-logging-1.1.jar
javaee.jar
jsf-impl.jar
shale-core-1.0.4-SNAPSHOT.jar
shale-spring-1.0.4-SNAPSHOT.jar
shale-tiles-1.0.4-SNAPSHOT.jar
spring-beans-1.2.8.jar
spring-context-1.2.8.jar
spring-core-1.2.8.jar
spring-web-1.2.8.jar
tiles-core-2.0-SNAPSHOT-20060922.jar

The javaee and jsf-impl jars came directly from the latest j2ee 5
installation.

I have successfully gotten the siteLayout.jsp page to render, if the
tiles:insert tag is commented out, so I know that JSF is getting that
far. I have also used the tiles-defs.xml and web.xml files in my
previous Tomcat tests successfully albeit with the verbatim tags
peppered all over the place. Does anyone see why I should receive the
following exceptions:

[#|2006-10-11T05:47:11.145-0400|SEVERE|sun-appserver-pe9.1|javax.enterprise.system.container.web|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;_RequestID=b9de8883-434e-4aac-b919-73480e7c1a4b;|ApplicationDispatcher[/tilestest3]
PWC1231: Servlet.service() for servlet jsp threw exception
org.apache.tiles.NoSuchDefinitionException
at
org.apache.tiles.taglib.InsertTag.processDefinitionName(InsertTag.java:486)
at org.apache.tiles.taglib.InsertTag.processName(InsertTag.java:452)
...

[#|2006-10-11T05:47:11.222-0400|WARNING|sun-appserver-pe9.1|javax.enterprise.resource.webcontainer.jsf.lifecycle|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;_RequestID=b9de8883-434e-4aac-b919-73480e7c1a4b;|executePhase(RENDER_RESPONSE
6,[EMAIL PROTECTED]) threw exception
javax.faces.FacesException: javax.servlet.ServletException: Error -  Tag
Insert : Can't get definition 'null'. Check if this name exists in
definitions factory.
at
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:418)
at
com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:410)
at
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:112)
at
org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java:175)
...

   -=> Gregg <=-



signature.asc
Description: OpenPGP digital signature