[sourcecode language="xml"]
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<t:form t:id="form">
Barang yang dipesan
<t:label for="rokok"/>:<br/>
<t:radiogroup t:id="rokok">
<t:radio t:id="gudang"/><t:label for="gudang"/>
<t:radio t:id="dyarum"/><t:label for="dyarum"/>
<t:radio t:id="djizamzoe"/><t:label for="djizamzoe"/>
</t:radiogroup><br/>
<t:label for="shampoo"/>:<br/>
<t:radiogroup t:id="shampoo">
<t:radio t:id="clear"/><t:label for="clear"/>
<t:radio t:id="pantene"/><t:label for="pantene"/>
<t:radio t:id="sunsilk"/><t:label for="sunsilk"/>
</t:radiogroup><br/><br/>
<t:submit t:id="submit" t:value="Pesan"/>
</t:form>
<t:if test="item">
${item}
</t:if>
</html>
[/sourcecode]
File .java
[sourcecode language="java"]
package com.example.tutorial.pages;
import org.apache.tapestry5.annotations.Persist;
import com.example.tutorial.entities.Rokok;
public class Tradiogroup {
@Persist
private String item;
private Rokok rokok;
private String shampoo;
Object onSelectedFromSubmit(){
String items = "Shampoo : " + getShampoo() +", Rokok : "+getRokok();
setItem(items);
return this;
}
public String getClear(){return "Clear"; }
public String getPantene() { return "Pantene"; }
public String getSunsilk() { return "Sunsilk"; }
public Rokok getGudang(){
return rokok.GUDANG;
}
public Rokok getDyarum(){
return rokok.DYARUM;
}
public Rokok getDjizamzoe(){
return rokok.DJIZAMZOE;
}
public Rokok getRokok() {
return rokok;
}
public void setRokok(Rokok rokok) {
this.rokok = rokok;
}
public String getShampoo() {
return shampoo;
}
public void setShampoo(String shampoo) {
this.shampoo = shampoo;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
}
[/sourcecode]
File Rokok.java
[sourcecode language="java"]
package com.example.tutorial.entities;
public enum Rokok {
GUDANG, DYARUM, DJIZAMZOE
}
[/sourcecode]
No comments:
Post a Comment