这是因为标签类的实例化是从doStartTag()开始的,因此在doStartTag()外用pageContext.getOut()方法将什么也得不到,如果你真的想在方法外使用,那你可以将声明写在方法外,然后在方法内扶植如:public class Calculate
extends TagSupport {
private String value;
private String inputParam;
JspWriter out ; public int doStartTag() throws JspException {
out = pageContext.getOut();
inputParam = pageContext.getRequest().getParameter(value);
.................
extends TagSupport {
private String value;
private String inputParam;
JspWriter out ; public int doStartTag() throws JspException {
out = pageContext.getOut();
inputParam = pageContext.getRequest().getParameter(value);
.................
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货