On Mon, Dec 14, 2009 at 09:31:02PM +0000, Milos Negovanovic wrote:
> Hi,
>
> I am trying to get JSON response from struts2 action.
>
>
> My struts.xml contains the fallowing:
>
> <struts>
> <package name="example" extends="json-default">
> <action name="testjson" class="tutorial.example.JSONAction">
> <result type="json" />
> </action>
> </package>
> </struts>
>
>
> Class JSONAction.java is empty at the moment:
>
>
> package tutorial.example;
>
>
> import com.opensymphony.xwork2.ActionSupport;
>
>
> public class JSONAction extends ActionSupport {
> public String execute() throws Exception {
> //setMessage(getText(MESSAGE));
> return SUCCESS;
> }
> }
>
>
> When I try to access JSON action under
> http://localhost:8080/tutorial/testjson URL I get the fallowing error
> page:
>
>
> Struts Problem Report
>
> Struts has detected an unhandled exception:
> # Messages: There is no Action mapped for namespace / and action name
> testjson.
>
>
> Any suggestions on how to make JSON action work?
>
Fixed. Solution was to add json plugin dependency in pom.xml.
Regards
--
Milos Negovanovic
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]