Jump to content

Recommended Posts

Posted

[quote name='Aamayakudu' timestamp='1352579941' post='1302775926']

atleast null ana ravali kada...
[/quote]
asalu nenu JSP fields lo urname and password enter chesthunte nothing happening bro.. ardham kavatledhu.. em exception kuda ravatledhu

  • Replies 92
  • Created
  • Last Reply

Top Posters In This Topic

  • chinni005

    44

  • Aamayakudu

    25

  • kiran karthik

    8

  • dollar vora

    5

Popular Days

Top Posters In This Topic

Posted

[CODE]
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>CustomerDemo</display-name>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>CustomerUpdate</display-name>
<servlet-name>CustomerUpdate</servlet-name>
<servlet-class>com.tekreliance.customer.CustomerUpdate</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CustomerUpdate</servlet-name>
<url-pattern>/CustomerUpdate</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>CustomerLogin</display-name>
<servlet-name>CustomerLogin</servlet-name>
<servlet-class>com.tekreliance.customer.CustomerLogin</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CustomerLogin</servlet-name>
<url-pattern>/CustomerLogin</url-pattern>
</servlet-mapping>
</web-app>
[/CODE]

idhi na web.xml

Posted

[img]http://lh5.ggpht.com/-GcTyLKR6x2w/TfvNY9YKk6I/AAAAAAAAC10/ZoAmEdae0Bw/brahmi.gif[/img][img]http://lh5.ggpht.com/-GcTyLKR6x2w/TfvNY9YKk6I/AAAAAAAAC10/ZoAmEdae0Bw/brahmi.gif[/img][img]http://lh5.ggpht.com/-GcTyLKR6x2w/TfvNY9YKk6I/AAAAAAAAC10/ZoAmEdae0Bw/brahmi.gif[/img]

Posted
sSc_hidingsofa [quote name='mustang302' timestamp='1352580696' post='1302775970']
[img]http://lh5.ggpht.com/-GcTyLKR6x2w/TfvNY9YKk6I/AAAAAAAAC10/ZoAmEdae0Bw/brahmi.gif[/img][img]http://lh5.ggpht.com/-GcTyLKR6x2w/TfvNY9YKk6I/AAAAAAAAC10/ZoAmEdae0Bw/brahmi.gif[/img][img]http://lh5.ggpht.com/-GcTyLKR6x2w/TfvNY9YKk6I/AAAAAAAAC10/ZoAmEdae0Bw/brahmi.gif[/img]
[/quote]
Posted

[quote name='Hava5' timestamp='1352580650' post='1302775968']
[CODE]
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>CustomerDemo</display-name>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>CustomerUpdate</display-name>
<servlet-name>CustomerUpdate</servlet-name>
<servlet-class>com.tekreliance.customer.CustomerUpdate</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CustomerUpdate</servlet-name>
<url-pattern>/CustomerUpdate</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>CustomerLogin</display-name>
<servlet-name>CustomerLogin</servlet-name>
<servlet-class>com.tekreliance.customer.CustomerLogin</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CustomerLogin</servlet-name>
<url-pattern>/CustomerLogin</url-pattern>
</servlet-mapping>
</web-app>
[/CODE]

idhi na web.xml
[/quote]
customer login class loo nuvu db ki connect ayee pasword authentication chesthunava ???

web.xml tho no problem ... as ur giving db parameters in class ...

Posted

[quote name='Aamayakudu' timestamp='1352580861' post='1302775980']
customer login class loo nuvu db ki connect ayee pasword authentication chesthunava ???
[/quote]
aa db connections anni console lo kuda osthunnayi ba

Posted

[CODE]
package com.xxxx.customer;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class CustomerLogin
*/
public class CustomerLogin extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public CustomerLogin() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
@SuppressWarnings("unused")
PrintWriter out = response.getWriter();
String userName = request.getParameter("userName");
System.out.println("1");
String password = request.getParameter("password");
System.out.println("2");
CustomerService service = new CustomerService();
System.out.println("3");
Connection con = service.getConnection();
System.out.println("4");
String selSQL = "SELECT * FROM userdetails";
try {
boolean check=false;
PreparedStatement pstmnt = con.prepareStatement(selSQL);
System.out.println("5");
ResultSet rs = pstmnt.executeQuery();
System.out.println("6");
while(rs.next()){
if(rs.getString(1).equals(userName) && rs.getString(2).equals(password)){
check = true;
break;
}

}
if(check==true){
//forward to success page
RequestDispatcher dispatch = request.getRequestDispatcher("info.jsp");
dispatch.forward(request, response);

}
if(check ==false){
RequestDispatcher dispatch = request.getRequestDispatcher("login.jsp");
dispatch.forward(request, response);

}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}

}

[/CODE][quote name='Aamayakudu' timestamp='1352580966' post='1302775990']
customer login code veyee..
[/quote]

Posted

[quote name='Hava5' timestamp='1352581229' post='1302776011']
[CODE]
package com.tekreliance.customer;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class CustomerLogin
*/
public class CustomerLogin extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public CustomerLogin() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
@SuppressWarnings("unused")
PrintWriter out = response.getWriter();
String userName = request.getParameter("userName");
System.out.println("1");
String password = request.getParameter("password");
System.out.println("2");
CustomerService service = new CustomerService();
System.out.println("3");
Connection con = service.getConnection();
System.out.println("4");
String selSQL = "SELECT * FROM userdetails";
try {
boolean check=false;
PreparedStatement pstmnt = con.prepareStatement(selSQL);
System.out.println("5");
ResultSet rs = pstmnt.executeQuery();
System.out.println("6");
while(rs.next()){
if(rs.getString(1).equals(userName) && rs.getString(2).equals(password)){
check = true;
break;
}

}
if(check==true){
//forward to success page
RequestDispatcher dispatch = request.getRequestDispatcher("info.jsp");
dispatch.forward(request, response);

}
if(check ==false){
RequestDispatcher dispatch = request.getRequestDispatcher("login.jsp");
dispatch.forward(request, response);

}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}

}

[/CODE]
[/quote]


syso("username from database" + rs.getString(1));
eedhi rasi console loo chudu asalu output vasthundhoo leka null value vasthundhoo ....

ayena nee select Satement loo where condition yedhi ??? asalu yee condition too select chesthunav ...??

select * from userdetails where username='"+username+"' ani unadali....


and CustomerService() class code veyee ....

Posted

[CODE]
package com.xxxxx.customer;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;
public class CustomerService {
public static void main(String[] args){
ResourceBundle rb = ResourceBundle.getBundle("com.xxx.resources.customer");
System.out.println(rb.getString("dbdriverName"));
System.out.println(rb.getString("dburl"));
System.out.println(rb.getString("dbusername"));
System.out.println(rb.getString("dbpassword"));


}
public Connection getConnection() {
Connection con = null;
//Properties properties = new Properties();
try {
// load properties
ResourceBundle rb = ResourceBundle.getBundle( "com.tekreliance.resources.customer");
String dbdriverName = rb.getString("dbdriverName");
String dburl = rb.getString("dburl");
String dbuserName = rb.getString("dbusername");
String dbpassword = rb.getString("dbpassword");

// register the driver
Class.forName(dbdriverName);
// establish the connection
con = DriverManager.getConnection(dburl,dbuserName,dbpassword);
System.out.println(con);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return con;
}
}

[/CODE]

Posted

[quote name='Hava5' timestamp='1352582270' post='1302776070']
[CODE]
package com.xxxxx.customer;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;
public class CustomerService {
public static void main(String[] args){
ResourceBundle rb = ResourceBundle.getBundle("com.xxx.resources.customer");
System.out.println(rb.getString("dbdriverName"));
System.out.println(rb.getString("dburl"));
System.out.println(rb.getString("dbusername"));
System.out.println(rb.getString("dbpassword"));


}
public Connection getConnection() {
Connection con = null;
//Properties properties = new Properties();
try {
// load properties
ResourceBundle rb = ResourceBundle.getBundle( "com.tekreliance.resources.customer");
String dbdriverName = rb.getString("dbdriverName");
String dburl = rb.getString("dburl");
String dbuserName = rb.getString("dbusername");
String dbpassword = rb.getString("dbpassword");

// register the driver
Class.forName(dbdriverName);
// establish the connection
con = DriverManager.getConnection(dburl,dbuserName,dbpassword);
System.out.println(con);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return con;
}
}

[/CODE]
[/quote]
if ur using oracle DB
ojdbc14.jar ni project ki add chesava alane server ki kuda ee jar ni add cheyali ..... whichserver r u using?

Posted

You will get the job before your OPT complition. May be in 26, 27, 28 or in 29th month of OPT if you do the same as today @3$% @3$%

Posted

code cofy paste seydama? sCo_^Y [quote name='FAKEID' timestamp='1352582566' post='1302776083']
You will get the job before your OPT complition. May be in 26, 27, 28 or in 29th month of OPT if you do the same as today @3$% @3$%
[/quote]

Posted

[quote name='Aamayakudu' timestamp='1352582498' post='1302776080']
if ur using oracle DB
ojdbc14.jar ni project ki add chesava alane server ki kuda ee jar ni add cheyali ..... whichserver r u using?
[/quote]
postgres yeah add chesa ATC 7.0

Posted

[quote name='Hava5' timestamp='1352582844' post='1302776092']
postgres yeah add chesa ATC 7.0
[/quote]

Customerlogin class loo connection null vasthunada ledha chudu ....

or else teamviewer unte ... chepu chudam entha kana easy gaa chepadam ante kastam bhaiya .... nee console or nee server side console loo error yemina vasthunaya chudu ...

×
×
  • Create New...