2013年12月24日
摘要: 最近一段时间的项目都是在Play这个框架上进行开发的,挺强大的,但不足之处也挺多的。今天分享下play中强大的标签,遍历list,map类型的数据的用法。遍历单纯的list数据,例如:List peoples;#{list peoples,as:'people'} //peoples为list对象,people为实体变量名 ,name则为实体相对应的属性值 ${people.name} #{/list}遍历list中泛化的map类型,例如:List> peoples; #{list peoples,as:'people'} //peoples为list对象 阅读全文
posted @ 2013-12-24 17:56 记性特差 阅读(539) 评论(0) 推荐(0)
摘要: 这里直接贴出的是我封装好的doPostFile方法,httpclient 的版本是3.1。 public static String doPostFile(String url, Part[] parts){ String response = null; PostMethod postMethod = new PostMethod(url); try{ //设置请求实体 postMethod.setRequestEntity(new MultipartRequ... 阅读全文
posted @ 2013-12-24 17:54 记性特差 阅读(1014) 评论(0) 推荐(0)
摘要: 代码没有进行过多的封装,可能看起来有点action代码部分,hibernate在这里只起到了一个查询记录集的作用。import java.util.ArrayList;import java.util.List; import java.util.Map; import org.apache.struts2.interceptor.SessionAware;import org.hibernate.Criteria; import org.hibernate.Session; import com.HibernateSessionFactory; import com.hibertest1.d 阅读全文
posted @ 2013-12-24 17:53 记性特差 阅读(183) 评论(0) 推荐(0)
摘要: 今天倒腾了半天,终于是把这个两个框架整合到一起了。还是要写一下总结,同时给大家一些帮助。开发环境:myeclipse 9.0(不好用!)tomcat6.01.准备工作需要导入的包:struts2与spring基本的包就不用说了,我用的是struts2.1 Spring 3.0,尤其要注意 别少导入的几个是:Spring3.0 Web Libraries ;struts支持spring的插件:struts2-spring-plugin-2.1.8.1.jar 将这个jar文件放到lib目录下2.web.xml 的配置除了struts2的核心配置外,我们还要加入spring的配置,代码如下:con 阅读全文
posted @ 2013-12-24 17:50 记性特差 阅读(256) 评论(0) 推荐(0)