IllegalArgumentException: Invalid character found in method name
Я новичек. Помогите исправить ошибку:
Дополняю. Вот код html-страницы:
<form action="ContactServlet" method="post">
Name: <input name="name" />
Email: <input name="email"type="email" />
Message: <input name="message" />
<input name="submit" type="submit" value="Отправить" />
</form>
И код сервлета:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
String name = request.getParameter("name");
String email = request.getParameter("email");
String message = request.getParameter("message");
PrintWriter writer = response.getWriter();
if(!message.equals(null)){
String host = "smtp.gmail.com";
int port = 587;
String username = "[email protected]";
String password = "***";
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
Session session = Session.getDefaultInstance(props, null);
String body = message;
try {
MimeMessage m = new MimeMessage(session);
m.setSubject(name);
m.setFrom(new InternetAddress(email, null));
m.setText(body);
m.addRecipient(MimeMessage.RecipientType.TO, new InternetAddress(username, "me"));
Transport transport = session.getTransport("smtp");
transport.connect(host, port, username, password);
Transport.send(m);
} catch (AddressException e) {
e.printStackTrace();
} catch (javax.mail.MessagingException e) {
e.printStackTrace();
}
try {
writer.println("Message send!");
} finally {
writer.close();
}
}
}
Ошибка:
