1

I have web-application: First Page - dashboard.xhtml:

<h:form>

                    <h:panelGroup styleClass="md-inputfield">
                        <p:inputText value="#{customerRegistrationBean.searchStr}" />

                        <label>Search</label>
                        <p:commandLink 
                            id="btnSearch" 
                            action="#{customerRegistrationBean.search()}"  >
                            <i class="topbar-icon material-icons">&#xE8B6;</i>
                        </p:commandLink>
                        <h:button value="Go to Next page" outcome="CustomerProfileSearchResults" />
                        <p:defaultCommand target="btnSearch"/>
                    </h:panelGroup>
                </h:form>

next page is CustomerProfileSearchResults.xhtml.

When I run my application i have that url on browser: localhost:8080/test/dashboard.xhtml

and dashboard.xhtml as first page.

Then when I click "search button" i have url: localhost:8080/test/dashboard.xhtml, but my url after clicking should be this: localhost:8080/test/CustomerProfileSearchResults.xhtml.

What should I do to make that the CustomerProfileSearchResults page in my application as a URL. here is search Method:

public String search() {
    comesFromTopBar = true;
    System.out.println("Global search");

    CustomerProfileRegistrationModel db = new CustomerProfileRegistrationModel();
    System.out.println(this.searchStr);
    if (searchStr.trim().equals("")) {
        System.out.println("Wrong input for search.");
    } else {
        profiles = db.getCustomersProfiles(this.searchStr);

        setProfiles(profiles);
    }

    return "CustomerProfileSearchResults";

}

0 Answers0