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 9012013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:53:31+00:00 2026-06-16T02:53:31+00:00

This may have been asked many times but I have not been able to

  • 0

This may have been asked many times but I have not been able to find a concrete answer over last two days. Using Spring 3.2.

I have two methods. One is for form creation and the other is for the form to post. Form creation works fine. But when I try to post/submit the form, I don’t see the log statement getting executed in the login() method and I get a 404 error HTTP Status 404 – /sample/login.

I think the problem is the form cannot submit to URL but I don`t know how to fix the mapping to make it work.

If there are any other files that are needed please let me know. BTW following example from sprin/mvc-basic and spring/petclinic

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import example.domain.User;
import example.service.UserValidator;


@Controller
@RequestMapping(value="/login")
public class LoginFormController {  

   protected final Log logger = LogFactory.getLog(getClass());

   @RequestMapping(method=RequestMethod.GET)
   public String loadForm(Model model) {
        logger.info("LoginFormController login");
        model.addAttribute("user", User.getUserInstance());
        return "login";
   }

   @RequestMapping(method=RequestMethod.POST)
   public String login(@ModelAttribute User user, BindingResult result) {
        logger.info("post");
        new UserValidator().validate(user, result);
        if (result.hasErrors()) {
            return "login";
         } else {
            logger.info("Email Id: " + user.getEmailId());
            //this.clinic.storeOwner(owner);
            //status.setComplete();
            return "redirect:/landing/" + user.getEmailId();
         }
   }
}

login.jsp

    <%@ include file="/WEB-INF/jsp/include.jsp"%>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

    <html>
    <head>
    <title><fmt:message key="title" /></title>
    <style>
    .error {
        color: red;
    }
    </style>
    </head>
    <body>
        <h1>
            <fmt:message key="login.heading" />
        </h1>
        <form:form method="post" modelAttribute="user" action="login">
            <table width="95%" bgcolor="f8f8ff" border="0" cellspacing="0" cellpadding="5">
                <tr>
                    <td align="right" width="20%"><form:label for="emailId" path="emailId" cssErrorClass="error">Email ID:</form:label></td>
                    <td width="20%"><form:input path="emailId" /></td>
                    <td width="60%"><form:errors path="emailId" cssClass="error" /></td>
                </tr>
                <tr>
                    <td align="right" width="20%"><form:label for="password" path="password" cssErrorClass="error">Password:</form:label></td>
                    <td width="20%"><form:input path="password" /></td>
                    <td width="60%"><form:errors path="password" cssClass="error" /></td>
                </tr>
            </table>
            <br>
            <input type="submit" align="center" value="Login">
        </form:form>
        <a href="<c:url value="signup.htm"/>">Signup</a>
    </body>
    </html>

name-servlet.xml

<bean....>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
        <property name="prefix" value="/WEB-INF/jsp/"></property>
        <property name="suffix" value=".jsp"></property>
   </bean>

 </bean>

Your help appreciated.

  • 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-16T02:53:32+00:00Added an answer on June 16, 2026 at 2:53 am

    Seems you have mapped *.htm URL to DispatcherServlet (Guessing from /signup.htm). Change the action in your form tag to login.htm instead of login:

    <form:form method="post" modelAttribute="user" action="login.htm">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this question may have been asked many times, but could not find any suitable
Ok, this may have been asked dozens of times over. But I'm not exactly
This may have been asked before, but I could not find the answer. I
This question may have been asked already - but unfortunately, I could not find
I know this question has been asked many times, but I have not been
this may have been asked before, but I could not find it. Suppose I
This question may have been asked before, but I had trouble finding an answer,
This may have been asked already, but I can't find it, so here goes.
this may have been asked already but I cant really find it (most likely
This may have been asked multiple times, but is there a good HTML-to-PDF creator

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.