View Javadoc
1 package com.mlw.fps.view.taglib; 2 3 import java.io.IOException; 4 5 import javax.servlet.jsp.JspException; 6 import javax.servlet.jsp.JspWriter; 7 8 import org.apache.struts.util.RequestUtils; 9 10 import com.mlw.fps.model.business.bean.SystemProperties; 11 12 public class WeaponTag extends javax.servlet.jsp.tagext.BodyTagSupport 13 { 14 private String name; 15 private String property; 16 private String scope = "page"; 17 18 public WeaponTag() 19 { 20 super(); 21 } 22 23 public void release() 24 { 25 name = null; 26 property = null; 27 scope = "page"; 28 } 29 30 public int doStartTag() throws JspException 31 { 32 return EVAL_BODY_AGAIN; 33 } 34 35 public int doEndTag() throws JspException 36 { 37 Object weapon = RequestUtils.lookup(pageContext, name, property, scope); 38 39 StringBuffer sb = new StringBuffer(); 40 41 sb.append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); 42 sb.append(" <tr><td class=\"weapon\" width=\"50%\" align=\"right\" >"); 43 sb.append(weapon); 44 sb.append("</td><td class=\"weapon\" width=\"50%\" align=\"left\" >"); 45 sb.append(" <img border=\"0\" src=\"/fps/images/weapons/2.0/").append(SystemProperties.getProperty("game")).append("_").append(weapon).append(".gif\" />" ); 46 sb.append("</td></tr>"); 47 sb.append("</table>"); 48 49 try 50 { 51 JspWriter out = pageContext.getOut(); 52 out.print( sb.toString() ); 53 } 54 catch(IOException e) 55 { 56 } 57 58 return SKIP_BODY; 59 } 60 61 /*** Setter for property name. 62 * @param name New value of property name. 63 */ 64 public void setName(String name) 65 { 66 this.name = name; 67 } 68 69 /*** Setter for property property. 70 * @param property New value of property property. 71 */ 72 public void setProperty(String property) 73 { 74 this.property = property; 75 } 76 77 /*** Getter for property scope. 78 * @return Value of property scope. 79 */ 80 public String getScope() 81 { 82 return this.scope; 83 } 84 85 /*** Setter for property scope. 86 * @param scope New value of property scope. 87 */ 88 public void setScope(String scope) 89 { 90 this.scope = scope; 91 } 92 93 }

This page was automatically generated by Maven