Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Spring's SimpleFormController problem

Reply
Thread Tools

Spring's SimpleFormController problem

 
 
Pawel
Guest
Posts: n/a
 
      01-22-2008
Hi,

I have a strange problem with my Spring 2.5 and Tomcat 5.5
application.

I have a form which looks like this:


<form:form method="post" commandName="loginCommand">
<form:errors path="*" cssClass="errorBox" />
<div id="login" class="lightBorder label">
<div id="header" class="lightBorder">Login</div>
user <form:input path="user"/> <form:errors path="user"/>
password <formassword path="password"/> <form:errors
path="password"/>

<div id="submit"><input type="Submit" name="submit" class="submit"
value=""></div>
</div>
</form:form>



My controller of this form looks like this:

public class LoginFormController extends SimpleFormController {
private Logger log = Logger.getLogger(LoginFormController.class);

public LoginFormController() {
log.debug("Constructor");
setCommandName("loginCommand");
setCommandClass(LoginCommand.class);
}

protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response,
Object command, BindException errors) throws ServletException {
....
}
}

My command class looks like this:

public class LoginCommand {
private String user;
private String password;

public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}


My dispatcher-servlet.xml's appropriate fragment looks like this:

....
<bean id="loginFormController"
class="org.dyndns.orzekanie.controller.LoginFormCo ntroller">
<property name="successView" value="/navigation/logon"/>
<property name="formView" value="/authexclude/index"/>
<property name="validator" ref="loginValidator"/>
</bean>
....

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
<property name="mappings">
<value>
/jsp/authexclude/index.html=loginFormController
</value>
</property>
<property name="order" value="0"/>
</bean>
.....





When I'm trying to run my application and display my form I get:

2008-01-22 16:59:44,578 610 DEBUG
[org.dyndns.orzekanie.controller.LoginFormControlle r] (main
Constructor
2008-01-22 16:59:44,703 735 INFO
[org.springframework.web.servlet.DispatcherServlet] (main
FrameworkServlet 'dispatcher': initializatio
n completed in 203 ms
2008-01-22 17:00:33,843 49875 ERROR
[org.springframework.web.servlet.tags.form.InputTag] (http-8080-
Processor24 Neither BindingResult nor
plain target object for bean name 'loginCommand' available as request
attribute
java.lang.IllegalStateException: Neither BindingResult nor plain
target object for bean name 'loginCommand' available as request
attribute
at
org.springframework.web.servlet.support.BindStatus .<init>(BindStatus.java:
142)
at
org.springframework.web.servlet.tags.form.Abstract DataBoundFormElementTag.getBindStatus(AbstractData BoundFormElementTag.java:
161)
at
org.springframework.web.servlet.tags.form.Abstract DataBoundFormElementTag.getPropertyPath(AbstractDa taBoundFormElementTag.java:
18
1)
at
org.springframework.web.servlet.tags.form.Abstract DataBoundFormElementTag.getName(AbstractDataBoundF ormElementTag.java:
147)
at
org.springframework.web.servlet.tags.form.Abstract DataBoundFormElementTag.autogenerateId(AbstractDat aBoundFormElementTag.java:
134
)
at
org.springframework.web.servlet.tags.form.Abstract DataBoundFormElementTag.writeDefaultAttributes(Abs tractDataBoundFormElementTag.
java:123)
........



Everything looks allright for me - I find this exception very strange.
Could someone give me some advice?
Thanks,
Pawel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments