Two cdi beans with the same rewrite @Join

Splash Forums Rewrite Users Two cdi beans with the same rewrite @Join

Tagged: , ,

This topic contains 3 replies, has 2 voices, and was last updated by  Christian Kaltepoth 31 seconds ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #27546

    Tsobis G
    Participant

    Hello,
    In our project we use rewrite-servlet, rewrite-integration-cdi and rewrite-integration-faces (3.4.1).
    We use @Join annotation on the beans for the jsf rewrite eg
    @Join(path="/records/category/component/create/parent={category}",to="/pages/records/category-input.jsf")
    This solution works perfectly for us. However, the last few days a requirement appeared which I do not know if it is possible with rewrite.

    We want two cdi beans to have the same @Join rewrite

    @Join(path="/records/component/list/category={category}/sortby={orderBy}/page={page}",to="/pages/records/records-list.jsf")
    public class RecordList{}
    @Join(path="/records/component/list/category={category}/sortby={orderBy}/page={page}",to="/pages/records/records-list.jsf")
    Public class CategoryList{}

    Can this be implemented with rewrite?
    Thanks in advance

    #27547

    Why do you want two joins which are exactly the same? You only need it once to let Rewrite pick it up. So just remove it from one of your beans.

    #27548

    Tsobis G
    Participant

    Yes you are correct, I made a mistake.
    Basically what I want is too initialize multiple cdi beans from one url.
    @Join(path="/records/component/list/category={category}/sortby={orderBy}/page={page}",to="/pages/records/records-list.jsf")
    records-list.jsf is a jsf page with two lists.
    A categories list and a records list. Which is simple, however, we want the categories list from a separate cdi bean since it will be used with another jsf file as well.
    eg.
    Categories list + category creation view
    Categories list + category update view
    Categories list + records list
    Categories list + record creation view
    etc
    I do not want to repeat the code in all cdi beans for these jsf files, since it is not only load of a list but actions as well.
    The older version of the app was based on seam 2.2. The solution was simple, we only had to call the action tag multiple times.

    <page view-id="/page/products/product-category/products-list.xhtml">
            <rewrite pattern="/products/component/list/category={catid}/sortby={orderby}/page={page}"/>
            <rewrite pattern="/products/component/list"/>
            <param name="orderby" value="#{productsListPaging.orderBy}" required="true"/>
            <param name="page" value="#{productsListPaging.currentPage}" converterId="javax.faces.Integer" required="true"/>
            <param name="catid" value="#{productsListPaging.categoryId}" converterId="javax.faces.Long" required="true"/>
            <action execute="#{productsListPaging.init}"/>
            <param name="catid" value="#{categoriesPaging.categoryId}" converterId="javax.faces.Long" required="true"/>
            <action execute="#{categoriesPaging.init}"/>
        </page>
    #27549

    What do you mean with “initialize multiple cdi beans from one url”? What kind of initialization? If you are talking about @RequestAction, then you should use a standard <f:viewAction> instead.

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

You must be logged in to reply to this topic.

Comments are closed.