81,114
社区成员
发帖
与我相关
我的任务
分享public class Clas {
private int id;
private int orde;//专业几班
private int birthday;//多少级
private int majorId;
private int bossId;
public class ClasAction extends ActionSupport {
private ClasService cs = new ClasService();
private Clas c;
public String add() {
System.out.println("cs:"+cs);
System.out.println("c:"+c);
cs.add(c);
System.out.println("Clas_add!");
return SUCCESS;
}
上面是action
班级增加<br/>
<s:form action="admin/Clas_add" method="post">
<s:hidden name="c.id"/>
<s:textfield name="c.orde" label="多少班" />
<s:textfield name="c.birthday" label="年级" />
<s:textfield name="c.majorId" label ="专业id"/>
<s:textfield name="c.bossId" label="班主任id" />
<s:submit/>
</s:form>
上面是jsp
貌似遇到过这问题的,所以会喽
,谢谢各位了

public Clas getC() {
return c;
}
public void setC(Clas c) {
this.c = c;
}这是action里面的
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}这是model里面的ognl.MethodFailedException: Method "setId" failed for object com.xhq.model.Clas@1ffccd6 [java.lang.NoSuchMethodException: com.xhq.model.Clas.setId([Ljava.lang.String;)]会出错