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

The Archive Base Latest Questions

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

Here is one of my controller method, @ResourceMapping(value=petPortalAction) @RequestMapping(params={transactionType=BUY_PET}) public String handlePetPurchaseAction( @RequestParam(required=true, value=petId)

  • 0

Here is one of my controller method,

  @ResourceMapping(value="petPortalAction")
  @RequestMapping(params={"transactionType=BUY_PET"})
  public String handlePetPurchaseAction(
                    @RequestParam(required=true, value="petId") String petId, 
                    PortletRequest request,
                    Model model)
  {
  ... 
  }

As you can see, parameter petId is mandatory request parameter.
If it’s missing from the request, org.springframework.web.portlet.bind.MissingPortletRequestParameterException will be raised.

My question is how to catch and handle this exception… Is there any listener in spring that I can use?

Thanks in advance.

  • 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-23T19:25:23+00:00Added an answer on May 23, 2026 at 7:25 pm

    The question is somewhat old, but I had the same problem (and this question comes up pretty high on Google ;-)). So here is what I did:
    I added the follwing to my applicationContext.xml:

    <bean id="defaultExceptionHandlerTemplate" class="org.springframework.web.portlet.handler.SimpleMappingExceptionResolver" abstract="true">
        <property name="defaultErrorView" value="error/error-exception-default" />
        <property name="exceptionMappings">
            <props>
                <prop key="org.springframework.web.portlet.bind.MissingPortletRequestParameterException">
                    error/error-missing-parameter
                </prop>
            </props>
        </property>
    </bean>
    
    <bean id="defaultExceptionHandler" parent="defaultExceptionHandlerTemplate" />
    

    The error/error-missing-parameter is the name of a view that is to be displayed. Spring will automatically publish the exception to the view, by default calling the variable “exception”. On a typical JSP setup that I have the view error/error-missing-parameter maps to /WEB-INF/jsp/error/error-missing-parameter.jsp depending on your view resolver configuration. This file can for example simply look like this:

    <jsp:root version="2.0"
        xmlns:jsp="http://java.sun.com/JSP/Page"
        xmlns:c="urn:jsptld:http://java.sun.com/jsp/jstl/core">
    
        <h1>Missing parameter</h1>
        <p>Error: The parameter '<c:out value="${exception.parameterName}" />' of type '<c:out value="${exception.parameterType}" />' is missing.</p>
    </jsp:root>
    

    The property “defaultErrorView” maps to a view in case that none of the exceptionMappings below matches. If you don’t need this, than you can skip this property.

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

Sidebar

Related Questions

In Rails Controller, Using Scaffolding we generate default methods. Here One of the method
Here is the problem, i have one controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Detail(SomeObjectX a) {
I have 2 Action methods in one controller, Index: public ActionResult Index(string url) {
I'm having an issue with one of my controller's AJAX functionality. Here's what I
Here one more basic question asked in MS interview recently class A { public
Here is one method that monkey patched the Dir[] method from autotest class Dir
I.e. would you recommend me to use one controller method like this: function save()
I'm having trouble writing a unit test for one of my controller actions. Here's
Ok, here's one for the JavaScript gurus: In my app, one of the controllers
Here's one from the No question's too dumb department: Well, as the subject says:

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.