看不出哪里问题,能进入action 但是获取不倒对象
@Action(value="article" ,results={
@Result (name="success" ,location="/loginFailer.jsp")
})
public class ArticleAction extends ActionSupport{
private static final long serialVersionUID = -2266695172069461659L;
@Resource
private ArticleService articleServicle;
private Article article;
public Article getArticle() {
return article;
}
public void setArticle(Article article) {
this.article = article;
}
public String add(){
System.out.println("asdasdasd");
articleServicle.save(article);
return "success";
}
}
<s:form action="article!add">
<s:textfield name ="article.title" label="title"/>
<s:textfield name ="article.content" label="content"/>
<s:textfield name ="article.type" label="type"/>
<s:textfield name="article.image" label="image"/>
<s:textfield name="article.keywords" label="keywords"/>
<s:textfield name="article.editer" label="editer"/>
<s:submit value="sumbit"/>
</s:form>
@Entity
@Table(name = "article")
public class Article {
@Id
@Column(name = "Id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "type")
private String type;
@Column(name = "content")
private String content;
@Column(name = "title")
public String title;
@Column(name = "keywords")
private String keywords;
@Column(name = "editer")
private String editer;
@Column(name = "image")
private String image;
public Article(String type,String content,String title,
String keywords,String editer,String image
){
this.type=type;
this.content=content;
this.title=title;
this.keywords=keywords;
this.editer=editer;
this.image=image;
}
/*
略get,set
*/