• 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

attributeUpdated

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can we create a new method attributeUpdated in a class that implements ServletRequestAtttributeListener and then use ServletRequestAttributeEvent.getValue() to get the old value of the attribute that was replaced?

i was wondering how will the method get hold of the Event...this was just an option from one of the Davids book. People say it has many errors...so i have to check if his answers are correct.....this is actually a good thing...helping me to learn things
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can we create a new method attributeUpdated in a class that implements ServletRequestAtttributeListener


Who is going to call it ? Isn't what attributeReplaced is used for ?
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what if we call it when we update an attribute.....i know attributeReplaced is used for it but can we create another method say attributeFind()....can we create our own listener?
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


what if we call it when we update an attribute.....i know attributeReplaced is used for it but can we create another method say attributeFind()....can we create our own listener?



But how will you call it?
I am also prepring for SCWCD. Dont have much idea about Listener. But my point is even if we can create our own listeners then how will methods in that listener get invoked? How we will maap the event and the its corresponding method in listener class?

 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
by manually calling them
 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

by manually calling them



Dont you think, then it will defeat the purpose of Listeners. We can have that method in any other java class and then call it.

I think we dont call listeners methods manually.
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i know that....we shouldnt do that....leave it..understood what david was trying to say though
 
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What did you understand?

Please post it so that we can also understand.
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
even if we do happen to create the method the container wont ever call it...so there is no way to retrieve any value to the attribute
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic