Pls look at the below code , The highlighted attributes are showing " cannot be resolved " ,
package com.programcreek.struts2; import java.sql.*; import java.io.*; import javax.servlet.*; import com.opensymphony.xwork2.ActionSupport; public class LoginAction extends ActionSupport{ private String accountno; private String password; public String execute() { String accNo = getAccountno(); String password = getPassword(); Connection conn = null; String url = "jdbc:mysql://localhost:3306/"; String dbName = "bank"; String driver = "com.mysql.jdbc.Driver"; String username = "root"; String userPassword = "java"; try { Class.forName(driver).newInstance(); conn = DriverManager.getConnection(url+dbName,username,userPassword); Statement st = conn.createStatement(); String strQuery = "select count(*) from user where accountNo='"+accNo+"' and password='"+password+"'"; [U]out[/U].println(strQuery); ResultSet rs = st.executeQuery(strQuery); if(rs.next()) { if(rs.getInt(1)>0) { [U]session[/U].setAttribute("useraccno",accNo); [U]response[/U].sendRedirect("Frame.jsp"); } else { [U]response[/U].sendRedirect("login.jsp"); } } System.out.println("Connected to the database"); conn.close(); System.out.println("Disconnected from database"); } catch (Exception e) { e.printStackTrace(); } } public String getAccountno() { return accountno; } public void setAccountno(String accountno) { this.accountno = accountno; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
Pls check & revert whats wrong in the code????????? very urgent.....