1 23 24 package org.dbforms.taglib; 25 26 import javax.servlet.http.*; 27 import javax.servlet.jsp.*; 28 29 30 31 37 public class DbBlobURLTag extends DbBaseHandlerTag 38 implements javax.servlet.jsp.tagext.TryCatchFinally { 39 40 protected String nameField; 41 42 47 public void setNameField(String nameField) { 48 this.nameField = nameField; 49 } 50 51 52 57 public String getNameField() { 58 return nameField; 59 } 60 61 62 65 public void doCatch(Throwable t) throws Throwable { 66 throw t; 67 } 68 69 70 73 80 public int doEndTag() throws javax.servlet.jsp.JspException { 81 try { 82 StringBuffer tagBuf = new StringBuffer (((HttpServletRequest) pageContext 83 .getRequest()).getContextPath()); 84 85 tagBuf.append("/servlet/file?tf=") 86 .append(getTableFieldCode()) 87 .append("&keyval=") 88 .append(getKeyVal()); 89 90 if (this.nameField != null) { 92 tagBuf.append("&nf="); 93 tagBuf.append(nameField); 94 } 95 96 if (getDefaultValue() != null) { 98 tagBuf.append("&defaultValue=" + getDefaultValue()); 99 100 } 102 103 pageContext.getOut() 104 .write(tagBuf.toString()); 105 } catch (java.io.IOException ioe) { 106 throw new JspException("IO Error: " + ioe.getMessage()); 107 } 108 109 return EVAL_PAGE; 110 } 111 112 113 116 public void doFinally() { 117 super.doFinally(); 118 } 119 120 121 126 protected String getKeyVal() { 127 return getParentForm() 128 .getTable() 129 .getKeyPositionString(getParentForm().getResultSetVector()); 130 } 131 132 133 136 141 private String getTableFieldCode() { 142 StringBuffer buf = new StringBuffer (); 143 144 buf.append(getParentForm().getTable().getId()); 145 buf.append("_"); 146 buf.append(getField().getId()); 147 148 return buf.toString(); 149 } 150 } 151 | Popular Tags |