0 0

在structs2.1.6配置完成ajax,但显示ajax属性未定义警告10

承接问题http://www.iteye.com/problems/15246

第二个问题已解决,但第一个问题还是没有解决,即

在structs2.1.6配置完成ajax,但s:submit标签的"targets"属性出现“undefined attribute name”警告信息
问题补充:
即使“targets”也不行。
问题补充:
据说Struts2.1.11已经把Ajax的功能从核心框架里移走,放到插件里面。但从structs版本2.1.11 to 2.1.16该如何配置ajax呢?
问题补充:
加了<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> 后报错:cannot find the tag library descriptor for /structs-dojo-tags


问题补充:
这个问题暂时解决了,不过在jsp运行时IE出错:
Error: 'dojo' is undefined

JSP代码如下:
<s:url id="ajaxAction" value="random.action"/>
<sx:div id="div_2" theme="ajax" href="%{ajaxAction}" updateFreq="1000">ajax test</sx:div>


生成的html代码:
<div dojoType="struts:BindDiv" updateFreq="1000" id="div_2"
	href="random.action" showError="true">ajax test</div>


Action代码:
public class RandomAction implements Action
{
	private String data;

	public String getRdmStr()
	{

		String result = String.valueOf(Math.round(Math.random() * 10000));
		
		return data != null && !data.equals("") ? data + result : result;
	}

	public void setData(String data)
	{
		this.data = data;
	}
	public String getData()
	{
		 return this.data;
	}

	public String execute()
	{
		return SUCCESS;
	}
}



问题补充:
加了<sx:head />也还是报同样的错呀!不过,为了表示对lovewhzlq的尊重和感激。先把这个问题关了,开个新问题:

http://www.iteye.com/problems/15339

希望lovewhzlq继续指导,不胜感激!




2009年4月20日 16:53
  • 大小: 8.6 KB

6个答案 按时间排序 按投票排序

0 0

采纳的答案

加上<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

用<sx:submit targets="theForm"></sx:submit>

2009年4月21日 10:51
0 0

jsp页面加上
<html>
<sx:head />

2009年4月21日 12:47
0 0

同学,这已经不是一个问题了,

2009年4月21日 12:42
0 0

你把struts2-dojo-plugin-2.1.6.jar加入工程啊

2009年4月21日 11:50
0 0

我看了下structs2.1.6的struts-tags.tld文件,发现s:submit标签的"targets"属性已经不存在了,而structs2.0.11的版本还有这个属性呢

2009年4月20日 17:39
0 0

你太不小心了吧,
你好像配置为<s:submit target="theForm"></s:submit>
jsp报警提示:undefined attribute name(target)

少加了"s" ==>targets

2009年4月20日 16:59

相关推荐

Global site tag (gtag.js) - Google Analytics