Caused by: java.lang.NullPointerException
at sample.Controller.action1(Controller.java:69)
... 57 more
signInBtn.setText("fgsdhjk");
@FXML
private Button signInBtn;
<Button id="signInBtn" defaultButton="true" mnemonicParsing="false" onAction="#action1" text="Sign In" textFill="$x2">
<font>
<Font size="30.0" />
</font>
</Button>
<Button fx:id="signInBtn" defaultButton="true" mnemonicParsing="false" onAction="#action1" text="Sign In" textFill="$x2">
<font>
<Font size="30.0" />
</font>
</Button>
Privacy mode or "private browsing" or "incognito mode"[1] is a privacy feature in some web browsers to disable browsing history and the web cache. This allows a person to browse the Web without storing local data that could be retrieved at a later date. Privacy mode will also disable the storage of data in cookies and Flash cookies. This privacy protection is only on the local computing device as it is still possible to identify frequented websites by associating the IP address at the web server.
Your browser fingerprint appears to be unique among the xxx,xxx,xxx tested so far.
@WebServlet(urlPatterns = "/contact")
public class ContactController extends HttpServlet {
private ContactDao contactDao = new HashMapContactDao();
@Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
contactDao.removeById(Long.valueOf(req.getParameter("id")));
this.doGet(req, resp);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
List<Contact> contactList = contactDao.findAll();
req.setAttribute("contactList", contactList);
req.getRequestDispatcher("view/contact.jsp").forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Contact newContact = new Contact();
newContact.setLastName(req.getParameter("lastName"));
newContact.setFirstName(req.getParameter("firstName"));
newContact.setPhone(req.getParameter("phone"));
this.contactDao.add(newContact);
this.doGet(req, resp);
}
@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Contact newContact = new Contact();
newContact.setId(Long.valueOf(req.getParameter("id")));
newContact.setLastName(req.getParameter("lastName"));
newContact.setFirstName(req.getParameter("firstName"));
newContact.setPhone(req.getParameter("phone"));
this.contactDao.update(newContact);
super.doPut(req, resp);
}
}
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Список контактов</title>
<style type="text/css">
table {
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
}
</style>
</head>
<body>
<h1>Список контактов</h1>
<form method="post">
<fieldset>
<legend>Новый контакт</legend>
<p>
<label>Фамилия: <input type="text" name="lastName" /></label>
</p>
<p>
<label>Имя: <input type="text" name="firstName" /></label>
</p>
<p>
<label>Номер телефона: <input type="text" name="phone" /></label>
</p>
<p>
<button>Создать</button>
</p>
</fieldset>
</form>
<table style="border: 1px solid black;">
<tr>
<th>№</th>
<th>Фамилия</th>
<th>Имя</th>
<th>Номер телефона</th>
</tr>
<c:if test="${contactList != null}">
<c:forEach items="${contactList}" var="c">
<tr>
<td>${c.id}</td>
<td>${c.lastName}</td>
<td>${c.firstName}</td>
<td>${c.phone}</td>
</tr>
</c:forEach>
</c:if>
</table>
</body>
</html>
public class Contact {
private Long id;
private String lastName;
private String firstName;
private String phone;
public Contact() {
}
public Contact(String lastName, String firstName, String phone) {
this.lastName = lastName;
this.firstName = firstName;
this.phone = phone;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
public class HashMapContactDao implements ContactDao {
private AtomicLong idCounter = new AtomicLong();
private Map<Long, Contact> map = new ConcurrentHashMap<Long, Contact>();
@Override
public List<Contact> findAll() {
return new ArrayList<Contact>(this.map.values());
}
@Override
public void removeById(Long id) {
this.map.remove(id);
}
@Override
public Contact add(Contact contact) {
Long newId = this.idCounter.incrementAndGet();
contact.setId(newId);
this.map.put(newId, contact);
return contact;
}
@Override
public void update(Contact contact) {
this.map.put(contact.getId(), contact);
}
}
InputStream is = new InputStream() {
@Override public int read() throws IOException {
return 123;
}
};
System.out.println(is.read());//123
System.out.println(System.in);//java.io.BufferedInputStream@5577140b
> консультанты в магазинах впаривают игровые видюхи
Телефон устройство = new Смартфон();
устройство.набратьНомер("03");
Смартфон усовершенствованноеУстройство = (Смартфон)устройство;