Announcement Announcement Module
Collapse
No announcement yet.
maxLength attribute ignored Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • maxLength attribute ignored

    Hello,
    I am playing with STS 2.3.3 M2 and Roo 1.1.0 M2
    I create my entity like this:

    entity --class ~.domain.Person --testAutomatically
    field string --notNull --fieldName username --sizeMin 7 --sizeMax 15

    and generate controller with:
    controller scaffold ~.web.PersonController

    When I startup jetty and navigate to my applicayion, I see peron usernames stripped (instead of 15, they are 10 char long).

    By looking at column.tagx file I notice:
    <jsp:directive.attribute name="maxLength" type="java.lang.Integer" required="false" description="Max displayed text length (default '10'). Unlimited if negative"/>

    It looks like maxLength attribute is never passed in request?
    Am I missing something or this is not a desired behavior?

    Is there any other way to support 15 char long strings in list view apart from manually replace 10 with 15 in column.tagx?

    thanks,
    Milan

  • #2
    The maxLength attribute in the column tag is not governed by the JSR 303 @Size constraint. The JSR 303 @Size constraint defines which length your String is allowed to have whereas the maxLength attribute in the column tag allows you defile how many characters are visible before they are cut off to save space in the table view (by default this is 10 characters).

    If you have a domain object with a lot of fields you need to cut off the number of characters you can show for each column in the table (that does not mean the actual field cannot contain more characters). The maxLength attribute is optional and intended to be used by you if you want to fine tune your table appearance. You can do this in the list.jspx pages on a per column basis or you can do it directly in the column.tagx (and therefore change the default for all tables).

    HTH,
    Stefan

    Comment

    Working...
    X