Hi,
I'm currently working on my first stripes app. This is what I want:
When a user goes to my site e.g. http://mysite.com/ I want there to be a
form on that page where they can enter some information and press 'submit'.
On successful form submission I want them to be returned to
http://mysite.com/ with info regarding success/failure of their form
submission. Basically, I want to do something like http://bit.ly does with
its URL shortening.
I'n my web.xml I'm using the DynamicMappingFilter, configured like this:
<filter>
<filter-name>DynamicMappingFilter</filter-name>
<filter-class>net.sourceforge.stripes.controller.DynamicMappingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>DynamicMappingFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
and the action that the page will execute on form submission is below. My
problem is that my shorten() method doesn't seem to be gettting called. If I
change the @UrlBinding("/") to (for example) @UrlBinding("/moo") it works
fine. I don't want moo to be in my URL though... Can anyone help me out
here? I feel like I'm missing something important and obvious but I've been
staring at this too long to figure it out. Thanks for any help.
@UrlBinding("/")
public class CreateTinyURLActionBean implements ActionBean {
private static final Logger logger =
Logger.getLogger(CreateTinyURLActionBean.class);
@SpringBean
private URLManager urlManager;
private ActionBeanContext context;
private String longUrl;
private String shortUrl;
public ActionBeanContext getContext() {
return context;
}
public void setContext(ActionBeanContext context) {
this.context = context;
}
public URLManager getUrlManager() {
return urlManager;
}
public void setUrlManager(URLManager urlManager) {
logger.debug("Setting the url manager");
this.urlManager = urlManager;
}
public String getLongUrl() {
logger.debug("Getting the long url...");
return longUrl;
}
public void setLongUrl(String longUrl) {
this.longUrl = longUrl;
}
public String getShortUrl() {
return shortUrl;
}
public void setShortUrl(String shortUrl) {
this.shortUrl = shortUrl;
}
@DefaultHandler
public Resolution shorten() {
shortUrl = urlManager.shortenAndStoreUrl(getLongUrl());
logger.debug("****The shortened url is: "+shortUrl);
return new ForwardResolution("jsp/index.jsp");
}
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users