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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:37:25+00:00 2026-05-27T19:37:25+00:00

My UserController.java @Controller @RequestMapping(/userRegistration) public class UserController{ @RequestMapping(method = RequestMethod.GET) public String showForm(ModelMap model)

  • 0

My UserController.java

@Controller
@RequestMapping("/userRegistration")
public class UserController{

    @RequestMapping(method = RequestMethod.GET)
    public String showForm(ModelMap model) {
        User user = new User();
        model.addAttribute(user);
        return "userForm";
    }

@RequestMapping(method = RequestMethod.POST)
public String onFormSubmit(@ModelAttribute("user") User user) {   // **#1**
    return "redirect:userSuccess.htm";                // **#2**
    }

}

My SuccessController.java

@Controller
public class SuccessController {

    @RequestMapping("/userSuccess.htm")
    public String getSuccessPage(@ModelAttribute("user") User user){       // **#3**
        return "userSuccess";
    }
}

I am not getting "user" model in SuccessController and so when I use ${user.name} in userSuccess.jsp, I don’t get any value.

When I set user model at Line 1, why don’t I get this value in another controller? If I keep this model in Session using @SessionAttributes, I can access it in another controller.

Then what is the scope of models formed using @ModelAttribute?

  • 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-05-27T19:37:26+00:00Added an answer on May 27, 2026 at 7:37 pm

    It’s in the request, unless modified with a @SessionAttributes as described here. (Delta the other cases described here.) You’re doing a redirect–request attributes are lost; it’s a new request.

    You answered your own question in your text: when you keep it in session, it’s available across controllers and redirects, because it’s in the session. If you don’t keep it in session, it’s not.

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

Sidebar

Related Questions

In my controller: @Controller public class UserController { @RequestMapping(value=/admin/user/id/{id}/update, method=RequestMethod.GET) public ModelAndView updateUserHandler(@ModelAttribute(userForm) UserForm
I have a controller with two simple Methods: UserController Methods: [AcceptVerbs(HttpVerbs.Get)] public ActionResult Details(string
I have a spring controller defined like this: @Controller @RequestMapping(/user) class UserController { ...
I have a user controller which consists of a method named listfolders(). class UserController
m developing rest api by zf. this is my user controller. <?php class UserController
I have the following code in my controller called UserController : public ActionResult Details(string
I have a User table and in UserController.java I have a method userList(); which
I have a controller which has a method called history class UsersController < ApplicationController
Class UserController def export_users users = User.all stream_csv do |csv| csv << [Name,Email,Gender] users.each
I'm using pylons, and my action of controller is: class UserController(BaseController): def create(self): name

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.