Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts - JSR168 Ajax Portlet - Problem!

 
Christopher Frankland
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Ok, I really hope somebody can help with this as I have hit a brick wall. I have a JSR-168 Struts portlet that I am developing and I would like to implement AJAX functionality - simply to update an InnerHTML tag on the screen for now.

I have my jsp page set up, along with my struts action. The aim is to update the page during the 'onchange' event of my text input. Can somebody please review my code to let me know if I am missing anything? It would much appreciated. Thanks.

districtChart.jsp



WelcomeAction.java



struts-config.xml

 
Bill Fly
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christopher,
I have two comments about your Javascript code, although I am certainly not an expert.
First, in you createXMLHttpRequest function, the preferred method of creating a XMLHttpRequest is new XMLHttpRequest
before the use of the new ActiveXObject.
Secondly, quoting Head Rush Ajax on page 183, "Using the innerHTML property is not a good way to get and set the contents of an element.
It's not part of the DOM specification, and the W3C has deprecated it - future versions of browsers may not even support it. Worse than that,
some browsers don't support it now."

I recommend that you look at the Head Rush book or any Ajax book and find better code to replace text in a DOM, instead of using the innerHTML
property.

[ December 06, 2007: Message edited by: Bill Fly ]

[ December 06, 2007: Message edited by: Bill Fly ]

[ December 06, 2007: Message edited by: Bill Fly ]
[ December 06, 2007: Message edited by: Bill Fly ]
 
Paul Earnest
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also facing the same problem. if you have found any solution for your posts, please let me know.
Thanks in advance,
Paul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic