JAVA涂鸦
关于JAVA的点点滴滴
posts - 50,  comments - 689,  trackbacks - 0

很不好意思,开始下载链接放错了,现在是新的。

这是前面那个struts1.x+spring1.x+hibernater3.1的升级版本。

spring2.0与1.x区别不大,可以平滑的过度,我也就是把spring1.28换成了spring2.0.3,算是升级到spring 2.0了。

struts2.0基本就是webwork2.2,与以前的struts1.x可以说没任何关系了。

因为是第一次用struts2.0,也是第一次用webwork,所以有很多不完善,不规范的地方,还望大家来拍砖。

下次在将这次使用struts2.0的心得写篇文章。

因为是对前一次写的struts+spring+hibernate的改进,所以一些新的朋友还不知道数据库以及架构是什么样子的。
建议可以先看看这里:
struts+spring+hibernate的web应用<一> 架构搭建

lib包需要以下这些包


示例代码下载


相关信息:

项目架构以及数据库信息
struts+spring+hibernate的web应用<一> 架构搭建

更多信息  

posted on 2007-04-19 16:05 千山鸟飞绝 阅读(11496) 评论(20)  编辑  收藏

FeedBack:
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-19 16:18 | 交口称赞
多谢,最近也在看struts2  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-19 17:02 | 交口称赞
用的sqlserver?

  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-19 17:02 | 交口称赞
建议下次用UTF-8  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-19 17:09 | javajman
多谢,我最近也在学struts2  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-19 17:22 | javajman
struts2?????


好象是struts1.X吧?!~~~  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-19 17:34 | 千山鸟飞绝
@javajman

不好意思,开始链接放错了,希望下载错误的朋友重新下载
  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-19 21:56 | yluck
下载后学习收益非浅。
希望有多一些的示例。
顺便请教下,
有二个表格,a与b.
这二者是一对多的关系,并在Hibernate中进行了映射配置。
现想依据a表查出所有数据,包括与a对应的b表中的数据。
方法最终得要的结果类型为List型.

因为List类型中,有包含a,b二表的数据。
请教,这个List类型,如何在JSP页面中显示。
(只显示a中的数据没有问题,就是不会一同显示b中的数据)  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-20 09:50 | 海蓝
@千山鸟飞绝

哈哈,我读了你旧版的文章,也尝试象你这样用struts2改写旧版的代码,已经基本上实现了。原本打算整理完毕后跟你交流交流的;现在你已经弄出来了,我就偷懒了~~~  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-20 11:25 | 海蓝
楼主的源码还是有些问题吧?

我在struts_products.xml中看到:

<action name="list" class="productAction" method="list">
<result>list.jsp</result>
</action>

但是源码中并没有productAction.java ......  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-20 11:28 | 海蓝
@千山鸟飞绝

Sorry,原来productAction这个bean是在applicationContext.xml中定义的  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-20 15:49 | 海蓝
@千山鸟飞绝

重新测试了代码,在我这里需要做以下修改才能运行:
1.将index.jsp从/products目录移到/目录里
2.将struts_products.xml中
<package name="products" extends="struts-default" namespace="/products">
修改为
<package name="products" extends="struts-default">
3.将struts_products.xml中各个action的result
<result>xxxx.jsp</result>
修改为
<result>/products/xxxx.jsp</result>

此外我使用MySQL,所以把dataSource改为
<bean id ="dataSource" class ="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/game" />
<property name="username" value="root" />
<property name="password" value="mypass"/>
</bean>
但新增一个游戏后保存,输入的中文均显示为?。将相应字段的Collation改为gbk_chinese_ci、gbk_bin都不行。不知是哪里不正确?  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-04-20 16:05 | 千山鸟飞绝
@海蓝
我使用的数据库是SQLServer2000,mysql没有测试过。

你可以用eclipse调试一下,看看product在insert之前保存的值是不是乱码,这样就可以判断是否是传值的原因,还是数据库的原因。  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-05-03 11:31 | Sullivan
请问你的JSP文件在哪里呢?我下载下来都没有发现有的。谢谢  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-05-04 08:56 | 千山鸟飞绝
@Sullivan
在products文件夹里面  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-08-21 19:05 | winie
学习中`````````我 也想整个`````````
谢谢楼主的程序`收益`````````````呵呵````  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-10-26 10:45 | 中华信鸽
下载了。  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2007-11-13 09:59 | ju
ok  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2008-01-17 16:02 | pooslife
@交口称赞
同意..GB2312让我很困扰啊.  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2008-01-17 16:05 | pooslife
@海蓝
你的mysql用的什么编码?
这个需要编码对应上才行的
例如:
jdbc:mysql://localhost:3306/game?useUnicode=true&characterEncoding=GB2312  回复  更多评论
  
# re: struts2.0+spring2.0+hibernate3.1 web应用 示例代码下载
2009-08-30 16:32 | 自言自语
谢谢!  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航:
 
正在阅读:



<2007年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

常用链接

留言簿(35)

随笔档案

文章分类

文章档案

好友的blog

我的其他blog

老婆的Blog

搜索

  •  

积分与排名

  • 积分 - 771284
  • 排名 - 55

最新评论

阅读排行榜

评论排行榜