• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

call a method by passing parameter in jstl

 
pk mishra
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i want to pass the variable as a parameter in a method. how can i do that.
my code is look like this


<c:set var="selectedDate" value="${Static.SELECTED_DATE}"/>

<c:if test="true">
<c:set var="selectedDate" value="${my:getCurrentMonth()}"/>

</c:if>
<c:set var="selectedDate" value="${my:formateDropDwnDate()}"/>


here i want to pass the variable selectedDate as a parameter in a method formateDropDwnDate .
i already declare the getCurrentMonth and formateDropDwnDate these two method in the mytld.tld fiel

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64181
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure exactly what you are asking, but I'll give it a try.

If you want to pass the scoped variable named selectedDate to an EL function that you've defined in your TLD (let's say that the function is named whatever), you'd just list in the parameter list. Such as:
But I'm not sure that's what you are asking.

Also, what is the sense of dropping the 'o' in the name formateDropDwnDate? Improve clarity by avoiding unnecessary abbreviations: name it formatDropDownDate using complete and real words (note that there's no 'e' in format).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic