1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * class FakeData -- represents the business logic */ public class FakeData { /** * data for mountains */ public static final String[] MOUNTAINS = {"Everest", "K2", "Kangchenjunga", "Lhotse", "Makalu", "Cho Oyu"}; /** * data for selected mountain */ public static final String SELECTED_MOUNTAIN = "Kangchenjunga"; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | package com.strutsrecipes; import org.apache.struts.action.ActionForm; /** * Radio Button Test Form to show an array of radio buttons and */ public class RadioTestForm extends ActionForm { // ------------------------------ FIELDS ------------------------------ /** * The selected Mountain */ private String selectedMountain; /** * The list of mountains for the radio button */ private String[] mountains; // --------------------------- CONSTRUCTORS --------------------------- /** * Constructor -- using FakeData... */ public RadioTestForm() { this.selectedMountain = FakeData.SELECTED_MOUNTAIN; this.mountains = FakeData.MOUNTAINS; } // --------------------- GETTER / SETTER METHODS --------------------- /** * Getter for the mountains * * @return the mountains array */ public String[] getMountains() { return this.mountains; } /** * Setter for the mountains * * @param m the Mountains array */ public void setMountains(String[] m) { this.mountains = m; } /** * Getter for selectedMountain * * @return the selected mountain */ public String getSelectedMountain() { return this.selectedMountain; } /** * Setter for selectedMountain * * @param sm the selectedMountain */ public void setSelectedMountain(String sm) { this.selectedMountain = sm; } } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |