This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//数字取反 | |
java.util.Scanner input=new java.util.Scanner(System.in); | |
System.out.println("请输入要取反的数字:"); | |
int i=input.nextInt(); | |
do{ | |
int j=i%10; | |
System.out.print(j); | |
i=i/10; | |
if(i<10){ | |
System.out.print(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input=new java.util.Scanner(System.in); | |
random=new java.util.Random(); | |
//取随机数 | |
int num=random.nextInt(100); | |
System.out.println(num); | |
boolean flag=true; | |
int count=0; | |
while(flag){ | |
System.out.println("请输入你的数字:"); | |
int i=input.nextInt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int temp; | |
for(int i=0;i<num.length-1;i++){ | |
for(int j=0;j<num.length-i-1;j++){ | |
if(num[j]>num[j+1]){ | |
temp=num[j];//大的先拿出来 | |
num[j]=num[j+1];//小的往前移 | |
num[j+1]=temp;//大的往后移 | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome下运行编写的javascript代码时,在工具javascript控制台下有时会出现“Uncaught SyntaxError: Unexpected identifier ”的报错,经过我反复查看代码最后得出,原来是代码中缺少一个“,”(英文逗号)。 | |
后经在网上查阅,也有文章指出,如果该异常出现在define里多半是因为你在该行的上一行缺少了逗号。 | |
原来如此简单! | |
在js中出现下面的错误: | |
Uncaught SyntaxError: Unexpected identifier可能的原因是: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
一、三种设置虚拟目录的方式 | |
Tomcat设置 /conf/server.xml | |
• 修改端口号 | |
<Connector port="8080" protocol="HTTP/1.1" | |
connectionTimeout="20000" | |
redirectPort="8443" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var eventUtil={ | |
addHandler:function(element,type,handler){ | |
if(element.addEventListener){ | |
element.addEventListener(type,handler,false); | |
}else if(element.attachEvent){ | |
element.attachEvent("on"+type,handler); | |
}else{ | |
element["on"+type]=handler; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DBhelp<T>{ | |
final String DRIVER="com.mysql.jdbc.Driver"; | |
final String URL="jdbc:mysql://127.0.0.1:3306/bookSystem"; | |
final String USERNAME="root"; | |
final String PASSWORD="123"; | |
/** | |
* 获取数据库连接对象 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//jar:commons-dbcp-1.4 | |
//依赖的jar:commons-pool-1.5.6 | |
//第一种// | |
private static BasicDataSource bd=null; | |
static{ | |
bd = new BasicDataSource(); | |
bd.setDriverClassName(DIRVER); | |
bd.setUrl(URL); | |
bd.setUsername(NAME); | |
bd.setPassword(PASSWORD); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//jar:commons-email-1.2 | |
//1.5的javaee.jar下的mail文件删除,添加1.4的mail.jar | |
//1、commons-email发送普通文本邮件 | |
public static void sendSimpleEmail(String toEmailAddress,String subject,String msg){ | |
Email email = new SimpleEmail(); | |
email.setHostName("smtp.163.com");//发信件的邮件服务器 | |
email.setAuthentication("wdfx100", "**********");//设置身份验证:用户名和密码 | |
email.setCharset("UTF-8"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//commons.apache.org 下的一个组件 upload | |
//jar:commons-fileupload-1.2.2.jar,依赖jar:commons-io-1.4.jar | |
<form action="fileUpload" method="post" enctype="multipart/form-data"> | |
文件描述:<input type="text" name="filedesc"><br/> | |
<input type="file" name="myfile"><br/> | |
<input type="submit" value="提交"/> | |
</form> | |
if(ServletFileUpload.isMultipartContent(request)){//获取请求的方式改变 |
OlderNewer