What are you expecting to appear in the target div?
How is the Ajax action creating its output?
Sunil Anna
Greenhorn
Joined: Apr 08, 2009
Posts: 7
posted
0
Thanks David,
I'm trying to send an html text back to browser. It's an <img ... tag with some attributes set (It'd appear as it is on browser, and it's not for showing an image).
On Submit button press I'm invoking process() method that tries to set the contents of sx:div tag
by invoking setSparklineImageCode()
I can not exactly return a string from this method (as struts would try to interpret it as an action result). Then, how should I update this div tag?
Please pardon my ignorance I'm new to Struts and AJAX.
You have to produce output somehow, like via a JSP or something.
So the process() method might return SUCCESS, and the JSP would consist of the image tag:(Or something similar, anyway.)
Things like this are really easy to test: just go to the URL of the Ajax action and see if it produces the output you expect. This one wouldn't create any output, because there's no way for it to.
Sunil Anna
Greenhorn
Joined: Apr 08, 2009
Posts: 7
posted
0
Thank you David,
It seems the only way to update UI components through AJAX in Struts 2 is to have a JSP. That would replace the contents of the UI component. I had tried this approach, though I don't remember it worked. But this seems a lousy way to me as in my case I'd have to create a JSP for every div component update.