Breadcrumb Breadcrumb
Community Links Community Links
Javadoc Links Javadoc Links
Community Forums Community Forums
Combination View Flat View Tree View
Threads [ Previous | Next ]
EL question and FacesMessage question
toggle
Hi!

I'm a starter with PortleFaces.
I have 2 questions. Because code is common to both questions I've posted it in one thread.
I created my first JSF portlet for Liferay with PortletFaces.

I've created request scoped managed bean
here's my faces-config.xml fragment
 1
 2    <application>
 3        <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
 4    </application>
 5    <lifecycle>
 6        <phase-listener>org.edorasframework.extfaces.lifecycle.DebugPhaseListener</phase-listener>
 7    </lifecycle>
 8    <managed-bean>
 9        <managed-bean-name>SearchBean</managed-bean-name>
10        <managed-bean-class>dumbuzz.SearchBean</managed-bean-class>
11        <managed-bean-scope>request</managed-bean-scope>
12    </managed-bean>



Here's my bean's code:
 1
 2public class SearchBean {
 3
 4    private String searchString;;
 5    private final PortletFacesContext portletFacesContext = PortletFacesContext.getInstance();
 6
 7    public SearchBean {
 8       searchString = "test string";
 9       portletFacesContext.addGlobalInfoMessage("test message");
10   }
11
12   public String getSearchString() {
13      return this.searchString;
14   }
15}


Also I created faceletbased-portlet view with view.xhtml.
Related fragment of view::
1
2<ui:composition xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">   
3    <h:outputText value="#{liferay.user.screenName}"/><br/>
4    <h:outputText value="#{SearchBean.searchString}"/>
5    <h:messages id="messages" globalOnly="true"/>
6</ui:composition>


I deployed portlet to Liferay, create new page "JSF" and put my portlet on this portal page - /web/guets/jsf.
It became a single portlet on this page.

1) So here's my first problem:
 1
 2When I try to render this portlet in Liferay I see this debug messages in my Tomcat log:
 324.12.2009 12:27:24 org.edorasframework.extfaces.el.ExtELResolver.resolveVariable
 4DEBUG: Unable to resolve variable [liferay] value=null
 524.12.2009 12:27:24 org.edorasframework.portletfaces.el.PortletELResolver.resolveVariable
 6DEBUG: Unable to resolve variable [liferay] value=null
 724.12.2009 12:27:24 org.edorasframework.extfaces.lifecycle.DebugPhaseListener.beforePhase
 8DEBUG: Before phase: RENDER_RESPONSE 6
 924.12.2009 12:27:24 org.edorasframework.extfaces.el.ExtELResolver.resolveVariable
10DEBUG: Unable to resolve variable [SearchBean] value=null
1124.12.2009 12:27:24 org.edorasframework.portletfaces.el.PortletELResolver.resolveVariable
12DEBUG: Unable to resolve variable [SearchBean] value=null
1324.12.2009 12:27:24 org.edorasframework.extfaces.lifecycle.DebugPhaseListener.afterPhase
14DEBUG: After phase: RENDER_RESPONSE 6


Though I see values of my outputText fields rendered correctly. I see correct searchString value - "test string" and correct liferay-user screenName.
That means, that variables resolved correctly, but why these messages appear?

my web.xml fragement related to el
1
2<context-param>
3        <param-name>com.sun.faces.expressionFactory</param-name>
4        <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>   
5</context-param>

2) My second problem:
In my SearchBean I simply add FacesMessage with severity INFO in constructor as you see higher in SearchBean constructor code:

When I start new browser session and surf to /web/guest/jsf portal page I see my info message. It's ok.
But when I refresh my browser or simply go away from portlet page with this portlet and return back to this page I see my message incrementing
(for example, after 3 refreshes of a page I see 3 messages "test message").
In debugger I see, that FacesMessages don't erase from FacesContext and each time my bean constructor is executed new message is adding to FacesContext messages list.

Why? I thought, that FacesContext messages live in request, but why they don't erase between requests
Flag Flag
RE: EL question and FacesMessage question
1/1/10 8:36 PM as a reply to Artur Vilsov.
You might want to try the jsf-facelets.jar that is found in the sample-jsf-1.2-sun-facelets-portlet that you can download from here:
http://sourceforge.net/projects/lportal/files/Liferay%20Plugins/5.2.0/sample-jsf-1.2-sun-facelets-portlet-5.2.0.1.war/download

It contains some patches that don't appear in the standard one available from Sun.
Flag Flag
RE: EL question and FacesMessage question
3/17/10 10:47 AM as a reply to Neil Griffin.
Neil Griffin:
You might want to try the jsf-facelets.jar that is found in the sample-jsf-1.2-sun-facelets-portlet that you can download from here:
http://sourceforge.net/projects/lportal/files/Liferay%20Plugins/5.2.0/sample-jsf-1.2-sun-facelets-portlet-5.2.0.1.war/download

It contains some patches that don't appear in the standard one available from Sun.


Thanks a lot, Neil.
With new jar FacesMessage incrementing stopped.

But I still see debug-messages in Tomcat log about PortletFaces EL-resolvers errors.
Though all variables are resolving correctly and this is not a problem.

So I think this topic should be closed.

------------------------
Important!

After migration from edorasframework.org to portletfaces.org I can't post any new messages or topics in this forum.

All I can do is to edit my older messages.

Portla admins, help me!
I think that after migration I lost permission to post to forums on portletfaces.org.
Can you restore it please!
Flag Flag
RE: EL question and FacesMessage question
4/7/10 11:24 PM as a reply to Artur Vilsov.
The login/posting problem should be fixed now.
Flag Flag
RE: EL question and FacesMessage question
4/19/10 1:11 PM as a reply to Neil Griffin.
Neil Griffin:
The login/posting problem should be fixed now.

Yes, everything is ok now.
Flag Flag