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

Possible bug on Spring 'tags/form' for input title and placeholder attributes working with Spring 'message' element [SPR-13444] #18024

Closed
spring-projects-issues opened this issue Sep 7, 2015 · 3 comments
Assignees
Labels
in: web status: declined

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 7, 2015

Manuel Jordan opened SPR-13444 and commented

I am working with Spring 4.2.0

I have the following:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

...
<label for="fecha"><spring:message code="persona.fecha.label" text="_fecha" /></label>
<form:input path="fecha" 
          size="50" 
          readonly="true" 
          title="<spring:message code='persona.fecha.title' />" />
...	
<input type="submit" 
           value="<spring:message code='button.register' text='_button.register' />" />

i18n (MessageSource) works fine.
For the label and submit the spring:message works fine.

The problem is for the input's title attribute. It always shows the raw content.
It means <spring:message code='persona.fecha.title' /> is not tranformed or interpreted

I can confirm that using <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> and
for <form:input the STS with Ctrl+Space can show the title attribute.

Seems it is a bug because:

If I use (html directly within the JSP file)

<input type="text" id="abc" 
           name="abc" 
           placeholder="enter input" 
           title="<spring:message code='persona.fecha.title' />"
           />

<spring:message code='persona.fecha.title' /> is really tranformed or interpreted

Therefore works fine...

Warning: Same problem for the placeholder attribute.

<form:input path="fecha" size="50"
          placeholder="<spring:message code='persona.fecha.title' />"
          title="<spring:message code='persona.fecha.title' />" />

Affects: 4.2.1

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 23, 2015

Brian Clozel commented

I believe this works as designed - we don't evaluate JSP tags in attributes (this is obviously possible in the body part of a tag).

There are many ways to work around this, one of them being:

<spring:message code='persona.fecha.title' var='fechaTitle' />
<form:input path="fecha" size="50" readonly="true" title="${fechaTitle}" />

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 24, 2015

Manuel Jordan commented

Hi Brian

Thanks by the explanation, has sense…

About: "we don't evaluate JSP tags in attributes"
Why that approach? Would be viable do viable that?

Thanks

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 25, 2015

Brian Clozel commented

I may be mistaken, but I think this is a JSP limitation (JSPs can evaluate expressions in attributes, but not nested tags) and not necessarily a choice on our end.
If you have a pointer to a resource that says otherwise, I'd be happy to look into it!

Thanks,

@spring-projects-issues spring-projects-issues added type: bug status: declined in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug label Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web status: declined
Projects
None yet
Development

No branches or pull requests

2 participants