Spring bean definition template

As we discussed earlier a bean definition in configuration metadata can contain constructor arguments, property values etc. Spring framework provides the facility to define a bean definition template which can be used by child bean definitions. To define a template remove class attribute and use abstract attribute to true in bean definition. Use parent attribute … Read more

Spring bean definition inheritance

As we discussed earlier a bean definition in configuration metadata can contain constructor arguments, property values etc. Spring framework provides the facility that a child bean definition can inherits configuration data from a parent definition. A child definition can override some values of parent definition or add some others, as required. Use parent attribute in … Read more

JSF inputtextarea html tag

JSF h:inputTextarea tag is used to render a HTML textarea field. JSF tag: <h:inputTextarea rows=”15” cols=”20” value="Hello world" /><h:inputTextarea rows=”15” cols=”20” value="Hello world" /> Rendered HTML tag: <textarea name="j_idt6:j_idt8" rows=”15” cols=”20” value="Hello world" /><textarea name="j_idt6:j_idt8" rows=”15” cols=”20” value="Hello world" /> Attributes of h:inputSecret tag. Attribute Description 1. id id for the tag 2. binding Reference … Read more

Categories JSF

JSF inputSecret Password html tag

JSF h:inputSecret tag is used to render an HTML input element of the type “password”. JSF tag: <h:inputSecret value="password" /><h:inputSecret value="password" /> Rendered HTML tag: <input name="j_idt6:j_idt8" type="password" value="password" /><input name="j_idt6:j_idt8" type="password" value="password" /> Attributes of h:inputSecret tag. Attribute Description 1. id id for the tag 2. binding Reference to the component used in a … Read more

Categories JSF

Spring hello world example in eclipse

Let us create spring hello world example by following below steps: 1. Download spring jar files and add into project class path. Or use the maven, see our Maven Eclipse Spring example. 2. Create java class (bean). 3. Create spring configuration file which contains all bean configurations. 4. Create spring test class. 5. Load spring … Read more

JSF inputtext html tag

JSF h:inputText tag is used to render an HTML input element of the type “text”. JSF tag: <h:inputText value="Hello World" /><h:inputText value="Hello World" /> Rendered HTML tag: <input name="j_idt6:j_idt8" type="text" value="Hello World" /><input name="j_idt6:j_idt8" type="text" value="Hello World" /> Attributes of h:inputText tag. Attribute Description 1. id id for the tag 2. binding Reference to the … Read more

Categories JSF

JSF basic tags

JSF framework provides a standard HTML tag library. Each tag will rendered into corresponding html output. To use these html tags we have to use the following namespaces of URI in html node. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" ><html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" > JSF Core tags are given below: JSF core tags tutorial examples. JSF inputtext html tag … Read more

Categories JSF

JSF page redirect rule

As you can see in the previous examples urls are not changed while navigating from one view page to another because JSF by default uses forward functionality instead of redirect. For page redirection we have to append faces-redirect=true at the end of the view name. Syntax: pageName?faces-redirect=truepageName?faces-redirect=true Example explanation: When “Welcome” link is clicked welcome.xhtml … Read more

Categories JSF

JSF from-action navigation rule

As we discussed in previous example JSF can resolve view based on what managed bean method returns but what if two or more managed bean methods returns the same view. To resolve such view requests JSF provides the from action navigation facility. We have to put the entries of view pages into faces-config.xml file with … Read more

Categories JSF

JSF conditional navigation rule

Conditional navigation in JSF 2 framework provides the facility to navigate based on some condition. Navigation condition can be easily handled in managed bean action method. Example explanation: In this example we have two links Test and Welcome. A parameter “pageId” is defined for the links which is linked with the “pageId” property of the … Read more

Categories JSF