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:

  1. Why is it that the ServletRequest accepts the value from the input tag but not my custom tag?
  2. Am I right in assuming that HTML5 supports this kind of extensibility?
  3. Does anyone know exactly which tags ServletRequest accepts for parameter binding?
有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top