Myeclipse8.5
提示这个错误,我搞不明白。请大侠帮忙Can't find a method to write property 'name' of type 'java.lang.String' in a bean of type 'part4.Student'package part4;public class Student
{
public String name=null;
public long number;
public double height,weight;
public String getName()
{
return name;
}
public void SetName(String name)
{
this.name=name;
}
public long getNumber()
{
return number;
}
public void SetHeight(double height)
{
this.height=height;
}
public double getHeight()
{
return height;
}
public void setWeight(double weight)
{
this.weight=weight;
}
public double getWeight()
{
return weight;
}
}
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="part4.Student" %>
<HTML>
<body bgcolor=pink>
<font size=4>
<jsp:useBean id="zhao" class="part4.Student" scope="page"/>
<jsp:setProperty property="name" name="zhao" value="赵峰"/>
名字是:<jsp:getProperty property="name" name="zhao"/>
<jsp:setProperty property="number" name="zhao" value="001"/>
<BR>学号是:<jsp:getProperty property="number" name="zhao"/>
<jsp:setProperty property="weight" name="zhao" value="60"/>
<BR>体重是:<jsp:getProperty name="zhao" property="weight" />
<jsp:setProperty property="height" name="zhao" value="<%=175%>"/>
<BR>身高是:<jsp:getProperty property="weight" name="zhao"/>
</font>
</body>
</HTML>
提示这个错误,我搞不明白。请大侠帮忙Can't find a method to write property 'name' of type 'java.lang.String' in a bean of type 'part4.Student'package part4;public class Student
{
public String name=null;
public long number;
public double height,weight;
public String getName()
{
return name;
}
public void SetName(String name)
{
this.name=name;
}
public long getNumber()
{
return number;
}
public void SetHeight(double height)
{
this.height=height;
}
public double getHeight()
{
return height;
}
public void setWeight(double weight)
{
this.weight=weight;
}
public double getWeight()
{
return weight;
}
}
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="part4.Student" %>
<HTML>
<body bgcolor=pink>
<font size=4>
<jsp:useBean id="zhao" class="part4.Student" scope="page"/>
<jsp:setProperty property="name" name="zhao" value="赵峰"/>
名字是:<jsp:getProperty property="name" name="zhao"/>
<jsp:setProperty property="number" name="zhao" value="001"/>
<BR>学号是:<jsp:getProperty property="number" name="zhao"/>
<jsp:setProperty property="weight" name="zhao" value="60"/>
<BR>体重是:<jsp:getProperty name="zhao" property="weight" />
<jsp:setProperty property="height" name="zhao" value="<%=175%>"/>
<BR>身高是:<jsp:getProperty property="weight" name="zhao"/>
</font>
</body>
</HTML>
解决方案 »
- 怎么实现网上商城中代金卷功能啊
- 品红网页如何编程
- action返回json奇怪啊。。。。
- 严重: Servlet.service() for servlet jsp threw exception
- js中关于prototype的问题
- 非常着急,而且很难得问题(关于将Excel文件转换为可编辑的Html)问题
- 求购新闻发布系统,那位能给点意见?
- JSP开发的过来人帮忙看看我的学习计划,谢谢!
- Tomcat注册成windows服务其中的web应用调用dll不好使
- 为什么idea新建的web项目不显示web和.idea文件夹?
- 我JavaScript的语句为什么在网页中不起作用啊
- 如何使用jquery动态获取id,并且做校验
在这里 <jsp:setProperty property="name" name="zhao" value="赵峰"/>
编译器可能会误解为其他的用处,换一个试试看
<%@ page import="part4.Student" %>
确保你的\part4是在tomcat\webapps\youweb\WEB-INF\CLASS目录下
可能是这个问题导致的
{
this.name=name;
}
改为
public void setName(String name)
{
this.name=name;
}
要是问题解决了,结贴,给分
提示说的很清楚啦,不能找到这个方法去写入name这个属性,那就是说你的set方法有问题
这个方法要按照规范来,不然内部映射找不到