泥巴麒麟的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 泥巴麒麟 閱讀(97) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 平利县| 广安市| 克拉玛依市| 上饶县| 镇雄县| 巴东县| 顺平县| 香格里拉县| 南汇区| 津市市| 玉山县| 青阳县| 藁城市| 文山县| 乌拉特前旗| 永年县| 赤水市| 宜黄县| 宜君县| 甘南县| 江川县| 武义县| 巴塘县| 宽甸| 宜都市| 崇文区| 怀柔区| 南平市| 胶南市| 田林县| 大埔县| 儋州市| 仪陇县| 类乌齐县| 石家庄市| 闽侯县| 满城县| 石柱| 洱源县| 津市市| 安溪县|