• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts property tag question

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


To test your code : It evaluates the expression and prints the true or false.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It gave me the following error. Do I have to escape the quotes?

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact even <s:property value='%{#ques1.equals(ques1)}' /> would print false which is unbelievable.
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic