JSP使用javabean时出现的问题,为什么我定义了半径的get和set方法,它却说我没有定义,新手求解,急!!

public class Circle { int radius; public Circle() { radius=1; } public int getRadius() { return radius; } public void setRadius(int newRadius) { radius=newRadius; } public double circleArea() { return Math.PI*radius*radius; } public double circleLength() { return 2.0*Math.PI*radius; }}<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body><jsp:useBean id="haha" class="first.Circle" scope="page" /><%haha.setRadius(100);%><P>圆的半径是:<%=haha.getRadius()%><P>圆的周长是:<%=haha.circleLength()%><P>圆的面积是:<%=haha.circleArea()%></body></html>

scope改为qppliaction试试
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网