<%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %>
<sql:query var="rs" dataSource="jdbc/ORACLE">
SELECT
to_char(r.TIME_STAMP, 'dd.mm.yyyy hh24:mi:ss') AS TIME_STAMP,
r.NAME AS COUNTER,
r.VALUE
FROM
profile_new r
WHERE
TIME_STAMP > to_date('25.07.2016 02:30:00', 'dd.mm.yyyy hh24:mi:ss')
and TIME_STAMP < to_date('25.07.2016 02:35:00', 'dd.mm.yyyy hh24:mi:ss')
order by time_stamp
</sql:query>
<c:set var="json_text" scope="application">
<json:array name="rows" prettyPrint="false">
<c:forEach var="row" items="${rs.rows}">
<json:object>
<json:property name="TIME_STAMP" value="${row.TIME_STAMP}"/>
<json:property name="COUNTER" value="${row.COUNTER}"/>
<json:property name="VALUE" value="${row.VALUE}"/>
</json:object>
</c:forEach>
</json:array>
</c:set>
[{"TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "COUNT_ALL", "VALUE": 635 }, { "TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "QUALITY", "VALUE": 99.84 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "COUNT_ALL", "VALUE": 642 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "QUALITY", "VALUE": 99.84 }]
<script type="text/javascript">
var jsonObj = ${json_text};
var jsonResult = [];
jsonResult.push("Вывод JSON="+'<c:out value="${json_text}"/>');
jsonResult.push("количество строк json="+jsonObj.length);
result_json.innerHTML = jsonResult.join('<br>');
</script>
@WebServlet(
name = "AuthenticationFilter",
description = "Аутентификационный фильтр",
urlPatterns = "/AuthenticationFilter"
)
@WebFilter("*.jsp")
public class AuthenticationFilter implements Filter {
private ServletContext context;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
this.context = filterConfig.getServletContext();
this.context.log("AuthenticationFilter initialized");
}
@Override
public void destroy() {
//close any resources here
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
String uri = req.getRequestURI();
this.context.log("Requested Resource::" + uri);
HttpSession session = req.getSession(false);
Object user_o = req.getSession().getAttribute("username");
this.context.log("Фильтр аутентификации, пользователь::" + user_o);
if (user_o == null && !(uri.endsWith("index.jsp") || uri.endsWith("LoginUser"))) {
this.context.log("Неавторизованный запрос");
res.sendRedirect("index.jsp");
} else {
// pass the request along the filter chain
this.context.log("Авторизованный запрос, сессия:: " + session);
chain.doFilter(request, response);
}
}
}
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="text-center">Bootstrap Editable Table <span class="fa fa-edit pull-right bigicon"></span></h4>
</div>
<div class="panel-body text-center">
<div id="grid"></div>
</div>
</div>
</div>
<!-- you need to include the shieldui css and js assets in order for the grids to work -->
<link rel="stylesheet" type="text/css" href="http://www.prepbootstrap.com/Content/shieldui-lite/dist/css/light/all.min.css" />
<script type="text/javascript" src="http://www.prepbootstrap.com/Content/shieldui-lite/dist/js/shieldui-lite-all.min.js"></script>
<script type="text/javascript" src="http://www.prepbootstrap.com/Content/data/shortGridData.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#grid").shieldGrid({
dataSource: {
data: gridData,
schema: {
fields: {
id: { path: "id", type: Number },
age: { path: "age", type: Number },
name: { path: "name", type: String },
company: { path: "company", type: String },
month: { path: "month", type: Date },
isActive: { path: "isActive", type: Boolean },
email: { path: "email", type: String },
transport: { path: "transport", type: String }
}
}
},
sorting: {
multiple: true
},
rowHover: false,
columns: [
{ field: "name", title: "Person Name", width: "120px" },
{ field: "age", title: "Age", width: "80px" },
{ field: "company", title: "Company Name" },
{ field: "month", title: "Date of Birth", format: "{0:MM/dd/yyyy}", width: "120px" },
{ field: "isActive", title: "Active" },
{ field: "email", title: "Email Address", width: "250px" },
{ field: "transport", title: "Custom Editor", width: "120px" },
{
width: 150,
title: "Update/Delete Column",
buttons: [
{ commandName: "edit", caption: "Edit" },
{ commandName: "delete", caption: "Delete" }
]
}
],
editing: {
enabled: true,
mode: "popup",
confirmation: {
"delete": {
enabled: true,
template: function (item) {
return "Delete row with ID = " + item.id
}
}
}
}
});
});
</script>
<style type="text/css">
.sui-button-cell
{
text-align: center;
}
.sui-checkbox
{
font-size: 17px !important;
padding-bottom: 4px !important;
}
.deleteButton img
{
margin-right: 3px;
vertical-align: bottom;
}
.bigicon
{
color: #5CB85C;
font-size: 20px;
}
</style>