泥巴麒麟的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)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 镇远县| 三明市| 金溪县| 濮阳市| 上高县| 普格县| 彭水| 姜堰市| 寻乌县| 内江市| 信丰县| 房山区| 杭锦旗| 女性| 美姑县| 南平市| 五大连池市| 吕梁市| 民丰县| 青神县| 如皋市| 襄垣县| 沂南县| 宕昌县| 栾城县| 武邑县| 东乡县| 城固县| 泗洪县| 封开县| 玛曲县| 宁都县| 抚州市| 海兴县| 平罗县| 天柱县| 高淳县| 昌乐县| 芦溪县| 喜德县| 蛟河市|