How to use angled arrows with 1.x spacers

I am new to angularjs and client side, and add a new page to the old application that uses struts 1.3 as its structure. I would like to use angularjs for the front end.

I know how to return json from the action class by writing json in the front end and returning null for the forward action. However, I do not understand how I will populate the scope variables in the controller after get. If I use get in the controller and return Json, how does my actionform fit into all this? Is this useful at all? Can I receive and send for the same controller if I want to send new values โ€‹โ€‹to my action? And can I have variables like: $ scope.items = {} $ Scope.items.name = "" $ Scope.items.email = "" And then just send json.stringify (items) as my data in message if I cannot use the form in any way? Thank you for your time. So far I have not found much information using angular factors with racks 1.3.

Answer:. I will try as best as possible to answer what conclusion I came to, but my questions above were very vague, since I really did not know what I was talking about, and my position with the company I worked with ended, so I no longer I have access to this code. What I wanted to ask earlier was what I'm going to do with the action form that I usually use for struts actions, and how am I going to get data from the front of my action class at the time of publication? I found out that my usual form of action is useless for what I wanted to do, so I got rid of it and wrote a json object at the time of receipt, which will be changed on the front side and passed to another action when I make this message. This is done as regular mail for "anyAction.do", but I had to configure the data that I sent in the message and call it something. Then I took the modified json object using request.getParameter ("jsonObjName") and analyzed it for different LinkedHashMap objects for each object in the json object. I think you can use the JSONObject classes instead of LinkedHashMap for parsing if you use JavaEE, but I used SE, so I did not have access to those in this project. Here is a link to another page that I used for message configurations:

How to get data in Struts from AngularJS post

+6
source share
1 answer

On the java side, you can also use the Gson library, which allows you to parse a string in and out of json, but struts1 will usually not work well with angularjs if you delete the form on the java side, which makes no sense to keep racks1. And if there is no way to remove struts1, just save struts1 for existing functions and start using struts2 for new screens where the angular function is applied. This will be much simpler because the json message from angular will be automatically bound to the bean object, which must match the format and name of json properies.

+2
source

Source: https://habr.com/ru/post/981937/


All Articles