views:

27

answers:

0

Hello all ! i have one page index.jsf, i was use ui:include for include header and footer,i want to dynamic view in content, it mean when user click on register link just content change header and footer didn't change

i image my code sample is:

<ui:include render="#{mybean.include}"/>

and in backing bean my code will :

public void getInclude(){
    if("page" == a){
        return "a.jsf";
    }
    else if("page" == b) {
     return "b.jsf";
    }
}

and i to use pretty url example in old way jsf page will display url

http://localhost/index.jsf?page=a or http://localhost/index.jsf?page=b

but i want use pretty url instead of old way, example:

http://localhost/index/a

how can i do it (it mean using pretty faces and how i can use if-else for what?) i can explain above question here instead of above i use if("page"=a) if i use old way paste parameter url http://loalhost/index.jsf?page=a but if i use pretter url or pretty faces what would i do for if-else statement? if(?? = a)

2 question please help me thankyou

  ==========================================================

Now i set up pretty faces and work well but i dont know how can i get parameter from Prettyfaces, in Pretty-config.xml i was config page follow:

Main page ( content change dynamic in there)

<url-mapping id="mainpage">
 <pattern value="/home" />
 <view-id>/faces/main.xhtml</view-id> 
</url-mapping>

Page1

<url-mapping id="mainpage">
 <pattern value="/home/#{page:content1}" />
 <view-id>/faces/content1.xhtml</view-id> 
</url-mapping>

page 2

<url-mapping id="mainpage">
 <pattern value="/home/#{page:content2}" />
 <view-id>/faces/content2.xhtml</view-id> 
</url-mapping>

in page one i use ui:include for dynamic subview

<ui:include src=#{bean.includePage}/>

my bean have one method for get include page

  public String getIncludePage(){
       if(page == null){
        return "content.xhtml";
       }
       else if (page.equals(content1)){
        return "content1.xhtml";
      }
      else if (page.equals(content2)){
        return "content2.xhtml;
      } 
}

But i can't change dynamic page view content in one page