Common problems when running java web & custom data binding

A: a common problem when running java web

错误1.This element neither has attached source nor attached Javadoc and hence no Javadoc

Cause of the problem: import lacks the required jar package

Solution: mouse on import Click the above question, there will jar package which directory the absence of import can be provided according to the path.

 

错误2.java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet

Error reason: jar package conflicts

Solution: Remove the conflicting Jar package (I have here is a tomcat jar package conflicts, and to remove one, the problem is solved)

3. Run the Web project error error appears as shown in Figure

Cause: wrong address

Solution:

 

II: Custom Data Binding

      In general, use basic data types and POJO type of the parameter data has been able to meet demand, but some special types of parameters can not be directly converted in the background, but there are special data types can not be direct data binding, it must first go through the data conversion, for example, the date data.

       For special data types mentioned above, the developer would need to custom converter (Converter) or a format (the Formatter) for data binding.

1.spring Converter provides a framework for converting one type of object to another object type.

2. Custom Converter class needs to implement org.springframework.core.convert.converter.Converter interface.

3.Formatter same role Converter, but Formatter original type must be a String type, and Converter can be of any type.

4. Formatter custom converter org.springframework.format.Formatter class needs to implement the interface.

发布了376 篇原创文章 · 获赞 172 · 访问量 9万+

Guess you like

Origin blog.csdn.net/Eider1998/article/details/104197322