Skip to content

Instantly share code, notes, and snippets.

@d3ep4k
Created October 1, 2019 04:42
Show Gist options
  • Save d3ep4k/60e31b726def8cf972ef75832b7f45c2 to your computer and use it in GitHub Desktop.
Save d3ep4k/60e31b726def8cf972ef75832b7f45c2 to your computer and use it in GitHub Desktop.
<jsp:directive.include file="../fragments/mason-init.jspf"/>
<m:resource>
<m:request method="GET">
<sql:query var="result" dataSource="${datasource}">
SELECT * FROM movie
</sql:query>
<c:set target="${output}" property="output" value="${result}"/>
</m:request>
<m:request method="GET" item="true">
<sql:query var="result" dataSource="${datasource}">
SELECT * from movie where id=?
<sql:param value="${mtgReq.id}"/>
</sql:query>
<c:set target="${output}" property="getReq2" value="${result}"/>
</m:request>
<m:request method='POST'>
<sql:update var="result" dataSource="${datasource}">
INSERT INTO movie (name,rating) values (?,?)
<sql:param value="${mtgReq.params['name']}"/>
<sql:param value="${mtgReq.params['rating']}"/>
</sql:update>
<c:set target="${output}" property="postResult" value="${result}"/>
</m:request>
<m:request method='PUT' item="true">
<sql:update var="result" dataSource="${datasource}">
UPDATE movie SET rating=? where id=?
<sql:param value="${mtgReq.params['rating']}"/>
<sql:param value="${mtgReq.id}"/>
</sql:update>
<c:set target="${output}" property="putResult" value="${result}"/>
</m:request>
<m:request method='DELETE' item="true">
<sql:update var="result" dataSource="${datasource}">
DELETE FROM movie WHERE id=?
<sql:param value="${mtgReq.id}"/>
</sql:update>
<c:set target="${output}" property="deleteResult" value="${result}"/>
</m:request>
</m:resource>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment