aspose file tools*
The moose likes JSF and the fly likes Displaying dynamic views using Facelets / JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Displaying dynamic views using Facelets / JSF" Watch "Displaying dynamic views using Facelets / JSF" New topic
Author

Displaying dynamic views using Facelets / JSF

Jason Ambrose
Greenhorn

Joined: Oct 22, 2011
Posts: 2
Hi

I am about to commence work on a project using JSF/Facelets that shall integrate with a third party library.

This third party library contains the screen definition and it has the following API :



The "Screen" object contains a list of controls. A "control" is an interface that has about 25 implementations
- namely LabelControl, TextBoxControl, TextAreaControl, DropDownListControl etc....

Here is an example of how the API will be used to collect data from the user:

Step 1: call getFirstScreenId() ==> This will return the id of the first screen to display to the user.

Step 2: call getScreen() using the screen id

Step 3: The Screen object returned in Step 2 has the list of controls. Display a HTML representation of the screen with all the controls (as a HTML form) to the user.

Step 4: The user has submitted the HTML form. Use the submitScreen() to submit the values.
The third party library will return the next screen id, or -1 if there are no more screens to show.

Step 5: Repeat steps 2-4 until the submitScreen() returns -1. If -1 is returned it means that the
data collection step is over, display the "thank you" page to the user.

The submitScreen() can throw a ScreenValidationException - In this case, redisplay the current screen with the
validation messages present in the ScreenValidationException object.

-------------------------------------------------------------------------------------------------------------

So, my question is how can I use JSF/Facelets to display the User Interface in this scenario?

I can picture that I need the following

(a) a managed bean that has an action method that performs the interaction with the third party library. Although I think a servlet might be best suited for this?

(b) Facelets UI templates for the 25 odd controls (textboxControl , dropdownlistControl etc....)

(c) Code that loops through the controls in the "Screen" object and does something like



I cannot picture how I can put these three together. Can someone help me?
Jason Ambrose
Greenhorn

Joined: Oct 22, 2011
Posts: 2
Any ideas?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15665
    
  15

It sounds like JSF is pointless here. Your third-party library is usurping most of the functionality of JSF anyway. Trying to weld the to together sounds like an immense amount of work.

Also, anything that involves looping through the UI in JSF is probably not a good idea anyway. JSF is not a linear display technology like JSPs are. It's based on a 2-dimensional component tree. If you have to run up and down that tree for every little detail, you're talking a lot of work and it's going to be more complex work than simply cycling over flat code a la JSP.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying dynamic views using Facelets / JSF
 
Similar Threads
Loose data in my editable datatable (JSF2)
Seam in Action: Can I mix Seam controls with non-seam JSF Controls
JSF 2.0 Ajax Implementation
Portlets and External Javascript Files
how to get the value in jstl