实现类(带功能的bean)
tld
配置(可以在web.xml中,在tld中也可以)
jsp使用百度下找个例子体会体会!
tld
配置(可以在web.xml中,在tld中也可以)
jsp使用百度下找个例子体会体会!
解决方案 »
- "?x…456#$%...<<<hello>>>yyy..!@#...*" 用一句话取出尖括号之间的字符。
- 急求一份jfreechart饼图能运行的到超链接的例子,谢谢了~~~~
- 求问action A 如何调用action B 中的方法?(涉及B的初始化)
- 我在打开我自己写的jsp页面时,为什么有时回跳出要求键入用户名和密码的对话框
- Weblogic上面的空指针错误
- 请问tomcat提示这个问题怎么解决
- 在LINUX下开发JSP,但TOMCAT配置不了
- 有谁能告诉我这两个的作用啊!!!!
- 在BMP中(注意:不是CMP),哪些方法是必须(注意:是必须)要实现的?
- 一个关于jms的问题
- 如何创建后台服务
- XSLT里 能不能 有个属性或元素 调用系统的时间?
继承TagSupport类,覆盖doStartTag方法
然后在你的doStartTag用TagUtils.getInstance().write(pageContext, tmpStr);
return SKIP_BODY;
tmpStr是你的Tag要输出的内容
然后tag的参数设置成getter和setter
在tld里做相应的配置
就这么简单
完了
/*
* 创建日期 2006-5-22
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
package org.epilot.eai.tag;import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
import org.epilot.eai.manage.SystemManager;/**
* @author zhh
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class OptionTag extends SimpleTagSupport{
//String paramType,String paramID,boolean haveEmptyHead,boolean isShowForbid,String prefix,String suffix;
protected String method;
protected String paramType;
protected String paramID;
protected boolean haveEmptyHead;
protected boolean isShowForbid;
protected String prefix;
protected String suffix;
/**
* @return 返回 haveEmptyHead。
*/
public boolean getHaveEmptyHead() {
return this.haveEmptyHead;
}
/**
* @return 返回 isShowForbid。
*/
public boolean getIsShowForbid() {
return this.isShowForbid;
}
/**
* @return 返回 method。
*/
public String getMethod() {
return this.method;
}
/**
* @return 返回 paramID。
*/
public String getParamID() {
return this.paramID;
}
/**
* @return 返回 paramType。
*/
public String getParamType() {
return this.paramType;
}
/**
* @return 返回 prefix。
*/
public String getPrefix() {
return this.prefix;
}
/**
* @return 返回 suffix。
*/
public String getSuffix() {
return this.suffix;
}
/**
* @param haveEmptyHead 要设置的 haveEmptyHead。
*/
public void setHaveEmptyHead(boolean haveEmptyHead) {
this.haveEmptyHead = haveEmptyHead;
}
/**
* @param isShowForbid 要设置的 isShowForbid。
*/
public void setIsShowForbid(boolean isShowForbid) {
this.isShowForbid = isShowForbid;
}
/**
* @param method 要设置的 method。
*/
public void setMethod(String method) {
this.method = method;
}
/**
* @param paramID 要设置的 paramID。
*/
public void setParamID(String paramID) {
this.paramID = paramID;
}
/**
* @param paramType 要设置的 paramType。
*/
public void setParamType(String paramType) {
this.paramType = paramType;
}
/**
* @param prefix 要设置的 prefix。
*/
public void setPrefix(String prefix) {
this.prefix = prefix;
}
/**
* @param suffix 要设置的 suffix。
*/
public void setSuffix(String suffix) {
this.suffix = suffix;
}
/**
*
* @throws JspException
* @throws IOException
*/
public void doTag() throws JspException, IOException {
if ("getParameterValue".equals(method)){
getJspContext().getOut().write(SystemManager.getParameterValue(this.paramType, this.getParamID()));
} else if ("getParameterOption".equals(method)){
getJspContext().getOut().write(SystemManager.getParameterOption(this.paramType, this.haveEmptyHead,
this.isShowForbid, this.prefix, this.suffix));
} else if ("getSelectedParameterOption".equals(method)){
getJspContext().getOut().write(SystemManager.getSelectedParameterOption(this.paramType, this.paramID, this.haveEmptyHead,
this.isShowForbid, this.prefix, this.suffix));
} else {
getJspContext().getOut().write("");
}
}
}
自己看看吧,对你应该有帮助!