In the previous example, I learned how to use JPA and how to use Apache olingo to automatically convert a JPA database to a RESTful Web Service.
I learned how to use SAPUI5. Now I want to integrate them.
Development Environment:
The development environment is: Eclipse Juno, MySQL 5.5, olingo 1.2, EclipseLink 2.4, Tomcat 7, SAPUI5 1.18
Here, the data layer directly uses the jpa2 project completed in the previous exercise, which implements a RESTful Web Service for the background database table employee operation,
Url: http: // localhost: 8080/jpa2/Employee. svc/
1. Install the Eclipse SAPUI5 plug-in provided by SAP.
Https://tools.hana.ondemand.com
2. Create a SAPUI5 Web Project named sapui5
3. Because my service is local, you need to use proxy to access it. modify web. xml.
Add:
<servlet><servlet-name>SimpleProxyServlet</servlet-name><servlet-class>com.sap.ui5.proxy.SimpleProxyServlet</servlet-class></servlet><servlet-mapping><servlet-name>SimpleProxyServlet</servlet-name><url-pattern>/proxy/*</url-pattern></servlet-mapping><context-param><param-name>com.sap.ui5.proxy.REMOTE_LOCATION</param-name><param-value>http://localhost:8080</param-value></context-param>
4.modify the index.html file:
<!DOCTYPE HTML>
Here we will mainly create a table component, create an odata model, and then bind them to it.
5. Deploy the project on Tomcat and run:
6. conclusion: After the RESTful service is obtained, web and mobile development will be very convenient, while SAPUI5 will become more convenient, not only beautiful interface, it can also greatly improve the development efficiency.