泥巴麒麟的BLOG

          shenAwesome@hotmail.com 縱不能,將醉做生涯,休拘束

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            195 Posts :: 2 Stories :: 80 Comments :: 0 Trackbacks
          I hate spring mvc, struts mvc because they are wierd, complicated and dishonest.

          the SW project is a simple framework(helperTool, I call it SW for simple) to create a web application


          1 web.xml

             <servlet>
                  <servlet-name>Dispatcher</servlet-name>
                  <servlet-class>com.shen.sw.Dispatcher</servlet-class>
              </servlet>
              <servlet-mapping>
                  <servlet-name>Dispatcher</servlet-name>
                  <url-pattern>*.htm</url-pattern>
              </servlet-mapping>

          2 sw.properties  create it in src root.

             linkPackage=com.seeker.web  
            
             that means the SW will search the package for annotation,
                  1 @Bind means we want to auto bind the object with request, which means
                     1 get data from page  (in your jsp, set fieldName as your property's name, see example below)
                     2 put bean to request Attribute

                     SW will try to use setter and getter method,
                     so for example, if you only need to set attribute then only implement setter method,
                        
                  2 @Link(<your URL>) tells SW which method should it call when a URL be request.

          3 in your Link class (controller , action whatever you call it)

              @Bind
              Person person; // in jsp we have  <input type='text' name='person_name'/> <input type='text' name='person_pass'/>...
              @Bind
              List<Person> personList; // be put into attribute, in jsp we only need to use it,
              @Bind
              String title;  // in jsp we have  <input type='text' name='title'/>

              @Link("personList.htm")
              public String personList(HttpServletRequest request) {

              }
              @Link("personCreate.htm")
              public String personList() {

              }
             
              //getters & setters ...
             
          4 that's all


          examples:
          http://www.aygfsteel.com/Files/black_zerg/SimpleWeb.zip
          It's a netbeans project , need to including ShenCommon.jar in your classpath (which is in simpleWeb folder)
          It's very simple so no difficult to try it if you are using eclipse.

          just have a try. Any question please do not hesitate to contact me.


            
          posted on 2008-07-17 08:17 泥巴麒麟 閱讀(98) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 闽侯县| 衢州市| 贡觉县| 东港市| 娄烦县| 十堰市| 电白县| 泸溪县| 新蔡县| 明溪县| 广东省| 谷城县| 德阳市| 宁蒗| 汪清县| 南阳市| 瓦房店市| 汝南县| 句容市| 梅河口市| 和平区| 依兰县| 阳曲县| 开江县| 隆昌县| 株洲市| 汕尾市| 明溪县| 富蕴县| 平昌县| 乌兰浩特市| 襄汾县| 阜南县| 浏阳市| 师宗县| 大石桥市| 蒲城县| 安达市| 珠海市| 蒙山县| 元阳县|