Wie erreiche ich strikt UrlBinding in Stripes? Strict bedeutet für mich, dass es keinen Standard-Handler für undefinierte Ereignisse außer dem leeren Ereignis geben sollte.Strict URLBinding für Streifen
Das Problem existiert auch nur für ein Ereignis, weil es automatisch ein Standardhandler ist. Der folgende Code ist aus dem Stripes Buch entnommen.
@UrlBinding("/hello/{$event}")
public class HelloActionBean implements ActionBean {
private static final String VIEW = "/WEB-INF/jsp/hello.jsp";
private ActionBeanContext ctx;
public ActionBeanContext getContext() {
return ctx;
}
public void setContext(ActionBeanContext ctx) {
this.ctx = ctx;
}
private Date date;
public Date getDate() {
return date;
}
@DefaultHandler
public Resolution currentDate() {
date = new Date();
return new ForwardResolution(VIEW);
}
public Resolution randomDate() {
long max = System.currentTimeMillis();
long random = new Random().nextLong() % max;
date = new Date(random);
return new ForwardResolution(VIEW);
}
}