aspose file tools*
The moose likes JSP and the fly likes JSTL 1.0 - Get value of from an object when fn cannot be used Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL 1.0 - Get value of from an object when fn cannot be used" Watch "JSTL 1.0 - Get value of from an object when fn cannot be used" New topic
Author

JSTL 1.0 - Get value of from an object when fn cannot be used

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
How can I get the value from the method of an Object (e.g., length of a String by calling myString.length()) and set the value of the length to a variable?

In the code below, my objective is to set myVar with the length() value obtained from myString of myForm object.

Code is somewhat like:

<c:choose>
<c:when test="${someCondition}">
<c:set var="${myVar}" value="${myForm.myString}"></c:set>
</c:when>
<!-- More <c:when> conditions -->
</c:choose>

myForm is an object which has myString as attribute with corresponding public getter and setter methods.

I get syntax error if "${myForm.myString}" is replaced with value="${myForm.myString.length}

I want to get the length of myString and set that value to myVar for future use in JSP.

Is there a work-around if I cannot use fn? I cannot use fn:length() as I am advised because of the level of JSp support
Any help will be appreciated.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60975
    
  65

Please continue the discussion in the original post.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL 1.0 - Get value of from an object when fn cannot be used