- 首先於mybatis-config新增<databaseIdProvider>設定
- 接者在欲使用的dynamic sql部分如下使用:
insert into users values (#{id}, #{name}) select seq_users.nextval from dual select nextval for seq_users from sysibm.sysdummy1"
insert into users values (#{id}, #{name}) select seq_users.nextval from dual select nextval for seq_users from sysibm.sysdummy1"
package com.example.shihanne.properties;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Locale;
import java.util.ResourceBundle;
public class Main {
public static void main(String[] args) throws IOException {
Locale locale = Locale.getDefault();
String key = "hello";
if(args.length == 1)
key = args[0];
if(args.length == 2){
key = args[0];
locale = Locale.forLanguageTag(args[1]);
}
System.out.println(new Main().getMessageByBundle(key,locale));
}
public String getMessageByBundle(String key,Locale local) throws UnsupportedEncodingException{
ResourceBundle rs = ResourceBundle.getBundle("config",local);
return new String(rs.getString(key).getBytes("ISO-8859-1"),"UTF-8");
}
}
與
後來找到上述討論區才知道原來可以加入以下這樣的property來解決這樣的問題:...
WebDriver _driver;
//....
WebElement element1 = _driver.findElement(By.xpath("//span[@id='MenuB']"));
builder.moveToElement(element1).perform();
< web-app>
log4jConfigLocation
${jboss.home.dir}/ap-config/xxxx/log4j.properties
</ web-app>
如上述,我們希望在web.xml中指定log4j.properties的外部路徑,但需要使用環境變數讀取(避免不同客戶端機器安裝位置不同產生問題),false true
< select id="selectTable" parametertype="hashmap" resulttype="hashmap">
select * from TABLE
< where>
< if test="type == 'M' or type=='C' ">
ColA=#{volue}
< / if>
< / where>
</ select>
< select id="selectTable" parametertype="hashmap" resulttype="hashmap">
select * from TABLE
< where>
< if test='type == "M" or type=="C" '>
ColA=#{volue}
< / if>
< / where>
</ select>
rem Setup JBoss specific properties set "JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS% "
rem Setup JBoss specific properties set "JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS% -Dorg.jboss.as.logging.per-deployment=false"
錯誤:... ... ... ....
... ... ... ....
{id:123,things['a','b','c']}The following would match when doing non-strict checking, but would fail on strict checking:{id:123,things['c','b','a'],anotherfield:'blah'}
FilterRedirector
org.apache.cactus.server.FilterTestRedirector
FilterRedirector
/FilterRedirector
@Test
WebDriver _driver = null;
public void test() throws Exception {
//...
WebElement textMerchno = _driver.findElement(By.xpath("//input[@id='merchno']"));
textMerchno.sendKeys(_merchno);
WebElement textUserid = _driver.findElement(By.xpath("//input[@id='userid']"));
textUserid.sendKeys(_userid);
WebElement textPwd = _driver.findElement(By.xpath("//input[@id='userpwd']"));
textPwd.sendKeys(_userpwd);
WebElement btn = _driver
.findElement(By.xpath("//input[@type='button' and @class='table_button']"));
btn.click();
Alert alert = _driver.switchTo().alert();
String actual = alert.getText();
assertEquals(expectedMsg, actual);
//...
}
但是就在執行時出現了Exception:Alert alert = _driver.switchTo().alert(); String actual = alert.getText(); _driver.switchTo().alert().accept(); assertEquals(expectedMsg, actual);
var date = Date.parse($("#billDate").val());
var szformatDate = $.datepicker.formatDate('yymmdd', new Date(date));
public class TestServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try{
String reqBillDate = request.getParameter("reqBillDate");
process(reqBillDate);
//...
}catch(...){
}
}
}
package ut.cactus;
public class CactusTestServlet extends ServletTestCase{
TestServlet _sv = new TestServlet();
public void setUp(){
// do something..
}
public void beginDoGet(WebRequest request){
request.addParameter("reqBillDate", "20131212");
}
public void testDoGet() throws Exception{
_sv.doGet(request, response);
}
public void endDoGet(WebResponse response) throws Exception {
String result = response.getText();
assertEquals("expectedResult",result);
}
}
ServletRedirector org.apache.cactus.server.ServletTestRedirector param1 value1 used for testing ServletTestRunner org.apache.cactus.server.runner.ServletTestRunner ServletRedirector /ServletRedirector ServletTestRunner /ServletTestRunner

ReplacementDataSet dataSet = new ReplacementDataSet(srcDataSet);
dataSet.addReplacementObject("[NULL]", null);
select MERCHANT_NO from MI_MIDATRD where MERCHANT_NO = #{merchno}
and ( (status = 'Y' or status = 'B')
and CREATE_DATE <= TO_DATE(#{billdate},'YYYYMMDD')
....
netstat -plten |grep java
tcp6 0 0 :::8080 :::* LISTEN
1000 30070621 16085/java
kill -9 16085
Namespace ns2 = new Namespace("ns1","http://ns.chinatrust.com.tw/XSD/CTCB/ESB/Message/EMF/ServiceBody");
((Element)nodeB).add(ns2);
Namespace ns2 = new Namespace("ns1","http://ns.chinatrust.com.tw/XSD/CTCB/ESB/Message/EMF/ServiceBody");
QName newQName = new QName(nodeB.getName(), ns2);
((Element)nodeB).setQName(newQName);
for(Namespace e : ((Element)nodeE).declaredNamespaces()){
((Element)nodeE).remove(e);
}
Node nodeB = root.selectSingleNode("//ns0:ServiceEnvelope/ns1:ServiceBody");
DefaultXPath xpath = new DefaultXPath("//ns0:ServiceEnvelope/ns1:ServiceBody");
Map uris = new HashMap();
uris.put("ns0","http://ns.chinatrust.com.tw/XSD/CTCB/ESB/Message/EMF/ServiceEnvelope");
uris.put("ns1", "http://ns.chinatrust.com.tw/XSD/CTCB/ESB/Message/EMF/ServiceHeader");
xpath.setNamespaceURIs(uris);
Node nodeB = xpath.selectSingleNode(root.getDocument());