JSF and Tiles Solution

2004-10-21 Thread Sean Schofield
[follow-up to a discussion from the user list]

I think I have a potential solution to a problem I've been having
trying to integrate JSF and Tiles.  At first I tried integrating JSF
and Tiles without the struts-faces package (since I wasn't concerned
with having Actions talk to faces, etc.)  If you are just relying on
Tiles for layout and using faces for everything else, you are left
with a single problem.  The problem is that the form generated by JSF
will try to post to the layout page instead of whatever the original
URL was that triggered Tiles.

I came up with something that will fix this and depends on using only
one (modified) class from struts-faces.  The catch is that it requires
struts-chain.  Actually, it can probably be done without struts-chain,
but struts-chain makes it easier to plug-in whatever functionality is
needed.  In the end, I envision it to be possible to integrate struts
and faces to varying degrees depending on what functionality you need.

What I did was to add a new command, TilesFacesPreProcessor (TFPP),
just before the TilesPreProcessor command.  TFPP checks to see if a
certain attribute is present in the request.  If that attribute is
null, it adds that attribute to the request with a value of the URI of
the request (minus the leading / char).  This way we have a record of
the original URI.  It only does this if the attribute is null in case
one of your Tiles inserts is itself a struts request.

The other part of the solution is to modify the ViewHandlerImpl in the
struts-faces package.  I overrode the getActionURL method and had it
check for the value in the request.  If there was a value there, I
return that as the actionURL, otherwise, I pass the request on to the
decorated ViewHandler.

I can submit some code for people to look at, but first I wanted to
get a sense of what people thought about this idea.  It's the best I
could come up with.

Let me know what you think,
sean

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JSF and Tiles Solution

2004-10-21 Thread Craig McClanahan
I'd definitely like to see the code.

Craig


On Thu, 21 Oct 2004 10:07:25 -0400, Sean Schofield
[EMAIL PROTECTED] wrote:
 [follow-up to a discussion from the user list]
 
 I think I have a potential solution to a problem I've been having
 trying to integrate JSF and Tiles.  At first I tried integrating JSF
 and Tiles without the struts-faces package (since I wasn't concerned
 with having Actions talk to faces, etc.)  If you are just relying on
 Tiles for layout and using faces for everything else, you are left
 with a single problem.  The problem is that the form generated by JSF
 will try to post to the layout page instead of whatever the original
 URL was that triggered Tiles.
 
 I came up with something that will fix this and depends on using only
 one (modified) class from struts-faces.  The catch is that it requires
 struts-chain.  Actually, it can probably be done without struts-chain,
 but struts-chain makes it easier to plug-in whatever functionality is
 needed.  In the end, I envision it to be possible to integrate struts
 and faces to varying degrees depending on what functionality you need.
 
 What I did was to add a new command, TilesFacesPreProcessor (TFPP),
 just before the TilesPreProcessor command.  TFPP checks to see if a
 certain attribute is present in the request.  If that attribute is
 null, it adds that attribute to the request with a value of the URI of
 the request (minus the leading / char).  This way we have a record of
 the original URI.  It only does this if the attribute is null in case
 one of your Tiles inserts is itself a struts request.
 
 The other part of the solution is to modify the ViewHandlerImpl in the
 struts-faces package.  I overrode the getActionURL method and had it
 check for the value in the request.  If there was a value there, I
 return that as the actionURL, otherwise, I pass the request on to the
 decorated ViewHandler.
 
 I can submit some code for people to look at, but first I wanted to
 get a sense of what people thought about this idea.  It's the best I
 could come up with.
 
 Let me know what you think,
 sean
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]