This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ABS() in JSF

 
jeff rusty
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

I have couple of questions in JSF

1. How to call Math.ABS() while displaying a number value in JSF? i am using Myfaces with trinidad.

2. how to align text when using <trutputlabel> (text-align:right or left). I tried the inlinestyle but it is working.


Any help in this is highly appreciated.


Thanks,
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could define a TLD file "myFunctions.tld" containing this:

<function>
<name>abs</name>
<function-class>java.lang.Math</function-class>
<function-signature>double abs (double)</function-signature>
</function>

and then write this in your JSP:

<%@ taglib prefix="math" uri="/WEB-INF/myFunctions.tld" %>

${math:abs(myDoubleVariable)}

 
jeff rusty
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Ulf Dittmer.
I am using JSF. Will this solution ork for me... Any way i will try and let you know..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic