@WebServlet(description="jserv.sample example/tools.serv",
urlPatterns="/tools.serv")
public class Tools
extends io.odysz.semantic.jserv.ServPort<io.odysz.semantic.jserv.user.UserReq>
Sample serv (Port = user.serv) shows how user can extend basic serv API with help of semantic-transact SQL builder
function branch: a = "A" | "B" | "C";var conn = jconsts.conn; function saveTooleA() { var dat = {borrowId: 'borrow-001', items: []}; dat.items.push(['item001', 3]); // return 3 of tiem001 var usrReq = new jvue.UserReq(conn, "r_tools_borrows") // turn back tools - or any function branch tag handled by tools.serv .a("A") // or reaplace these 2 set() with data(dat) .set('borrowId', 'borrow-001') .set('items', [['item001', 3]]); var jmsg = ssClient // ssClient's current user action is handled by jeasy when loading menu .usrCmd('save') // return ssClient itself .userReq(conn, engports.tools, usrReq); // return the AnsonMsg<UserReq> object // You should get sqls at server side like this: // delete from r_tools_borrows where borrowId = 'borrow-001' // insert into detailsTbl (item001) values ('3.0') // update borrowTbl set total= where borrowId = 'borrow-001' ssClient.commit(jmsg, function(resp) { EasyMsger.ok(EasyMsger.m.saved); }, EasyMsger.error); }
Constructor and Description |
---|
Tools() |
Modifier and Type | Method and Description |
---|---|
protected void |
onGet(io.odysz.semantic.jprotocol.AnsonMsg<io.odysz.semantic.jserv.user.UserReq> req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
onPost(io.odysz.semantic.jprotocol.AnsonMsg<io.odysz.semantic.jserv.user.UserReq> jmsg,
javax.servlet.http.HttpServletResponse resp) |
doGet, doPost, err, ok, ok, ok, ok, ok, onGetAnsonException, write
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
protected void onGet(io.odysz.semantic.jprotocol.AnsonMsg<io.odysz.semantic.jserv.user.UserReq> req, javax.servlet.http.HttpServletResponse resp) throws IOException
onGet
in class io.odysz.semantic.jserv.ServPort<io.odysz.semantic.jserv.user.UserReq>
IOException
protected void onPost(io.odysz.semantic.jprotocol.AnsonMsg<io.odysz.semantic.jserv.user.UserReq> jmsg, javax.servlet.http.HttpServletResponse resp) throws IOException
onPost
in class io.odysz.semantic.jserv.ServPort<io.odysz.semantic.jserv.user.UserReq>
IOException
Copyright © 2023. All rights reserved.