From 693984fbbdc0cc150320fbde3065c5f7b9312317 Mon Sep 17 00:00:00 2001 From: koda Date: Sun, 22 Jul 2018 11:22:41 +0900 Subject: [PATCH] Fixed bug that search condition removed when page switching --- .../control/KnowledgeControlBase.java | 34 ++++++++++--------- .../WEB-INF/views/open/knowledge/list.jsp | 8 ++--- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/support/project/knowledge/control/KnowledgeControlBase.java b/src/main/java/org/support/project/knowledge/control/KnowledgeControlBase.java index 4be90a0df..123f3eb69 100644 --- a/src/main/java/org/support/project/knowledge/control/KnowledgeControlBase.java +++ b/src/main/java/org/support/project/knowledge/control/KnowledgeControlBase.java @@ -31,21 +31,21 @@ public class KnowledgeControlBase extends Control { private static final String MARKDOWN_SAMPLE = "/org/support/project/knowledge/markdown/sample_markdown.md"; protected String setViewParam() { - List paramsArray = new ArrayList<>(); - paramsArray.add(new LabelValue("offset", getParamWithDefault("offset", ""))); - paramsArray.add(new LabelValue("keyword", getParamWithDefault("keyword", ""))); - paramsArray.add(new LabelValue("tag", getParamWithDefault("tag", ""))); - paramsArray.add(new LabelValue("tagNames", getParamWithDefault("tagNames", ""))); - paramsArray.add(new LabelValue("group", getParamWithDefault("group", ""))); - paramsArray.add(new LabelValue("groupNames", getParamWithDefault("groupNames", ""))); - paramsArray.add(new LabelValue("user", getParamWithDefault("user", ""))); - paramsArray.add(new LabelValue("creators", getParamWithDefault("creators", ""))); - String[] templates = getParam("template", String[].class); - if (templates != null) { - for (String template : templates) { - paramsArray.add(new LabelValue("template", template)); - } + List paramsArray = new ArrayList<>(); + paramsArray.add(new LabelValue("offset", getParamWithDefault("offset", ""))); + paramsArray.add(new LabelValue("keyword", getParamWithDefault("keyword", ""))); + paramsArray.add(new LabelValue("tag", getParamWithDefault("tag", ""))); + paramsArray.add(new LabelValue("tagNames", getParamWithDefault("tagNames", ""))); + paramsArray.add(new LabelValue("group", getParamWithDefault("group", ""))); + paramsArray.add(new LabelValue("groupNames", getParamWithDefault("groupNames", ""))); + paramsArray.add(new LabelValue("user", getParamWithDefault("user", ""))); + paramsArray.add(new LabelValue("creators", getParamWithDefault("creators", ""))); + String[] templates = getParam("template", String[].class); + if (templates != null) { + for (String template : templates) { + paramsArray.add(new LabelValue("template", template)); } + } StringBuilder params = new StringBuilder(); boolean append = false; for (LabelValue labelValue : paramsArray) { @@ -56,10 +56,12 @@ protected String setViewParam() { } else { params.append('&'); } - params.append(labelValue.getLabel()).append("=").append(labelValue.getValue()); + params.append(HtmlUtils.escapeHTML(labelValue.getLabel())) + .append("=") + .append(HtmlUtils.escapeHTML(labelValue.getValue())); } } - setAttribute("params", HtmlUtils.escapeHTML(params.toString())); + setAttribute("params", params.toString()); return params.toString(); } diff --git a/src/main/webapp/WEB-INF/views/open/knowledge/list.jsp b/src/main/webapp/WEB-INF/views/open/knowledge/list.jsp index 52144847b..3a9ddb446 100644 --- a/src/main/webapp/WEB-INF/views/open/knowledge/list.jsp +++ b/src/main/webapp/WEB-INF/views/open/knowledge/list.jsp @@ -229,12 +229,12 @@