Prettyfaces: Set a bean property to some constant value, on observing a specific url pattern

前端 未结 2 1116
庸人自扰
庸人自扰 2021-01-24 08:06

While writing the URL mapping rules for Prettyfaces in pretty-config.xml I would like to add a rule that whenever a particular pattern is observed in URL then set a

2条回答
  •  花落未央
    2021-01-24 08:19

    You should simply use a path parameter and convert the value from the URL to your constant in a page action method. Something like this:

     
       
      
      #{bean.action}
    
    

    And the action method:

    public void action() {
    
      if( "electronics".equals(this.category) ) {
        this.category = "ELECTRONICS_ITEMS";
      }
      // more categories...
    
    }
    

提交回复
热议问题