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

  • Home
  • SEARCH
  • 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 9274115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:16:45+00:00 2026-06-18T16:16:45+00:00

This is my controller @Controller public class MyController { @Autowired private LoginService loginService; @RequestMapping(/login.do)

  • 0

This is my controller

@Controller
public class MyController {

    @Autowired
private LoginService  loginService;

@RequestMapping("/login.do")
public String login() {     
    return "login";
}
@RequestMapping("/validate.do")
public String validate(HttpServletRequest request,ModelMap model) {
    String name=request.getParameter("uname1");
    String pwd=request.getParameter("pwd1");
    boolean b=loginService.validate(name,pwd);
    if (b){
        model.addAttribute("name", name);
        return "welcome";
    }
    else
        return "login";
}
@RequestMapping("/register.do")
public String register() {
    return "register";
}

@RequestMapping("/registration.do")
public String registration(HttpServletRequest request, @ModelAttribute("modelObject") Login entity, BindingResult result) {
    String uname=entity.getUserName();
    String pwd=entity.getPassword();
    String sex=entity.getSex();
    String dob=entity.getDob();
    String nation=entity.getNation();
    Login log=new Login();
    log.setUserName(uname);
    log.setPassword(pwd);
    log.setSex(sex);
    log.setDob(dob);
    log.setNation(nation);  
    loginService.register(log);
    return "login";
}

}

and this is the jsp page

<form:form commandName="modelObject" action="registration.do" method="post" >
    <table>
        <tr>
        <td><form:label path="userName">User Name</form:label></td>
        <td><form:input path="userName"></form:input></td>
        </tr>
        <tr>
        <td><form:label path="password">Password</form:label></td>
        <td><form:input path="password"></form:input></td>
        </tr>
        <tr>
        <td><form:label path="sex">Sex</form:label></td>
        <td><form:radiobutton path="sex" value="M" label="M"></form:radiobutton>
        <form:radiobutton path="sex" value="F" label="F"></form:radiobutton></td>
        </tr>
        <tr>
        <td><form:label path="dob">Date of Birth</form:label></td>
        <td><form:input path="dob"></form:input></td>
        </tr>       
        <tr>
        <td><form:label path="nation">Nationality</form:label></td>
        <td><form:select path="nation">
        <form:option value="0" label="Please Select"></form:option>
        <form:options items="${countryList}" itemValue="id" itemLabel="name" />
        </form:select></td>
        </tr>
        <tr>
        <td align="right"><input type="submit" value="Submit Form"></input></td>
        <td align="center"><input type="reset" value="Clear Form"></input></td>
        </tr>
    </table>    
</form:form> 

With them i am getting the following error

Feb 11, 2013 5:08:51 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [mode] in context with path [/SpringHb] threw exception [An exception occurred processing JSP page /WEB-INF/jsp/register.jsp at line 16

13: <form:form commandName="modelObject" action="registration.do" method="post" >
14:     <table>
15:         <tr>
16:         <td><form:label path="userName">User Name</form:label></td>
17:         <td><form:input path="userName"></form:input></td>
18:         </tr>
19:         <tr>


Stacktrace:] with root cause
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'modelObject' available as request attribute
    at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:174)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:194)
    at org.springframework.web.servlet.tags.form.LabelTag.autogenerateFor(LabelTag.java:129)
    at org.springframework.web.servlet.tags.form.LabelTag.resolveFor(LabelTag.java:119)
    at org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:89)
    at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
    at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    at org.apache.jsp.WEB_002dINF.jsp.register_jsp._jspx_meth_form_005flabel_005f0(register_jsp.java:282)
    at org.apache.jsp.WEB_002dINF.jsp.register_jsp._jspService(register_jsp.java:114)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1063)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:801)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

I’m not able to understand what is the problem

The code above written using spring form tags it shows the above error but if i am writing same code using html it is working fine
The below is html code written in jsp

<c:url value="/registration.do" var="reg" />
<form:form action="${reg}" >
User Name <input type="text" name="userName"/><br>
Password<input type="password" name="password"/><br>
Sex<input type="radio" name="sex" value="M"/>M<input type="radio" name="sex" value="F"/>F<br>
DOB<input type="text" name="dob"/><br>
Nationality<select name="nation">
  <option value="India">India</option>
  <option value="USA">USA</option>
</select><br>
<input type="submit" name="submit" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form:form>    

<c:url value="/login.do" var="log" />
<form:form action="${log}" >
<input type="submit" name="Go Back" value="Go Back" />
</form:form>

Please help….

  • 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-18T16:16:46+00:00Added an answer on June 18, 2026 at 4:16 pm

    You need the bind the empty Login object in the controller method from where you are returning your specified jsp page Somehting like this.

    model.addAttribute("modelObject", yourEmptyModelObject);
    

    And one more thing paths are only needed for only those fields from which you wanted the input from user.So no need to specify paths for <form:label> and other non renderable fields.

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

Sidebar

Related Questions

Given this methodology of relative redirect to another controller: @Controller @RequestMapping(/someController) public class MyController
I have this code for my Spring-based web project: Controller: @Controller @RequestMapping(mycontroller) public class
I have this Controller : @Controller @RequestMapping(/path/*) public class MyController { @RequestMapping(value = /,
I've this controller public class AdminController : Controller { private IAdministratorService _administratorService; public AdminController(IAdministratorService
Currently I have a controller which looks something like this: public class MyController :
All my controller has this code on the top of class. public class TestController
I have this controller: public class StandingsController : Controller { public ViewResult Index(int id)
I got a ASP.NET MVC controller like this [Authorize] public class ObjectController : Controller
I have a controller that looks like this: public class PageController : Controller {
I have a Controller with syntax like this: public class CrudController<TEntity> : Controller Now

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.