1 5 6 package com.raptus.owxv3.libtags; 7 8 import java.io.IOException ; 9 10 import javax.servlet.jsp.JspException ; 11 import javax.servlet.jsp.tagext.TagSupport ; 12 13 import org.apache.struts.Globals; 14 import org.apache.struts.action.Action; 15 import org.apache.struts.util.RequestUtils; 16 17 import com.raptus.owxv3.LoggingManager; 18 19 41 public class ResourceFileTag extends TagSupport { 42 43 44 46 49 protected String myid = Action.MESSAGES_KEY; 50 51 public String getId() { 52 return (this.myid); 53 } 54 55 public void setId(String id) { 56 this.myid = id; 57 } 58 59 60 63 protected String mykey = null; 64 65 public String getKey() { 66 return (this.mykey); 67 } 68 69 public void setKey(String key) { 70 this.mykey = key; 71 } 72 73 75 76 81 public int doStartTag() throws JspException 82 { 83 String fname = RequestUtils.message(pageContext, myid, 84 Globals.LOCALE_KEY, mykey); 85 if(fname == null) 86 { 87 JspException e = new JspException ("Cannot retrieve filename!"); 88 RequestUtils.saveException(pageContext, e); 89 throw e; 90 } 91 else 92 { 93 try 94 { 95 pageContext.include(fname); 96 } 97 catch(javax.servlet.ServletException e) { 98 LoggingManager.log("ServletException (" + e.getMessage() + 99 ") while trying to include file " + fname, this); 100 } 101 catch(IOException e) { 102 LoggingManager.log("IOException (" + e.getMessage() + 103 ") while trying to include file " + fname, this); 104 } 105 } 106 107 return (SKIP_BODY); 109 } 110 111 112 115 public void release() 116 { 117 super.release(); 118 } 119 120 } 121 122 | Popular Tags |