0

I am trying to search through a table in the database and return the values on button click. This is the form that contains the search button

<div class="form-group">    
                          <form action="searchT">
                              <label class=" control-label col-sm-2">No</label>
                              <div class="col-sm-4"> <input class="form-control" type='text' name='searchName' id='searchName'/> </div>
                              <div class="col-sm-4"><input class="btn btn-success" type='submit' value='Validate'/></div>
                          </form>
                         </div>

This is the controller

@RequestMapping("searchT")
    public ModelAndView searchTOE(@RequestParam("searchName") String searchName) {  
        logger.info("Searching the T: "+searchName);
        List<TOE> tinList = TOEService.getAllTins(searchName);
        return new ModelAndView("serviceDescription", "tList", tList);      
    }

This is the error response when I click the submit button

type Status report

message Request method 'POST' not supported

description The specified HTTP method is not allowed for the requested resource.

Please what could be wrong?

Blaze
  • 2,269
  • 11
  • 40
  • 82

1 Answers1

0

you make a post request through your form and then in the controller you expect a get request.

Try something like this in the front end and tell me if this worked for you change

<form action="searchT" >

to

<form action="searchT" method="get">
Periklis Douvitsas
  • 2,431
  • 1
  • 13
  • 14