Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

anand tiwari
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
(servlet)-action.xml 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
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?

Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!