现在的位置: 首页 > 综合 > 正文

Jee – response.sendRedirect 中文乱码; 在 eclipse 中删除 Connection Profile

2013年12月09日 ⁄ 综合 ⁄ 共 1238字 ⁄ 字号 评论关闭
response.sendRedirect 中文乱码
Scene:
response.sendRedirect("/failed.html?r=中文字符");
假设 failed.html 里面用 javascript 获取 r 的值 (页面编码为 utf-8)
function getR() {
    var url = window.location.href;
    return decodeURIComponent((url.slice(url.indexOf('?') + 3)));
}
那么 url 中的中文字符是无法被解析的。
Solution: 
response.sendRedirect("failed.html?r=" + java.net.URLEncoder.encode("中文字符", "utf-8");
Question:
javascript 中 encodeURI, encodeURIComponent, decodeURI, decodeURIComponent, escape, unescape 的区别
JDBC 连接 Null Pointer Exception
Scene:
在 Servlet 中控制 JavaBean 来完成某种业务逻辑。而在 JavaBean 中利用 JDBC 来连接数据库,但是在语句 connection 无法建立,原因是在语句 Class.forName( drivername ) 会抛出 ClassNotFoundException。
Solution:
由于你没有把 MySQL 的驱动包放在 ClassPath 或工程的 lib 下,或者放在服务器的 lib 下,JBoss 或者 Tomcat 等服务器找不到该驱动包引起空指针问题。
Jee - 2013.03.12 - _________杰 - G G I C C I

 

Reference:
在 eclipse 中创建 Connection Profile
Scene:
在 eclipse 中开发 SQL 的时候,比如建立一个 .sql 文件,在里面写了一些脚本。然后利用 JDBC 连接数据库服务器做相应测试的时候,首先需要添加 Driver Definitions(驱动定义),然后为 .sql 文件配置 Connection Profile(链接概要)。
Solution:
1. 添加 Driver Definitions: Windows -> Preferences -> DataManagement -> Connectivity -> DriverDefinitions
2. 配置 Connection Profile:  .sql 文件编辑页面的右键菜单 -> Set ConnectionInfo (Jee - 2013.03.12 - _________杰 - G G I C C I
 )
在 eclipse 中删除 Connection Profile
Scene:
在 eclipse 中已经创建的 Connection Profile 如果不再用了,怎么删除呢?
Jee - 2013.03.12 - _________杰 - G G I C C I

 

Solution:
Windows->Show View->Data Source Explorer
Jee - 2013.03.12 - _________杰 - G G I C C I

 

抱歉!评论已关闭.