Reputation: 2134
I have the following @RequestMapping defined for a Controller's method.
@RequestMapping(value = "{transactionId}/continue", params = "submitButton=enterApplication")
In the JSP, I have the following button defined:
<button type="submit" name="submitButton" id="button.enterApplication" value="enterApplication">
Enter Application
</button>
Everything works fine with modern browsers. The following is submitted in the request:
submitButton=enterApplication
But it looks like with IE7 (probably earlier as well), the browser is submitting the contents of the button tag instead of the value attribute. So in this case, it is submitting the following:
submitButton=Enter+Application
Note the '+' symbol instead of a space (using Fiddler, I was able to inspect the Request and saw the above parameter/value had the '+' in it). I'm pretty sure this is where my problem is -but I'm not sure what to do about it. I tried to add another method with the following @RequestMapping:
@RequestMapping(value = "{transactionId}/continue", params = "submitButton=Enter+Application")
But this does not seem to work. I continue to get the following error:
javax.servlet.ServletException: No adapter for handler [...]: Does your handler implement a supported interface like Controller?
Is there a way to determine what logic Spring is doing to compare what is being submitted in the request with the defined params in the @RequestMapping? I'm thinking there has to be a problem comparing the space or '+' character.
*Note: The problem may not necessarily be the plus character -that was just my initial thought. If I can figure out how Spring determines the handler, I may be able to figure out why it's not matching.
Upvotes: 0
Views: 592
Reputation: 2134
Sotirios Delimanolis' answer was correct. I'm not entirely sure why it didn't work originally.
To recap, the following RequestMapping is correct.
@RequestMapping(value = "{transactionId}/continue", params = "submitButton=Enter Application")
Also, in order to support older browsers and NOT have to create multiple methods with different RequestMappings, we made the decision to remove the value attribute and rely on the contents of the button tag.
So, the button looks like this now.
<button type="submit" name="submitButton" id="button.enterApplication">
Enter Application
</button>
Upvotes: 0
Reputation: 10709
Uses a paramValue.equals(request.getParameter(paramName))
for the "paramName=paramValue" form.
Upvotes: 0
Reputation: 4251
You can just put a hidden field on your form instead of using the submit button value to send up the parameter. Remove value="enterApplication"
from the submit button and put something like this on the form:
<input type="hidden" value="enterApplication" name="myParameterName"/>
Then just add the parameter to your controller method signature:
@RequestMapping(value = "{transactionId}/continue")
public void myControllerMethod(@RequestParam String myParameterName)
....
Upvotes: 0