Jsf attribute html tag

JSF f:attribute tag is used to assign an attribute value to a JSF UI component or a parameter to a component which can be get via action listener. Attributes of f:attribute tag. Attribute Description name The name of the attribute to set value The value of the attribute Example: Test.java import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import … Read more

Categories JSF

Jsf param html tag

JSF f:param tag is used to pass parameters to JSF UI Component. Note: 1. If f:param component is used with h:outputFormat then it specifies the placeholder. 2. If f:param component is used with other component then it specifies the request parameter. Attributes of f:param tag. Attribute Description id Identifier for a component binding Reference to … Read more

Categories JSF

Jsf messages html tag

JSF h:messages tag is used to render all messages for JSF UI Components in current page. JSF tag: <h:messages style="color:red;" /><h:messages style="color:red;" /> Rendered HTML tag: <ul style="color:red"> <li> UserName: Validation Error: Value is required </li> <li> Password: Validation Error: Value is required </li> </ul><ul style="color:red"> <li> UserName: Validation Error: Value is required </li> <li> … Read more

Categories JSF

Jsf message html tag

JSF h:message tag is used to render a message for a specific JSF UI Component. JSF tag: <h:inputText id="userName" size="15" label="UserName" required="true"> </h:inputText> <h:message for="userName " style="color:red" /><h:inputText id="userName" size="15" label="UserName" required="true"> </h:inputText> <h:message for="userName " style="color:red" /> Rendered HTML tag: <span style="color:red">UserName: Validation Error: Value is required</span><span style="color:red">UserName: Validation Error: Value is required</span> Attributes … Read more

Categories JSF

Jsf panelgrid html tag

JSF h:panelGrid tag is used to render HTML table element. Attributes of h:panelGrid tag. Attribute Description id id for the tag binding Reference to the component used in a backing bean rendered A boolean value; false would suppress rendering styleClass Cascading stylesheet (CSS) class name value value binding bgcolor Background color for the table border … Read more

Categories JSF

Jsf outputlink html tag

JSF h:outputLink tag is used to render HTML anchor element. Value attribute specify the target URL. JSF tag: <h:outputLink value="nextPage">Click Here</h:outputLink><h:outputLink value="nextPage">Click Here</h:outputLink> Rendered HTML tag: <a href="nextPage.xhtml">Click Here</a><a href="nextPage.xhtml">Click Here</a> Note: 1. The “h:link” tag is useful to generate a link which requires to interact with the JSF “outcome” , but lack of “action” … Read more

Categories JSF

Jsf commandlink html tag

JSF h:commandLink tag is used to render HTML anchor element. Value attribute specify the anchor text and action attribute determined the target URL. JSF tag: <h:commandLink value="Click here" action="nextPage" /><h:commandLink value="Click here" action="nextPage" /> Rendered HTML tag: <a href="#" onclick="mojarra.jsfcljs(document.getElementById(‘j_idt6’), {‘j_idt6:j_idt16′:’j_idt6:j_idt16’},”); return false">Click Here</a><a href="#" onclick="mojarra.jsfcljs(document.getElementById(‘j_idt6’), {‘j_idt6:j_idt16′:’j_idt6:j_idt16’},”); return false">Click Here</a> Note: In HTML output we … Read more

Categories JSF

Jsf link html tag

JSF h:link tag is used to render HTML anchor element. JSF tag: <h:link value="Click here" outcome="nextPage" /><h:link value="Click here" outcome="nextPage" /> Rendered HTML tag: <a href="/JavaServerFaces/faces/nextPage.xhtml">Click here</a><a href="/JavaServerFaces/faces/nextPage.xhtml">Click here</a> Note: We can add parameter to generated link by using f:param. <h:link value="Click here" outcome="nextPage" > <f:param name="id" value="1" /> </h:link><h:link value="Click here" outcome="nextPage" > <f:param … Read more

Categories JSF

Jsf outputscript html tag

JSF h:outputScript tag is used to render HTML script element with type “text/javascript” and link it to a js file. JSF tag: <h:outputScript library="js" name="test.js"/><h:outputScript library="js" name="test.js"/> Rendered HTML tag: <script type="text/javascript" src="/JavaServerFaces/faces/javax.faces.resource/test.js?ln=js"> </script><script type="text/javascript" src="/JavaServerFaces/faces/javax.faces.resource/test.js?ln=js"> </script> Example: test.js function sayHello(){ alert("Hello World."); }function sayHello(){ alert("Hello World."); } welcome.xhtml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC … Read more

Categories JSF

Jsf outputstylesheet html tag

JSF h:outputStylesheet tag is used to render HTML link element with type “text/css”. JSF tag: <h:outputStylesheet library="css" name="styles.css" /><h:outputStylesheet library="css" name="styles.css" /> Rendered HTML tag: <link type="text/css" rel="stylesheet" href="/JavaServerFaces/faces/javax.faces.resource/style.css?ln=css" /><link type="text/css" rel="stylesheet" href="/JavaServerFaces/faces/javax.faces.resource/style.css?ln=css" /> Note: When using h:outputStylesheet put entry in your page otherwise it will not work. Example: style.css .hello{ color:blue; }.hello{ color:blue; } … Read more

Categories JSF