<!-- Rice KRAD Web Framework configuration -->
<servlet>
<servlet-name>krad</servlet-name>
<servlet-class>org.kuali.rice.krad.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>configLocations</param-name>
<param-value>classpath:kew-config.xml classpath:kns-config.xml classpath:kns-maintenance-impl.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>krad</servlet-name>
<url-pattern>/krad/*</url-pattern>
</servlet-mapping>
import org.kuali.rice.krad.web.bind.UifBeanPropertyBindingResult;
import org.kuali.rice.krad.web.controller.UifControllerBase;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/myapp")
public class MyController extends UifControllerBase {
@RequestMapping("/form")
public ModelAndView showForm() {
ModelAndView modelAndView = new ModelAndView();
// Create new form
MyForm form = new MyForm();
modelAndView.addObject("form", form);
// Set view name
modelAndView.setViewName("myFormPage");
return modelAndView;
}
@RequestMapping("/submit")
public ModelAndView submitForm(@ModelAttribute("form") MyForm form,
UifBeanPropertyBindingResult result) {
ModelAndView modelAndView = new ModelAndView();
// Process form data
// ...
// Set view name
modelAndView.setViewName("successPage");
return modelAndView;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<page>
<header>
<title>My Form Page</title>
</header>
<content>
<group>
<field>
<inputField maxLength="100" label="Name" bind="form.name"/>
</field>
<field>
<inputField type="email" maxLength="100" label="Email" bind="form.email"/>
</field>
<button action="submit" label="Submit"/>
</group>
</content>
</page>