aspose file tools*
The moose likes Struts and the fly likes Struts property tag question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts property tag question" Watch "Struts property tag question" New topic
Author

Struts property tag question

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9520
    
    2

I would like to access the value using a property tag. This value comes from a Map < String, Long >. I have the String for which I would need the Long. The catch here is, I do not have an iterator running ahead of it.

I have the following check but this would throw me an exception:



What is wrong with the above code? In my if I have to check for the String questionId and if they are equal, print the long value in s:property.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9520
    
    2

Got one step closer to the issue:



Why would the above sample code not get into the if and print the value?
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485



To test your code : It evaluates the expression and prints the true or false.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9520
    
    2

It gave me the following error. Do I have to escape the quotes?

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9520
    
    2

This version seems to work without errors, but still the s:if is not getting inside to print the property value

Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485



I haven't tested it. I hope this help you. I will update my answer once i tested it with proper quotes.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9520
    
    2



The above tag evaluates to false and I'm confused as to how this could happen.

The following is what I get printed for ques1 and ques2:





Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9520
    
    2

In fact even <s:property value='%{#ques1.equals(ques1)}' /> would print false which is unbelievable.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485



I was updated my answer with proper quotes. I had used set for demonstration purpose don't use it. Evaluate the expression directly don't set it SET and compare.
 
Consider Paul's rocket mass heater.
 
subject: Struts property tag question