I need to install 2 different ManagedProperty on the same bean. So I tried:
@ManagedBean(name="selector") @RequestScoped public class Selector { @ManagedProperty(value="#{param.page}") @ManagedProperty(value="#{param.profile_page}") private String page; private String profile_page; public String getProfile_page() { if(profile_page==null || profile_page.trim().isEmpty()) { this.profile_page="main"; } return profile_page; } public void setProfile_page(String profile_page) { this.profile_page = profile_page; } public String getPage() { if(page==null || page.trim().isEmpty()) { this.page="homepage"; } return page; } public void setPage(String page) { this.page=page; } }
but unfortunately I can't write 2 different @ManagedProperty: it says duplicate annotations. How can i fix this?
Other: when I return this value, it is a string, and I need to confront. This syntax is:
<h:panelGroup rendered="#{selector.profile_page.compareTo("main")}"> <ui:include src="/profile/profile_main.xhtml" /> </h:panelGroup>
will work?
Greetings
source share