私はこの問題を解決するのに苦労していますが、運がない。なぜstruts2がジェネリックで動作しないのですか
以下はサンプルコードです.jspでeditメソッドを呼び出すと、すべての値が入力されますが、変更を保存する場合はOGNLで例外が発生します。 おそらく、stuts2はジェネリックスでうまく動作しません。どんな提案も高く評価されます。おそらく...タイプミスフォームが、終了タグは、単なるHTMLのformタグである:S:
public abstract class ActionHelper<T> extends ActionSupport{
protected T entity;
protected Integer id;
public void setId(Integer id){
this.id=id;
}
public void setEntity(T entity){
this.entity=entity;
}
public void getEntity(T entity){
this.entity=entity;
}
public String edit(){
this.entity=fillEntity();
return "edit";
}
public String save(){
genericDao.save(entity);
}
protected abstract T fillEntity();
}
public class PersonAction extends ActionHelper<Person>{
Person fillEntity(){
return genericDao.find(id,Person.class);
}
}
<s:form action="person_save" method="post">
<s:hidden name="entity.id">
<s:textfield name="entity.name">
<s:textfield name="entity.surname">
</form>
関連するJSPコードを投稿できますか? – nmc
例外は何ですか? – joelittlejohn
この[質問](http://stackoverflow.com/questions/2516407/how-to-declare-a-generics-action-in-struts2-xml-file)が役立つかもしれません。 – doctrey