Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/aendvari/tethys/tag/logic/LessEqualTag.java


1   /*
2    * LessEqualTag.java
3    *
4    * Copyright (c) 2001, 2002 Aendvari, Ltd. All Rights Reserved.
5    *
6    * See the file LICENSE for terms of use.
7    *
8    */
9   
10  package com.aendvari.tethys.tag.logic;
11  
12  import java.io.IOException;
13  
14  import javax.servlet.http.*;
15  import javax.servlet.jsp.*;
16  import javax.servlet.jsp.tagext.*;
17  
18  import com.aendvari.common.util.*;
19  import com.aendvari.common.model.*;
20  
21  import com.aendvari.tethys.*;
22  import com.aendvari.tethys.tag.*;
23  import com.aendvari.tethys.context.*;
24  
25  
26  /**
27   * <p>Less then or equal operator tag.</p>
28   *
29   * @author  Scott Milne
30   *
31   */
32  
33  public class LessEqualTag extends OperatorTag
34  {
35    /* Variables */
36  
37  
38    /* Constructor */
39  
40    public LessEqualTag()
41    {
42      super();
43    }
44  
45    public int doStartTag() throws JspTagException
46    {
47      try
48      {
49        // call the parent first
50        super.doStartTag();
51  
52        // set the boolean value for the true/false tags
53        if( isStringType() )
54        {
55          // do the operation
56          if( (getActualValue().compareTo(getValue()) <= 0) )
57            setOperatorResponse(true);
58        }
59        // compare using number
60        else
61        {
62          double nActualValue = ConversionUtil.stringToDouble(getActualValue());
63          double nValue = ConversionUtil.stringToDouble(getValue());
64  
65          // do the operation
66          if( nActualValue <= nValue )
67            setOperatorResponse(true);
68        }
69      }
70      catch (Exception e)
71      {
72        throw new JspTagException("LessEqualTag:" + e.toString());
73      }
74  
75      return EVAL_BODY_INCLUDE;
76    }
77  }
78