
我设置页面的之后,如果我换一个分类,提交没问题tapestry5 长度限制,里都升级了,按照以前默认的分类不变提交直接就报错了,里其他字段都升级了tapestry5 长度限制,就是两表关联的字段为空了,不是很理解
页面类
ArticleUpdate.java
package com.bw.pages.article;
import java.util.Date;
import java.util.List;
import org.apache.tapestry5.SelectModel;
import org.apache.tapestry5.ValueEncoder;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.PageActivationContext;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.Errors;
import org.apache.tapestry5.corelib.components.Select;
import org.apache.tapestry5.corelib.components.TextArea;
import org.apache.tapestry5.corelib.components.TextField;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.bw.entities.Article;
import com.bw.entities.Category;
import com.bw.services.dao.jpa.AppJpaDAO;
import com.bw.util.CategoryEncoder;
import com.bw.util.CategorySelectModel;
public class ArticleUpdate {
@Property
private Article article;
@Property
private Category category;
@Property
private List<Category> categorys;
@PageActivationContext
private int id;
@Inject
private AppJpaDAO dao;
@SuppressWarnings("unused")
@Component
private Errors errors;
@SuppressWarnings("unused")
@Component(parameters = { "value=article.title" })
private TextField articleTitle;
@SuppressWarnings("unused")
@Component(parameters = { "value=article.content" })
private TextArea articleContent;
@SuppressWarnings("unused")
@Component(parameters = { "value=category", "encoder=categoryEncoder",
"model=categoryModel","blankLabel=${article.category.getTitle()}"})
private Select categorySelect;
public SelectModel getCategoryModel() {
return new CategorySelectModel(categorys);
}
@SuppressWarnings("rawtypes")
public ValueEncoder getCategoryEncoder() {
return new CategoryEncoder(dao);
}
void onPrepare(){
if (article == null) {
article = dao.findByID(Article.class, id);
}
categorys = dao.findWithJpql("select o from _category o order by o.level asc");
}
Object onSuccess() {
String s = new java.text.SimpleDateFormat("yyyy-MM-dd hh
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-120226-1.html
都因为遇见你耗尽