我需要知道如何将LinkedList迭代器"重置"到它的第一个元素.
例如:
LinkedList<String> list;
Iterator iter=list.listIterator;
iter.next();
iter.next();
一遍又一遍,经过迭代器的多次移动后,我需要"重置"迭代器的位置.`
我想问一下如何将我的迭代器"重置"到第一个元素
我知道我可以通过这种方式获得第一个元素的列表迭代器:
iter= list.listIterator(1);
这是最好的解决方案吗?或者我可能错过了Oracle文档中的某些内容?
我有一个到MySQL数据库的Java程序连接,如何在同一个连接上将当前数据库更改为另一个?
我像这样连接到MySQL:
DriverManager.getConnection("jdbc:mysql://"+server+"/",log,pass);
Run Code Online (Sandbox Code Playgroud)
在一些操作之后,我想连接到同一连接上的不同mysql数据库.我怎样才能做到这一点?
我试着用:
Statement stat= con.createStatement();
ResultSet r=stat.executeQuery("use mysql");
Run Code Online (Sandbox Code Playgroud)
但这并没有改变要使用的数据库.
我正在尝试在其他计算机上的Apache Tomcat上运行我的Eclipse JSF项目.我用本教程创建了一个WAR文件.但是,当我部署WAR并在Firefox中打开Facelet页面时,我只收到以下错误消息:
此XML文件似乎没有与之关联的任何样式信息.文档树如下所示.
这是我第一次尝试在没有Eclipse的情况下运行我的JSF应用程序.这是怎么造成的,我该如何解决?
我实际上是在尝试打开以下Facelet页面:
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition template="/WEB-INF/templates/template_a.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define name="title">
tytol
</ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud) 我的实体:
@Entity
public class Document {
@Id
protected String id; //It string in purpose
@OneToOne(cascade = ALL)
@JoinColumn(name = "DOCUMENT_DETAILS")
private DocumentDetails details;
}
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "documentDiscr")
@EqualsAndHashCode
public abstract class DocumentDetails {
@Id @GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
private Money total;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "SELLER_ID")
private Company seller;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "BUYER_ID")
private Company buyer;
}
@Entity
public class Company {
@Id
protected String id;
private String name;
private String …Run Code Online (Sandbox Code Playgroud) 如何在jmeter中格式化json响应?我不想告诉你应该展示哪一部分的json答案.我希望看到我的响应不是很长的一行,而是用新行和制表符/空格格式化的行数.
我看见:
http://eclipsesource.com/blogs/2014/06/12/parsing-json-responses-with-jmeter/
http://stackoverflow.com/questions/18562060/jmeter-extracting-fields-parsing-json-response
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我正在创建我的第一个facelets/JSF应用程序.在我的第一页中,我添加了一个facelet模板:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</h:head>
<body>
<ui:insert name='top'>
<ui:include src="/templates/template_a.xhtml"></ui:include>
</ui:insert>
</body>
</f:view>
</html>
Run Code Online (Sandbox Code Playgroud)
这是我的模板页面:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</h:head>
<body>
<ui:composition template="/inwert_a.xhtml">
<ui:define name="top">
<h2>naglowek</h2>
</ui:define>
</ui:composition>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是当我在网络浏览器中查看页面源代码时,我看到了:
<?xml version="1.0" encoding="ISO-8859-1" …Run Code Online (Sandbox Code Playgroud) 我有枚举
enum Number{
FIRST(123),
SECOND(321);
}
Number nr=Number.FIRST
Run Code Online (Sandbox Code Playgroud)
如何在不创建新方法的情况下从变量nr获取枚举值(不是String而是int)?