struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yasser Zamani <yasserzam...@apache.org>
Subject RE: Migration Help for angular2
Date Sat, 25 May 2019 09:50:11 GMT


>-----Original Message-----
>From: Gopal, Siva Prakash (US - Mechanicsburg Delivery)
><sigopal@DELOITTE.com>
>Sent: Wednesday, May 22, 2019 10:51 AM
>To: Struts Users Mailing List <user@struts.apache.org>
>Subject: RE: Migration Help for angular2
>
>Our Current Application as below structure
>
>
>
>Config.xml
>
>
>
>                <action name="credentials" class="CredentialsAction"
>
>                                                method="loadForgotCredentials">
>
>                                                <param name="anonymous">true</param>
>
>                                                <result name="success">success.jsp</result>
-> jsp
>(tiles-def)
>
>                                                <result name="passreset"
>type="chain">resetSubmit</result> <!--chaining action-->
>
>                </action>
>
>
>
>                Action class
>
>
>
>                class CredentialsAction{
>
>                                private String username;
>
>                                private String pwd;
>
>
>
>                                public String loadForgotCredentials(){
>
>                                                if(true){
>
>                                                                return success;
>
>                                                }else{
>
>                                                                return passreset;
>
>                                                }
>
>                                }
>
>
>
>                }
>
>                Currently (http:\\localhost\Demo\credentials) it will render JSP or
>chaining to another action class.
>
>
>
>                What is best approach to change above structure to return as json
>response for API call. Since i need to use that api call in angular code.


Hi Siva,

Use Struts "JSON Plugin" [1] which has json result for actions [2]. Regarding chains, use
json result for last action in the chain e.g. for resetSubmit action in your example above.

Regards.

[1] https://struts.apache.org/plugins/json/
[2] https://struts.apache.org/plugins/json/#write-the-mapping-for-the-action


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