• Post Reply Bookmark Topic Watch Topic
  • New Topic

question regarding el

 
Graham Bedford
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first of all Hi everyone, this is my first post so let me know if im not posting correctly or doing something silly

i decided to create an online java database app using jsp/servlets and hibernate as a bit of a hobby to make my overtime easier to record at work, however i have hit stumbling block.

This is because im using a GregorianCalendar object to store my overtime start date/time. I pass this to the jsp as part of a larger List of OTSecond objects and im trying to list the various overtime details in a table.

if i try then i get the calendar.toString which is no use to me. But if i try this wont work either because there is no getter and setter.

So i guess what im asking is how can i display the fields of the GregorianCalendar in a JSP.

below is a little code snippet hope im not being too vague. i didnt want to post lots of servlet code and make this post too large.

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One option would be to wrap the GregorianCalandar object with an object of your own and provide getters for the properties that you want to expose.
 
Graham Bedford
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply

I thought of that too but wasn't sure if that was the easiest or "best practice" way to do it.

I assume I just have to provide getters and setters for the fields I wish to use, I know next to nothing about el.... (considers getting a book)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If what you want to expose to the JSP are class constants, you might find this article interesting.
 
Graham Bedford
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot im having a read through now
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!