• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Progress, I think!

 
village idiot
Posts: 1208
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After hours of fussing with VideoServlet, I came to the conclusion that the method with the list stuff in it was never actually being called. So I commented out the add stuff, and voila, the link from the index page now retreives the list jsp. However, the code still isn't working. I'm having trouble coming up with a way to tell the app which action I want it to perform. It seems to do the one that appears first, even if I put it inside an if block. It seems to me the logic should work, but it doesn't. I tried doing a private class like default for each action, but the compiler complained because there are some abstract classes I would have to implement in order to do that, and I have a feeling that this is the wrong trail. The doc for ActionServlet states:
/**
* Override init and call this method for every action to be implemented.
*
* @param actionKey The text that will be sent in the servlet parameter to kick off this action.
*/
I want to put all of the code inside the inner class Default that deals with adding or listing and where to forward, etc, and then have init add the actionHandler, just like was done in reverse and bee servlets. Is this the right approach, or am I missing something because there are two actions to be dealt with here?
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you want an inner class for each action. Default can list the videos (at least for now), the other one will add a video. Each action is listed in init with it's associated class.
 
Carol Murphy
village idiot
Posts: 1208
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I have to implement the abstract methods mentioned by my compiler in order to do that, or can I put the inner class inside Default? Hmmmm... Wish I was at home right now!
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Each class should implement the same abstract method that the Default class implements.
reply
    Bookmark Topic Watch Topic
  • New Topic