I have worked up a simple test case that exhibits some behaviour I find
puzzling. I discovered it by accident a week ago, but worked out of it
somehow.
The behaviour I'm getting is that if my ActionBean has an object member that
I create a select form element for and the form element doesn't point to a
valid id, but instead to nothing, Stripes throws an error with no message
back to the page. In the case of my form, 'None' is a valid selection, and
I don't want to throw an error in this case, but I can't figure a way of
avoiding this.
Hope someone can shed some light on this
Alex
Here is the ActionBean:
package com.tmdworldwide.projectmanager.web;
import net.sourceforge.stripes.action.*;
import net.sourceforge.stripes.integration.spring.SpringBean;
import com.tmdworldwide.projectmanager.persist.ClientDao;
import com.tmdworldwide.projectmanager.db.Client;
import java.util.List;
public class TestActionBean implements ActionBean {
@SpringBean
ClientDao clientDao;
private Client client;
protected ActionBeanContext context;
public ActionBeanContext getContext() {
return context;
}
public void setContext(ActionBeanContext context) {
this.context = (ActionBeanContext)context;
}
@DefaultHandler
public Resolution page() {
return new ForwardResolution("/WEB-INF/jsp/test.jsp");
}
public Resolution submit() {
return new ForwardResolution("/WEB-INF/jsp/test_thanks.jsp");
}
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
}
and the JSP:
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>Simple jsp page</title></head>
<body>
<s:form beanclass="com.tmdworldwide.projectmanager.web.TestActionBean">
<s:errors/>
<s:select name="client">
<s:option>None</s:option>
</s:select>
<s:submit name="submit" value="Submit"/>
</s:form>
</body>
</html>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users