Re: [solved] Problem with prettyfaces + a4j:commandLink

Splash Forums PrettyFaces Users [solved] Problem with prettyfaces + a4j:commandLink Re: [solved] Problem with prettyfaces + a4j:commandLink


Ricardo Amaral

Hi guys,

First of all, Lincoln, congratulations for your nice work!

I’m also having problem with pretty faces + richfaces (a4j). Probably it’s something i’m doing wrong.

Here is my problem:

All my app is in AJAX with a4j and jquery, and i’m developing something like an online store.

Two major problems with an ajax only app is history and access things by URL.

With pretty faces I think I can fix both. But i’m not getting the right config yet.

I managed to access products by URL configuring to something like this w/ pretty faces: http://localhost:8080/myappname/search/coke, and everything works great, and the page with products is returned.

The page returned have a4j components like commandLinks, commandButtons and a form.

Looking to the rendered html code I could see the commandLink is becoming the following:

<a href="#" id="generalForm:j_id23:0:j_id28:7:category" name="generalForm:j_id23:0:j_id28:7:category" onclick="A4J.AJAX.Submit('generalForm',event,{'similarityGroupingId':'generalForm:j_id23:0:j_id28:7:category','parameters':{'generalForm:j_id23:0:j_id28:7:category':'generalForm:j_id23:0:j_id28:7:category'} ,'actionUrl':'/myappname/search/coke;jsessionid=A7E70CC70CB271F353B04E5A867F3F07'} );return false;">Link Label</a>

Pay attention to the param ‘actionUrl’, it is being rendered with the actual URL /myappname/search/coke, and every time I click the link, the same backing bean method is being called, but another method in the same backing bean should be called. This is going on because the pretty faces mapping is working! :)

Debugging the a4j javascript code, I could see this actionUrl param is used to mount the XmlHttpRequest object destination.

The question is obvious, how to make it work? :)

My env: tomcat 6.0.24 + JSF 1.2 (myfaces implementation 1.2.8) + richfaces 3.3.2 + servlet 2.5 + JSP 2.1 + facelets 1.1.15

Thanks in advance!