解决方案 »
- Struts+Spring+Hibernate问题
- 哥哥姐姐们小弟有一问题
- web services实现计算A+B
- 谁有 extjs有关的资料电子书啊?? 请给我介绍一本!
- 异常org.hibernate.hql.ast.QuerySyntaxException: unexpected token怎么解决
- 如何把客户上传的word文档按照原来的样式显示在网页里?(保持文档样式不变)
- java ssh jdbc 链接 oracle 问题。新手弄了两天了,999
- 请教Javascript高手!!!!!!!!!!!!!!!!!!!!!!
- 请问各位高手一个关于JBUILDER的简单问题
- java bean与ejb的区别???
- struts1 的 actionform 为null问题
- 小小的问题!!
字符串无法被转换成字节数组
看看你给byte[] context;赋值的时候是否错了.? String.getBytes()赋值
这个是Action里面的 public String add(){
Document document=new Document();
if(contextFile!=null){
document.setContext(this.fileToByteArray(contextFile));
System.out.println("fdsfdsfdasfdsa");
}
document.setDescription(description);
document.setTitle(title);
documentManager.addDocument(document, workflowId, this.currentUser().getId()); return "add_success";
}这个是DocumentManager里面的addDocument()方法:
public void addDocument(Document document, int workflowId, int userId) {
System.out.println(0);
//添加公文
document.setCreateTime(new Date()); this.getHibernateTemplate().save(document); document.setWorkflow((Workflow)this.getHibernateTemplate().load(Workflow.class, workflowId));
document.setCreator((Users)this.getHibernateTemplate().load(Users.class, userId));
document.setStatus(Document.STATUS_NEW);
//
// this.getHibernateTemplate().save(document);
// System.out.println(5); //添加流程实例
long processInstanceId = workflowManager.addProcessInstance(document.getWorkflow().getName(), document.getId());
System.out.println(6);
//绑定流程实例的标识到公文对象
document.setProcessInstanceId(processInstanceId);
System.out.println(7);
getHibernateTemplate().update(document);
System.out.println(8);
}帅哥 帮我看看哈!
是这样的.! Struts2的Action中有的Document属性, 然后从页面中填充请求参数.!
那么你页面上获取context应该是document.context吧.? 这个跟你是否添加了没有关系.!
只要你有name为document.context的请求参数过来,就会填充, 没有填值是"", 就像你request.getParameter(name),有这个name,没值,就是""是一样的道理
那么把一个空字符串转成byte,能不错吗?
因为后台如果是数组的属性,那么在前台上是有多个这样的name与之对应的.!