When using NetBeans to develop JSP Javabeans, the book is turned on, according to JSP book ("JSP practical tutorial" Tsinghua University Press), the book is turned, and the word is said to be in accordance with the book, but When debugging, NetBeans did not know how much returned, and later found the reason.
The original JavaBeans source code is as follows: Circle.java
Public class circle {private int i; public circle () {i = 1;} public void setint (int J) {i = j;} public int getint () {Return i;}
And compile Circle.java Get Circle.class, WEB-INF / CLASSES / below
INDEX.JSP code is as follows:
<% @ Page Import = "Circle"%>
mybean = <% = myBean.get ()%> p>
body> html> When compiling, IMPORT CIRCLE = NULL
Later, I made the following adjustments to perform correctly: Circle.java
Package mypack; // pay attention to this sentence
Public class circle {private int i; public circle () {i = 1;} public void setint (int J) {i = j;} public int getint () {Return i;}
And the compiled circle.class is stored under Web-INF / CLASSES / MYPACK.
INDEX.JSP is modified as follows:
<% @ page import = "mypack.circle"%>
mybean = <% = myBean.get ()%> p>
body> html>
Then you can perform smoothly.
Summary: Pay attention to the importance of Package when developing JSP, this is the only statement that is the only way to mark.