Skip to content

Instantly share code, notes, and snippets.

@Promichel
Created January 13, 2012 18:17
Show Gist options
  • Save Promichel/1607869 to your computer and use it in GitHub Desktop.
Save Promichel/1607869 to your computer and use it in GitHub Desktop.
JSF Tutorial 2
package de.jsftutorial;
import javax.faces.bean.ManagedBean;
/**
* Created by Patrick Trautmann
* <p/>
* Contact: patrick.trautmann@gmail.com
* Date: 13.01.12
* Time: 18:57
*/
@ManagedBean(name = "helloWorld")
public class HelloWorldController {
private String helloText = "Willkommen";
private String eingabeTest;
public void absenden() {
System.out.println(eingabeTest);
}
public String getHelloText() {
return helloText;
}
public void setHelloText(String helloText) {
this.helloText = helloText;
}
public String getEingabeTest() {
return eingabeTest;
}
public void setEingabeTest(String eingabeTest) {
this.eingabeTest = eingabeTest;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
Created by Patrick Trautmann
Contact: patrick.trautmann@gmail.com
Date: 13.01.12
Time: 18:34
-->
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Simple JSF Facelets page</title>
</h:head>
<h:body>
<h:outputText value="#{helloWorld.helloText}" />
<h:form>
Unsere Eingabe: <h:inputText value="#{helloWorld.eingabeTest}" />
<h:commandButton value="Absenden" action="#{helloWorld.absenden}" />
</h:form>
</h:body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment