Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding display tag

 
Tusshar Fasate
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.i want to show two propeties into one column using display tag.
for. ex. I am having firstname and lastname .these two independent properties that i want to show under column name "NAME".

2.I want to show the size of Set in one column ..how can i do this using display tag?
please provide me reply.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't something that DisplayTag needs to solve. You should provide that information in your java code. For example, if you have an object that looks something like this:



All you have to do is provide a method to get the full name:



Same goes for the size of a set. Just provide a getter that returns mySet.size().
 
Tusshar Fasate
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Gregg for your reply.
I have done all these things already(getters and setters for fields) whatever you are saying.
I have a list object from which i want information in different columns.
In one column i want Name containing firstname and lastname attributes.
Tell me syntax for that how can i do that using display tag?
Same i have getters and setters for set also.But how can i calulate its size in column.I want syntax of display tag for that.
thanks.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand why you think you need the display tag syntax. It is the same syntax you use for any other properties.



Where you have getName() that returns the full name and getSomeSize() that returns the size.
 
Tusshar Fasate
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I want to show pagination,sorting in my application so i am going for display tag.

Secondly ,i dont have name property.I have two firstname and lastname properties and i want to show both under title Name.So i want a syntax for that.

Secondly i have set property "Replies" and i want to show size of "Replies" set.
So how can i show that?
Thanks Gregg .

Again i have added display tag jar in lib.
Do i need to add something in my web.xml file ?Because when i try to add <cut>
its showing me error as unknown tag.
Please guide me.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to read my first reply to you. That is your answer. I don't know what else to tell you to help you understand. I wasn't asking why you are using Display Tag. I was asking why you still aren't understanding what you need to do, since I already told you with code examples. Just read what I wrote again, add the code for getName() which returns your first and last name concatenated. Add a getter method that returns your replies.size().

Add those properties as columns to your display tag. Again, I showed you all the code you need.
 
Tusshar Fasate
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am really sorry.I thought you are telling me to write getters and setters to firstname and lastname ..so i didnt read your first reply completely.Now my problems got solved.Thanks again for your help.
Can you reply for my second problem .

Again i have added display tag jar in lib.
Do i need to add something in my web.xml file ?Because when i try to add <cut>
its showing me error as unknown tag.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
c:out is part of the JSTL. You need to download that and include its jars in your classpath.

http://faq.javaranch.com/java/JstlTagLibDefinitions
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic