这是一个输出英文字母表的jsp程序, 但是为什么在out.print();这里会出错呢

<%@ page contentType="text/html;charset=GB2312" %>
<html>
<body>
<%!
public void num(){
char num1='a';
if(num1<'z'){

out.print(num1+"");
num1++;

}
}
public void num2(){
char num3='A';
if(num3<'Z'){

out.print(num3+"");
num3++;

}
}
%>
<%
num();
num2();
%>
</bdoy>
</html>

<%@ page contentType="text/html;charset=GB2312"%>
<html>
<body>

    <%!
    public void num(JspWriter sos) throws Exception {
        char num1 = 'a';
        if (num1 < 'z') {

            sos.print(num1 + "");
            num1++;

        }
    }

    public void num2(JspWriter sos) throws Exception {
        char num3 = 'A';
        if (num3 < 'Z') {

            sos.print(num3 + "");
            num3++;

        }
    }%>
    <%
        num(out);
        num2(out);
    %>
    </bdoy>
</html>

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答