Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Servlets-4a - using supplied files without modification?

Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just worked out how to solve a problem I was having using EL to print attributes of a VideoData object in the JSP with ${videoData.title}, but it involved modifying the supplied - is this allowed, or do I need to find some other way round the problem?  The instructions for this assignment say I "can use these files without modification", but do I have to?

A little context: I was getting a blank page and "javax.el.PropertyNotFoundException: Property 'title' not readable on type" in localhost.[today's date].log.   The best I could do was print out the output of the object's toString() method, but any attempt to access its properties failed.  I added the example Employee class and tried accessing its properties, and that worked fine, so I could then see that the public access modifier was the difference, and once I made VideoData public, it also worked as expected.

Also, I haven't got as far as working with the booleans dvd and vhs, but I noticed that their accessor methods are called inDVD() and inVHS(), shouldn't they be isDVD() and isVHS() in order to work with ${videoData.dvd} and ${videoData.vhs}?  So I need to know if I'm able to change these myself or if I have to find another way around it.
Posts: 3034
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, sorry about that. The original assignments had inVHS() and inDVD(). I vaguely remember that wasn't simply a typo, but I don't really remember the details. In any case, EL works with classes that strictly follow the JavaBean specification -- and that means naming accessors with "get", except for booleans where "is" is preferred. I remember updating the sample files, but it looks like either I'm wrong or that update got reverted at some point. Here's the you should be using:

Feel free to make other changes if the sample files aren't working right for you. Just give me a heads up, so I can correct them online if need be.
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!