Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
S P
Need urgent help on Liferay primefaces response forwarding
September 11, 2012 7:23 AM
Answer

S P

Rank: Junior Member

Posts: 65

Join Date: August 6, 2012

Recent Posts

Hi All,
I have developed portlet using Liferay6.1 with primefaces3.2 and deployed in weblogic 10.3.5.
i am able to view.xhtml and able to hit mangebean JSF class on click on of submit button but i am unable to forward the page to sucess.xhtml or failure.xhtml

Also i have defined the navigation rule in faces-config.xml file

<navigation-rule>
<from-view-id>/test/portletViewMode.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/test/success.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/test/failure.xhtml</to-view-id>
</navigation-case>
</navigation-rule>

in portlet.xml i have written like this.
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/test/portletViewMode.xhtml</value>
</init-param>

in my Managebean .add(){
FacesMessage msg = new FacesMessage();
msg.setSummary("test");
FacesContext.getCurrentInstance().addMessage(null, msg);

if(true){
return "success";
}else{
return "failure";
}

Could you please suggest me ,i am unable to display any message to the browser...or forwarding to sucess/other page.


Appriciate your help.
Neil Griffin
RE: Need urgent help on Liferay primefaces response forwarding
September 11, 2012 7:40 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2337

Join Date: July 26, 2005

Recent Posts

In order to display a message to the user, you would need the following in your Facelet view markup:

1<h:messages globalOnly="true" />


As for the navigation rule, are you sure that the managed bean add() method is getting called? Sometimes there is a validation failure in the PROCESS_VALIDATIONS phase of the JSF lifecycle, which causes the INVOKE_APPLICATION phase to get bypassed.
S P
RE: Need urgent help on Liferay primefaces response forwarding
September 11, 2012 9:29 AM
Answer

S P

Rank: Junior Member

Posts: 65

Join Date: August 6, 2012

Recent Posts

Thanks a lot neil.
I have tried by this line
<h:messages globalOnly="true" />
but still no difference came but same code is showing messages in another system
and i have disable ajax as false in the command button
<p:commandButton action="#{testModelBean.save}" value="save" ajax="false"/>

but i am getting following errors now.. emoticon
javax.faces.FacesException: The FacesServlet cannot have a url-pattern of /*. Please define a different url-pattern.
but i have checked i have not added /* pattern in web.xml

Appriciate your help.
Neil Griffin
RE: Need urgent help on Liferay primefaces response forwarding
September 11, 2012 9:39 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2337

Join Date: July 26, 2005

Recent Posts

I would recommend that you take a look at the primefaces3-portlet demo. It executes a navigation-rule with PrimeFaces using Ajax. When I disabled Ajax the navigation-rule still fired correctly. Here is the line that I modified inside of applicant.xhtml:

1<p:commandButton action="#{applicantBackingBean.submit}" update="f1" value="#{i18n['submit']}" ajax="false" />
S P
RE: Need urgent help on Liferay primefaces response forwarding
September 11, 2012 9:43 AM
Answer

S P

Rank: Junior Member

Posts: 65

Join Date: August 6, 2012

Recent Posts

Hi Neil,

after i have commented navigation rules.
 1<!-- <navigation-rule>
 2<from-view-id>/test/portletViewMode.xhtml</from-view-id>
 3<navigation-case>
 4<from-outcome>success</from-outcome>
 5<to-view-id>/test/success.xhtml</to-view-id>
 6</navigation-case>
 7<navigation-case>
 8<from-outcome>failure</from-outcome>
 9<to-view-id>/test/failure.xhtml</to-view-id>
10</navigation-case>
11</navigation-rule>
12-->
i am able to get the messages in the portlet page.
but page is not forwarding to success.xhtml as i have defined in save method return type is success.
here is the error i am getting
Unable to find matching navigation case with from-view-id '/test/portletViewMode.xhtml' for action '#{testModelBean.save}' with outcome 'success'
emoticon
Any idea will be really greatful.
S P
RE: Need urgent help on Liferay primefaces response forwarding
September 11, 2012 9:44 AM
Answer

S P

Rank: Junior Member

Posts: 65

Join Date: August 6, 2012

Recent Posts

ok sure ,i will have a look.
Thank you very much.
S P
RE: Need urgent help on Liferay primefaces response forwarding
September 11, 2012 10:04 AM
Answer

S P

Rank: Junior Member

Posts: 65

Join Date: August 6, 2012

Recent Posts

Thanks again Neil.
I am following exactly similiar path as in the primefaces-demo but still unable to find the file..
Unable to find matching navigation case with from-view-id '
emoticon ,i will check if i missed any configuration,or i am thinking ,its not locating the file path.
Neil Griffin
RE: Need urgent help on Liferay primefaces response forwarding
September 11, 2012 10:15 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2337

Join Date: July 26, 2005

Recent Posts

One thing you can try, is to start with the source from the primefaces3-portlet demo, and then remove everything from it except for the parts that enable the navigation from one view to another. Then you can slowly make changes to it in order to make it look more like the portlet you are developing.