Skip to content

Commit a3eed06

Browse files
authored
Merge pull request #1055 from support-project/issue1052_fix_search_keyword
Fixed bug that search condition removed when page switching
2 parents 05adb30 + 693984f commit a3eed06

2 files changed

Lines changed: 22 additions & 20 deletions

File tree

src/main/java/org/support/project/knowledge/control/KnowledgeControlBase.java

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ public class KnowledgeControlBase extends Control {
3131
private static final String MARKDOWN_SAMPLE = "/org/support/project/knowledge/markdown/sample_markdown.md";
3232

3333
protected String setViewParam() {
34-
List<LabelValue> paramsArray = new ArrayList<>();
35-
paramsArray.add(new LabelValue("offset", getParamWithDefault("offset", "")));
36-
paramsArray.add(new LabelValue("keyword", getParamWithDefault("keyword", "")));
37-
paramsArray.add(new LabelValue("tag", getParamWithDefault("tag", "")));
38-
paramsArray.add(new LabelValue("tagNames", getParamWithDefault("tagNames", "")));
39-
paramsArray.add(new LabelValue("group", getParamWithDefault("group", "")));
40-
paramsArray.add(new LabelValue("groupNames", getParamWithDefault("groupNames", "")));
41-
paramsArray.add(new LabelValue("user", getParamWithDefault("user", "")));
42-
paramsArray.add(new LabelValue("creators", getParamWithDefault("creators", "")));
43-
String[] templates = getParam("template", String[].class);
44-
if (templates != null) {
45-
for (String template : templates) {
46-
paramsArray.add(new LabelValue("template", template));
47-
}
34+
List<LabelValue> paramsArray = new ArrayList<>();
35+
paramsArray.add(new LabelValue("offset", getParamWithDefault("offset", "")));
36+
paramsArray.add(new LabelValue("keyword", getParamWithDefault("keyword", "")));
37+
paramsArray.add(new LabelValue("tag", getParamWithDefault("tag", "")));
38+
paramsArray.add(new LabelValue("tagNames", getParamWithDefault("tagNames", "")));
39+
paramsArray.add(new LabelValue("group", getParamWithDefault("group", "")));
40+
paramsArray.add(new LabelValue("groupNames", getParamWithDefault("groupNames", "")));
41+
paramsArray.add(new LabelValue("user", getParamWithDefault("user", "")));
42+
paramsArray.add(new LabelValue("creators", getParamWithDefault("creators", "")));
43+
String[] templates = getParam("template", String[].class);
44+
if (templates != null) {
45+
for (String template : templates) {
46+
paramsArray.add(new LabelValue("template", template));
4847
}
48+
}
4949
StringBuilder params = new StringBuilder();
5050
boolean append = false;
5151
for (LabelValue labelValue : paramsArray) {
@@ -56,10 +56,12 @@ protected String setViewParam() {
5656
} else {
5757
params.append('&');
5858
}
59-
params.append(labelValue.getLabel()).append("=").append(labelValue.getValue());
59+
params.append(HtmlUtils.escapeHTML(labelValue.getLabel()))
60+
.append("=")
61+
.append(HtmlUtils.escapeHTML(labelValue.getValue()));
6062
}
6163
}
62-
setAttribute("params", HtmlUtils.escapeHTML(params.toString()));
64+
setAttribute("params", params.toString());
6365
return params.toString();
6466
}
6567

src/main/webapp/WEB-INF/views/open/knowledge/list.jsp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@
229229
<nav>
230230
<ul class="pager">
231231
<li class="previous"><a
232-
href="<%=request.getContextPath()%>/open.knowledge/list/<%=jspUtil.out("previous")%><%=jspUtil.out("params")%>"> <span
233-
aria-hidden="true">&larr;</span><%=jspUtil.label("label.previous")%>
232+
href="<%=request.getContextPath()%>/open.knowledge/list/<%=jspUtil.out("previous")%><%=jspUtil.out("params")%>">
233+
<span aria-hidden="true">&larr;</span><%=jspUtil.label("label.previous")%>
234234
</a></li>
235235
<li class="next"><a
236-
href="<%=request.getContextPath()%>/open.knowledge/list/<%=jspUtil.out("next")%><%=jspUtil.out("params")%>"> <%=jspUtil.label("label.next")%>
237-
<span aria-hidden="true">&rarr;</span>
236+
href="<%=request.getContextPath()%>/open.knowledge/list/<%=jspUtil.out("next")%><%=jspUtil.out("params")%>">
237+
<%=jspUtil.label("label.next")%> <span aria-hidden="true">&rarr;</span>
238238
</a></li>
239239
</ul>
240240
</nav>

0 commit comments

Comments
 (0)