• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mapping double value to inputText

 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • 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 ]
 
Ish Rawal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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 ]
 
Ganesh Jung
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Ganesh, it works !!

Rajeev.
 
stalin das
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic