You don't. The EL is not a general-purpose programming language; you cannot use it to call general methods. In JSP 2.0 you can define functions, but they are limited to calling static methods and cannot be used to call instance methods of beans.
In short, how to use the c:if tag as per my requirement?
In the following example:
you appear to have coded it correctly. If the evaluated values of session.userBean.userName and trip.createdBy are equal, the content of the <c:if> tag will be evaluated. If it is not being evaluated, then the values are not equal. If you think that they are, you need to check them very carefully; they cannot be.
By the way, using two <c:if> statements, with opposite expressions, to represent an if-then-else pattern isn't a great idea. It is possible for the two expressions to get out of synch with each other too easily over the course of additions and maintenance to the page.
A more common pattern for representing an if-then-else would be along the lines of:
Note that in this idiom, the expression is coded once so the chance of introducing errors if the expression needs to be changed is eliminated.
Also, please check the 'disable smilies' checkbox when posting code. [ May 12, 2005: Message edited by: Bear Bibeault ]