Skip to content

Commit

Permalink
update ListManager.java
Browse files Browse the repository at this point in the history
  • Loading branch information
dotype committed Feb 12, 2020
1 parent 9071a0d commit a482a82
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 30 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</distributionManagement>

<properties>
<java.version>1.5</java.version>
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<bintray.repo>hopegiver/hellojsp</bintray.repo>
<bintray.package>hellojsp</bintray.package>
Expand Down Expand Up @@ -67,7 +67,7 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20151123</version>
<version>20190722</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/hellojsp/db/DataObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class DataObject {
public String dbType = "mysql";
public String fields = "*";
public String table = "";

public String orderby = null;
public String groupby = null;
public String join = "";
Expand Down
28 changes: 4 additions & 24 deletions src/main/java/hellojsp/db/ListManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public ListManager(HttpServletRequest request) {
setRequest(request);

}

public void setRequest(HttpServletRequest request) {
this.request = request;
}
Expand Down Expand Up @@ -75,12 +76,11 @@ public void setDebug(Writer out) {
this.debug = true;
this.out = out;
}

public void setDebug() {
this.out = null;
this.debug = true;
}
public void d(Writer out) { setDebug(out); }
public void d() { setDebug(); }

public void setPage(int pageNum) {
if(pageNum < 1) pageNum = 1;
Expand Down Expand Up @@ -155,7 +155,6 @@ public void addSearch(String field, String keyword, String oper, int type) {
else if(type == 4) keyword = "%" + keyword;
if(field.indexOf(',') == -1) {
if(!"".equals(field)) {
//addWhere(field + " " + oper.replace("%", "") + " '" + keyword + "'");
addWhere(field + " " + oper.replace("%", "") + " ?");
params.add(keyword);
}
Expand All @@ -165,7 +164,6 @@ public void addSearch(String field, String keyword, String oper, int type) {
for(int i=0; i<fields.length; i++) {
field = fields[i].trim();
if(!"".equals(field)) {
//v.add(fields[i].trim() + " " + oper.replace("%", "") + " '" + keyword + "'");
v.add(fields[i].trim() + " " + oper.replace("%", "") + " ?");
params.add(keyword);
}
Expand Down Expand Up @@ -224,9 +222,6 @@ public int getTotalNum() throws Exception {
}
return this.totalNum;
}
public String getTotalString() {
return "<span style=\"font-family:arial, dotum;font-weight:normal;\">Total : <font color=\"blue\">" + Hello.numberFormat(this.totalNum) + "</font> 嫄�</span>";
}

public void setListQuery(String query) {
this.listQuery = query;
Expand Down Expand Up @@ -271,8 +266,8 @@ public String getListQuery() {
}


public DataSet getRecordSet() throws Exception {

public DataSet getDataSet() throws Exception {
if(listMode == 1) totalNum = this.getTotalNum();
DB db = null;
DataSet rs = null;
try {
Expand Down Expand Up @@ -302,21 +297,6 @@ public DataSet getRecordSet() throws Exception {
return rs;
}

public DataSet getDataSet() throws Exception {
if(listMode == 1) totalNum = this.getTotalNum();
DataSet rs = getDataSet();
if(rs != null) {
for(int j=0; rs.next(); j++) {
if(listMode == 1) {
rs.put("__ord", totalNum - (pageNum - 1) * listNum - j);
rs.put("__asc", (pageNum - 1) * listNum + j + 1);
}
}
rs.first();
}
return rs;
}

public String getPaging(int linkType) throws Exception {

Pager pg = new Pager(request);
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/hellojsp/util/Form.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.fileupload.FileItem;
Expand All @@ -28,7 +27,7 @@ public class Form {
public String encoding = Config.getEncoding();

private static HashMap<String, String> options = new HashMap<String, String>();
private HttpServletRequest request;
private HttpServletRequest request = null;
private Writer out = null;
private boolean debug = false;
private String allowScript = null;
Expand Down Expand Up @@ -92,8 +91,7 @@ public void setRequest(HttpServletRequest req) {
DiskFileItemFactory factory = new DiskFileItemFactory();

// Configure a repository (to ensure a secure temp location is used)
ServletContext servletContext = req.getServletContext();
File repository = (File) servletContext.getAttribute("javax.servlet.context.tempdir");
File repository = (File) req.getSession().getServletContext().getAttribute("javax.servlet.context.tempdir");
factory.setRepository(repository);

// Create a new file upload handler
Expand Down

0 comments on commit a482a82

Please sign in to comment.