1 16 17 18 package org.apache.struts.webapp.example; 19 20 21 import java.io.IOException ; 22 import javax.faces.FacesException; 23 import javax.faces.context.FacesContext; 24 25 26 29 30 abstract class AbstractBacking { 31 32 33 35 36 42 protected StringBuffer action(FacesContext context, String action) { 43 44 StringBuffer sb = new StringBuffer (action); 46 sb.append(".do"); 47 return (sb); 48 49 } 50 51 52 61 protected void forward(FacesContext context, String url) { 62 63 try { 64 context.getExternalContext().dispatch(url); 65 } catch (IOException e) { 66 throw new FacesException(e); 67 } finally { 68 context.responseComplete(); 69 } 70 71 } 72 73 74 80 protected StringBuffer logoff(FacesContext context) { 81 82 return (action(context, "/logoff")); 83 84 } 85 86 87 93 protected StringBuffer logon(FacesContext context) { 94 95 return (action(context, "/logon")); 96 97 } 98 99 100 106 protected StringBuffer registration(FacesContext context) { 107 108 return (action(context, "/editRegistration")); 109 110 } 111 112 113 119 protected StringBuffer subscription(FacesContext context) { 120 121 return (action(context, "/editSubscription")); 122 123 } 124 125 126 } 127 | Popular Tags |