private static void readyDB() { request.setCharacterEncoding("UTF-8"); Class.forName("com.mysql.cj.jdbc.Driver"); conn = DriverManager.getConnection ("jdbc:mysql://localhost:3306/loginform?"+ "serverTimezone=Asia/Seoul","root","1234"); }
Multiple annotations found at this line: - Syntax error on token "readyDB", AnnotationName expected after this token - Syntax error on token "readyDB", AnnotationName expected after this token
this is error text Here is all code .. also this file is jsp file
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="java.sql.*"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>just a moment, please</title> </head> <body> <%! String id, pw, pwc, name, hbd, sex, email, phone, sql; String ID, PW, PWC, NAME, HBD, SEX, EMAIL, PHONE; Connection conn; PreparedStatement ps; ResultSet rs; %> <%! private static void Registration_Identify(){ try { if(!request.getParameter("id").equals(null)){ id=request.getParameter("id"); } if(!request.getParameter("pw").equals(null)){ pw=request.getParameter("pw"); } if(!request.getParameter("pwc").equals(null)){ pwc=request.getParameter("pwc"); } if(!request.getParameter("name").equals(null)){ name=request.getParameter("name"); } if(!request.getParameter("hbd").equals(null)){ hbd=request.getParameter("hbd"); } if(!request.getParameter("sex").equals(null)){ sex=request.getParameter("sex"); } if(!request.getParameter("email").equals(null)){ email=request.getParameter("email"); } if(!request.getParameter("phone").equals(null)){ phone=request.getParameter("phone"); } else { out.println("Error"); System.out.println("Error"); } } catch(Exception e){ } %> <%! private static void readyDB() { request.setCharacterEncoding("UTF-8"); Class.forName("com.mysql.cj.jdbc.Driver"); conn = DriverManager.getConnection ("jdbc:mysql://localhost:3306/loginform?"+ "serverTimezone=Asia/Seoul","root","1234"); } %> <% Registration_Identify(); readyDB(); ps=conn.prepareStatement("select * from member where phone='"+phone+"'"); rs=ps.executeQuery(); if(!rs.next()) { /* if (id.equals("")) out.println("Please fill in the blanks ID for membership registration"); if (pw.equals("")) out.println("Please fill in the blanks Password for membership registration="); if (pwc.equals("")) out.println("Please fill in the blanks Password Confirm for membership registration"); if (name.equals("")) out.println("Please fill in the blanks Name for membership registration"); if (hbd.equals("")) out.println("Please fill in the blanks Birthday for membership registration"); if (sex.equals("")) out.println("Please fill in the blanks Sex for membership registration"); if (email.equals("")) out.println("Please fill in the blanks Email for membership registration"); if (phone.equals("")) out.println("Please fill in the blanks Phone for membership registration"); */ if(id.equals("")||pw.equals("")||pwc.equals("")||name.equals("")|| hbd.equals("")||sex.equals("")||email.equals("")||phone.equals("")) { out.println("Please fill in all the blanks for membership registration"); %> <form action="signup.jsp" method="post"> <input type="submit" value="back" /> </form> <% } else { ps = conn.prepareStatement("INSERT INTO member(id,pw,pwc,name,hbd,sex,email,phone) values(?,?,?,?,?,?,?,?)"); ps.setString(1, id); ps.setString(2, pw); ps.setString(3, pwc); ps.setString(4, name); ps.setString(5, hbd); ps.setString(6, sex); ps.setString(7, email); ps.setString(8, phone); int x=ps.executeUpdate(); if(x > 0) { System.out.println("Regisration done sucessfully..."); %> <h2>please check your information</h2><br> <p>ID: <%= id %></p> <p>Password: <%= pw %></p> <p>Password confirm: <%= pwc %></p> <p>Name: <%= name %></p> <p>Birth day: <%= hbd %></p> <p>Sex: <%= sex %></p> <p>Email: <%= email %></p> <p>Phone(only number): <%= phone %></p> <form action="login.jsp" method="post"> <input type="submit" value="Log in" /> </form> <% } else { System.out.println("Regisration Faild..."); } } } else { ID=rs.getString("id"); PW=rs.getString("pw"); PWC=rs.getString("pwc"); NAME=rs.getString("name"); HBD=rs.getString("hbd"); SEX=rs.getString("sex"); EMAIL=rs.getString("email"); PHONE=rs.getString("phone"); if(id.equals(ID)){ out.println("<br>This ID already exists."); } if(pw.equals(pwc)){ out.println("<br>Password is not coincide."); } if(phone.equals(PHONE)){ out.println("<br>This Phone number already exists."); } %> <form action="signup.jsp" method="post"> <input type="submit" value="back" /> </form> <% } } catch(Exception e) { System.out.println(e); } finally{ } %> </body> </html>
https://stackoverflow.com/questions/65895296/how-can-i-fix-it-for-working-syntax-error-on-token-readydb-annotationname-e January 26, 2021 at 10:55AM
没有评论:
发表评论