1

I'm new to JSF. I have two use cases.

1: URL: https://site.com/context/part/{partId}
2: URL: https://site.com/context/register-token?tokenType=xxxxxx&token=xxxxx

in each of these cases i'd like to extract the variable information, execute code in a java class (scoped bean/@PostConstruct, i presume) then display appropriate content based on the values.

I'm sure this is pretty straight forward in JSF and I have seen quite a few nice suggestions on how to do pieces of these, but they seem to not be without controversy, so I can't say they're the correct way due to my ignorance. Additionally there seems to be significant enough changes in 2.2 the older posts could be out of date as far as "correctness" goes. Lastly there doesn't seem to be a guide (that I can find) that specifically talks to these workflows specifically in 2.2.

Can anyone provide me a semi comprehensive "correct" way to do these things in JEE7/JSF2.2?

Correct can be subjective I know, but my thinking though this seems rudimentary enough that in this case a vanilla happy path suggestion would be enough.

Much appreciated, thanks.

Steve Holt
  • 85
  • 9
  • `f:viewAction` with omnifaces [@Param](http://showcase.omnifaces.org/cdi/Param). – mabi Jun 08 '14 at 21:48
  • thanks, not using omnifaces though. – Steve Holt Jun 08 '14 at 23:34
  • For workflow 1: i found this and it worked: http://www.oracle.com/technetwork/articles/java/jsf22-1377252.html For workflow 2: I'm using prettyfaces and i was able to get it to work ~sort-of~ by using this: http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/Configuration.html#config.actions I'm loosing all my styling right now, but I think thats a config thing...hopefully not a bug. It seems that for workflow 2: out of the box JSF can't handle. Will report back if i find anything else out. – Steve Holt Jun 09 '14 at 02:25

1 Answers1

0

Finishing comment from above as the last issue has been resolved...

For workflow 1: i found this and it worked: http://www.oracle.com/technetwork/articles/java/jsf22-1377252.html

But it seemed limited to query params.

For workflow 2: I'm using prettyfaces and i was able to get it to work ~sort-of~ by using this (Section 3.6): http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/Configuration.html#config.actions

My web assets not resolving issue was resolved, by using this tip given by @chkal: PrettyFaces using mapped urls and actions, i lose all my stylings.

This suggestion pushed me over the edge to abandon a pure JSF solution and use pretty faces especially since im going to lean towards workflow 2 more often than not: Should I use f:event or action element in PrettyFaces?

Community
  • 1
  • 1
Steve Holt
  • 85
  • 9