File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Portals and Portlets and the fly likes Struts - JSR168 Ajax Portlet - Problem! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Struts - JSR168 Ajax Portlet - Problem!" Watch "Struts - JSR168 Ajax Portlet - Problem!" New topic

Struts - JSR168 Ajax Portlet - Problem!

Christopher Frankland
Ranch Hand

Joined: Jan 22, 2005
Posts: 42

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.



Bill Fly

Joined: Mar 16, 2003
Posts: 12
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

[ 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

Joined: Jun 18, 2008
Posts: 11
I am also facing the same problem. if you have found any solution for your posts, please let me know.
Thanks in advance,
I agree. Here's the link:
subject: Struts - JSR168 Ajax Portlet - Problem!
It's not a secret anymore!