Custom Tags Support with Java EE
-
27-06-2021 - |
Question
Given the following HTML in a Java EE environment:
<input name="foo" value="hello" />
I would expect ServletRequest.getParameterNames()
would include foo
.
However given for example:
<footag name="foo" value="hello"/>
I would hopefully expect ServletRequest.getParameterNames()
to include foo
but it doesn't. This leads me to ponder:
- Why is it that the
ServletRequest
accepts the value from the input tag but not my custom tag? - Am I right in assuming that HTML5 supports this kind of extensibility?
- Does anyone know exactly which tags
ServletRequest
accepts for parameter binding?
Solution
After further investigation into this it turns out that it was in fact the browser that was not sending form parameter. According to the HTML5 specification:
Submittable elements:
Denotes elements that can be used for constructing the form data set when a form element is submitted.
button, input, keygen, object, select, textarea
It seems that only these tags should supply posted data. So it was not the RequestServlet
that is causing the problem.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow