⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calendartag.java

📁 一个实用工具类
💻 JAVA
字号:
/* * Copyright (C) butor.com. All rights reserved. * * This software is published under the terms of the GNU Library General * Public License (GNU LGPL), a copy of which has been included with this * distribution in the LICENSE.txt file.  */package org.butor.web.taglib.html;import java.io.IOException;import java.util.Locale;import javax.servlet.jsp.JspException;import javax.servlet.jsp.JspWriter;import javax.servlet.jsp.tagext.TagSupport;import org.apache.struts.taglib.html.Constants;import org.apache.struts.util.RequestUtils;import org.apache.struts.util.ResponseUtils;import org.butor.web.action.IButorActionForm;import org.butor.web.context.IWebContext;import org.butor.web.context.WebContextService;/** * Puts the calendar link along with its icon. *  * @author 	mateusfi */public class CalendarTag extends TagSupport {	/**	 * Name of the form-bean containing the property attribute.	 */	protected String f_name;		/**	 * Property of the form-bean on which the date must be copied.	 */	protected String f_property;		/**	 * Property of the form-bean representing the start date as relative to property attribute.	 */	protected String f_startDateProperty;		/**	 * Format of the input date.	 */	protected String f_format;		/**	 * Image file name of the icon to display.	 */	protected String f_image;		/**	 * @see javax.servlet.jsp.tagext.Tag#release()	 */	public void release() {		super.release();				f_name = Constants.BEAN_KEY;	}	/**	 * Returns the name.	 * @return String	 */	public String getName() {		return f_name;	}	/**	 * Sets the name.	 * @param name The name to set	 */	public void setName(String name) {		f_name = name;	}	/**	 * Returns the format.	 * @return String	 */	public String getFormat() {		return f_format;	}	/**	 * Returns the property.	 * @return String	 */	public String getProperty() {		return f_property;	}	/**	 * Sets the format.	 * @param format The format to set	 */	public void setFormat(String format) {		f_format = format;	}	/**	 * Sets the property.	 * @param property The property to set	 */	public void setProperty(String property) {		f_property = property;	}	/**	 * @see javax.servlet.jsp.tagext.Tag#doStartTag()	 */	public int doStartTag() throws JspException {    	// Find and check the form bean    	Object o = RequestUtils.lookup(pageContext, getName(), null);    	        if (! (o instanceof IButorActionForm)) {			ResponseUtils.write(pageContext, "The form bean must be an instance of ButorActionForm !!!");			return SKIP_BODY;        }                IButorActionForm form = (IButorActionForm) o;        				if (getImage() == null) {			setImage("/_images/calendar.gif");		}				if (form.getEnabled(getProperty())) {			try {				JspWriter writer = pageContext.getOut();				writer.print("<a href=\"javascript:startCalendar(");				writer.print("'" + getName() + "', ");				writer.print("'" + getProperty() + "', ");				writer.print("'" + getStartDateProperty() + "', ");								IWebContext context = WebContextService.getContext();				Locale locale = context.getLocale();								// Temporary!				// Language conversion - calendar.js should be fixed to use ISO language codes !				String language = "";				if (locale.getLanguage().equals(Locale.FRENCH.getLanguage())) {					language = "FRA";				} else if (locale.getLanguage().equals(Locale.ENGLISH.getLanguage())) {					language = "ENG";				}				writer.print("'" + language + "', ");				writer.print("'" + getFormat() + "')\">");								writer.print("<img src=\"" + getImage() + "\"border=\"0\">");				writer.print("</a>");								writer.println();			} catch (IOException e) {				throw new JspException(e);			}		}						return SKIP_BODY;	}	/*	protected String findFormName() {					}*/	/**	 * Returns the startDateProperty.	 * @return String	 */	public String getStartDateProperty() {		return f_startDateProperty;	}	/**	 * Sets the startDateProperty.	 * @param startDateProperty The startDateProperty to set	 */	public void setStartDateProperty(String startDateProperty) {		f_startDateProperty = startDateProperty;	}	/**	 * Returns the image.	 * @return String	 */	public String getImage() {		return f_image;	}	/**	 * Sets the image.	 * @param image The image to set	 */	public void setImage(String image) {		f_image = image;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -