-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a method like this, namely the Restful WebService method to receive data sent in the form of JSON data from the Client. then how to change this method in Restful ZK using zest
i use library zcommons-el.jar zest-2.0.0.FL.20130205.jar
file zest.xml
<xel-method prefix="c" name="listSalesmanCol"
class="org.zkoss.zest.examples.rest.SalesmanRESTController"
signature="java.lang.String toMethodName(java.lang.String)"/>
<action path="/rest" method="${c:toMethodName(request.method)}"
class="org.zkoss.zest.examples.rest.SalesmanRESTController">
<result>/WEB-INF/rest/RESTfulView.jsp</result>
</action>
file SalesmanRESTController.java this method i want convert Rest using zest
@RequestMapping(value = "/salesman/listSalesmanCol", method = RequestMethod.POST, produces = "application/json")
public void postListSalesmanCol(@RequestBody String strJSONSalesmanCol)throws JsonParseException, JsonMappingException, IOException {
try {
Gson gson = new Gson();
Type type = new TypeToken<List<SalesmanColBean>>() {}.getType();
List<SalesmanColBean> salesmanColBeanList = gson.fromJson(strJSONSalesmanCol,type);
for (SalesmanColBean salesmanCol : salesmanColBeanList) {
System.out.println("salesman.custName() = " + salesmanCol.getCustName());
}
}catch(Exception e) {
e.printStackTrace();
}
}
thanks
You can tell the timestamp from its file name that ZEST is not actively maintained for a long time, so we don't suggest to use it.
If you can share some details of your requirements or intentions, we may be able to suggest an alternative.
Asked: 2021-09-21 16:16:43 +0800
Seen: 6 times
Last updated: Sep 22 '21