详细解决方案
DWR与SSH调整
热度:155 发布时间:2012-10-30 16:13:36.0
首先把SSH整合完毕。
相关解决方案
<!-- 配置DWR --> <servlet> <servlet-name>dwr-invoker</servlet-name> <servlet-class> org.directwebremoting.servlet.DwrServlet </servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dwr-invoker</servlet-name> <url-pattern>/dwr/*</url-pattern> </servlet-mapping>?2.配置dwr.xml
<dwr> <allow> <create creator="spring" javascript="BookBiz"> <param name="beanName" value="bookBiz"/> <include method="findById"/> </create> <convert match="com.wepull.bookSys.dto.BookDto" converter="bean"></convert> <convert match="com.wepull.bookSys.dto.TypeDto" converter="bean"></convert> </allow> </dwr>整合完毕,前台代码
jQuery(function(){ jQuery("#tx1").blur(function(){ var id = jQuery(this).attr("value");; BookBiz.findById(id, function(book){ if(book==null){ jQuery("#sp1").text("没有该图书,可以添加"); return; } var id = book.id; var name = book.name; jQuery("#sp1").text("id为"+id+"的图书 : "+name+"已经存在"); }); }); });?