The simplest 1 InputText and 1 CommandButton ADF (Application Development Framework) sample
It is a simple Java Server Page with ADF but it is not easy to find in the Internet. So, I created one here.
I have only one InputText and One Commandbutton on my page, all the properties are by default. I have a jspx page named OneButton.jspx and managed bean named OneButton.java.
Here is the XML representation in OneButton.jspx:
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="
http://java.sun.com/JSP/Page" version="2.0"
xmlns:h="
http://java.sun.com/jsf/html"
xmlns:f="
http://java.sun.com/jsf/core"
xmlns:af="
http://xmlns.oracle.com/adf/faces"
xmlns:afh="
http://xmlns.oracle.com/adf/faces/html">
<jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
doctype-system="
http://www.w3.org/TR/html4/loose.dtd"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
<jsp:directive.page contentType="text/html;charset=windows-1252"/>
<f:view>
<afh:html binding="#{backing_OneButton.html1}" id="html1">
<afh:head title="OneButton" binding="#{backing_OneButton.head1}"
id="head1">
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1252"/>
</afh:head>
<afh:body binding="#{backing_OneButton.body1}" id="body1">
<h:form binding="#{backing_OneButton.form1}" id="form1">
<af:inputText label="Label 1"
binding="#{backing_OneButton.inputText1}"
id="inputText1"/>
<af:commandButton text="commandButton 1"
binding="#{backing_OneButton.commandButton1}"
id="commandButton1"
action="#{backing_OneButton.commandButton1_action}"/>
</h:form>
</afh:body>
</afh:html>
</f:view>
<!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_OneButton-->
</jsp:root>
My InputText named inputText1 and CommandButton commandButton1. I have the following code in the managed bean:
public void setInputText1(CoreInputText inputText1) {
this.inputText1 = inputText1;
}
public CoreInputText getInputText1() {
return inputText1;
}
public void setCommandButton1(CoreCommandButton commandButton1) {
this.commandButton1 = commandButton1;
}
public CoreCommandButton getCommandButton1() {
return commandButton1;
}
public String commandButton1_action() {
// Add event code here...
String name = "Hello";
inputText1.setValue(name);
return null;
}
Download the sample file from http://skydrive.live.com. The sample file name is JustAButton.zip. My MSN ID is chanmmn@hotmail.com
Download JDeveloper here: http://www.oracle.com/technology/products/jdev/index.html, unzip JDeveloper. Open the JDeveloper application file with jws extension.