struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject RE: AjaxTag 1.3 support?
Date Sat, 02 Feb 2008 23:10:11 GMT
--- "Griffith, Michael *" <Michael.Griffith@fda.hhs.gov> wrote:
> Thanks for the comprehensive reply. Looking at the documentation and the
> example app, I am still not sure how to configure my action/response.  I
> am using tiles 2.

As previously stated if you are writing directly to the response you need to
return null from the action. I am still not sure why you're using a tile
definition here.


> It seems I need to return my result in JSON format correct? By returning
> a JSON String from the action, how to I configure my response?

As Jeremy said this is, however, probably a bad idea, considering that the
same outcome can be achieved in several different ways.

Using a JSON result will serialize your action to JSON automagically. You'd
use a "json" result (via the JSON plugin), not a tile. Or you could build the
JSON manually and configure a FreeMarker result.

> If I use the tiles response type, I get a dojo parsing error because the
> whole page is returned from the reply. 

Sure.

> The example in the example app isn't very clear to me, as the action
> returns a .JS file with the result hard coded, and not using any
> template like tiles I might add.

What example are you referring to? 

http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocompleterTag?

When making an Ajax request for a component like <s:autocompleter.../> it's
unlikely you'd want to return anything other than JSON. (Other components or
component libraries may want other formats like XML or whatever.) Unless your
tile definition is creating JSON it's not going to work, and it's unlikely
that would be the best way to generate the JSON anyway.

> Also, I think I found a bug? -- the namespace attribute seems to be
> ignored when I pass href=%{search} to the autocompleter. I had to put
> qualify the namespace in the value to get the correct action to be
> invoked.

When you configure the package does your namespace have a leading "/" (slash)
character? If it doesn't this can lead to dispatching issues.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message