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.blogjava.net/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.