1. Config pom.xml
2. Add mvc-dispatcher in web.xml
3. Config dispatcher xml, i.e.
<context:component-scan base-package="com.liguoliang.jee.web" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
4. Controler:
package com.liguoliang.jee.web;
@Controller
@RequestMapping("/OrgMgt")
public class OrgMgtController {
@RequestMapping(method=RequestMethod.GET, value={"", "view"})
public String listOrgs(ModelMap modelMap) {
return "OrgsList"; // JSP
}
@RequestMapping(value="new", method=RequestMethod.GET)
public String createOrg(ModelMap modle) {
Org initOrg = … // init new Org object.
modle.addAttribute("newOrg", initOrg);
return "NewOrg";
}
@RequestMapping(method=RequestMethod.POST)
public String onSubmit(@ModelAttribute("org") Org org, BindingResult result) {
OrgValidator validator = new OrgValidator();
validator.validate(org, result);
if(result.hasErrors()) {
return "NewOrg";
}
return "redirect: OrgMgt";
}
@RequestMapping(value="view/{id}", method=RequestMethod.GET)
public String viewOrg(ModelMap modelMap, @PathVariable Integer id) {
modelMap.addAttribute("id", id);
return "OrgDetails";
}
}
ActionScript
Adobe
AIR
ANT
Apache
ApacheFlex
Apache Flex
Better Developer
BlazeDS
Cloud Computing
CMD
DataGrid
DataGridColumn
DB2
Derby
DTSX
Eclipse
ETL
Event
Excel
Flash Builder
Flex
Google
Java
JDBC
JDK
JIRA
Life@SG|新加坡
Linux
MySQL
Oracle
PHP
Python
RegEx
Servlet
SQL
SQL Server
SSIS
SVN
T-SQL
Tools
Tree
Ugly
WordPress
XML
dev-notes
side-projects
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.