jsf-2

Invisible comments in jsf 2.0? [duplicate]

和自甴很熟 提交于 2020-01-02 00:12:09
问题 This question already has an answer here : How can I remove HTML comments in my Facelets? (1 answer) Closed 5 years ago . is it possible to embed comments in my .xhtml-files that are only displayed in the source and not the rendered result? I want to include author, date,... in the files but they should not be visible to the enduser in the generated output. If I use the standard comment-tags <!-- --> the browser displays them. 回答1: Add the following into your web.xml : <context-param> <param

JSF life after logout

假装没事ソ 提交于 2020-01-01 19:48:27
问题 I'm using form based authentication. I have a logout link which looks like: <h:commandLink action="#{loginBean.logout}"> <h:outputText value="logout" /> </h:commandLink></div> And the corresponding logout method: public String logout() { FacesContext.getCurrentInstance().getExternalContext().invalidateSession(); return "/view/index?faces-redirect=true"; // Redirect added as per BalusC's suggestion. } After hitting the logout link I'm returned to the front page, but seemingly without CSS. When

JSF 2: h:link and getrowdata

a 夏天 提交于 2020-01-01 17:05:46
问题 If I have a h:dataTable in books.xhtml providing a list of records and I want to view a particular record, then add or edit that record, currently I have this: <h:dataTable #{BookBean.books}" var="books"> <h:link outcome="bookview" value="#{books[1]}"> <f:param name="id" value="#{books[2]}" /> </h:link> </h:dataTable> I found out that I need to include <f:param> in order to show the CSS status of clicked link; otherwise if I don't have <f:param> , every time I clicked on a link rendered by h

How do i embed java code inside jsf page?

回眸只為那壹抹淺笑 提交于 2020-01-01 16:53:33
问题 I have: A managed bean called "LoginBean". A JSF page called "login.xhtml" In this jsf page, i have a login form. Inside the managebean i have a loginCheck function. public void loginCheck(){ if(logincorrect){ //set user session }else{ //set lockout count session ++ } } What i want to do in my jsf page is that when the lock out count session == 2 (means users failed to login correctly 2 times, i need a recaptcha tag to be displayed. <td> <% if(FacesContext.getCurrentInstance()

Primefaces tabView executes form validation on tab change

守給你的承諾、 提交于 2020-01-01 16:46:40
问题 I am having a serious issue with the p:tabView component. I have set dynamic="true" and cache="false" to the tabView. One of the tabs has some input components which are set required="true" . Now when I am changing the tab each time, the form validation is occurring and the FacesMessages are being displayed in growl. Here is the tab: <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun

How to execute transition on value change in h:selectOneMenu?

孤街浪徒 提交于 2020-01-01 15:05:09
问题 Usually i do something like below. Clicking button execute transition. <!-- view --> <h:form> <h:commandButton action="doit"> <f:ajax render="@form"/> </h:commandButton> </h:form> <!-- flow --> <transition on="doit">...</transition> How to fire a transition on change value in (for example) h:selectOneMenu ? <h:form> <h:selectOneMenu value="#{selected}"> <f:selectItems value="#{items}/> <f:ajax event="valueChange" render="@form" /> </h:selectOneMenu> </h:form> Edit: I thought about registering

How to execute transition on value change in h:selectOneMenu?

家住魔仙堡 提交于 2020-01-01 15:05:08
问题 Usually i do something like below. Clicking button execute transition. <!-- view --> <h:form> <h:commandButton action="doit"> <f:ajax render="@form"/> </h:commandButton> </h:form> <!-- flow --> <transition on="doit">...</transition> How to fire a transition on change value in (for example) h:selectOneMenu ? <h:form> <h:selectOneMenu value="#{selected}"> <f:selectItems value="#{items}/> <f:ajax event="valueChange" render="@form" /> </h:selectOneMenu> </h:form> Edit: I thought about registering

Where should I open / close JMS connections in a JSF ManagedBean?

百般思念 提交于 2020-01-01 12:01:09
问题 In a simple demo web app using JSF 2 and Ajax, there is a method in the ManagedBean which receives messages from a JMS queue: @ManagedBean public class Bean { @Resource(mappedName = "jms/HabariConnectionFactory") private ConnectionFactory connectionFactory; @Resource(mappedName = "jms/TOOL.DEFAULT") private Queue queue; public String getMessage() { String result = "no message"; try { Connection connection = connectionFactory.createConnection(); connection.start(); Session session = connection

JSF form with URL action?

点点圈 提交于 2020-01-01 11:51:08
问题 Is there any way to call a URL action within a <h:commandButton> , or for that matter a <h:form> ? I'm trying to bypass my email's login page from my own website, so I'm using JSF beans to hold my login info in <h:inputSecret> tags so that I can simply click "Go to Email" and because I'm logged in to my own website, I could go straight to my inbox w/o logging in again 回答1: Just use plain HTML <form> instead of JSF <h:form> . <form action="http://example.com/mail" method="post"> <input type=

How can I use <h:outputScript /> with a remote file?

纵饮孤独 提交于 2020-01-01 09:57:13
问题 I have a server dedicated for static contents so I don't want to use the resources dir for storing javascript files but I don't want to stop using the <h:outputScript /> tag. How can I make that tag generate a link to my static server where the files are located instead of RES_NOT_FOUND . I don't even need JSF to check if the files are there... I tried: <h:outputScript name="#{requestBean.staticURL}/javascript.js"/> To generate: <script type="text/javascript" src="http://static.server.com