KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > jtrac > web > tag > ItemView


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package info.jtrac.web.tag;
18
19 import info.jtrac.domain.Item;
20 import info.jtrac.util.ItemUtils;
21 import java.io.IOException JavaDoc;
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23 import javax.servlet.http.HttpServletResponse JavaDoc;
24 import javax.servlet.jsp.JspWriter JavaDoc;
25 import javax.servlet.jsp.PageContext JavaDoc;
26 import javax.servlet.jsp.tagext.SimpleTagSupport JavaDoc;
27
28 public class ItemView extends SimpleTagSupport JavaDoc {
29     
30     private Item item;
31     
32     public void setItem(Item item) {
33         this.item = item;
34     }
35     
36     @Override JavaDoc
37     public void doTag() {
38         PageContext JavaDoc pageContext = (PageContext JavaDoc) getJspContext();
39         HttpServletRequest JavaDoc request = (HttpServletRequest JavaDoc) pageContext.getRequest();
40         HttpServletResponse JavaDoc response = (HttpServletResponse JavaDoc) pageContext.getResponse();
41         JspWriter JavaDoc out = pageContext.getOut();
42         try {
43             out.print(ItemUtils.getAsHtml(item, request, response));
44         } catch (IOException JavaDoc ioe) {
45             throw new RuntimeException JavaDoc(ioe);
46         }
47     }
48     
49 }
50
Popular Tags