我这是按着书上的范例写的
我没有发现
一个字母都不错,大小写也区分了,符号也不错
测试 :
提示错误为:
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 4 in the jsp file: /jsptest/3.08.jsp
string cannot be resolved to a type
我没有发现
一个字母都不错,大小写也区分了,符号也不错
测试 :
提示错误为:
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 4 in the jsp file: /jsptest/3.08.jsp
string cannot be resolved to a type
private String phoneType; private String phoneModel; private int phonePrice; public String getPhoneModel() {
return phoneModel;
} public void setPhoneModel(String phoneModel) {
this.phoneModel = phoneModel;
} public int getPhonePrice() {
return phonePrice;
} public void setPhonePrice(int phonePrice) {
this.phonePrice = phonePrice;
} public String getPhoneType() {
return phoneType;
} public void setPhoneType(String phoneType) {
this.phoneType = phoneType;
} public static void main(String[] args) {
CellPhone myphone = new CellPhone();
myphone.setPhoneModel("Siemens");
myphone.setPhonePrice(500);
myphone.setPhoneType("s2588"); System.out.println(myphone.getPhoneModel());
System.out.println(myphone.getPhonePrice());
System.out.println(myphone.getPhoneType()); }
}
错误信息中
org.apache.jasper.JasperException: Unable to compile class for JSP:
——JasperException 代表jsp语法错误
An error occurred at line: 4 in the jsp file: /jsptest/3.08.jsp
——这个说明了第四行诗错误的
string cannot be resolved to a type
——这个说string不是个正确的类型拜托,异常都说那么明白了,怎么还研究是不是get方法的问题?只有get没有set只能说明不是bean文件或者代码不规范而已,就算不写set照样不报错的。
不否认有些书的确有错误,但是不能出现问题就怀疑书不对吧~~