Java
Java

Reputation: 2489

Not able to navigate to another page on button in jsf portlet

I am trying to develop a jsf portlet(primefaces 3.2)

I have created a jsf portlet in which i am displaying a datatable.Inside my datable there is one button.

Now when i will click on that button a jsp page should open. its not working actually.

I am trying to achieve it using this way.

<div style="text-align:right">
                        <p:lightBox iframe="true" width="1000" height="840">
                            <h:outputLink
                             value="./next.jsp">
                                <p:commandButton value="Add" icon="ui-icon ui-icon-plusthick" style="margin:3px;display: table-cell;vertical-align: middle;"/>
                            </h:outputLink>
                        </p:lightBox>
                    </div>

My current portletViewMode.xhtml(portlet display page) and next.jsp are present inside portlet(in xhtml folder).

Its a jsf view(portletViewMode.xhtml) which creates when you create a jsf-portlet ,and in that view I have displayed a datatable inside there is a button.

When I 'll click on that button I should be able to navigate to a jsp page which acts as a light box.. So if I close I should be able to see my previous jsf view.

So I am trying to navigate from jsf view to another jsp page on action of a button(which is a jsf component) .

what should I need to do for that? Have any one tried navigate from jsf view to any other page.?

Upvotes: 0

Views: 1641

Answers (1)

Matt Handy
Matt Handy

Reputation: 30025

You are using the p:lightBox in a wrong way.

Regarding the example on the Primefaces homepage you should use the p:lightBox with iframe="true" in order to display page content.

Wrapping an h:commandButton with an h:outputLink is not the most elegant solution. You could use a simple h:button but it will also work with a h:commandButton:

<p:lightBox iframe="true">
    <h:outputLink value="page2.xhtml"  >  
        <h:commandButton action="#" value="Next page" />  
    </h:outputLink>  
</p:lightBox>

Note that the content of the iFrame needs to go in the value attribute of h:outputLink.

Furthermore, JSP and Primefaces won't work. Use facelets only.

Upvotes: 1

Related Questions