• 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

Question about Custom tags, Listeners, and Struts

 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to struts and custom tags, but implemented a solution where right click options are added to folders in a tree. It's working in every part of the application that uses that tree except one , where the frame also holds another tree component.
I verified that the options are being added on tree construction but after the tree is constructed nothing happens when I right click, as if the option is being removed immediately after being added. I did debugged this in JS and it appears as if this snippet from a custom tag may be getting called twice :


This is the jsp code that triggers the custom tag call:



and this is the struts xml that places the right click component into the tree:



My question is how can i trace where the second call is coming from? I don't quite understand how the listener is being called. The inside of the cm.render method is null the second time around and the reason why my right click components are not present when i right click.
My theory is that node object is being reset when the 2nd tree (which doesn't have right click options) is being created in the frame.
Is there a possibility that this is an AJAX or JS issue? (I'm also green to those tech as well)
Any ideas?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is there a possibility that this is an AJAX or JS issue? (I'm also green to those tech as well)



Certainly. It sounds like there are some JavaScript variables that get overwritten if you have more than one instance of the tree on the page but trying to narrow it down from there, seeing as how you have snippets of a custom tag, Struts tags, STL tags and... is that jQuery? scattered around I don't think I can figure it out from here. My advice to you is: IsolateTheProblem. Strip the code to the bare minimum (i.e. if you think the problem is in JavaScript, remove all the Struts and AJAX) and get up to speed on JavaScript and/or jQuery. The better you understand the problem, the better question you can ask and the more help we can be.
Who wrote this custom tree widget? Perhaps they can shine some light on how it behaves.
 
Jay Dilla
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joe Ess wrote:

Certainly. It sounds like there are some JavaScript variables that get overwritten if you have more than one instance of the tree on the page.



This is what i'm thinking. cm.render is a js method that's expecting a node array full of information about the tree/folders. After the tree gets built it must be getting called again with the null array passed. I guess my question is what could be calling the listener again? Basically what kind of string search should i do in my code base? The JEE 5 tutorial talks about custom tags and listener events but not in the context of Struts or interacting with JS (from what I can see). There is no page refresh going on as far as i know after the tree is built so it must be getting removed right after i step through it on the js side some how.

The person that built this is not here and the architect/only guy strong in JS on our team left right when I begun implementing this feature.
 
Oh the stink of it! Smell my tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic