jQuery模式窗体AJAX到Struts 1.3 Action [英] jQuery modal form AJAX to Struts 1.3 Action
问题描述
提出一个新问题,就像我建议的那样.
Making a new question, as was suggested to me.
我正在尝试使用AJAX将数据从jQuery UI模态形式发送到Struts ActionForm. URL看起来像这样(使用HTTP GET):
I'm trying to send data from a jQuery UI modal form to a Struts ActionForm using AJAX. The URL looks something like this (using HTTP GET):
localhost.../insertVenue.do?param1=param1¶m2=param2...
但是,当我尝试执行此操作时,找不到404./insertVenue.do,但未找到带有额外参数的URL.
However, when I try to to do this I get 404 not found. /insertVenue.do is found, but not the URL with the extra parametres.
希望任何人都可以阐明这个问题!
Hope anyone can shed some light on the issue!
这是我的struts-config.xml的样子(针对特定操作):
This is what my struts-config.xml looks like (for the specific action):
<action path="/registered/insertVenue" type="actions.InsertVenueAction" name="venueFormInsert"></action>
谢谢! :)
推荐答案
您必须定义一个Form Bean才能在struts-config.xml中携带参数的值.在上面的示例中,您提到了"venueFormInsert".您会想要这样的东西...
You must define a Form Bean to carry the values of your parameters in your struts-config.xml. In your example above you have mentioned "venueFormInsert". You'll want something like this...
<form-beans>
<form-bean name="venueFormInsert" type="forms.venueFormInsert" />
</form-beans>
然后定义此Java Bean以匹配您的预期参数
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;
}
}
除此之外,您还没有说明实际使用的URL.它必须包含上下文根以及您在struts-config.xml中上面列出的路径".因此,如果您的应用的上下文根在部署时被称为"myapp",则类似这样……
Other than that you havent stated what the actual URL you are using. It must have the context root included and the "path" you listed above from your struts-config.xml. So something like this if your appication's context root is called "myapp" when deployed...
http://server.acme.com/myapp/registered/insertVenue.do?id=5
然后,该场地表单插入Bean将自动传递给您的动作处理程序InsertVenueAction.execute(),并使用传入的URL参数进行填充
This venueFormInsert bean will then be passed automatically to your action handler InsertVenueAction.execute() and be populated with the URL parameters passed in
这篇关于jQuery模式窗体AJAX到Struts 1.3 Action的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!