aspose file tools*
The moose likes JSF and the fly likes JSF + AJAX partial rendering redundent method call 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 "JSF + AJAX partial rendering redundent method call" Watch "JSF + AJAX partial rendering redundent method call" New topic
Author

JSF + AJAX partial rendering redundent method call

Dziki Dzik
Greenhorn

Joined: Dec 15, 2011
Posts: 2
Hi All!

I am aware that JSF may call a managed bean method a couple of times even if it is called only once in .xhtml.
I understand that is due to JSF lifecycle phases.

I would like to ask you to explain the following case to me.
I have a JSF file that sort of looks like this:

<h:form id="form1">
<h:panelGroup id="output"/>
...
<h:commandLink...
<f:ajax render=":form1: output"/>
...
</h:commandLink>
</h:form>

All clear so far; pressing the command link rerenders a part of the page within the form panelGroup.
The code follows:

...
<ui:repeat value="#{movieBean.categories}" var="category">
<li>
<h: outputLink value="index.xhtml">
<f:param name="categoryId" value="#{category.categoryId}"/>
<h: outputText value="#{category.description}"/>
</h: outputLink>
</li>
</ui:repeat>
#{movieBean.categories} //this is just a 'test line'

movieBean is request scoped.

Now, when I enter the page for the first time I get two calls to movieBean.categories.
That is clear because it is called twice in the code. However, when I hit the AJAX link rendering
only a part of the page (output) I get movieBean.categories from <ui:repeat> called again even
though it is outside the partially rendered page area. The 'test line' is not called this time.

I performed another test. I deleted the <ui:repeat> tag leaving the 'test line' only.
AJAX partial rendering dosen't call it as before.

What makes the movieBean.categories call inside a <ui:repeat> tag different
than the one in 'test line'? And why is the call inside <ui:repeat> made when pressing the AJAX link
even though it is outside partially rendered <h:panelGroup id="output"/> tag?
Dziki Dzik
Greenhorn

Joined: Dec 15, 2011
Posts: 2
I am aware that JSF may call a managed bean method a couple of times even if it is called only once in .xhtml. I understand that is due to JSF lifecycle phases.

A small correction. I'm not sure if what I wrote here about lifecycle phases is true. It is true, however, that some evaluation in UIComponents and Resolver .encode* methods causes multiple managed bean method calls.
mallareddy gamannagari
Greenhorn

Joined: Dec 23, 2011
Posts: 3
hi all,
here, i want to use JEE container based security for my application. Here i have configured realm in tomcat and in my application and validating user and role succeeded but the problem is i'm not getting how to redirect to my home page after completion of j_security_check

in my page i'm getting fallowing error
in url:::::::::http://localhost:9999/HMS/j_security_check
in webpage:::::::
HTTP Status 408 - The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser


please helm me anyone
thanks to advance all...... :rolleyes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF + AJAX partial rendering redundent method call
 
Similar Threads
ui:repeat + AJAX
Problem with h:panelGroup
JSF and charting
Ajax render outside of form problem
JSF 2.0 GlassFish 3.0.1 problem