• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

mapping double value to inputText

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have a inputText which i mapped to a double value in the ManagedBean, when the page gets loaded the textfield displays 0.0 since it has been mapped as double value. Is it possible to display blank in the textfield if the value is 0.0, if i map it to a String and later parse the value to double in the backing bean it will work. Just wondering if JSF has anything inbuilt to handle this scenario.

Thanks,
Rajeev
[ March 24, 2006: Message edited by: Rajeev Ravindran ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rajeev,
JSF has nothing to do with it. You will have to write some logic for it. You can just pass a parameter names "success=true" to the jsp after submitting the form. And in your jsp just do like this

<% if(request.getParameter("success")!=null { %>
<html:text name="BEAN_NAME" property="TEXTBOX_NAME" Value="" />
<% } else { %>
<html:text name="BEAN_NAME" property="TEXTBOX_NAME" />
<%}%>

i have made text box in above code using struts, but you can do whatever framework you are using. But the logic will be the same.
[ April 03, 2006: Message edited by: Ish Rawal ]
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Use Double instead of double. null-value in the property will display as blank.

Greetz,
Ganesh
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ganesh, it works !!

Rajeev.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Double will not display the value in the inputtext field but when its get saved in table showing as 0.0.
 
reply
    Bookmark Topic Watch Topic
  • New Topic