JQuery modal form AJAX to Struts 1.3 Action

Creating a new question, as I was asked.

I am trying to send data from a jQuery UI modal form to a Struts ActionForm using AJAX. The URL looks something like this (using an HTTP GET):

localhost.../insertVenue.do?param1=param1&param2=param2... 

However, when I try to do this, I do not get 404./insertVenue.do, but not a URL with additional parameters.

Hope anyone can shed some light on this question!

This is what my struts-config.xml looks like (for a specific action):

 <action path="/registered/insertVenue" type="actions.InsertVenueAction" name="venueFormInsert"></action> 

Thanks!:)

0
source share
2 answers

You must define a Bean form to transfer the values ​​of your parameters to your struts-config.xml. In the above example, you mentioned "eventFormInsert". You need something like this ...

 <form-beans> <form-bean name="venueFormInsert" type="forms.venueFormInsert" /> </form-beans> 

Then define this Java Bean to match your expected parameters.

 public class JmsMessageForm extends ActionForm { private String id; public String getId() { return id; } public void setId(String id) { this.id = id; } } 

In addition, you did not indicate which actual URL you are using. It should include the root context and the "path" above from your struts-config.xml. So, something like this if your root application context is called "myapp" when deployed ...

http://server.acme.com/myapp/registered/insertVenue.do?id=5

This place of the FormInsert Bean will then be automatically passed to your ActionVenueAction.execute () handler and will be populated with the URL parameters passed to

0
source

Your url is badly formatted.

 localhost.../insertVenue.do?param1=param1?param2=param2.. 

should be like

 localhost.../insertVenue.do?param1=param1&param2=param2.. 
0
source

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


All Articles