View Javadoc

1   /*
2    * JCaptcha, the open source java framework for captcha definition and integration
3    * Copyright (c)  2007 jcaptcha.net. All Rights Reserved.
4    * See the LICENSE.txt file distributed with this package.
5    */
6   
7   package com.octo.captcha.module.taglib;
8   
9   import com.octo.captcha.module.config.CaptchaModuleConfig;
10  import com.octo.captcha.service.CaptchaService;
11  
12  import java.io.IOException;
13  
14  /***
15   * <p><ul><li></li></ul></p>
16   *
17   * @author <a href="mailto:mag@jcaptcha.net">Marc-Antoine Garrigue</a>
18   * @version 1.0
19   */
20  public class MessageTag extends BaseCaptchaTag implements javax.servlet.jsp.tagext.Tag {
21  
22      private String messageKey = CaptchaModuleConfig.getInstance().getMessageKey();
23  
24      public int doEndTag() throws javax.servlet.jsp.JspException {
25  
26  
27          String message = (String) pageContext.getRequest().getAttribute(messageKey);
28          if (message != null) {
29              try {
30                  pageContext.getOut().write(message);
31              } catch (IOException e) {
32                  throw new javax.servlet.jsp.JspException(e);
33              }
34  
35          }
36          return javax.servlet.jsp.tagext.Tag.EVAL_PAGE;
37      }
38  
39  
40      protected CaptchaService getService() {
41          return null;
42      }
43  }