permaculture playing cards*
The moose likes JSF and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark ""JSF" + "RIA" == lie" Watch ""JSF" + "RIA" == lie" New topic

"JSF" + "RIA" == lie

Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
It's stated that JSF can be used to create Rich Internet Applications.
Using dynamic <ui:include src="#{pageSelector.chosenPage}" /> fails.
Can anyone give me more ways to include dynamic content within one page?
Guy deLyonesse
Ranch Hand

Joined: Apr 12, 2011
Posts: 200

It's really counterproductive to create a thread to talk about a perceived problem with JSF without any useful level of detail so people can understand what it is you're trying to do.
Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
I'm trying to create RIA. Just RIA, nothing more. RIA also known as "one-screen-application"has consistent interface where only parts of page are refreshed and filled with new content.
Something like this:

Clicking menu links should reload main content with chosen page without realoading whole page.
Guy deLyonesse
Ranch Hand

Joined: Apr 12, 2011
Posts: 200

That's what AJAX is for, and can be easily used with JSF through the ICEfaces extension, among others.
Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
I'm happy you pointed out ICEfaces. That's what I'm using.
But forget ICEfaces, there seems to be problem with including one page into another.
I've seen many threads with questions why <ui:include doesn't work as it should. Like here
but I've never found a solution nor any approach.
<icecore:singleSubmit /> works great for ajax-submitting forms. But I don't have a clue how to use it to change content of displayed page.
One big xhtml page with many panelGroups triggered by rendered attributes is not a very elegant solution.
Vinu Shanmugam

Joined: Jul 22, 2011
Posts: 4
I have the same problem. I tried using dynamically included pages and ended up like a fool.

There can be thousand debates on JSF, but if there is a specification and there is an implementation, it should work.

include tags and Ajax support were in specification and implementation but can't be combined with Ajax. Then what is the point of saying that JSF provides Ajax support.

I dont want to end up writing hundred different pages to avoid includes and mess up with templates or decorators.

JSF Ajax support is only good for writing Hello World programs! Not for real world applications.

My intention is not to give any counter-productive comments, but what I said above is the truth. Else some one please advice how to get Ajax capabilities with dynamic include pages. I will be more than happy!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960

Vinu Shanmugam wrote:
JSF Ajax support is only good for writing Hello World programs! Not for real world applications.

Don't tell my clients that. They think they're running real, sophisticated business applications. If they knew I was only doing "Hello World" all this time, they might not want to pay me anymore.

I've seen complaints about the "include" problem before. I have apps that include View components heavily, and almost all of my pages are template-based, but I've never had a reason to attempt to do a "reverse template" when the include is a dynamic reference. However, I have misgivings about attempting such things.

JSF is not like JSP where you can "include" straight-line content by copying from one file to another. JSF does all its serious work in a 2-dimensional tree of components. The ui:include directive is not actually pulling text, it's inserting a component subtree. So behaviour is a bit different there. The component tree is a model in a MVC system, not a papyrus to be inscribed. Only at the last stage of the JSF lifecycle is the tree used to actually write out the resulting HTML (or whatever, depending on what renderer has been selected).

AJAX can further complicate the issue. For example, if your view definition includes a component which has a "rendered=false" attribute, you cannot use AJAX to come in and render it or any of its children later, since the initial web page containing the AJAX request didn't render the item that you're attempting initially and so there's no place in the client's HTML to render to. The cure for that is to send a reRender request to a component that contains the desired component. Similar tricks can be anticipated for included object rendering.

JSF is very powerful and designed to make many common tasks very simple. But it does have its own unique ways of setting up and doing these things. One of the most common generators of questions on this forum is when people attempt to do things the way they've "always done it" and end up writing a lot of arcane JSF-specific code to do things that JSF actually would prefer to handle for them with little or no JSF-specific code required.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: "JSF" + "RIA" == lie
Similar Threads
how you add textbox dynamically in JSF?
* Welcome Ed Burns & Chris Schalk
To Hans: When to use JSF?
To create a dynamic tree using jsf