Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring: Parameter conditions "loanTitle" not met for actual request parameters

Tags:

java

spring

Java Spring MVC. I can't open url without a parameter. I found suggestions in Internet(Spring MVC Thymeleaf Error: Parameter conditions not met for actual request parameters, http://www.baeldung.com/spring-requestmapping), but they didn't help me.

@Controller
@RequestMapping("/loans/")
public class LoanController {

    @Autowired 
    LoanDAO loanDAO;

    @GetMapping(value= "objectloan", params = {"loanTitle"})
    public String index(Model theModel, HttpSession session, @RequestParam(value = "loanTitle", required = false, defaultValue = "") Optional<String> loanTitle)
    {
....
    }

URL works

http://localhost:8080/college/loans/objectloan?loanTitle=test

URL with error

http://localhost:8080/college/loans/objectloan

Error:

Type Status Report
Message Parameter conditions "loanTitle" not met for actual request parameters:
Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
like image 510
Audr Avatar asked Oct 20 '25 07:10

Audr


1 Answers

Since loanTitle might not present in your query url,try to remove params = {"loanTitle"} in your controller method

    @GetMapping(value= "objectloan")
    public String index(Model theModel, HttpSession session, @RequestParam(value = "loanTitle", required = false, defaultValue = "") Optional<String> loanTitle)
    {
....
    }
like image 184
lucumt Avatar answered Oct 23 '25 00:10

lucumt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!