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

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


          網站導航:
           
          主站蜘蛛池模板: 张北县| 隆林| 平安县| 贵州省| 麻江县| 盐亭县| 偏关县| 铅山县| 蕉岭县| 凤庆县| 河西区| 胶南市| 宜阳县| 吉首市| 阳山县| 黄梅县| 郴州市| 耒阳市| 土默特右旗| 赤壁市| 营口市| 民丰县| 象州县| 巴彦淖尔市| 高雄县| 扶绥县| 巴林右旗| 榆社县| 监利县| 鄂伦春自治旗| 岚皋县| 金湖县| 汨罗市| 治多县| 临猗县| 吉水县| 卫辉市| 商丘市| 璧山县| 旺苍县| 吉隆县|