jQuery in Action, 2nd edition*
The moose likes Struts and the fly likes Struts 2 Remote Div Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 Remote Div Problem" Watch "Struts 2 Remote Div Problem" New topic
Author

Struts 2 Remote Div Problem

Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
I am trying to build a JSP page that contains a DIV which can be dynamically updated via AJAX whenever a navigation tab is selected. For this, I am using Struts 2.1.8.1 with included dojo plugin.

In my JSP head element, I have the following:

Here is the DIV element defined on the same JSP:

Inside Struts.xml, here is what I have defined for QueueView action (note that there are no special parameters being set for struts.xml):

Here is the action class for QueueView:

I am taking this approach because I want to be able to set the href attribute on the div element via javascript according to what action needs to be called (will be set in the DOM when navigation tab buttons are clicked). At this point, all that happens when the page loads is the div displays with the text, "Initial Content" but the AJAX request is never made to the action. I know this because I have set debug break points in the action class, and they have not been hit.

Can somebody help point me in the right direction?



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If it's not a timer, why are you using autoStart? Did you try it without it?
Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
David Newton wrote:If it's not a timer, why are you using autoStart? Did you try it without it?


I did try that already and it doesn't seem to make a difference.
Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
Here is a directory listing of my WEB-INF/lib directory:


Note that all JAR files were obtained from the official Struts website for Struts 2.1.8.1.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Any JavaScript errors in Firebug?
Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
As far as I can tell, Firebug is not reporting any JS errors. I am developing this project as a prototype for an internal application that will run in IE6/7 (neither of which are reporting JS errors).
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Is the generated URL correct?
Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
Generated URL is relative and appears to be correct:


(Where "contextroot" is the name of the application)
Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
Also, here is my taglib statement:

Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
After working through some example tonight at home, I'm not having any problems getting Ajax to work on Tomcat 6. I'm using WebSphere 6.1 at work and it has been producing odd system log messages. I think my problem has something to do with Websphere, I'll follow up tomorrow.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I don't even know if the filter compatibility flag is available in WebFear 6, but check for it anyway. It's a known issue.
Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
It definitely looks like an issue with WebSphere 6.1.0.2. I set "com.ibm.ws.webcontainer.invokefilterscompatibility" to true in the container settings, but that didn't produce any results. I'm also seeing the following after every request:



This thread describes the same problem with the strange log message, but it doesn't address non-functional Ajax functionality:

http://www.coderanch.com/t/485837/Struts/Application-Frameworks/Struts-Reponse-already-committed-errors

Per some recommendations I've read, I'm going to install Fix Pack 5 for WebSphere 6.1.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts 2 Remote Div Problem
 
Similar Threads
Struts 2 + Updating target element with content returned from url
Ajax using dojo plugins in struts2
getting 500 Internal Server error when using <sx:div> tag
Struts 2: tree tag causing javascript errors
Ajax not working on IE. Undefined error