~ubuntu-branches/ubuntu/trusty/libstruts1.2-java/trusty-proposed

« back to all changes in this revision

Viewing changes to src/share/org/apache/struts/taglib/nested/logic/NestedMessagesNotPresentTag.java

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2004-11-19 15:35:25 UTC
  • Revision ID: james.westby@ubuntu.com-20041119153525-mdu08a76z4zo67xt
Tags: upstream-1.2.4
ImportĀ upstreamĀ versionĀ 1.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedMessagesNotPresentTag.java,v 1.8 2004/03/14 06:23:45 sraeburn Exp $
 
3
 * $Revision: 1.8 $
 
4
 * $Date: 2004/03/14 06:23:45 $
 
5
 *
 
6
 * Copyright 1999-2004 The Apache Software Foundation.
 
7
 * 
 
8
 * Licensed under the Apache License, Version 2.0 (the "License");
 
9
 * you may not use this file except in compliance with the License.
 
10
 * You may obtain a copy of the License at
 
11
 * 
 
12
 *      http://www.apache.org/licenses/LICENSE-2.0
 
13
 * 
 
14
 * Unless required by applicable law or agreed to in writing, software
 
15
 * distributed under the License is distributed on an "AS IS" BASIS,
 
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
17
 * See the License for the specific language governing permissions and
 
18
 * limitations under the License.
 
19
 */
 
20
package org.apache.struts.taglib.nested.logic;
 
21
 
 
22
import javax.servlet.http.HttpServletRequest;
 
23
import javax.servlet.jsp.JspException;
 
24
 
 
25
import org.apache.struts.taglib.logic.MessagesNotPresentTag;
 
26
import org.apache.struts.taglib.nested.NestedPropertySupport;
 
27
import org.apache.struts.taglib.nested.NestedPropertyHelper;
 
28
 
 
29
/**
 
30
 * NestedMessagesNotPresentTag.
 
31
 *
 
32
 * @since Struts 1.1
 
33
 * @version $Revision: 1.8 $ $Date: 2004/03/14 06:23:45 $
 
34
 */
 
35
public class NestedMessagesNotPresentTag extends MessagesNotPresentTag
 
36
                                                  implements NestedPropertySupport {
 
37
 
 
38
  /**
 
39
   * Overriding method of the heart of the matter. Gets the relative property
 
40
   * and leaves the rest up to the original tag implementation. Sweet.
 
41
   * @return int JSP continuation directive.
 
42
   *             This is in the hands of the super class.
 
43
   */
 
44
  public int doStartTag() throws JspException {
 
45
    // get the original properties
 
46
    originalName = getName();
 
47
    originalProperty = getProperty();
 
48
 
 
49
    // request
 
50
    HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
 
51
    // set the properties
 
52
    NestedPropertyHelper.setNestedProperties(request, this);
 
53
 
 
54
    // let the super do it's thing
 
55
    return super.doStartTag();
 
56
  }
 
57
 
 
58
  /**
 
59
   * Complete the processing of the tag. The nested tags here will restore
 
60
   * all the original value for the tag itself and the nesting context.
 
61
   * @return int to describe the next step for the JSP processor
 
62
   * @throws JspException for the bad things JSP's do
 
63
   */
 
64
  public int doEndTag() throws JspException {
 
65
    // do the super's ending part
 
66
    int i = super.doEndTag();
 
67
 
 
68
    // reset the properties
 
69
    setName(originalName);
 
70
    setProperty(originalProperty);
 
71
 
 
72
    // continue
 
73
    return i;
 
74
  }
 
75
 
 
76
  /**
 
77
   * Release the tag's resources and reset the values.
 
78
   */
 
79
  public void release() {
 
80
    super.release();
 
81
    // reset the originals
 
82
    originalName = null;
 
83
    originalProperty = null;
 
84
  }
 
85
 
 
86
  /* the usual private member variables */
 
87
  private String originalName = null;
 
88
  private String originalProperty = null;
 
89
}