1 19 20 package com.sslexplorer.webforwards.webforwardwizard.forms; 21 22 import javax.servlet.http.HttpServletRequest ; 23 24 import org.apache.struts.Globals; 25 import org.apache.struts.action.ActionErrors; 26 import org.apache.struts.action.ActionMapping; 27 import org.apache.struts.action.ActionMessage; 28 29 import com.sslexplorer.webforwards.WebForward; 30 import com.sslexplorer.wizard.AbstractWizardSequence; 31 import com.sslexplorer.wizard.forms.DefaultWizardForm; 32 33 35 public class WebForwardTypeSelectionForm extends DefaultWizardForm { 36 private static final int NO_TYPE_SELECTED = -1; 37 public static final String ATTR_TYPE = "type"; 38 private int type = WebForward.TYPE_TUNNELED_SITE; 39 40 43 public WebForwardTypeSelectionForm() { 44 super(true, false, "/WEB-INF/jsp/content/webforward/webforwardwizard/webForwardTypeSelection.jspf", "", false, false, 45 "webForwardTypeSelection", "webForwards", "webForwardWizard.webForwardTypeSelection", 1); 46 } 47 48 51 public void apply(AbstractWizardSequence sequence) throws Exception { 52 super.apply(sequence); 53 sequence.putAttribute(ATTR_TYPE, new Integer (type)); 54 } 55 56 59 public int getType() { 60 return type; 61 } 62 63 66 public void setType(int type) { 67 this.type = type; 68 } 69 70 @Override 71 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { 72 if(isCommiting() && type == NO_TYPE_SELECTED) { 73 ActionErrors errors = new ActionErrors(); 74 errors.add(Globals.ERROR_KEY, new ActionMessage("webForwardWizard.webForwardTypeSelection.error.noSelection")); 75 return errors; 76 } 77 return null; 78 } 79 } | Popular Tags |