struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burton Rhodes <>
Subject [S2] Displaying user entered values after failed type conversion while using getText()?
Date Thu, 17 Nov 2011 03:09:25 GMT
I am having an issue with displaying the original value entered on a
form after failed type conversion.  This "bug" is caused by my use of
getText() in the form value fields.  I'm curious how one solves this
issue for making sure the field is formatted correctly upon display,
but also making sure the users see the orignal malformed entry after
failed type conversion.  I have a few examples below.  The last one
displays works the way it should.  The top two only present an empty
field upon failed type conversion.

[code snippets]

<!-- "convert to java.util.Date": Will NOT display the incorrectly
entered date -->
<s:textfield key="xaction.closedDate"
value="%{getText('format.dateShort',{xaction.closedDate != null ?
xaction.closedDate :''})}" />

<!-- "convert to BigDecimal": Will NOT display the incorrectly entered
number -->
<s:textfield key="xaction.listPrice"
value="%{getText('',{xaction.listPrice != null ?
xaction.listPrice :''})}"/>

<!-- "convert to Integer": Will display the incorrect value -->
<s:textfield key="xaction.beds" />

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message