Skip to content

Spring web's tag library removes "[" and "]" in the path attribute for input (and possibly others). [SPR-6989] #11654

@spring-projects-issues

Description

@spring-projects-issues

Ken Egervari opened SPR-6989 and commented

I have some code that purposefully puts "[" and "]" in the path, which eventually gets rendered to the id and name attributes on the input tag.

Code:

<@springForm.input type=type attributes=attributes path=path htmlEscape="true" /><br/>

At a high level, it gets used like this:
Code:

<@form.text path="studentAnswer.answers[${chunk.text}]" />

Unfortunately, spring's tag library is removing the "[" and "]", so what is left over is a giant string value. I must use this pattern since this page has multiple input fields that are totally random based on the list of text chunks.

Each form value is supposed to map to this:

private Map<String,String> answers = new HashMap<String, String>();

Of course, when the server tries to get the values, there are NPE's everywhere due to Spring's stupidity.

How did this break? I was using plain html before, and I just recently switched over to the tag library because it was the only way to get multipart's working correctly. Otherwise, Spring didn't pass the MultipartFile object to the domain object. I tried everything, and this is what fixed it.

Now that I have converted about 50 forms to use the tag library, I have finally arrived to the 1 outlier form that does not covert over successfully. Sigh.

Please tell me how I can get this to work so I can get this production code launched.


Affects: 3.0.1

Reference URL: http://forum.springsource.org/showthread.php?t=86199

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions