Passing parameters with h:commandButton — or the equivalent

前端 未结 1 1474
[愿得一人]
[愿得一人] 2021-01-07 07:28

I read on other threads that this does not work:


   &l         


        
1条回答
  •  再見小時候
    2021-01-07 08:03

    This should work perfectly fine on JSF 2.x. Did you ever try it yourself? If it doesn't work, then you're either actually using JSF 1.x or you're sending a redirect after POST.

    The other threads which you're referring to were undoubtely talking about JSF 1.x, when the was indeed not supported on . On JSF 1.x, you would have used instead or some shot of CSS to style the to look like a button.

    E.g.

    
    

    with

    a.button {
        display: inline-block;
        background: lightgray;
        border: 1px outset lightgray;
        outline: none;
        color: black;
        text-decoration: none;
        cursor: default;
    }
    a.button:active {
        border-style: inset;
    }
    

    Note that in JSF 2.x you've also the opportunity to use the new which fires a GET request instead of a POST request. This is better if you don't need to execute any bean action (i.e. your current action is just returning a plain navigation case outcome) and want the request to be idempotent.

    
        
        
    
    

    This will navigate to create.xhtml with the given parameters in request URL.

    0 讨论(0)
提交回复
热议问题