Navigation in JavaServer Faces, redirecting with correct parameters

前端 未结 2 514
情话喂你
情话喂你 2021-01-28 07:00

I have a page: http://mypage.com/items.jsf.

This page takes the following for granted:

  • ID is set by GET or ID is set by POST.

Now, I can man

2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-28 07:10

    With only the core JSF framework and the Facelets library, you may find this difficult. The JSF 1.2 library does not include support for adding request parameters to the redirect URL.

    A few solutions spring to mind:

    • Just redirect as outlined here.
    • Add your own custom NavigationHandler and/or ViewHandler code. Some 3rd party frameworks already cater for this type of thing. For example, Seam adds a pages.xml that allows parameters in navigation rules.
    • Upgrade to JSF2. It adds support for handling parameters during navigation (and standardises Facelets as part of the core API, among other things - spec here). It's at release candidate 2, which may or may not suit.

提交回复
热议问题