aspose file tools*
The moose likes JSF and the fly likes FaceletContext.includeFacelet trouble Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "FaceletContext.includeFacelet trouble" Watch "FaceletContext.includeFacelet trouble" New topic
Author

FaceletContext.includeFacelet trouble

Jason Pettengill
Greenhorn

Joined: Feb 20, 2012
Posts: 3
I am currently trying to insert pre-defined jsf pages into a particular portion of a main jsf page. I have been able to achieve this semi-successfully using the following:



Where the centerPanelGrid is a field variable in my managed bean (dynamicComponentBean) which is bound to a HtmlPanelGrid within the main jsf page and the actualPath variable is the relative path indicating the location of the jsf page.

As for the note, it may seem like non-sense to have to have that line (trust me I realize that) however in all of my tests if I didn't have that line then when I went to include the jsf page it wouldn't include anything...

This is an outline of the main jsf page:



And a small example of a page that could get inserted into the centerPanelGrid would be as follws:



With navString being whatever String I pass to it so that the includeFacelet method can pull the appropriate jsf to insert next.

My problem arises when I try to use the command button to navigate, it requires me to press it twice to work, the first press makes it seem like it refreshes the page or something and then the subsequent click allows me to include the correct facelet in the centerPanelGrid.

I have done extensive debugging on the issuse and I have found that during the first click it is making no calls to any method within any of my managed beans and is not actually going into any of my code for that matter. I have no idea why it is doing this or what I need to do to get it to just include the facelet that I want and have it navigate normally.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Welcome to the JavaRanch, Jason!

I'm not entirely sure I understand what you want to do that couldn't have been done more easily using the standard Facelet tiling capabilities without the need for all that complexity.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jason Pettengill
Greenhorn

Joined: Feb 20, 2012
Posts: 3
Thank you.

In essence these web pages come from an additional enterprise application that was developed seperately and integrated into the current system. The current system does all page generation through manually creating the java objects that represent all of the various UIComponents and putting them into their appropriate place. However short of creating seperate stateles session beans to generate all of these various pages in a similar fashion I have set it up to know when these pages from the integrated application are being called and to instead put them into the dynamic component panel using the includeFacelet method.

Given the current setup of everything the only fashion in which I can go about inserting these pages is through the method that I am using and like I said it works fine save for the whole double clicking that must transpire for the pages to navigate appropriately.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Of course, you do realize that any system that "works fine, except..." doesn't really work fine.

I still need a little more understanding. I can read what you've said in one of 2 ways. If there's a third way, it's beyond my ability to conceive. And being long and evil in JSF as I am, that in itself should serve as a caution that your chosen solution is quite likely going to be something expensive to keep running.

1. An external application generates the UIComponent objects.

2. An external application generates the View Definition Language (JSF source) fragment.

Case 1 is a tough sell, since I'm pretty sure that there are too many internal objects that wouldn't survive the transition needed to serialize them out of the generating webapp and into the client webapp.

Case 2 I can conceive, but pretty much mandates creation of arcane code in sensitive parts of the system.

Actually, I can visualize a third and more practical scenario, and that's where you're attempting to effectively embed another app within the client app. This is exactly what portal servers do, and they have the advantage of being pre-coded, pre-debugged and conformant to published standards, thus making it possible to hire developers off the street who are already trained in the technology - or who can at least go down to the local computer bookstore and train themselves.
Jason Pettengill
Greenhorn

Joined: Feb 20, 2012
Posts: 3
The integrated application I am speaking of is more of a enterprise app with an ejb module that was placed into the main project I am working on and the web pages and classes from the war file of the integrated application were put into the war file of the main project. The war file that was integrated into the main project contained concrete web pages because for that particular part of the application we knew what needed to be in the pages before hand. However the rest of the application works by dynamically creating the page through creating the particular UIComponents that are needed based on the information that it recieves from the business logic. There are times when these concrete pages need to be displayed in the center panel grid as opposed to that information being dynamically generated. I haven't found any other way to achieve this save for the way I am currently trying to do. If you know of another way to get these concrete web pages into the center panel grid I would be greatly appreciative as I have tried many, many different things to get this work and I always end up with having to double click everything, it displays nothing or it gives me some exception or another.
 
 
subject: FaceletContext.includeFacelet trouble