Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Jute Powerful Forum  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
话题被移动
该话题已被移动 - 阿熊 , 2005-01-03 12:28
如果您尚不清楚该话题被移动的原因,请参考论坛规则以及本版公告或者联系本版版主。
作者 Jute Forum and Spring Framework
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2004-10-15 01:53 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
现在已经将Jute Froum 1.4 的一个分支移植到Spring Framework中了. 只用了一个小时, 显示了良好的移植性啊, 吼吼.



作者 Re:Jute Forum and Spring Framework [Re:rainman]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2004-10-15 01:56 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!--
- Application context definition for "forum" DispatcherServlet.
-->

  <!-- ===========================================================-->
  <!-- Velocity configurer. -->
  <!-- ===========================================================-->
  <!--
   This bean sets up the Velocity environment for us based on a root path for templates.
   Optionally, a properties file can be specified for more control over the Velocity
   environment, but the defaults are pretty sane for file based template loading.
  -->
  <bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer" singleton="true">
   <property name="configLocation"><value>/WEB-INF/conf/velocity.properties</value></property>  
   <property name="resourceLoaderPath"><value>/WEB-INF/templates/</value></property>
    <property name="velocityProperties">
     <props>
     <prop key="resource.loader">file</prop>
     <prop key="file.resource.loader.class">org.apache.velocity.runtime.resource.loader.FileResourceLoader</prop>
     <prop key="file.resource.loader.path">${webapp.root}/WEB-INF/templates</prop>
     <prop key="file.resource.loader.cache">true</prop>
     <prop key="file.resource.loader.modificationCheckInterval">2</prop>
     <prop key="velocimacro.library">macro_forum.vm</prop>
     </props>
    </property>  
  </bean>
  
  <!-- ===========================================================-->
  <!-- View resolver. Required by web framework. -->
  <!-- ===========================================================-->
  <!--
   View resolvers can also be configured with ResourceBundles or XML files. If you need
   different view resolving based on Locale, you have to use the resource bundle resolver.
  -->
  <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
   <property name="cache"><value>true</value></property>
   <property name="prefix"><value>/</value></property>
   <property name="suffix"><value>.vm</value></property>
   <property name="contentType"><value>text/html; charset=ISO-8859-1</value></property>
   <property name="exposeSpringMacroHelpers"><value>true</value></property>
  </bean>
      
  <bean id="forumUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="interceptors">
      <list>                
      </list>
    </property>
    <property name="mappings">
      <props>        
        <prop key="*">forumController</prop>        
      </props>
    </property>
  </bean>
  
  <bean id="forumController" class="org.jute.forum.ForumController">
     <property name="handlerNameResolver"><ref bean="forumControllerResolver"/></property>
  </bean>
  
  <bean id="forumControllerResolver" class="org.jute.framework.spring.MapHandlerNameResolver">
    <property name="mappings">
      <map>
        <entry key="/index"><bean class="org.jute.forum.Homepage"/></entry>
        <entry key="/page/*"><bean class="org.jute.forum.resource.ResourceAction"/></entry>
        <entry key="/post/delete"><bean class="org.jute.forum.post.DeletePost"/></entry>
        <entry key="/post/edit"><bean class="org.jute.forum.post.EditPost"/></entry>
        <entry key="/post/forward"><bean class="org.jute.forum.post.ForwardPost"/></entry>
        <entry key="/post/new"><bean class="org.jute.forum.post.NewPost"/></entry>
        <entry key="/post/page"><bean class="org.jute.forum.post.PostPage"/></entry>
        <entry key="/post/preview"><bean class="org.jute.forum.post.PreviewPost"/></entry>
        <entry key="/post/print"><bean class="org.jute.forum.post.PrintPost"/></entry>
        <entry key="/post/reply"><bean class="org.jute.forum.post.ReplyPost"/></entry>
        <entry key="/post/view"><bean class="org.jute.forum.post.ViewPost"/></entry>
        <entry key="/user/download/*"><bean class="org.jute.forum.user.DownloadFile"/></entry>
        <entry key="/user/edit"><bean class="org.jute.forum.user.EditUser"/></entry>
        <entry key="/user/help"><bean class="org.jute.forum.user.UserHelp"/></entry>
        <entry key="/user/info"><bean class="org.jute.forum.user.UserInfo"/></entry>
        <entry key="/user/list"><bean class="org.jute.forum.user.UserList"/></entry>
        <entry key="/user/login"><bean class="org.jute.forum.user.UserLogin"/></entry>
        <entry key="/user/logout"><bean class="org.jute.forum.user.UserLogout"/></entry>
        <entry key="/user/markread"><bean class="org.jute.forum.user.UserMarkRead"/></entry>
        <entry key="/user/myforum"><bean class="org.jute.forum.user.MyForum"/></entry>
        <entry key="/user/message"><bean class="org.jute.forum.message.MessageAction"/></entry>
        <entry key="/user/online"><bean class="org.jute.forum.user.UserOnline"/></entry>
        <entry key="/user/register"><bean class="org.jute.forum.user.UserRegister"/></entry>
        <entry key="/user/survey"><bean class="org.jute.forum.survey.SurveyAction"/></entry>
        <entry key="/user/whatsnew"><bean class="org.jute.forum.user.WhatsNew"/></entry>
      </map>
    </property>
  </bean>
  
</beans>


有熟悉Sping的同好吗? 来探讨一下配置Spring的issue.




作者 Re:Jute Forum and Spring Framework [Re:rainman]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2004-10-18 09:12 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Here are some points I could think of:

move user checking to an interceptor.

not sure how to handle validation in your case(using one controller)

i18n messages to isolated files.

themes

Did you benefit from this migration?



"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:Jute Forum and Spring Framework [Re:rainman]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2004-10-23 06:29 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Agree to move user checking into an interceptor, acutally I did that already.
It's easy for other people to implement their own user authentication.

Jute forum already implement data binding, so data validation is an easy part in this case.

i18n messages and theme are also supported by Jute itself(using xml resource loader). Properties based messages sometimes is not convenient for editiing.

The benefit I got:
1. IOC best practice
2. More and more loose coupling
3. Tested hibernate O/R mapping tool with spring.

The issue I found:
Hibernate lazy-init is a good idea, but open-session-in-view mode is not so good. Spring's solution is not good at this point.

Thanks floater, for your comments.




作者 Re:Jute Forum and Spring Framework [Re:rainman]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2004-10-23 10:08 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
you are welcome.

yes, we have several different implementations for user authentications so we could run applications in different environments(using different config files), quite convenient.

I found the testing is more easier than before, I can even test controllers now, without servlet containers.

I am using ibatis in production, no production experience on Hibernate. It seems there is a fundamental difference between Spring underlying logic and the open-session-in-view mode, even Raible(Spring live author) didn't do it right at the first place.

In Spring 1.1.1, there are a few testing classes in the test dir that are nice. The neat idea is that we run all the testing in one transaction and roll it back at the end so we don't need to clean up dbs. Now the issue is how to set the dbs to a known state and how to test db code. I tend to put the code to populate dbs and the code to verifiy output in the same class, rather than spread them around, e.g., in an ANT script, xml files, etc. This is a better choice if we need to modify these data, ever.

Another interesting experience is that once I started using Spring, it's really hard to go back to the old way, Smile. I just finished a small, but nasty project with 3 implementations of a DAO layer, a pure jdbc one, a spring jdbc one, and a spring + ibatis one. It's just so hard, like fighting against something, to do it in pure jdbc.



"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:Jute Forum and Spring Framework [Re:rainman]
yikid





发贴: 25
积分: 0
于 2004-11-07 20:57 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
spring+velocity是如何支持国际化的资源文件的?
jsp可以使用spring的标签。vm怎么做的?



作者 Re:Jute Forum and Spring Framework [Re:rainman]
simonli





发贴: 8
积分: 0
于 2004-11-27 14:45 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不错



flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923