我正在尝试一个简单的弹簧Web服务应用程序.我已正确配置应用程序,但当我尝试访问wsdl文件时,我收到以下错误:
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
17:24:35,409 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/springWsTest]] (http--127.0.0.1-8080-1) Initializing Spring FrameworkServlet 'webservice'
17:24:35,419 INFO [org.springframework.ws.transport.http.MessageDispatcherServlet] (http--127.0.0.1-8080-1) FrameworkServlet 'webservice': initialization started
17:24:35,428 INFO [org.springframework.web.context.support.XmlWebApplicationContext] (http--127.0.0.1-8080-1) Refreshing WebApplicationContext for namespace 'webservice-servlet': startup date [Tue Jul 03 17:24:35 BST 2012]; parent: Root WebApplicationContext
17:24:35,443 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (http--127.0.0.1-8080-1) Loading XML bean definitions from ServletContext resource [/WEB-INF/ws-config.xml]
17:24:35,541 INFO [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (http--127.0.0.1-8080-1) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
17:24:35,595 INFO [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (http--127.0.0.1-8080-1) JSR-330 'javax.inject.Named' annotation found and supported for component scanning
17:24:35,655 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] …Run Code Online (Sandbox Code Playgroud) 阅读http://www.jamesward.com/2011/08/23/war-less-java-web-apps上有关如何在应用程序中嵌入应用服务器的文章,我注意到了这段代码.
package foo;
import java.io.File;
import java.net.URL;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.*;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.webapp.WebAppContext;
public class Main
{
public static 9900;">);
out.close();
}
}
Run Code Online (Sandbox Code Playgroud)
什么是主类,因为我不理解该语法.
我正在浏览一个使用Swing的遗留应用程序,我正在努力弄清楚当用户点击按钮时屏幕是如何变化的.我无法弄清楚这一点的原因之一是因为这是我第一次使用Swing.我读了一本书并得到了基础知识,但仍在苦苦挣扎.
基本上,我正在看的屏幕有一个JSplitPane,左边有一些快捷按钮,右边有一个空窗格.当我单击按钮时,右侧窗格将根据按下的按钮填充不同的屏幕.
通过代码,我期待某个地方会有一些东西调用setVisible()方法,具体取决于按下哪个按钮.
每个快捷按钮的actionPerformed方法如下所示:
void shortCutBtn_actionPerformed(ActionEvent e) {
propertyChangeListeners.firePropertyChange("selectedShortCut", previousShortCutSel, currentShortCutSel);
mainPanel.updateUI();
}
Run Code Online (Sandbox Code Playgroud)
我已经完成了大部分代码并得出结论,上面的代码是导致帧切换的原因,但我不明白这是怎么回事.
每个屏幕由数字常量标识.在上面的代码示例中,previousShortCutSel和previousShortCutSel引用表示各个屏幕的数值屏幕.
我试图寻找updateUI()如何工作的文档,但我迷路了.以上是如何使用新屏幕更新JSplitPanel右侧面板的内容?
我有一个查询连接两列的值并返回一个字符串,如下所示:
423545(50),7568787(50),53654656,2021947(50),
Run Code Online (Sandbox Code Playgroud)
现在我需要处理没有括号中的值的单个数字.我可以重新运行另一个查询以检索值,但我认为拆分现有字符串而不是进行另一个数据库调用更有效.
如何拆分上面的字符串以删除括号中的值?我想将数字存储在ArrayList中.arrayList将包含423545,7568787,53654656,2021947,(不带逗号)
请注意,并非所有列都具有括号值 - 请参阅第三列字符串末尾可能有逗号.
String.split()如果它只是用逗号我可以拆分它,但我想上面的格式需要一个正则表达式.
我有以下测试脚本:
#!/bin/sh
testArray=(A,B,C,D,E)
currentValue=''
tempValue=x
for i in "${testArray[@]}"
do
currentValue=$i
echo "Processing " ${currentValue}
if [ ${currentValue}==A ]
then
tempValue="$i 123"
else
tempValue=$i
fi
echo "Current loop " ${tempValue}
echo `date`
done
Run Code Online (Sandbox Code Playgroud)
当我测试它时,我得到的输出是
Processing A,B,C,D,E
Current loop A,B,C,D,E 123
Mon Dec 2 20:33:26 GMT 2013
Run Code Online (Sandbox Code Playgroud)
看起来Bash中的'for'循环在某种程度上与我习惯的不同,因为我期待以下输出(即,'for'循环中的任何内容都要为每个数组元素重复)
Processing A
Current loop A 123
Mon Dec 2 20:29:44 GMT 2013
Processing B
Current loop B
Mon Dec 2 20:29:45 GMT 2013
Processing C
Current loop C
Mon Dec 2 20:29:46 GMT …Run Code Online (Sandbox Code Playgroud) 如果我不知道列的名称,是否可以使用索引或列位置等选择第二列的值?
Select col(2) FROM (
Select 'a', 'b',' c', 'd' from dual
)
Run Code Online (Sandbox Code Playgroud) 我正在查看以下两种检索值的方法,并稍后通过insert语句存储它.即通过Pl/SQL游标或直接SQL.两种方法都有任何优势吗?还是有更有效的方法?
方法1
Cursor system_date
Is
select sysdate from dual;
system_date_rec system_date%type;
Open system_Date;
Fetch system_date into system_date_rec;
Insert into table(dateValue)
values(system_date_rec.date);
Run Code Online (Sandbox Code Playgroud)
方法2
dateString varchar(20);
Select sysdate into dateString from dual;
Insert into table(dateValue)
values(dateString);
Run Code Online (Sandbox Code Playgroud) 我想使用jquery来执行某些操作,具体取决于单击的复选框.出于某种原因,下面的任何复选框都没有触发onClick甚至.
<HTML>
<HEAD>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<SCRIPT language="javascript">
$(document).ready(function() {
$("#group1").click(function() {
$('.group1').attr('checked', this.checked);
});
});
function checkGroup (id ) {
// ...
// do anything you want here
alert ("id: "+id+" "name: " + id.name);
//...
}
</script>
<script type="text/javascript">
</script>
<TITLE>Multiple Checkbox Select/Deselect - DEMO</TITLE>
</HEAD>
<BODY>
<a href="">Link</a>
<H2>Multiple Checkbox Select/Deselect - DEMO</H2>
<table border="1">
<tr>
<th><input type="checkbox" id="group1" name="master" onClick="javascript:checkGroup('group1');"/></th>
<th>Cell phone</th>
<th>Rating</th>
</tr>
<tr>
<th><input type="checkbox" id="group2" name="master" onClick="javascript:checkGroup('group2');"/></th>
<th>Cell phone</th>
<th>Rating</th>
</tr>
</table>
</BODY> …Run Code Online (Sandbox Code Playgroud) 在以下示例中:
<html>
<head>
<SCRIPT language="JavaScript">
function checkcheckboxElem(checkboxElem)
{
alert ("checkboxElem " + checkboxElem.length);
}
</script>
</head>
<body>
<form name="checkForm">
Master: <input type="checkbox" name="master" value="6694" onclick="checkcheckboxElem(document.checkForm.checkboxElem)"><br>
Child1: <input type="checkbox" name="checkboxElem" value="2">
</form>
</body>
Run Code Online (Sandbox Code Playgroud)
警报输出'undefined'.出于某种原因,如果只有一个复选框,则会执行此操作.如果我添加另一个复选框,则输出正确的长度.如果我按如下所示进行更改,则输出2
<html>
<head>
<SCRIPT language="JavaScript">
function checkcheckboxElem(checkboxElem)
{
alert ("checkboxElem " + checkboxElem.length);
}
</script>
</head>
<body>
<form name="checkForm">
Master: <input type="checkbox" name="master" value="6694" onclick="checkcheckboxElem(document.checkForm.checkboxElem)"><br>
Child1: <input type="checkbox" name="checkboxElem" value="2">
Child2: <input type="checkbox" name="checkboxElem" value="1">
</form>
Run Code Online (Sandbox Code Playgroud)
如果只有一个复选框,为什么它会返回'undefined'?
谢谢
在读书的时候,我发现了这句话:
对象的方法定义其行为.这些方法称为实例方法.重要的是要注意这些方法属于该类的每个对象.这不应该与该类的所有实例共享的方法的实现相混淆.
我知道什么是实例方法,我知道什么是静态方法(即由类的所有实例共享).上述陈述似乎表明所有实例都共享方法的实现.这到底是什么意思?它听起来不像是指静态方法.
在以下示例中:
public static void main(String[] args){
List<String> list = new ArrayList<String>();
list.add("hi");
list.add("hi");
list.add("hi");
list.remove("hi");
System.out.println(list); //prints [hi, hi]
}
Run Code Online (Sandbox Code Playgroud)
ArrayList减少了一个但删除了哪一个?它是删除最后插入的还是最早插入的?
我真的在努力解决这个问题:
import java.util.regex.*;
class Regex2 {
public static void main(String[] args) {
Pattern p = Pattern.compile(args[0]);
Matcher m = p.matcher(args[1]);
boolean b = false;
while(b = m.find()) {
System.out.print(m.start() + m.group());
}
}
}
Run Code Online (Sandbox Code Playgroud)
使用以下命令运行上述程序时:
java Regex2 "\d*" ab34ef
Run Code Online (Sandbox Code Playgroud)
它输出01234456.我真的不明白这个输出.考虑每个字符的以下索引:
a b 3 4 e f
^ ^ ^ ^ ^ ^
0 1 2 3 4 5
Run Code Online (Sandbox Code Playgroud)
输出应该不是0123445吗?
我一直在阅读,看起来RegEx引擎也将读取字符串的结尾,但我只是不明白.如果有人可以提供有关如何获得该结果的分步指南,将不胜感激.即如何找到每个数字.
class ZiggyTest{
public static void main(String[] args){
RunnableThread rt = new RunnableThread();
Thread t1 = new Thread(rt);
Thread t2 = new Thread(rt);
Thread t3 = new Thread(rt);
t1.start();
t2.start();
t3.setPriority(10);
t3.start();
try{
t3.join();
t2.join();
t1.join();
System.out.println("Joined");
}catch(InterruptedException e){System.out.println(e);}
Thread t4 = new Thread(new RunnableThread());
Thread t5 = new Thread(new RunnableThread());
Thread t6 = new Thread(new RunnableThread());
t4.start();
t5.start();
t6.start();
}
}
Run Code Online (Sandbox Code Playgroud)
上述测试产生以下输出
Thread-0
Thread-0
Thread-0
Thread-0
Thread-0
Thread-2
Thread-2
Thread-2
Thread-2
Thread-2
Thread-1
Thread-1
Thread-1
Thread-1
Thread-1
Joined
Thread-3
Thread-3 …Run Code Online (Sandbox Code Playgroud)