使用struts dojo ajax源码案例

我这里使用的jar 包struts2-dojo-plugin-2.2.1.1.jar

===========jsp=======================

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<sx:head />
</head>

<body>

<form method="post" style="margin: 0px;padding:0px;">

<input type="text" name="key" value="我是参数" />

<sx:a targets="middle_content" showLoadingText="true" loadingText="请稍等......"  href="index!SearchInfo?option2=all">
<input type="button" value="提交"/>
</sx:a>

</form>

<sx:div id="middle_content" showLoadingText="true" loadingText="请稍等......" executeScripts="true" >
</sx:div>

</body>
</html>

================action==================

//站内搜索
public String SearchInfo(){
try {
tempsimpleList.clear();
 request.getParameter("key");
return "searchInfo";
}

================struts.xml=======================

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<!--大文件上传过滤,否则上传不了大文件 -->
<constant name="struts.multipart.maxSize" value="4096000000"></constant>
<package name="lhwebsite" extends="struts-default">
<global-results><result name="input">/error.jsp</result></global-results>
<result name="searchInfo">search.jsp</result>
</action>

</package>
</struts>

上一篇:关于Struts与Ajax整合时的异常处理


下一篇:AjaxAnywhere+struts用法