Time of Update: 2018-12-03
一. 枚舉映射:<type name="org.hibernate.type.EnumType"> <param name="enumClass">com.cn.Gender</param> <param name="type">12</param> 12則以String類型顯示</type>二. 聯合主鍵映射:<hibernate-mapping package="com.cn">
Time of Update: 2018-12-03
一、重寫重寫方法要求——傳回型別、方法名、參數類型和個數一樣。(方法頭相同,方法體不同)public class A { public A(){ System.out.println("A"); }}public class B extends A { public B(){System.out.println("B");}}public class Test { public static void main(String[] args) {
Time of Update: 2018-12-03
關鍵就是在Action中,針對的File必須寫成數組形式或者說是List形式package com.bird.action;import java.io.File;import org.apache.commons.io.FileUtils;import org.apache.struts2.ServletActionContext;public class FileUpload { private File[] image;//擷取上傳檔案 private
Time of Update: 2018-12-03
<script language="javascript">//1、無參函數new出來 function Car(){ var ōcar = new Object; ocar.color = "blue"; ocar.doors = 4; ocar.showColor = function(){ document.write(this.color) }; return ocar; } var car =
Time of Update: 2018-12-03
例子一:<script type="text/javascript"> var t = 1; function addFile() { var parent = document.getElementById("more"); var br = document.createElement("br"); var input = document.createElement("input"); var button =
Time of Update: 2018-12-03
一.定義攔截器類,實現Interceptor介面,重寫裡面的方法:import com.opensymphony.xwork2.ActionContext;import com.opensymphony.xwork2.ActionInvocation;import com.opensymphony.xwork2.interceptor.Interceptor;public class MyInterceptor implements Interceptor { public String
Time of Update: 2018-12-03
String對象<script language="javascript"> var s1 = "hello world"; var s2 = new String("hello world"); alert(s1.charAt(4)); alert(s1.indexOf("r")); alert(s1.lastIndexOf("r")); alert(s1.indexOf("r")); var s3 = "a,b,c,d";
Time of Update: 2018-12-03
一、servlet初始化參數的傳遞: 第一步:web.xml中: <servlet> <servlet-name>SearchItemServlet</servlet-name> <servlet-class>com.bjpowernode.drp.basedata.web.SearchItemServlet</servlet-class> <!--
Time of Update: 2018-12-03
線程同步: 一、synchronized關鍵字 二、資料庫的悲觀鎖 select * from t_table_id where table_name='t_client' for update; //查詢時把該資訊鎖住,適合任何資料庫 commit; //
Time of Update: 2018-12-03
1、首先,需要匯入包commons-fileupload-1.2.1.jar和commons-io-1.3.2.jar,後面的那個包是因為在下面的代碼中會使用到它裡面的一些方法,實際上也可以不加入,這些包都是可以在Struts的lib檔案夾裡面找到的. 2、然後就是寫Action類了,這裡需要接收檔案(File類型),檔案名稱,檔案類型,檔案名稱,必須和表單裡面的name屬性名稱一致,學過servlet的都知道為什麼,然後檔案名稱的寫法是檔案名稱+FileName,然後檔案類型名稱的寫法是檔案名
Time of Update: 2018-12-03
String方法:strObj.charAt(index) 尋找指定下標的charstrObj.indexOf(str) 尋找指定的String字串第一次出現的下標位置strObj.substring(startIndex,endIndex) 包括起始下標不包括結束下標間的字串strObj.substr(startIndex,length)
Time of Update: 2018-12-03
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
Time of Update: 2018-12-03
下載時設定前台的響應類型:response.setContentType("application/x-download");os = response.getOutputStream();is = new FileInputStream(new File(path));上傳時設定前台的相應類型:response.setContentType("text/html;charset=gb2312");FileOutputStream fos = new
Time of Update: 2018-12-03
一、阻止表單重複提交在表單提交頁面寫上<s:token/><s:form action="add" method="post"> <s:token /><!-- 防止表單重複提交 --> <s:textfield name="userName" label="使用者名稱"></s:textfield><br/> <s:password name="password" label="密碼"&
Time of Update: 2018-12-03
select deptno,sum(sal) from emp where sal>1200 group by deptno having sum(sal)>8500 order by deptno;1、在一個sql語句中可以有where子句和having子句:where子句的作用是在分組之前過濾資料,條件中不能包含聚組函數(SUM(),AVG()等);having子句的作用是在分組之後過濾資料,條件中經常包含聚組函數。2、group by
Time of Update: 2018-12-03
prepareStatement.addBatch() //添加sql進入prepareStatement中prepareStatement.executeBath() //批量執行sql//例子:PreparedStatement ps = null;public void addFlowCardDetail(String flowCardVouNo,List<FlowCardDetail> flowCardDetailList) throws
Time of Update: 2018-12-03
使用如下XML文檔描述XPath文法:<?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <cd country="USA"> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <price>10.90
Time of Update: 2018-12-03
jsp頁面中:<s:param name="section" value="aaaa"></s:param>提交到action中獲得該section的值:String[] str = (String[])ActionContext.getContext().getParameters().get("section");str[0]就是要擷取的對象1.
Time of Update: 2018-12-03
Struts2檔案上傳完美解決中文亂碼問題今天主要分享開源架構Struts2檔案上傳執行個體過程,並且筆者將帶著大家解決出現的一系列亂碼問題,本文章中的重要部分將用特殊顏色標識,斜體表示不確定內容。筆者建議讀者先快速閱讀一遍本文,下載應具備的工具,再動手操作。或許寫一遍比看十遍的功效更為明顯。筆者的Struts2版本號碼是2.2.3,如果你的是2.0版本以上也沒關係。建立的java
Time of Update: 2018-12-03
應用一: <?xml version="1.0" encoding="utf-8" ?> - <ACCESOS> - <item> - <SOCIO> <NUMERO>00045050</NUMERO> <REPOSICION>0</REPOSICION> <NOMBRE>MOISES