BAEL-151 - Adding EL dependency

This commit is contained in:
Slavisa Baeldung 2016-07-06 13:24:52 +02:00
parent eb244dd0e6
commit 3b9e4c7a56
2 changed files with 117 additions and 118 deletions

View File

@ -25,6 +25,12 @@
<artifactId>jsf-impl</artifactId> <artifactId>jsf-impl</artifactId>
<version>${com.sun.faces.version}</version> <version>${com.sun.faces.version}</version>
</dependency> </dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>${javax.el.version}</version>
</dependency>
<!-- Spring --> <!-- Spring -->
@ -114,6 +120,7 @@
<!-- JSF --> <!-- JSF -->
<com.sun.faces.version>2.1.7</com.sun.faces.version> <com.sun.faces.version>2.1.7</com.sun.faces.version>
<javax.el.version>2.2</javax.el.version>
<!-- logging --> <!-- logging -->
<org.slf4j.version>1.7.13</org.slf4j.version> <org.slf4j.version>1.7.13</org.slf4j.version>

View File

@ -1,8 +1,4 @@
/* package com.baeldung.springintegration.controllers;
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.baeldung.el.controllers;
import java.util.Random; import java.util.Random;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@ -13,10 +9,6 @@ import javax.faces.bean.ViewScoped;
import javax.faces.component.html.HtmlInputText; import javax.faces.component.html.HtmlInputText;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
/**
*
* @author Tayo
*/
@ManagedBean(name = "ELBean") @ManagedBean(name = "ELBean")
@ViewScoped @ViewScoped
public class ELSampleBean { public class ELSampleBean {
@ -32,7 +24,7 @@ public class ELSampleBean {
pageCounter = randomIntGen.nextInt(); pageCounter = randomIntGen.nextInt();
} }
public void save(){ public void save() {
} }
@ -41,12 +33,12 @@ public class ELSampleBean {
} }
public void saveByELEvaluation(){ public void saveByELEvaluation() {
firstName = (String)evaluateEL("#{firstName.value}", String.class); firstName = (String) evaluateEL("#{firstName.value}", String.class);
FacesContext ctx = FacesContext.getCurrentInstance(); FacesContext ctx = FacesContext.getCurrentInstance();
FacesMessage theMessage = new FacesMessage("Name component Evaluated: "+firstName); FacesMessage theMessage = new FacesMessage("Name component Evaluated: " + firstName);
theMessage.setSeverity(FacesMessage.SEVERITY_INFO); theMessage.setSeverity(FacesMessage.SEVERITY_INFO);
ctx.addMessage(null,theMessage); ctx.addMessage(null, theMessage);
} }