View Full Version : Using the <form> tags in binding JSP to bean; how to test value?
blueskies
Aug 8th, 2007, 01:53 PM
I have a field which is by default -1 as an int. I don't want the value -1 to display in my JSP page form though.
Enter Number: <form:input path="number" />
I have it -1 by default because during validation I will check if it is greater than or equal to 0. How can I test the value before hand? I would like to check if it is -1 to just display a blank input.
Toxic
Aug 8th, 2007, 04:20 PM
From my understanding this can't be done with the form tags. Generally speaking they are an higher level implementation of some common operation, advantageously used when appropriate, however unsupportative when finer granularity is needed.
You can always use the core taglib to obtain if if-else statement; <c:if test=""> or <c:choose>.
blueskies
Aug 8th, 2007, 04:21 PM
From my understanding this can't be done with the form tags. Generally speaking they are an higher level implementation of some common operation, advantageously used when appropriate, however unsupportative when finer granularity is needed.
You can always use the core taglib to obtain if if-else statement; <c:if test=""> or <c:choose>.
Thanks. I ended up just changing it to a regular String value and converting it after.
Jörg Heinicke
Aug 9th, 2007, 11:47 PM
I have a field which is by default -1 as an int. I don't want the value -1 to display in my JSP page form though.
Usually a task for PropertyEditor, but if you are happy with your current solution ...
Joerg
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.