1 27 28 29 package com.sun.ebank.web.template; 30 31 import javax.servlet.jsp.JspTagException ; 32 import javax.servlet.jsp.PageContext ; 33 import javax.servlet.jsp.tagext.SimpleTagSupport ; 34 import java.util.*; 35 36 37 public class DefinitionTag extends SimpleTagSupport { 38 private String definitionName = null; 39 private String screenId; 40 private HashMap screens = null; 41 42 public DefinitionTag() { 43 super(); 44 } 45 46 public HashMap getScreens() { 47 return screens; 48 } 49 50 public void setName(String name) { 51 this.definitionName = name; 52 } 53 54 public void setScreen(String screenId) { 55 this.screenId = screenId; 56 } 57 58 public void doTag() { 59 try { 60 screens = new HashMap(); 61 62 getJspBody() 63 .invoke(null); 64 65 Definition definition = new Definition(); 66 PageContext context = (PageContext ) getJspContext(); 67 ArrayList params = (ArrayList) screens.get(screenId); 68 Iterator ir = null; 69 70 if (params != null) { 71 ir = params.iterator(); 72 73 while (ir.hasNext()) 74 definition.setParam((Parameter) ir.next()); 75 76 context.setAttribute(definitionName, definition, 78 context.APPLICATION_SCOPE); 79 } else { 80 Debug.println("DefinitionTag: params are not defined."); 81 } 82 } catch (Exception ex) { 83 ex.printStackTrace(); 84 } 85 } 86 } 87 | Popular Tags |