Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8520477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:32:52+00:00 2026-06-11T06:32:52+00:00

In my basic spring mvc application I am getting the exception. I am using

  • 0

In my basic spring mvc application I am getting the exception. I am using SimpleFormController. My code is as below.

In my dispatcher-servlet

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
        <props>
            <prop key="index.htm">indexController</prop>
           <!-- <prop key="login.htm">loginController</prop>  -->
        </props>
    </property>
</bean>

<bean id="viewResolver"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"
      p:prefix="/WEB-INF/jsp/"
      p:suffix=".jsp" />

<!--
The index controller.
-->
<bean name="indexController"
      class="org.springframework.web.servlet.mvc.ParameterizableViewController"
      p:viewName="index" />
<!--  <bean name="loginController"
      class="org.springframework.web.servlet.mvc.ParameterizableViewController"
      p:viewName="login"/>  -->

 <bean name="/login.htm" class="com.pack.controller.LoginController" >
 <property name="commandClass" value="com.pack.model.User" />
 <property name="formView" value="login"/>
 <property name="successView" value="index.htm"/>
 </bean>

In my JSP page

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Login</title>
    </head>
    <body>
        <h1>Login</h1>
        <form:form name="loginForm" method="post">
        ${msg}
        <form:input id="username" path="username"/>
        <form:password id="password" path="password"/>
        <input type="submit" value="login" name="login" />
        </form:form>
    </body>
</html>

In my controller class

public class LoginController extends SimpleFormController{

    @Override
    public ModelAndView onSubmit(Object command) throws ServletException {
        User user =  (User)command;
        System.out.println("Username:" + user.getUsername() + " Password:" + user.getPassword());
        if(user.getUsername().equalsIgnoreCase("sa") && user.getPassword().equalsIgnoreCase("12")){
            return new ModelAndView(new RedirectView(getSuccessView()));
        }
        else
        {
            ModelAndView modelAndView = new ModelAndView("login");
            modelAndView.addObject("msg", "Invalid login");
            return  modelAndView;
        }
    }    
}

Once the user enter correct username and password will redirect to the index page. This is working properly. But the user enter wrong login credentials it throws this error.

exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ‘command’ available as request attribute
root cause
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ‘command’ available as request attribute

Any suggestion to solve this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:32:53+00:00Added an answer on June 11, 2026 at 6:32 am

    I got a solution for this problem,If we use HTML controls rather than spring controls, this issue will solve.Here in JSP file,

     <%--   <form:input id="username" path="username"/>
            <form:password id="password" path="password"/> --%>
            <input type="text" name="username"/> 
            <input type="password" name="password"/>
    

    This will solve the issue.Thanks for all responses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building very basic mvc application with Spring. It has one controller that should
I'm trying to set up a basic Spring MVC app with MongoDB intergration. Using
I have an application which are using Hibernate / Spring and Spring MVC, but
I am currently building my first MVC 3 application, using EF Code First, SQL
I am using Spring MVC for an application I am building. Everything is working
I am using Spring MVC for my web application. I need to validate that
Trying to deploy Spring's mvc-basic in Equinox container. Brief error (full below): org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration
I'm new to Spring and Spring MVC. I'm trying to implement a basic web-application
I have a spring mvc application that I am using Hibernate with. I am
I have basic Spring MVC 3 setup for i18n where I can show labels

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.