您的位置:首页 > 编程语言

常用技术代码或问题快现-不断更新中

2016-12-16 10:22 483 查看
常用技术代码快现-不断更新中

1、struts2的actionSupport获取web.xml中的配置参数

第一步:web.xml设置

<context-param>
<param-name>getURL</param-name>
<param-value>https://www.baidu.com</param-value>
</context-param>


第二步:actionSupport 获取

ActionContext ctx = ActionContext.getContext();
String getURL=((ServletContext) ctx.get(ServletActionContext.SERVLET_CONTEXT)).getInitParameter("getURL");
System.out.println("getURL="+getURL);


总结,ActionSupport对HttpServlet进行了封装,可以取代之前的方法

getServletContext().getInitParameter("getURL");

其他获取文件以及解析的例子-通过spring读取配置文件、java类直接读取配置文件

http://blog.csdn.net/bestcxx/article/details/54564687#t9 8 和 9

java读取txt文件的内容,按行和列解析
http://blog.csdn.net/bestcxx/article/details/65446489

2、Linux 赋予 某用户对某文件夹的操作权限

第一步:使用root用户登陆,获取root权限

第二步:普通用户存在,比如普通用户为 admin

第三步:文件夹目录存在,比如为/home/usr/share/

第四步:执行下面的命令

$ chown -R admin:admin /home/usr/share

3、http协议获取Header中的文件名-split



String fileName=connection.getHeaderField("Content-Disposition").split("=")[1];

4、nas

NAS(Network Attached Storage:网络附属存储)按字面简单说就是连接在网络上,具备资料存储功能的装置,因此也称为“网络存储器”。它是一种专用数据存储服务器。它以数据为中心,将存储设备与服务器彻底分离,集中管理数据,从而释放带宽、提高性能、降低总拥有成本、保护投资。其成本远远低于使用服务器存储,而效率却远远高于后者。目前国际著名的NAS企业有Netapp、EMC、OUO等。

5、myecplise生成javaAPI文档

http://blog.sina.com.cn/s/blog_630d68f601014tj3.html

6、myecplise中设置注释格式

http://blog.csdn.net/hu_shengyang/article/details/8061685

7、StringUtils.isNotBlank("stringstr")

import org.apache.commons.lang3.StringUtils;

StringUtils.isNotBlank("stringstr");

8、Axis2调用服务org.apache.axis2.AxisFault: Service class stu.demo.service.Axis2TestImpl must have public as access Modifier

使用axis2对外发布服务的时候,一般的方法是需要发布实现类,而不是接口类。

9、eclipse转大小写快捷键

ctrl+shift+x 转为大写 ctrl+shift+y 转为小写

10、根据名字获取项目中文件的绝对路径

this.getClass().getResource("/888010047890002.p12").getPath();


11、CLOB、BLOB , CLOB与BLOB的区别

具体参照http://blog.csdn.net/magister_feng/article/details/7825892

12、Object… obj

具体参照 http://blog.sina.com.cn/s/blog_6d9ecdef0100nyxv.html

13、hibernate 注解 时间格式 2017-02-19 21:50:52

@Temporal(TemporalType.TIMESTAMP)

14、hibernate 配置文件 时间类型

映 射 类 型
Java类型
标准SQL类型
描    述
date
java.util.Date或者java.sql.Date
DATE
代表日期,形式为:

YYYY-MM-DD
time
java.util.Date或者java.sql.Time
TIME
代表时间,形式为:

HH:MM:SS
timestamp
java.util.Date或者java.sql.

Timestamp
TIMESTAMP
代表时间和日期, 形式为:

YYYYMMDDHHMMSS
calendar
java.util.Calendar
TIMESTAMP
同上
calendar_date
java.util.Calendar
DATE
代表日期,形式为:

YYYY-MM-DD

15、SVN提交报错

svn: E200007: CHECKOUT

这个解决办法就是使用cleanup命令,然后就可以提交了

项目右键->team->Cleanup

16、<c:if>没有else,使用<c:choose>

<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>


 c标签 的 jar包   
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>


<c:choose>
<c:when test="${data.num1==0}">
${data.num2}
</c:when>
<c:otherwise>
${data.num2-data.num1}
+${data.num1}
</c:otherwise>
</c:choose>

国际化

<!-- jstl标签 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core" %>


17、linux查看域名解析配置cat /etc/hosts

cat /etc/hosts

18、Eclipse启动时发生An internal error occurred during: "Initializing Java Tooling"

删除当前工作目录下的WORKSPACE_HOME/.metadata/.plugins/org.eclipse.core.resources/.project,然后重新启动Eclipse

19、Could not write metadata for '/RemoteSystemsTempFiles'.

Project Explorer view > Customize View... > Filters > Uncheck "RSE Internal Projects" > OK

然后在Project Explorer中找到RemoteSystemsTempFiles并删除。

见图例 http://jingyan.baidu.com/article/e4511cf32b14ea2b845eaf8a.html

20、js文件和css文件连接后面带的参数是什么意思

<link href="/css/css.css?v=20110526" media="screen" rel="Stylesheet" type"text/css" />

<script src="/js/js.js?v=20110526" type="text/javascript"></script>

问:上面链接外部的css或js文件名后跟了一个“?”,并带上一个参数,作用是什么呢?

答:js或css带参数,是为了避免旧的浏览器缓存继续生效;

特别是在大型站中随时可能会更改局部css文件,为了避免浏览器刷新而继续使用旧的CSS缓存文件,在使用时往往会带上一个动态参数。

21、Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

async : true, 就可以了。当然,这可能只是众多场景中的一种。

22、<c:forEach>和<select>标签的使用,list中是实体

<select id="opt_groupCode" name="groupCode">
<c:forEach var="Group" items="${List}">
<option value="${Group.GroupCode}" <c:if test="${Group.GroupCode == user.groupCode}"> selected</c:if>>
${Group.GroupCode}- ${Group.GroupName}
</option>
</c:forEach>
</select>


23、静态变量和静态类的继承与重写规律

测试抽行类、接口类、普通类中静态方法、静态变量、普通方法、普通变量的继承和覆盖的结果。结论在各类中有提现。

https://github.com/Bestcxy/SSH-ajax-axis2-maven-log4j-redis

com.bestcxx.mavenstu.mavenssh.test 包下

总结就是:静态方法是不可以被覆盖重写的,但是可以被继承。

普通方法可以被覆盖重写也可以不覆盖重写。抽象类的继承类必须覆盖重写抽象方法,可以选择是否覆盖重写抽象类中普通方法。

接口类的继承还是接口类,没有强制覆盖重写的要求。接口类的实现要求子类强制覆盖重写普通方法。

但是再次强调一下,静态方法不可以被覆盖重写。所以,接口类无静态方法,抽象类无抽象静态方法。

接口无构造方法。

静态变量和一般变量可以存在于接口类中。

有构造方法的类,其子类可以通过super(value..)的方式修改其父类中常量的初始值。

24、oracle与mysql 搜索为空赋默认值

oracel 函数声明:(http://blog.csdn.net/wxn877838604/article/details/42523209)

nvl(col,val)

说明:当col为空时取val作为返回值,当col不为空时取col值。

mysql函数声明:(http://jingyan.baidu.com/article/6b182309516bc5ba58e159f0.html)

ifnull(expr1,expr2)

 假如expr1不为NULL,则IFNULL()的返回值为expr1; 否则其返回值为expr2。IFNULL()的返回值是数字或是字符串,具体情况取决于其所使用的语境。

25、case when then+left join +3个表

t1表



t2表



t3表



SELECT * FROM t1 LEFT JOIN t2 ON t1.`id`=t2.tid LEFT JOIN t3 ON t1.id=t3.tid



SELECT t1.id, 

CASE t1.`name` 

WHEN 't1-id=1' THEN t2.`name` 

WHEN 't1-id=2' THEN t3.`name` 

END AS theName 

FROM t1 LEFT JOIN t2 ON t1.`id`=t2.tid LEFT JOIN t3 ON t1.id=t3.tid;



26、checkbox 的全勾选和全部取消勾选-不可勾选 disabled="disabled"

注意这里的逻辑,isChecked为true是勾选,false是不勾选

$(".chooseall").click(function(){
var isChecked = $(this).prop("checked");
$("input[name='checkbox1']").prop("checked", isChecked);
});


<input type="checkbox"  disabled="disabled"/>


27、svn合并代码标识意义

-- <<<<<<< .working  到====之间是本地的

--======是分割符号

>>>>>>> .merge-right.r 数字 ====到这个之间是线上的

28、sql表新增字段和注释-以及修改

ALTER TABLE user ADD COLUMN user.status VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '状态,0-正常,1-废弃';


修改

ALTER TABLE user MODIFY COLUMN user.status INT NOT NULL DEFAULT '0' COMMENT '测试,修改为int';


29、默认隐藏div


<div id="hide" style="display:none;"></div>


30、jstl fn:indexOf()函数

${fn:indexOf(record.serviceTypeId, "1")}


31、jstl组合用法-字符串截取判断-c:set

<c:set var="bannerflag" value='${fn:contains(record.serviceTypeId,"2")}'/><!-- 包含2,则为ture -->
<c:choose>
<c:when test="${bannerflag}">
<input type="checkbox" name="allLoanSalesPlatform"value="${record.numbering }" class="showBannerDiv" /> ${record.name }
</c:when>
<c:otherwise>
<input type="checkbox" name="allLoanSalesPlatform" value="${record.numbering }" class="hideBannerDiv"/> ${record.name }
</c:otherwise>
</c:choose>

32、LRU和LFU的区别

LFU (Least Frequently Used) 最近最少使用,以时间段内使用次数为排序依据,当存储空间不足,使用次数最少的将被淘汰,新加入的加到队尾。

LRU (Least Recently Used)最长时间未被使用,重点是是否使用,一旦被命中,则排序上升至最前端,如果没有被命中,则淘汰最久没有被使用的,即队尾的,新加入的将被排在队尾。

比如3个存储空间

依次进入的是:1,2,3,2,4,2,4,5

LFU实现:

1                   //1(1次)

21                //1(1次),2(1次)

321              //1(1次),2(1次),3(1次) 

312              //3(1次),1(1次),2(2次) 

412              //4(1次),1(1次),2(2次) 3被淘汰,4加入队尾

412              //4(1次),1(1次),2(3次)

142              //1(1次),4(2次),2(3次) 4的次数超过1的次数,但是比2的出现次数要少,排位上升一位

542               //5(1次),4(2次),2(3次) 1被淘汰,5加入队尾

LRU 实现:

依次进入的是:1,2,3,2,4,2,4,5

1                  

21

321

312       //2被命中,排序放到队首

412

412

124        //4被命中,排序放到队首

524        //1被淘汰,5被加到队尾

33、静态方法和静态变量继承覆盖规律

测试抽行类、接口类、普通类中静态方法、静态变量、普通方法、普通变量的继承和覆盖的结果。结论在各类中有提现。总结就是:静态方法是不可以被覆盖重写的,但是可以被继承。普通方法可以被覆盖重写也可以不覆盖重写。抽象类的继承类必须覆盖重写抽象方法,可以选择是否覆盖重写抽象类中普通方法。接口类的继承还是接口类,没有强制覆盖重写的要求。接口类的实现要求子类强制覆盖重写普通方法。但是再次强调一下,静态方法不可以被覆盖重写。所以,接口类无静态方法,抽象类无抽象静态方法。对于静态变量,如果父类提供了构造方法,子类可以重写父类的变量或者静态变量,但是接口类无构造方法,所以只有抽象类和普通类的静态变量或者变量可以被子类覆盖重写。

详细的验证代码请看 https://github.com/Bestcxy/SSH-ajax-axis2-maven-log4j-redis  下 src/test/java/ com.bestcxx.mavenstu.mavenssh.test 的测试类

静态变量如果是public的,那么这个类所有的实例共享一个静态变量。

34、@Before 和 @BeforeClass、@After 和 @AfterClass  的区别 

@Before、@After

在每个测试方法之前都会运行一次,只需声明成public,一个测试类中可以有多个方法被标注

@BeforeClass,@AfterClass

在类中只运行一次,必须声明成public static,一个测试类中只能有一个方法被标注

35、junit捕获预计异常算是通过

@AfterClass
public static void After(){
//测试结果已经无法获取,说明 Ehcache 已经被关闭了
try {
TestCase.assertEquals("true",singletonCache.get(1L).equals("This is a test for Ehcache"));
logger.info("\n "+singletonCache.get(1L));
} catch (IllegalStateException e) {
logger.info("\n 测试结果已经无法获取,说明 Ehcache 已经被关闭了");
TestCase.assertEquals("没有出现预计的异常则junit无法通过",e.getMessage(),"State is UNINITIALIZED");
}
}

异常信息

java.lang.IllegalStateException: State is UNINITIALIZED
at org.ehcache.core.StatusTransitioner.checkAvailable(StatusTransitioner.java:60)
at org.ehcache.core.Ehcache.get(Ehcache.java:165)
at com.bestcxx.mavenstu.mavenssh.ehcache.EhCacheStudyTest.After(EhCacheStudyTest.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)


36、一个全局遮照层的例子-底层、上层的显示和隐藏

·<div id="mask" style="display: none;"></div>
·$("#mask").attr("style","width: 100%;height: 100%;background-color: rgba(210,210,210,0.7);position: absolute;margin-top: -70;z-index: 999999");

·$("#rejectDiv").attr("style","background-color: white;position: absolute;z-index: 999999;width: 300px;height: 200px;border: 5px solid #E9EDF1;margin-left:"+($("body").width()/2-150)+";margin-top:"+($("body").height()/2-200));

·$("#rejectDiv").hide();
·$("#mask").hide();


37、eclipse 无法debug跟踪代码

1、将项目资源定位给eclipse,clean install 然后需要一段时间(试试重启eclipse,有时候后台会运行一些东西,前台未必有所感知,然后给你的感觉就是查不到)
http://www.educity.cn/wenda/469018.html
2、检查 jar 包依赖

<!-- apache 基础组件-debug跟踪代码 -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>

38、String、StringBuffer与StringBuilder之间区别

1.(String 类型赋值或者+,会重复创建对象)如果要操作少量的数据用 = String

2.(StringBuilder 线程不安全)单线程操作字符串缓冲区 下操作大量数据 = StringBuilder

3.(StringBuffer 线程安全)多线程操作字符串缓冲区 下操作大量数据 = StringBuffer

39、mysql 常用语句

http://www.111cn.net/database/mysql/60915.htm

ALTER TABLE 表名 ADD COLUMN 字段名 VARCHAR(20) DEFAULT NULL COMMENT '注释'

ALTER TABLE 表名 MODIFY  COLUMN 字段名 VARCHAR(20)COMMENT '注释'

40、switch 的参数类型String需要jdk1.7以上

  switch语句在jdk1.5之前可以使用byte、boolean、int、short、char,不能使用String;但是在Java程序中用String只能是1.7 版本以上

41、实体类json注解的使用技巧-忽略和限定格式

实体和json之间是可以自由转化的,有时候我们不需要某个字段在实体转json的时候出现,这个时候在这个字段的get方法上标注

@JsonIgnore 即可

如果这个字段是时间类型,而我们在实体转json的时候需要其自动以需要的格式显示,则在这个字段的get方法上增加标注

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 即可

42、hibernate 限定时间格式的字段

@Temporal(TemporalType.TIMESTAMP) 存库市时间格式为 yyyy-MM-dd HH:mm:ss

43、hibernate 限定整数和小数位数

@Column(name="PRICE",nullable=true,precision = 10, scale = 2)//整数位10,小数位2

44、insert的数据是已存的另一张表的数据

表主键自动生成

INSERT usermodel2 (usermodel2.`passWord`,usermodel2.`createDate`) SELECT usermodel.`passWord`,usermodel.`createDate` FROM usermodel WHERE usermodel.`userName`='658469'


45、insert增加条件

 INSERT 语句 增加条件,条件成立插入,否则不插入

46、Spring AOP中pointcut expression表达式解析 及匹配多个条件

http://www.cnblogs.com/qinyubin/p/4075466.html

表达式例子如下:

  任意公共方法的执行:

    execution(public * *(..))

  任何一个以“set”开始的方法的执行:

    execution(* set*(..))

  AccountService 接口的任意方法的执行:

    execution(* com.xyz.service.AccountService.*(..))

  定义在service包里的任意方法的执行:

    execution(* com.xyz.service.*.*(..))

  定义在service包和所有子包里的任意类的任意方法的执行:

    execution(* com.xyz.service..*.*(..))

  定义在pointcutexp包和所有子包里的JoinPointObjP2类的任意方法的执行:

    execution(* com.test.spring.aop.pointcutexp..JoinPointObjP2.*(..))")

47、junit 测试 Spring-可在junit控制回滚

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.bestcxx.mavenstu.mavenssh.model.TClass;
import com.bestcxx.mavenstu.mavenssh.service.TClassService;

48、maven中配置jetty 插件

1、在 pom 文件中增加

<build>
<!-- jar包名称 -->
<finalName>springmvc</finalName>

<plugins>
<!-- 编译jdk版本设置 1.6 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<uriEncoding>${project.build.sourceEncoding}</uriEncoding>
</configuration>
</plugin>

<!-- jetty插件 -->
<!-- 在settings.xml 文件中新增 <pluginGroup>org.mortbay.jetty</pluginGroup>
<pluginGroups>
<pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
<pluginGroup>org.mortbay.jetty</pluginGroup>
</pluginGroups>
-->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version>
<configuration>
<!-- 通过jetty访问项目时的项目名称 ${project.build.outputDirectory} 为war包名 -->
<webApp>
<contextPath>${project.build.outputDirectory}</contextPath>
</webApp>
<!-- jetty附属配置,未启用 -->
<!-- <webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml> -->
<!-- configuration.scanIntervalSeconds 配置表示新代码的扫描时间间隔(秒),值 <= 0 表示不扫描 -->
<scanIntervalSeconds>0</scanIntervalSeconds>
<!-- 端口设置 -->
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8085</port>
</connector>
</connectors>
</configuration>
</plugin>

</plugins>
</build>


2、在 maven 的 setting.xml 文件中增加

<!-- pluginGroups
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
|-->
<pluginGroups>
<!-- pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
<pluginGroup>org.mortbay.jetty</pluginGroup>
</pluginGroups>


49、commit之后rollback无效

commit之后rollback无效

50、多线程的测试只能在 main 方法中

多线程的测试只能在 main 方法中,junit 中是无效的

51、一个满足一般条件的注解式事务配置

每次请求,如果没有事务则新起一个事务,如果有则加入当前事务。不会出现脏度、幻读和不可重复读。超时设置可以防止事务超时锁死表

@Transactional(readOnly=false,isolation=Isolation.REPEATABLE_READ,propagation=Propagation.REQUIRED,rollbackFor=Exception.class,timeout=3)

52、http 协议的 DELETE 提交无效

在过滤器中添加 

headers.add(“Access-Control-Allow-Methods “,”GET,POST,OPTIONS,PUT,DELETE“);

53、java.util.zip.ZipException: invalid LOC header (bad signature)

Maven 本地 jar 包下载有问题,具体那个不好判断的话,就全部删掉重新下载

54、java.lang.OutOfMemoryError: GC overhead limit exceeded解决办法

一、异常如下:

Exception in thread "main" Java.lang.OutOfMemoryError: GC overhead limit exceeded

二、解释:

JDK6新增错误类型。当GC为释放很小空间占用大量时间时抛出。

一般是因为堆太小。导致异常的原因:没有足够的内存。

三、解决方案:

1、查看系统是否有使用大内存的代码或死循环。

2、可以添加JVM的启动参数来限制使用内存:-XX:-UseGCOverheadLimit

55、接口传递复杂参数-实体符合list

jar:jackson-core-2.8.7.jar

java部分,接口增加注解:@RequestBody 实体 ,实体需要提供get和set方法

jquery部分:

data: JSON.stringify(params),
dataType: "json",
contentType: "application/json",

56、eclipse 特定版本无法在IDE中设置字体大小

.metadata\.plugins\org.eclipse.core.runtime\.settings 目录下有org.eclipse.ui.workbench.prefs

打开,设置org.eclipse.jface.textfont=1|Courier New|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Courier New;可以修改12.0为你想要的数值,重启eclipse字体会变成相应的大小

57、异常处理:Exception,RuntimeException,Error

Exception及其子类修士的方法必须被捕获或者抛出

RuntimeException以及子类修饰的方法没有必要捕获或者输出,因为一旦出现就不可挽回了-除非你自定义的,那也是自定义的问题

Error以及其子类修饰的方法出现错误也是不可挽回的

package com.bestcxx.stu.test.common.exception;

/**
* Error及其子类 可以不捕获
* RuntimeException及其子类 可以不捕获
* Exception及其子类 必须捕获或者抛出异常
* @author Administrator
*
*/
public class ExceptionImpl implements ExceptionTest {

@Override
public void TestException() throws Exception {
// TODO Auto-generated method stub

}

@Override
public void TestError() throws Error {
// TODO Auto-generated method stub

}

@Override
public void TestRuntimeExceoption() throws RuntimeException {
// TODO Auto-generated method stub

}

public void testTestError() {
ExceptionImpl exceptionImpl=new ExceptionImpl();
exceptionImpl.TestError();
}
public void testTestRuntimeExceoption() {
ExceptionImpl exceptionImpl=new ExceptionImpl();
exceptionImpl.TestRuntimeExceoption();
}
public void testTestExceptionThrow() throws Exception{
ExceptionImpl exceptionImpl=new ExceptionImpl();
exceptionImpl.TestException();
}
public void testTestExceptionCatch(){
ExceptionImpl exceptionImpl=new ExceptionImpl();
try {
exceptionImpl.TestException();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}

58、jsp 页面报错 The superclass "javax.servlet.http.HttpServlet" was not found on the J

增加jar包依赖 

<!-- apache 基础组件 -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>


59、RPC 远程服务调用

RPC (Remote Procedure Call Protocol)远程过程调用协议

60、Caused by: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp;

数据库时间字段为0000-00-00 00:00:00非法。建议填写实际日期
传送门
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  杂技 常用 技术集合