Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7488949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:06:59+00:00 2026-05-29T15:06:59+00:00

In my JSF2 project I want to include following two style sheet to my

  • 0

In my JSF2 project I want to include following two style sheet to my Facelet page based on a condition which is to be obtained from a managed bean.

<link rel="stylesheet" href="css/menu_style_1.css" type="text/css" />
<link rel="stylesheet" href="css/menu_style_2.css" type="text/css" />

How can I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:07:01+00:00Added an answer on May 29, 2026 at 3:07 pm

    try

    <h:outputStylesheet  name="css/menu_style_1.css" target="head" rendered="#{myBean.myValue eq 'myCondition1'}"/>
    

    and

    <h:outputStylesheet name="css/menu_style_2.css" target="head" rendered="#{myBean.myValue eq 'myCondition2'}"/>
    

    OR… you can do it in one line…

    <h:outputStylesheet name="css/#{myBean.myValue == 'true' ? 'menu_style_1.css' : 'menu_style_2.css'}" target="head" />
    

    I guess if you want to stick to the link tag you can try something like that

    <link  rel="stylesheet" href="css/#{myBean.myValue == 'true' ? 'menu_style_1.css' : 'menu_style_2.css'}" type="text/css" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSF2/Richfaces 4 project in which I want to use one of
I'd like to start a little project with maven. I want to use JSF2
i want use spring security taglibs in my jsf project,so I've made ​​the following
Quick project explanation: We have a built application based on JSF2 + Spring with
Some problematic bahaviour in my JSF2 project. I have a dropdown box h:selectOneMenu which
I create simple project using the following environment. 1. Netbeans IDE6.9.1 (File->NewProject->Select JSF2.0 libraries)
In my JSF 2.0 project, I get a name-space collision when I include two
I've got two JSF2 composite components: <my:modal /> and <my:about /> . <my:modal />
I want to deploy my JSF2 app on tomcat using mvn tomcat:run . I
I have a web project using jsf2 implementing a gaming web site on tomcat7.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.