Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Highlighted words Not resolved

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Highlighted words Not resolved

    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.....


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Highlighted words Not resolved

    Sorry I don't see where you have stated what your problem is. Do you get compiler errors?
    Please copy and paste here the FULL text of the error messages.

    Otherwise please explain.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Highlighted words Not resolved

    Cross posted at Highlighted keyword showing Not resolved - Dev Shed

Similar Threads

  1. [SOLVED] This absolute uri (http://displaytag.sf.net) cannot be resolved in either web.xml or
    By santosh.dhulipala in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: October 4th, 2021, 09:58 AM
  2. "The import ___ cannot be resolved" (stupid noob question)
    By RobG in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 18th, 2010, 03:09 PM
  3. cannot be resolved to a type
    By Teraphim in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 16th, 2010, 10:42 AM
  4. Error msg : 'pageContext' cannot be resolved in tag file....
    By saikrishna436 in forum JavaServer Pages: JSP & JSTL
    Replies: 5
    Last Post: September 8th, 2009, 07:58 AM