java

Java:

----------------------------------------------------------------------------------------------

IDE:(Integrated Development Environment)集成开发环境

-----------------------------------------------------------------------------------------------

标识符的命名:

Java语言中,对于变量,常量,函数,语句块也有名字,我们统统称之为Java标识符.
标识符是用来给类、对象、方法、变量、接口和自定义数据类型命名的。
标识符的命名规则:
命名上可以看出一个程序员的好坏。
1.Java标识符由数字,字母和下划线(_),美元符号($)或人民币符号(¥)组成
2.Java中是区分大小写的,而且还要求首位不能是数字。最重要的是,Java关键字不能当作Java标识符。
3.类和接口名。每个字的首字母大写,含有大小写。例如,MyClass,HelloWorld,Time等。
4.方法名。首字符小写,其余的首字母大写,含大小写。尽量少用下划线。例如,myName,setTime等。这种命名方法叫做驼峰式命名。
5.常量名。基本数据类型的常量名使用全部大写字母,字与字之间用下划线分隔。对象常量可大小混写。例如,SIZE_NAME。
6.变量名。可大小写混写,首字符小写,字间分隔符用字的首字母大写。不用下划线,少用美元符号。给变量命名是尽量做到见名知义。
------------------------------------------------------------------------------------------------------------------------------------------------

服务器:硬件服务器,软件服务器(软硬构成一套体系);

Web服务器是运行及发布Web应用的容器,只有将开发的Web项目放置到该容器中,才能使网络中的所有用户通过浏览器进行访问。开发Java Web应用所采用的服务器主要是与JSP/Servlet兼容的Web服务器,比较常用的有Tomcat、Resin、JBoss、WebSphere 和 WebLogic 等,下面将分别进行介绍。

Tomcat 服务器

   目前最为流行的Tomcat服务器是Apache-Jarkarta开源项目中的一个子项目,是一个小型、轻量级的支持JSP和Servlet 技术的Web服务器,也是初学者学习开发JSP应用的

首选。

Resin 服务器

   Resin是Caucho公司的产品,是一个非常流行的支持Servlet和JSP的服务器,速度非常快。Resin本身包含了一个支持HTML的Web服务器,这使它不仅可以显示动态内容,

而且显示静态内容的能力也毫不逊色,因此许多网站都是使用Resin服务器构建。

JBoss服务器

   JBoss是一个种遵从JavaEE规范的、开放源代码的、纯Java的EJB服务器,对于J2EE有很好的支持。JBoss采用JML API实现软件模块的集成与管理,其核心服务又是提供EJB

服务器,不包含Servlet和JSP的Web容器,不过它可以和Tomcat完美结合。

WebSphere 服务器

   WebSphere是IBM公司的产品,可进一步细分为 WebSphere Performance Pack、Cache Manager 和WebSphere Application Server等系列,其中WebSphere Application

 Server 是基于Java 的应用环境,可以运行于 Sun Solaris、Windows NT 等多种操作系统平台,用于建立、部署和管理Internet和Intranet Web应用程序。


WebLogic 服务器

   WebLogic 是BEA公司的产品,可进一步细分为 WebLogic Server、WebLogic Enterprise 和 WebLogic Portal 等系列,其中 WebLogic Server 的功能特别强大。

WebLogic 支持企业级的、多层次的和完全分布式的Web应用,并且服务器的配置简单、界面友好。对于那些正在寻求能够提供Java平台所拥有的一切

应用服务器的用户来说,WebLogic是一个十分理想的选择。


默认端口号:

1、Tomcat   默认端口号8080
2、MySQL   默认端口号3306
3、SqlServer  默认端口号 1433
4、Http    默认端口号 80

常用服务和开放端口对照表

http://jingyan.baidu.com/article/03b2f78c498da25ea237aeb8.html

----------------------------------------------------------------------------------------------------------------------

MyEclipse:

在Java中,main()方法是Java应用程序的入口方法,也就是说,程序在运行的时候,第一个执行的方法就是main()方法,这个方法和其他

的方法有很大的不同,比如方法的名字必须是main,方法必须是public static void 类型的,方法必须接收一个字符串数组的参数等等。

具体详解在:http://lavasoft.blog.51cto.com/62575/53263

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
           
           
public class Test {
/**
* @param args
*/
public static void main ( String [] args ) {
/*************************/
int sumdigui = 0 ;
for ( int i = 1 ; i <= 15 ; i ++){
sumdigui = getSum ( i )+ sumdigui ;
}
System . out . println ( sumdigui );
/*for循环阶乘*/
int numfor = 1 ;
int sumfor = 0 ;
for ( int j = 1 ; j <= 15 ; j ++){
for ( int i = 1 ; i <= j ; i ++){
numfor *= i ;
}
sumfor += numfor ;
numfor = 1 ;
}
System . out . println ( sumfor );
getTable ();
getShop ();
/***************************************************/
}
public static int [] getNum ( String str ){ /*求位数*/
int count = str . length ();
int sun = Integer . parseInt ( str );
int nums [] = new int [ count ];
for ( int i = 0 ; i < count ; i ++){
int num = ( int )( sun / Math . pow ( 10 , i ))% 10 ;
nums [ i ]= num ;
}
return nums ;
}
public static int getSum ( int num ){ /*递归求阶乘*/
if ( num <= 1 ){
return 1 ;
} else {
return num * getSum ( num - 1 );
}
}
public static void getTable (){ /*9*9乘法表*/
for ( int i = 1 ; i <= 9 ; i ++){
for ( int j = 1 ; j <= i ; j ++){
System . out . print ( i * j < 10 ? j + " * " + i + " = " + i * j + "\t" : j + " * " + i + " = " + i * j + "\t" );
}
//System.out.print(i*j>10?j+" * "+i+" = "+i*j+"\t":j+" * "+i+" = "+i*j+"\t");
System . out . println ();
}
}
public static void getShop (){
for ( int i = 20 ; i >= 1 ; i --){
for ( int j = 1 ; j <= 20 ; j ++){
System . out . print ( j <= i / 2 ? " " : " * " );
}
System . out . println ();
}
}
}
 来自CODE的代码片
test.java
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
           
           
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script>
var password=0;
function showName(){ /*判断用户输入的名字是否为空*/
var name=document.getElementById("name").value;
//name=trim(name);
if(name==""){
document.getElementById("nameFont").innerHTML="<img src ='image/wrong.jpg' style='margin-top:0px;'/><div style='color:red;margin-top:-19px;font-size:10px;margin-left:30px;'>你输入的名字为空</div>";
}else{
document.getElementById("nameFont").innerHTML="<img src ='image/right.jpg'/>";
}
}
function showEmil(){ /*判断用户输入的EMIL是否为合格*/
var emil=document.getElementById("emil").value;
var rightEmli = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
var isright=rightEmli.test(emil);
//name=trim(name);
if(emil==""){
document.getElementById("emilFont").innerHTML="<img src ='image/wrong.jpg' style='margin-top:0px;'/><div style='color:red;margin-top:-19px;font-size:10px;margin-left:30px;'>你输入的邮箱为空</div>";
}else if(!isright){/*验证是否符合邮箱格式没有起作用*/
//alert(rightEmil.test(emil));
document.getElementById("emilFont").innerHTML="<img src ='image/wrong.jpg' style='margin-top:0px;'/><div style='color:red;margin-top:-19px;font-size:10px;margin-left:30px;'>你输入的邮箱格式有误</div>";
}else{
document.getElementById("emilFont").innerHTML="<img src ='image/right.jpg'/>";
}
}
function showPwd(){ /*判断用户输入的密码是否为空*/
var pwd=document.getElementById("pwd").value;
//name=trim(name);
if(pwd==""){
document.getElementById("pwdFont").innerHTML="<img src ='image/wrong.jpg' style='margin-top:0px;'/><div style='color:red;margin-top:-19px;font-size:10px;margin-left:30px;'>你输入的密码为空</div>";
}else{
document.getElementById("pwdFont").innerHTML="<img src ='image/right.jpg'/>";
password=pwd;
}
}
function showNextPwd(){ /*判断用户输入的密码是否和上次的一样||是否为空*/
var nextpwd=document.getElementById("nextpwd").value;
//name=trim(name);
if(nextpwd==""){
document.getElementById("nextpwdFont").innerHTML="<img src ='image/wrong.jpg' style='margin-top:0px;'/><div style='color:red;margin-top:-19px;font-size:10px;margin-left:30px;'>你输入的密码为空</div>";
}else if(password!=nextpwd){
document.getElementById("nextpwdFont").innerHTML="<img src ='image/wrong.jpg' style='margin-top:0px;'/><div style='color:red;margin-top:-19px;font-size:10px;margin-left:30px;'>你输入的密码不一致</div>";
}else{
document.getElementById("nextpwdFont").innerHTML="<img src ='image/right.jpg'/>";
}
}
</script>
</head>
<body>
<center>
<h1 style ="color:red;font-size:60px">用户注册</h1>
</center>
<hr></hr>
<from action="#" method="post">
<table cellpadding="5">
<tr>
<td><span>name:</span></td>
<td ><input style="width:200px" type="text" value="youe name" id="name" οnfοcus="showName()" οnblur="showName()"/></td>
<td id="nameFont"></td>
</tr>
<tr>
<td><span>emil:</span></td>
<td><input style="width:200px" type="text" value="@com" id="emil" οnfοcus="showEmil()" οnblur="showEmil()"/></td>
<td id="emilFont"></td>
<tr>
<td><span>pwd:</span></td>
<td><input style="width:200px" type="password" value="888" id="pwd" οnfοcus="showPwd()" οnblur="showPwd()"/></td>
<td id="pwdFont"></td>
</tr>
<tr>
<td><span>last:</span></td>
<td><input style="width:200px" type="password" value="777" id="nextpwd" οnfοcus="showNextPwd()" οnblur="showNextPwd()"/></td>
<td id="nextpwdFont"></td>
</tr>
<tr>
<td>
<input type="button" value="注册新用户" id ="button"/>
</td>
<td>
</td>
</tr>
</table>
<hr></hr>
</from>
</body>
</html>
 来自CODE的代码片
用户登录验证.txt

-----------------------------------------------------------------------------------------------------------------------

html: 

  • GET - 从指定的资源请求数据。
  • POST - 向指定的资源提交要被处理的数据

GET:
  • GET 请求可被缓存
  • GET 请求保留在浏览器历史记录中(数据会裸露在URL中)
  • GET 请求可被收藏为书签
  • GET 请求不应在处理敏感数据时使用
  • GET 请求有长度限制
  • GET 请求只应当用于取回数据

POST:
  • POST 请求不会被缓存
  • POST 请求不会保留在浏览器历史记录中
  • POST 不能被收藏为书签
  • POST 请求对数据长度没有要求(可以发大数据GET不可以)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值