DWR问题 我找了三天

jack-ma 2008-05-29 08:35:14
spring_hibernate.xml 文件

<bean id="messageTypeDao"
class="cn.dareway.mbd.persistance.MessageTypeDaoImpl">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>




<bean id="messageTypeDaoProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref bean="messageTypeDao" />
</property>
<property name="transactionAttributes">
<props>
<prop key="create*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>



<bean id="messageTypeService"
class="cn.dareway.mbd.service.MessageTypeServiceImpl">
<property name="messageTypeDao">
<ref bean="messageTypeDaoProxy" />
</property>
</bean>



DWR.xml

<dwr>

<allow>
<create javascript="MessagesServiceImpl" creator="spring">
<param name="beanName" value="MessagesServiceImpl"></param>
<include method="findAll" />
<param name="location" value="spring_hibernate.xml"></param>
</create>
</allow>

</dwr>


jsp 页面


<script type='text/javascript' src='dwr/engine.js'></script>
<script type='text/javascript' src='dwr/util.js'></script>
<script type='text/javascript' src='dwr/interface/MessagesServiceImpl.js'></script>



<script>
window.onload = function() {
MessagesServiceImpl.findAll(populate);
};

function populate(list){
DWRUtil.removeAllOptions("messageTypeService");
DWRUtil.addOptions("messageTypeService", list);
}
</script>


web.xml 配置

<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>
uk.ltd.getahead.dwr.DWRServlet
<!-- org.directwebremoting.servlet.DwrServlet -->
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<!-- <init-param>
<param-name>classes</param-name>
<param-value>
com.test.dwr.User
</param-value>
</init-param> -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>

提示错误是 MessagesServiceImpl 未定义 service 没有错误执行过 没有异常
...全文
124 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
mihaisheng 2008-05-31
  • 打赏
  • 举报
回复
问题是你现在卡在哪了,看看log里的错误日至,以便我们对正下要
jack-ma 2008-05-30
  • 打赏
  • 举报
回复
我的spring 是1.2的
TomyGuan 2008-05-29
  • 打赏
  • 举报
回复
或者

这个是我在我们的项目中拿的,上面的是官网的。二个都试试
<!-- Servlet -->
<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>
<!--
<init-param>
<param-name>activeReverseAjaxEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>initApplicationScopeCreatorsAtStartup</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>maxWaitAfterWrite</param-name>
<param-value>500</param-value>
</init-param>
-->
</servlet>
TomyGuan 2008-05-29
  • 打赏
  • 举报
回复
试试

DWR 2.0.x - Spring 2.0.x - The DWR namespace handler

Spring 2.x includes a new feature named XML Namespace Handlers. This allows DWR when working with Spring MVC to remote Spring beans easily with a custom syntax. If you're not using the MVC module, you can still leverage the namespace by mapping an org.directwebremoting.spring.DwrSpringServlet in your web.xml.
<servlet>
<servlet-name>dwr</servlet-name>
<servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
jack-ma 2008-05-29
  • 打赏
  • 举报
回复
配置是在别的工程上 抄下来的 急啊~ 大家帮帮忙
jack-ma 2008-05-29
  • 打赏
  • 举报
回复
配置 没有问题 因为我在工程中 要用到 就是 dwr的不好使
TomyGuan 2008-05-29
  • 打赏
  • 举报
回复
Spring配置没问题吧。

<allow>
<create javascript="MessagesServiceImpl" creator="spring">
<param name="beanName" value="MessagesServiceImpl"> </param>
<include method="findAll" />
<param name="location" value="spring_hibernate.xml"> </param>
</create>
</allow>
Spring配置后直接用
<create creator="spring" javascript="MessagesServiceImpl">
<param name="beanName" value="MessagesServiceImpl"/>
</create>
试试
jack-ma 2008-05-29
  • 打赏
  • 举报
回复
dwr.xml <param name="beanName" value="MessagesServiceImpl"> </param> value 是 messageTypeService 这个我发错了
songfuqiang 2008-05-29
  • 打赏
  • 举报
回复
这个东西并不难啊,好象网上有下载整个工程的,你找找,找不到就找我.

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧