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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:25:03+00:00 2026-05-28T06:25:03+00:00

I have this Controller : @Controller @RequestMapping(/path/*) public class MyController { @RequestMapping(value = /,

  • 0

I have this Controller :

@Controller
@RequestMapping("/path/*")
public class MyController {

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String welcomeHandler(final Model model) {
        // SOME CODE...
    }

    @RequestMapping(params = "reloadPage", value = "/", method = RequestMethod.POST)
    public String reloadPageHandler(final Model model) {
        // SOME CODE...
    }

    @RequestMapping(params = "search", value = "/", method = RequestMethod.POST)
    public String processSubmit(final BindingResult result...)
        // SOME CODE...
    }
}

and this jsp :

<form:form id="SearchFormController" method="post" modelAttribute="SearchFormBean">
    <form:select path="searchCriteria.departmentId">
        <form:options items="${addressDepartmentList}" itemValue="id" itemLabel="name" />
    </form:select>

    <p>
        <button type="submit" name="reloadPage">Reload the page</button>
    </p>

    <form:select path="searchCriteria.cityId">
        <form:options items="${addressCityList}" itemValue="id" itemLabel="name" />
    </form:select>

    <p>
        <button type="submit" name="search">Submit</button>
    </p>
</form:form>

This code works perfectly fine, when I click on the “Reload the page” button, the reloadPageHandler is called.

Now what I want to achieve, is to remove this button and put an onchange event on my jsp like this :

<form:select path="searchCriteria.departmentId" onchange="submit()">
    <form:options items="${addressDepartmentList}" itemValue="id" itemLabel="name" />
</form:select>

The problem here is that when the form is submitted, it’s the “processSubmit” handler that’s called. But I have to call the “reloadPageHandler”.

Any idea on how to do this ? Thanks !

  • 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-28T06:25:04+00:00Added an answer on May 28, 2026 at 6:25 am

    It seems that the reloadPage-parameter is missing. (The former button’s name.)

    If you put a hidden field with this name into the form, it should work:

    <form:form id="SearchFormController" method="post" modelAttribute="SearchFormBean">
        <input type="hidden" name="reloadPage" value=""/>
    
        <form:select path="searchCriteria.departmentId" onchange="submit()">
            <form:options items="${addressDepartmentList}" itemValue="id" itemLabel="name" />
        </form:select>
    
    </form:form>
    

    But the problem with this code is still that always the processSubmit-Handler will be called. So a solution could be to change the controller that the reloadPageHandler is only called if reload=true. Then change the onchange to “this.form.reloadPage.value=’true’;submit()”

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

Sidebar

Related Questions

Lets say i have a Controller like this one : @RequestMapping(method=RequestMethod.GET, value=/error) public void
Imagine a code like this one: @RequestMapping(value=/users, method=RequestMethod.GET) public String list(Model model) { ...
This is my code: @Controller @RequestMapping(loginform.htm) public class LoginController { @RequestMapping(method = RequestMethod.GET) public
Imagine I have this annotated method in a Spring 3 @Controller @RequestMapping() public @ResponseBody
I have the following controller @Controller @RequestMapping(/project/view.html) public class ProjectViewController { private static final
I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult
I have a spring controller defined like this: @Controller @RequestMapping(/user) class UserController { ...
I have a Spring MVC Controller class (bean): @Controller @RequestMapping(/index.jsp) public class EjbCaller {
Imagine that I have a Spring MVC controller something like this: @Controller @RequestMapping(/base-url) public
Let's say I have a handler in a Spring MVC controller: @RequestMapping public String

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.