Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic navigation in jsf  RSS feed

 
Khushwinder Chahal
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi good people,

I want to create dynamic <to-view-id>#{dynamicValue}</to-view-id>
in jsf. Is there any way of doing this?
Please suggest me something.

Regards,
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. It wouldn't make any sense either.

What's the functional requirement after all?
 
Khushwinder Chahal
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bauke ,
Thanks for your reply.
The requirement is this i have a drop down menu.
Which is having sub nodes in it.
When i click on these sub nodes it is going to a controller class which is evaluating the next to-view-id dynamically.
Now rather than writing entries in the faces-config separately i want that next view id must be call based upon the value evaluating in the controller class and there should be only one entry for next view id in the faces-config.xml.

Please suggest me if there is any way out in jsf.

Regards,
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use ExternalContext#dispatch() or ExternalContext#redirect() where you pass the desired view-id in as parameter.
 
Hatem Alimam
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, actualy this bad idea to use ExternalContext#dispatch() or ExternalContext#redirect()... why ... it's not Pro..
You can do this ....
go to faces-config.xml and ...

<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>globalHome</from-outcome>
<to-view-id>/app/index.jspx</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>globalAbout</from-outcome>
<to-view-id>/app/about.jspx</to-view-id>
</navigation-case>
</navigation-rule>

so in this case where ever your outcome from any JSF page is globalHome >>>
it take you to > /app/index.jspx ....and you can do it for any page like >/app/about.jspx in my example the outcome from any page would be globalAbout will take you to >>> >/app/about.jspx

Best Regards.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that he should define them all in the faces-config.xml, but he said that he didn't want to do that. Don't be a smartass please.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!