Dynamic sub view with Pretty Faces

Splash Forums PrettyFaces Users Dynamic sub view with Pretty Faces

This topic contains 10 replies, has 3 voices, and was last updated by  kency 11 years, 3 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #17795

    kency
    Participant

    Hello Lincoln

    before using JSF and Pretty Faces, i use JSP .

    i have one page and it just change content in it, header and footer was keeped.

    i use getParameter for do it

    example

    url: http://localhost/myapp/index.jsp?page=item

    http://localhost/myapp/index.jsp?page=product

    http://localhost/myapp/index.jsp?page=category

    in index page my handle code:

    if(request.getParameter(“page”) == item){

    <jsp:include page =”item.jsp”/>

    }

    with Pretty Faces how can i do it??

    i write one method in backing bean for handle dynamic content for JSF page follow:

    public String getIncludePath(){

    if(??){

    //do something

    }

    }

    in question mark i dont know what i will compare like jsp request.getParameter(“page”)==item?

    in JSF will follow:

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

    how can i do with Pretty Faces like JSP dynamic content view

    i was read User Guide and do follow it in pretty-config.xml:

    <url-mapping id="mainRegister">
    <pattern value="/register" />
    <view-id>/faces/mainregister.xhtml</view-id>
    </url-mapping>

    <url-mapping id="step1register">
    <pattern value="/register/#{reg:step1}" />
    <view-id>/faces/registerStep1.xhtml</view-id>
    </url-mapping>

    <url-mapping id="step2register">
    <pattern value="/register/#{reg:step2}" />
    <view-id>/faces/registerStep2.xhtml</view-id>
    </url-mapping>

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

    in JSF ManagedBean i write one method do it such as:

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

    public String getIncludePath(){

    if(reg==step1){

    return “registerStep1.xhtml”;

    }else if(reg==step2){

    return “registerStep2.xhtml”;

    }else if (reg == null){

    return “mainregister.xhtml”;

    }

    }

    but it not work.

    Please help me!

    Thank You !

    Best Regards

    #20267

    kency
    Participant

    Pleas help me !!

    #20268

    kency
    Participant

    no one help me? :((

    #20269

    Hi Kency,

    It’s the weekend right now. Most people are not “at work” and should be able to help you Monday.

    Thanks for your patience,

    Lincoln

    #20270

    kency
    Participant

    Hi Lincoln ,

    Sorry you, i will wait for you in Moday!

    Thank You

    #20271

    Did you take a look at the DynaView feature of PrettyFaces?

    http://ocpsoft.com/docs/prettyfaces/3.1.0/en-US/html/Configuration.html#config.dynaview

    This may be a better way of solving your problem as you won’t need to dynamically include views in some kind of master file. You can use standard Facelets/VDL templating to include your header and footer.

    #20272

    kency
    Participant

    Hi Chkal DynaView is good!

    But i want dynamic pattern ex: home/ <=== index home/login <== login page

    i want content and url dynamic but page still keeped

    if i want user read the rule of site and click on commandButton and content will change and url will change

    Thank for your support!

    #20273

    But why do you want the page to be kept while changing the URL and the content? Is it because you don’t want to duplicate the header and the footer in each file? In this case you should really use Facelets/VDL templates:

    http://www.ibm.com/developerworks/java/library/j-facelets/

    #20274

    kency
    Participant

    Hi Chkal you right i don’t want to duplicate header and footer , i want change URL because when user want to access page he want, he can access through URL,and content will change when it getParameter like JSP http://localhost/index?page=value , value is page user want to access , for this purpose, i don’t know how do it with PrettyFaces . Thank for your response

    I will read Facelets/VDL template !

    Thank you!

    #20275

    Try reading this section of the documentation as well. It may help you:

    http://ocpsoft.com/docs/prettyfaces/3.1.0/en-US/html_single/#config.pathparams

    #20276

    kency
    Participant

    Thank you Lincoln and Chkal, i was solved my problem with VDL templates , it greats !!

    Many Thank to You

    Best Regards

Viewing 11 posts - 1 through 11 (of 11 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.