wood burning stoves
The moose likes Other Application Frameworks and the fly likes Problem while developing my spring application... (urgent!) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Problem while developing my spring application... (urgent!)" Watch "Problem while developing my spring application... (urgent!)" New topic

Problem while developing my spring application... (urgent!)

anand tiwari

Joined: Jun 22, 2007
Posts: 22
I am facing a very strange issue while developing my spring application,

I am posting the code snippets from my application for better understanding of the problem. Following are the relevant files which are in use:
controller.java which extends simpleformcontroller

Here is the code in the servlet-action.xml:

<bean id="gameValidator" class="com.lbadmin.validator.ManageGameValidator"></bean>
<bean id="manageGameController" class="com.lbadmin.web.ManageGameController">
<property name="failedView"><value>fail</value></property>
<property name="commandClass"><value>com.lbadmin.model.Game</value></property>
<property name="commandName"><value>gamemanage</value></property>
<property name="gameservice"><ref bean="gameService"/></property>
<property name="validator"><ref bean="gameValidator"/></property>

(Here the thing to notice is that i have not included the formview property as i am using customized form view)

The code in the controller looks like this:

protected BindException bindObject(HttpServletRequest request,
Object command, Validator validator) throws Exception {
ServletRequestDataBinder binder = createBinder(request, command);
BindException errors = new BindException(command,
System.out.println("commandname=" + getCommandName());
if (validator.supports(command.getClass())) {
ValidationUtils.invokeValidator(validator, command, errors);
return errors;

protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException errors) throws Exception {
// TODO Auto-generated method stub
Map model = new HashMap();
if (request.getSession().getAttribute("userName") != null) {
String operation = RequestUtils.getStringParameter(request,
"operation", "");
if (operation.equals("showgames")) {
} else if (operation.equals("addgame")) {

return handleAddGame(request, response, model, errors);

} else if (operation.equals("editgame")) {
handleEditGame(request, response, model);
} else if (operation.equals("deletegame")) {
handleDeleteGame(request, response, model);

return new ModelAndView(getViewName(), "model",model);

protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object obj, BindException errors)
throws Exception {

Map model = new HashMap();
if (request.getSession().getAttribute("userName") != null) {
String operation = RequestUtils.getStringParameter(request,
"operation", "");
if (operation.equals("submitGameDetails")) {

handleSaveGame(response, model, obj);

return new ModelAndView(getViewName(), "model", model);

As you can see in the above code we are using the bindobject() and the show form() methods.

Now the code in the jsp will look like this:

<td width="173">
<b class="UserName">Top Scores To Show</b></td>
<td width="296" align="left">

<spring:bind path="gamemanage.topscore">
<input name="topscore" type="text" class="smallTextBox" size="30" maxlength="3" width="50"
value="<c ut value="${status.value}"/>"/>
<c:if test="${status.error}">
<span id="<c ut value="${status.expression}"/>Error" class="error">
<c ut value="${status.errorMessage}"/>


Here topscore is the property i am trying to bind and validate...

however when the above application is run i am getting the following exception:

javax.servlet.ServletException: Neither Errors instance nor plain target object for bean name 'gamemanage' available as request attribute

I think i am missing somthing here?? can someone please help.... i am really stuck up....
thanks in advance
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387

Map model = new HashMap();
return new ModelAndView(getViewName(), "model", model);

Do you put anything in your map or is it still empty when you get to the jsp?

subject: Problem while developing my spring application... (urgent!)
It's not a secret anymore!