1

I want to define a navigation case in faces-config.xml to do a page reload/refresh, without navigating to another page on certain outcome from any view id. How do I define it in faces-config.xml as I dont have any specific to-viewId to hardcode in faces-config.xml ?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Rajat Gupta
  • 25,853
  • 63
  • 179
  • 294
  • 2
    Sounds like you want to reload the existing page. In which case, viewId = #{view.viewId} ? – 8bitjunkie Nov 14 '13 at 09:43
  • 1
    yes I want to reload just the current page. I'll try out your solution! So, it's possible to put ELs in `faces-config` ?! Didn't know this! – Rajat Gupta Nov 14 '13 at 09:51
  • yes. See http://docs.oracle.com/javaee/6/tutorial/doc/bnaxf.html and http://java.dzone.com/articles/fluent-navigation-jsf-2 – 8bitjunkie Nov 14 '13 at 09:56
  • 1
    Thanks please post as an answer so I could accept. `#{view.viewId}` didn't work for me as I use a URL rewritter(Prettyfaces) but I found a solution once I came to know I could use EL over there. Another thing, there is small issue if you could help, my URLs are extensionless, `topic/23423` & faces-config redirects me to `topic/23423.xhtml` by appending `.xhtml` at the end of my viewIds. How could I prevent adding `.xhtml` to my extensionless URLs ? – Rajat Gupta Nov 14 '13 at 13:24
  • 1
    OP has posted followup question: http://stackoverflow.com/questions/19978988/prevent-xhtml-append-to-to-view-id-within-faces-config-xml – 8bitjunkie Nov 15 '13 at 12:10

1 Answers1

0

You can use EL expressions in your faces-config.xml file.

To return to the current view, for example:

<navigation-case>
        <from-outcome>success</from-outcome>
        <to-view-id>#{view.viewId}</to-view-id>
 </navigation-case>
8bitjunkie
  • 12,793
  • 9
  • 57
  • 70