Search code examples
jspwebjsp-tagsstripes

Placeholder tag in stripes framework


I'm developing a web application using the stripes framework and I would like to use the 'placeholder' tag within a text box like this:

<s:form beanclass="myproject.action.ContactFormActionBean">
  <table class="form">
    <tr>
     <td>Email:</td>
     <td><s:text name="contact.email" placeholder="Please enter your email"></td>
    </tr>
  </table>
</s:form>

However, when I run the page I get a 500 error (Unexpected error). Looking at the stripes documentation, I see that the placeholder attribute is invalid.

Is there a work around that is available for this or do I need to use another tag library in order for placeholder to work?


Solution

  • Use dynamic attributes.

    <%@ taglib prefix="sdyn" uri="http://stripes.sourceforge.net/stripes-dynattr.tld" %>
    
    <sdyn:text name="contact.email" placeholder="Please enter your email">
    

    https://stripesframework.atlassian.net/wiki/display/STRIPES/Tag+Library+Doc