ALL

By 肖奈
2008-08-08
3767 read
<%@ page contentType="text/html; charset=gb2312" language="java"  %> 
<%@ page import="java.sql.*" %>
<%@ page import="java.text.ParsePosition" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<jsp:useBean id="result" class="cd.ConnetDB" scope="session"/>
<jsp:useBean id="dbCourse" class="opDB.ConnectDB" scope="page"></jsp:useBean>
》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》标题《》》》》》》》》》》》》》》》》》》》》》》
<script type="text/javascript">
  document.title="标题";
</script>


居中
<div style="width:80%; margin-left:auto; margin-right:auto;">


a标签弹窗提示》》》》》
<a style="color: #fff"  onclick="if (confirm('确定要退出吗?')) return true; else return false;"  href="../logout.jsp" target=_top>退出系统</a> 


段落原文显示
<pre></pre>
<style type="text/css">
pre{
white-space: pre-wrap;       
white-space: -moz-pre-wrap;  
white-space: -pre-wrap;      
white-space: -o-pre-wrap;    
word-wrap: break-word;       
}
</style>



获取系统信息》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

	<%
	String TomUserType = (String) session.getAttribute("TomUserType");
	if ("1".equals(TomUserType)) {
	float fFreeMemory=(float)Runtime.getRuntime().freeMemory();
	float fTotalMemory=(float)Runtime.getRuntime().totalMemory();
	float fUsedMemory = fTotalMemory - fFreeMemory;
	float fPercent=fFreeMemory/fTotalMemory*100;
	%>
	<h3>系统状态</h3>
	<ul class="ilist">
		<li>服务器名:<%= request.getServerName() %>(<%=request.getRemoteAddr()%>)</li>
		<li>
			内存消耗:<%=fUsedMemory/1024/1024%>M / <%=fTotalMemory/1024/1024%>M 
			<div style="width:200px; height:10px; background:#f00; font-size:1px">
				<div style="float:right; background:#0f0; width:<%=(int)(fPercent*2)%>px; font-size:1px; height:10px"></div>
			</div>
		</li>
		<li>操作系统:<%=System.getProperty("os.name") %></li>
		<li>JDK版本:<%=System.getProperty("java.version") %></li>
	</ul>
	<%}%>








网页》》》》》图标
<link rel="shortcut icon" href="favicon.ico" />
》》》》》》》》》QQQQQQQQQQQQQQQQQQ
tencent://message/?uin=1104018628
mqqwpa://im/chat?chat_type=wpa&uin=1104018628&version=1



》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》输出返回页面 》》》》》》》》》》》》》》》》》》》》》》》》》》{
				response.sendRedirect("main.html");
			}



圆形图片
<input type="image" src="images/clear.jpg" style="border-radius:25px;" width="50">

a href 》》》》》》》》》》》》》》》
_blank浏览器总在一个新打开
_self默认目标
_parent父窗口
_top清除框架

<script type="text/javascript">
var mobileUrl="http://m.heanny.top",
mobile = (/mmp|symbian|smartphone|midp|wap|phone|xoom|iphone|ipad|ipod|android|blackberry|mini|windowssce|palm/i.test(navigator.userAgent.toLowerCase()));
if (mobile) {
window.location = mobileUrl;
}
</script>
<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]-->
<!--[if IE]> 所有的IE可识别 <![endif]-->
<!--[if IE 6]> 仅IE6可识别 <![endif]-->
<!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->
<!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
<!--[if IE 7]> 仅IE7可识别 <![endif]-->
<!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->
<!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]-->
<!--[if IE 8]> 仅IE8可识别 <![endif]-->
<!--[if IE 9]> 仅IE9可识别 <![endif]-->


跳转 》》》》》》》》》》》》》》》》》》》》》》》》》》
<% response.sendRedirect("index.html"); %>



》》》》》》》》》》》》》》》String 转换
int inttype = Integer.parseInt(type);	
String no=String.valueOf(aa); 

<style type="text/css">
.ddwe {
	font-family: Tahoma, Geneva, sans-serif;
}
</style>
》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》隐藏》》》》》》》》》》》》》》》》》》
<input type = "hidden" >

》》》》》》表格">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>》》》》》》》》》》》》》》》
<table width="200" border="1">
  <tr>
    <td height="53" rowspan="2"竖排 colspan="4"横排>&nbsp;</td>//表格1/2/1
 
  
  <jsp:useBean id="result" class="cd.ConnetDB" scope="page"/>//java获取sql内容
  <%
  ResultSet rs = result.connetSQL(strQuery);
  %>
  
  
 <table background="images/backImage.jpg"border="0" style= "border-collapse:collapse" bordercolor=rgb(2, 50, 112) width="690", height="540">
<tr><td height="80" align="center" valign="top">


》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》获取当前时间0000-00-00 00:00:00:.0》》》
<%
String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
%>

》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》获取当前时间》》》》》》》》》》》
Date dNow = new Date(); 
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
String time = sdf.format(dNow); 



text不能修改》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
<input readOnly="true" />



a href下划线》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
<style type="text/css">
a:link,a:visited{
 text-decoration:none;  /*超链接无下划线*/
}
a:hover{
 text-decoration:underline;  /*鼠标放上去有下划线*/
}
</style>
》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
响应式布局,里面基本不能出现px,宽度改为100%,px替换为rem


<%输出弹窗,返回页面》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》 
out.println("<script>alert('注册失败!');location.href='zhuce.html';</script>");
%>

判断相同》》》
if(no.13:51 2017/4/21(nno))

背景图片》》》
background="images/backImage.jpg"


SQL数据库统计人数》》》
select count(*) from user where age between 20 and 25


》》》》》》》》》》》》》》》》》》》》》》》》头像》》》
String imagePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
	输出》》》
out.print("<img src="+imagePath+"upload/images/"+imgurl+">");

服务器信息》》》
<%= application.getServerInfo() %>

》》》》》》》》》》》》》》》》》》头像输出》》》
<%String imagePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
            String stre="select imgurl from img where user='"+userName+"'";
			dbCourse.connect("yyxt");
			ResultSet rrs = result.connetSQL(stre);
			if(rrs.next()){%>
<input type=image src="<%=imagePath%>upload/images/<%=rrs.getString(1)%>" width="100" height="100">




<%@ page language="java" contentType="text/html; charset=GBK"%>
<%@ page import="java.sql.*"%> 
<jsp:useBean id="result" class="cd.ConnetDB" scope="page"/>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
    
    <title>My JSP 'jsp.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">
	

  </head>
  
  <body>
    <%
	String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 
	String userName =(String)session.getAttribute("userName");
	out.println("username="+userName+"<br>");
	String str = "select uName from user where username='"+userName+"'";
	//out.print("str="+str+"<br>");
	ResultSet rs = result.connetSQL(str);
	//out.print("rs="+rs+"<br>");
	while(rs.next()) {
	String m=rs.getString(1);
	//out.println("m="+m+"<br>");
	String n ="select title from teacher where tName='"+m+"'";
	ResultSet l = result.connetSQL(n);
	//out.println("l="+l+"<br>");
	//out.print("l.next=");
	while(l.next()) {out.print(l.getString(1));}}
	//通过登录名查找用户名,在查找域名户名相关信息
	%>
	

               
  </body>
</html>



<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.util.*,java.text.*" errorPage="" %>
<%@ page import="java.util.Date" %>
<html>
  <body onload="disptime();">
  <FORM NAME="myform">
   <DIV align="center">

    <SCRIPT language="JavaScript"> 
     <!-- 
     
     function disptime( ) 
     { 
     
     var time = new Date( ); //获得当前时间
     var year = time.getYear( );//获得年、月、日
     var month = time.getMonth( );
     var day = time.getDay( ); 
     var hour = time.getHours( ); //获得小时、分钟、秒 
     var minute = time.getMinutes( ); 
     var second = time.getSeconds( ); 
     var apm="AM"; //默认显示上午: AM 
     
     if (hour>12) //按12小时制显示 
     { 
      hour=hour-12; 
      apm="PM" ; 
     } 
     if (minute < 10) //如果分钟只有1位,补0显示 
      minute="0"+minute; 
     if (second < 10) //如果秒数只有1位,补0显示 
      second="0"+second; 
     /*设置文本框的内容为当前时间*/ 
     document.myform.myclock.value =year+"年"+month+"月"+day+"日   "+hour+":"+minute+":"+second+" "+apm; 
     /*设置定时器每隔1秒(1000毫秒),调用函数disptime()执行,刷新时钟显示*/ 
     var myTime = setTimeout("disptime()",1000); 
     
    } 
     
     //--> 
    </SCRIPT>
    动态显示时间<INPUT name="myclock" type="text" value="" size="25">
   
 <br>
 静态显示时间 <%=new java.util.Date()%><br>
 <%
java.util.Date now=new java.util.Date();
out.println(now);
%>
<br>
<%
 String Nowtime=new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
 out.print(Nowtime);%>
 
收藏》设为首页》 头》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
   <table border="0" width="960" height="100" align="right" valign="top"cellspacing="5" cellpadding="5" background="images/1.png">
            <tr>
   <td style="width: 36px; " valign="top"><a href="/yyxt">主页  </td>  
    <td style="width: 70px; " valign="top"><a href=""><a onclick="this.style.behavior='url(#default#homepage)';this.setHomepage('http://meng:8080/yyxt/bbs/index.jsp')" href="http://meng:8080/yyxt/bbs/index.jsp">设为首页</a>  </td> 
                        <td style="width: 70px; " valign="top"> <a href="#" onclick="JavaScript:window.external.addFavorite('http://meng:8080/yyxt/bbs/index.jsp','心理在线')" title="收藏本站到收藏夹">收藏本站</a></td>
 
            </tr>            
        </table>

 
 
 div 加滚动条的方法:》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

<div style="position:absolute; height:400px; overflow:auto"></div>
div 设置滚动条显示:overflow :yes
div 设置滚动条自适应显示:overflow :auto
div 设置上下滚动条显示:overflow-y :yes
div 设置上下滚动条自适应显示:overflow-y :auto
如果该div被包含在其他对象例如td中,则位置可设为相对:position:relative
 
 
 
》》》》》》》》》》》》》》》》》》》》》》》》 html包含jsp》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
 <iframe src="news/news.jsp" frameBorder="0" width="900" scrolling="no" height="500"></iframe>
 jsp包含html》》》
 <jsp:include page="index.html"/>

   <%@ include file="top.jsp"%>   
页面包含》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
<iframe name="nfrm" src="about:blank"></iframe>
<a href="http://www.baidu.com" target="nfrm">在框架中显示百度</a> 

<iframe name="nfrm" id="nfrm" src="about:blank"></iframe>
<a onmouseover="javascript:document.getElementById('nfrm').src='http://www.baidu.com'" target="nfrm">鼠标移过时显示百度</a>


   
   
   
   
   
   
   
   String name = new String(((request.getParameter("name")).trim()).getBytes("ISO-8859-1"));
	
   
   
   
   
   
   
 
 
 簡單點﹕<a href="a.htm" style="text-decoration : none ">asd</a>
 
 
<input placeholder="账号">
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>select选中提交
  <script>   
       function submitForm1(){
//获取form表单对象   提交
    var form = document.getElementById("form1");
    form.submit();//form表单提交
}
</script>
<form action="b1.jsp" method="post" accept-charset="gbk" name="form1" id="form1">     form表单
    <select name="class" onChange="submitForm1()"> 








input value  传递参数》》》》》》》》》》》
<input type="button" value="检测ISBN是否存在" class="button" id="button" onClick="aa()">
				     <script>
						var str;
						function aa(){
						str=document.getElementById("isbn").value;//把文本框值赋值给变量str
						if(str=="")
						alert("ISBN为空");
						else
						location.href='jc.jsp?isbn='+str;
						//alert(str);
						}
						</script>

















Action动态方法的调用》》

  在实际的项目中,一个action类的中,可能存在多个方法,而不同的方法执行的效果是不一样的,如果按照了一般性的配置,将无形的增加了程序员的负担

第一种方法:   在struts.xml中的action属性标签中用method属性指定方法名(不怎么推荐使用)

第二种方法: jsp页面中指定你要调用的那个方法

表格                       <form action=”login!myfun.action”,method=”post” accept-charset="utf-8" >

                        在客户端请求中进行动态的配置:映射名!方法名.action

这样可以动态的调用action中的myfun方法,就不要在action标签中进行method的配置

第三种方法:使用通配符进行配置(推荐使用:适用情况当一个类中存在较多的响应方法)
<action name="*user" class="com.zzjmay.action.UserAction" method="{1}">
//这种通配是针对的是同一个action中,响应不同的方法

在jsp页面中调用的时候
<form action="loginuser.action" method="post">
	<!-- 需要注意的是要保证表单中的name的命名要和Action中属性的命名保持一致 -->
		用户名:<input type="text" name="username" id="username"><br>
		密	 码:<input type="password" name="password" id="password">
		<br>
		<input type="submit" value="提交">
		
	</form>



虚拟机tp兼容性问题:》》
monitor_control.restrict_backdoor = "true"
》》》》》》》》》》》iframe 大小自适应》》》》》》》》》》》》》》》》》》》》》》》》》》
<script type="text/javascript">
function reinitIframe()
{
var iframe = document.getElementById("myframe");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);
</script>


》》》》》》》》》》》》》》》》》》》》》》》》》》》隐藏input》》》》》》》》》》》》》》》》》》》》》》》》
<input type="text" name="" value="" style="display:none">
<input type = "hidden" class="" id="" name="" value="">



》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》连接赋值

  <script>
						var str;
						function aa(){
						str=document.getElementById("isbn").value;//把文本框值赋值给变量str
						if(str=="")
						alert("ISBN为空");
						else
						location.href='jc.jsp?isbn='+str;
						//alert(str);
						}
						</script>


TOP-TITLE
Photoshop抠图-边缘调整

Comments

暂无评论,还不快来坐沙发...

Leave a Reply