mencoba komponen radiogroup tapestry5

File .tml

<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>

File .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;
 }

}

File Rokok.java

 package com.example.tutorial.entities;

public enum Rokok {
 GUDANG, DYARUM, DJIZAMZOE
 }

Published by

saifiahmada

Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s