Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Mar 15, 2010 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 15, 2010

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:

@spring-projects-issues
Copy link
Collaborator Author

Ken Egervari commented

I also want to add that putting small quotes like ['${blah}'] does not help. It merely generates studentAnswer.answers'xyz' as the id and name pair for the input element.

What is it doing? I used to call status.expression directly. I had some old Spring 2.5 cold that Jeuron wrote in Freemarker, and I was using that for eternity. Works great, but didn't work with multiparts in 3.0. Now that I use the tag library, I cannot use path expressions I was using before? There is a step in between that the tag library is doing that I really want to prevent now.

Please help.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This was an unfortunate regression in 3.0.1 that has been fixed in 3.0.2 snapshots already. Spring 3.0.2 is scheduled for release next week; feel free to give a snapshot a try in the meantime!

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants