Dwr Exception Handling

Source: Internet
Author: User

Dwr Exception Handling

Configuration exception converter:

Dwr. xml:

<! -- Exception Conversion --> <convert match = "java. lang. exception "converter =" exception "/> <convert match =" java. lang. stackTraceElement "converter =" bean "/>


UserService:

Package com. demo. service; import java. util. arrayList; import java. util. list; import com. demo. model. user; public class UserService {public static final String SUCCESS = "success"; public String add (User user) {System. out. println (user); return SUCCESS;} public String deleted (int userId) {throw new RuntimeException ("deletion error... ");} public String update (User user User) {System. out. println ("update:" + user); return SUCCESS;} public List <User> list () {List <User> users = new ArrayList <User> (); users. add (new User (1, "aa"); users. add (new User (2, "bb"); users. add (new User (3, "cc"); return users ;}}


Delete. jsp

<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %> <! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd"> 
 

Result:









I want to teach you a problem about SSH + dwr: dwr cannot report error after adding transaction processing in spring. I do not know why.

Dwr Configuration:
<Create creator = "spring" javascript = "quest" scope = "application">
<Param name = "beanName" value = "questService"/>
<Include method = "getTaskSql"/>
<Include method = "getTaskRows"/>
<Include method = "getTaskResult"/>

Line 19 character 2 error dwr engine undefined how to solve?

Is your dwr configured in web. xml similar to the following?
<Servlet>
<Servlet-name> dwr-invoker </servlet-name>
<Servlet-class> uk. ltd. getahead. dwr. 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>
<! -- Used to intercept localhost: 8080/dwr -->
<Url-pattern>/dwr/* </url-pattern>
</Servlet-mapping>
<Servlet>
<Servlet-name> dwr-invoker </servlet-name>
<Servlet-class> uk. ltd. getahead. dwr. 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>
<! -- Used to intercept localhost: 8080/dwr -->
<Url-pattern>/dwr/* </url-pattern>
</Servlet-mapping>

Then there is no dwr. xml configuration file under the WEB-INF directory
<? Xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE dwr PUBLIC
"-// GetA... the remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.