KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > quikj > application > web > talk > jspbeans > ChatAccessFormTag


1 /*
2  * ChatTranscriptTag.java
3  *
4  * Created on April 4, 2004, 8:42 AM
5  */

6
7 package com.quikj.application.web.talk.jspbeans;
8
9 import javax.servlet.http.*;
10 import javax.servlet.jsp.*;
11 import java.io.*;
12
13 /**
14  *
15  * @author amit
16  */

17 public class ChatAccessFormTag extends javax.servlet.jsp.tagext.TagSupport JavaDoc
18 {
19     
20     /** Holds value of property type. */
21     private String JavaDoc type;
22     
23     /** Creates a new instance of ChatTranscriptTag */
24     public ChatAccessFormTag()
25     {
26     }
27     
28     public int doStartTag()
29     {
30         try
31         {
32             JspWriter out = pageContext.getOut();
33             HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
34             String JavaDoc context = request.getContextPath();
35             String JavaDoc customer = null;
36             if (request.getAttribute("customerProperty") != null)
37             {
38                 customer = ((ContactCenterCustomerProperty)request.getAttribute("customerProperty")).getCustomer();
39             }
40             
41             if (type.equals("unrestricted") == true)
42             {
43                 out.println("<form action=\""
44                 + context
45                 + "/servlet/ContactCenterUserInfoServlet\">");
46                 out.println("<input type=\"HIDDEN\" name=\"customer\" value=\""
47                 + customer + "\">");
48             }
49             else if (type.equals("restricted") == true)
50             {
51                 out.println("<form action=\""
52                 + context
53                 + "/servlet/ContactCenterAuthenticatorServlet\">");
54                 out.println("<input type=\"HIDDEN\" name=\"customer\" value=\""
55                 + customer + "\">");
56             }
57             else if (type.equals("email") == true)
58             {
59                 out.println("<form action=\""
60                 + context
61                 + "/servlet/ContactCenterEmailServlet\">");
62                 out.println("<input type=\"HIDDEN\" name=\"customer\" value=\""
63                 + customer + "\">");
64             }
65                 
66         }
67         catch (IOException ex)
68         {
69             return SKIP_PAGE;
70         }
71         
72         return EVAL_BODY_INCLUDE;
73     }
74     
75     public int doEndTag()
76     {
77         try
78         {
79             JspWriter out = pageContext.getOut();
80             
81             out.println("</form>");
82         }
83         catch (IOException ex)
84         {
85             return SKIP_PAGE;
86         }
87         return EVAL_PAGE;
88     }
89     
90     /** Getter for property type.
91      * @return Value of property type.
92      *
93      */

94     public String JavaDoc getType()
95     {
96         return this.type;
97     }
98     
99     /** Setter for property type.
100      * @param type New value of property type.
101      *
102      */

103     public void setType(String JavaDoc type)
104     {
105         this.type = type;
106     }
107     
108 }
109
Popular Tags