java developer

java developer

i didnt get the correct ANSWER PLZ EXECUTE THE FOOLWING SERVLET BY USING DATABASE USERLOGIN TABLE VALUES.

//validate login.html


<html>
<body>
<body bgcolor="wheat">
<center>

<h1>Login Form</h1>

<form action="ss">
<Table>

<tr>
<td>enter name</td>
<td><Input Type="text" name="uname"></td>
</tr>

<tr>
<td>enter password</td>
<td><Input Type="password" name="pwd"></td>
</tr>
<tr>

<td><Input type="CHECKBOX" value="tick">remember my password</td>
</tr>


<tr>
<td><Input type="submit" value="submit"></td>
</tr>

<tr>
<td><Input type="reset" value="clear"></td>
</tr>

</Table>
</form>
</center>
</body>
</html>

//vallidate user n pwd by validservlet


package active;

import javax.servlet.*;
import java.io.*;
import java.sql.*;


public class validservlet extends GenericServlet
{


Connection conn;
ServletConfig sc;
ServletContext scont;

public void init() throws ServletException 
{

try{

      sc=getServletConfig();
    scont=sc.getServletContext();

    String driver=scont.getInitParameter("driver");
    String url=scont.getInitParameter("url");
    String user=sc.getInitParameter("User");
    String Password=sc.getInitParameter("Password");

       Class.forName(driver);
    conn=DriverManager.getConnection(url,user,Password);

}
 catch(Exception e)
{
System.out.println(e.getMessage());
}

}

public void service(ServletRequest req, ServletResponse res) throws IOException,ServletException
{

res.setContentType("text/html");

PrintWriter out=res.getWriter();

try{

    String uname=req.getParameter("uname");
    String pwd=req.getParameter("pwd");

String sql="SELECT * FROM userlogin UNAME=? and PWD=?";

PreparedStatement pst=conn.prepareStatement(sql);

pst.setString(1,uname);
pst.setString(2,pwd);

ResultSet rs=pst.executeQuery();

if(rs.next())
{

RequestDispatcher rd=req.getRequestDispatcher("Admin.java");
rd.forward(req,res);

}
else
{

RequestDispatcher rd=req.getRequestDispatcher("userlogin.html");

//rd.forward(req,res);
rd.include(req,res);

System.out.println("<center><font color=red>invalid</font></center>");
}
}

catch(Exception e){}

}

public void destroy()
{

try
{conn.close();

}catch(Exception e){}
}
}




package active;
import javax.servlet.*;
import java.io.*;
import java.sql.*;

public class Admin extends GenericServlet
{

public void service(ServletRequest req,ServletResponse res)throws IOException,ServletException
{

res.setContentType("text/html");

PrintWriter out=res.getWriter();

System.out.println("<center> welcome to Admin </center>");

}

}



<web-app>

<content-param>
<param-name>driver</param-name>
<param-value>
sun.jdbc.odbc.JdbcOdbcDriver
</param-value>
</content-param>

<content-param>
<param-name>url</param-name>
<param-value>
jdbc:odbc:mydsn
</param-value>
</content-param>



<servlet>
<servlet-name>validservlet</servlet-name>
<servlet-class>active.validservlet</servlet-class>


<init-param>
<param-name>user</param-name>
<param-value>system</param-value>
</init-param>


<init-param>
<param-name>password</param-name>
<param-value>rammohan</param-value>
</init-param>

</servlet>


<servlet-mapping>
<servlet-name>validservlet</servlet-name>
<url-pattern>/ss</url-pattern>
</servlet-mapping>


<servlet>
<servlet-name>Admin</servlet-name>
<servlet-class>active.Admin</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Admin</servlet-name>
<url-pattern>/admin</url-pattern>
</servlet-mapping>

</web-app>
View Answers

August 4, 2011 at 3:32 PM

Hello,

If you are using init parameters(for username and password) to check from database whether they are valid or not then what is the need of html to insert the values of username and password?

Please clarify this.


August 4, 2011 at 10:07 PM

Hi,

Actually i want to write the program for validate the username and password through database.

My idea is to write the programe whenever user want to see the his information he should enter to his account through html,if user and password is valid then get the information from database.......

And that init parameter belongs to database.....


August 5, 2011 at 3:41 PM

sorry that init parameters belongs to connction object which is taking arguments url,user,password









Related Tutorials/Questions & Answers:
Java Developer
Java Developer  Hi, I am engineering student. I want to make career in as Java Developer. How to become a Java Developer? What programming languages... an expert Java Developer? Thanks
Java Developer
Java Developer  What is scenario where i use interface and where use interface
Advertisements
Java Developer
Java Developer  where we should use interface and where we should use abstract class
java developer
java developer  i didnt get the correct ANSWER PLZ EXECUTE THE FOOLWING SERVLET BY USING DATABASE USERLOGIN TABLE VALUES. //validate login.html <html> <body> <body bgcolor="wheat"> <center>
Java/PHP Developer
Java/PHP Developer  Hi, I need a cloak embedded in java swing frame or panel..And it should not change when system time is changed ..please
Java/PHP Developer
Java/PHP Developer  Hi, can u help me to embedd time on java frame and it should be independent of operating system time..if we change system time it should'nt be changed.. Thank you sir
Java/PHP Developer
Java/PHP Developer  help me with passing data from jframe to text file please
Java/PHP Developer
Java/PHP Developer  please help me to bring cell values of jtable to a text file
Java/PHP Developer
Java/PHP Developer  how to remove and add a new contentpane on same frame do we have any methods
Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box
Java/PHP Developer
Java/PHP Developer  how can we get words seperated by delimeters in text file can be imported in jframe like one word for one line
Java/PHP Developer
Java/PHP Developer  Hi, how to create radio buttons on one pannel and should change when pressed ok... can u help me htrough this sooner... THANK U
Java/PHP Developer
Java/PHP Developer  Hi, can u please help me with this, I have a text file with 3 sentences separated by delimiters and i want to get each sentence in different JFrames when press ok button on first frame it should close
Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box..... like a text file containing questions and another text file containing answer of 3 r 4 options,each one
Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box..... like a text file containing questions and another text file containing answer of 3 r 4 options,each one
Java/PHP Developer
Java/PHP Developer  Hi, I have a textfile(notepad1.txt) with 1 question and another textfile(notepad2.txt) with answers(4 options like multiple choice),question is imported from first text file to jframe and 4 options with check
Java/PHP Developer
Java/PHP Developer  Hello sir, Am working on playing audio file in jframe and im not able to import javax.media into the code.. the code.../java/javase/download-142937.html After downloading, put the jar file under the lib
Java/PHP Developer
Java/PHP Developer  HI, I want to know how can we place a link in one jframe to open a videopanel. import java.net.MalformedURLException; import... } // end MediaPanel constructor } // end class MediaPanel   Java create
Java Developer Training
Java Developer training are provided by Roseindia for the Java developers... and work there way up. The Java Developer training program includes the Servlet... the developers to learn new programs and topics in Java. The Java developer
Sr. Java Developer with EJB Experience
Sr. Java Developer with EJB Experience       Position Vacant: Sr. Java Developer with EJB...; Keywords: J2EE, JEE, EJB, Java, Development, Software system, 
Maven dependency for merlin-developer - merlin-developer-core version 20040423.083017 is released. Learn to use merlin-developer-core version 20040423.083017 in Maven based Java projects
-developer - merlin-developer-core version 20040423.083017 ) in their Java...-developer - merlin-developer-core version 20040423.083017 in Java projects... - merlin-developer-core version 20040423.083017 java library in your project. ADS
plsql developer
plsql developer  how did plsql developer provided the information to the frent end people when ever they contact plsql developer and how plsql developer tck the data from the database
Software Developer
Software Developer  what is the java code to turn off my pc
App Developer
App Developer  Hi, Who is App Developer? Thanks   Hi, App Developer is the term used for the programmers or companies developing mobile applications. Mobile application or simply app is the hot trend there days
Senior Java Developer Jobs at Rose India
Senior Java Developer Jobs at Rose India  ... Java or J2EE developer, preferably on one or more large, highly transactional... Java Developers to immediately start on Java projects. The senior Java
ModuleNotFoundError: No module named 'developer'
ModuleNotFoundError: No module named 'developer'  Hi, My Python... 'developer' How to remove the ModuleNotFoundError: No module named 'developer' error? Thanks   Hi, In your python environment you
Maven dependency for maven - maven-developer-activity-plugin version 1.5.1 is released. Learn to use maven-developer-activity-plugin version 1.5.1 in Maven based Java projects
Maven dependency for  maven  - Version 1.5.1 of maven-developer-activity-plugin released The developers of   maven - maven-developer... 2005, the released version of  maven - maven-developer-activity-plugin
Developer Files - Development process
Developer Files  Hi, I dont have real time experience. can u tell as a j2ee developer should i edit struts properties files or not . like wise changes in any other properties file. Thanks Prakash
Developer discussion forums
Developer discussion forums  Hi, What is discussion forums? Is there any good forum for discussion programming technologies? Thanks... managed and spam protected. You can check LiveTechTalk.com - Developer discussion
Hire iPhone developer
Hire iPhone developer - Hire iPhone developers in India Apple?s iPhone... few efficient developer in this field. If you want to develop any outstanding... programmer or hire iPhone app developer who can develop an iPhone application
ai developer course
ai developer course  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: ai developer course... the topic "ai developer course". Also tell me which is the good training
iPhone apps developer
iPhone apps developer With the launch of Apple's innovative product iPhone that comprises three advanced products in it-a smart mobile, a faster internet connection and advanced multimedia devices with touch screen and virtual
Version of merlin-developer>merlin-developer-core dependency
List of Version of merlin-developer>merlin-developer-core dependency
Mozilla Developer Center
Mozilla Developer Center       Great site to get a first look at AJAX. Read full DescriptionADS_TO_REPLACE_1
Artifacts of merlin-developer
List of Artifacts of merlin-developer maven depenency
Artifacts of com.ns-developer
List of Artifacts of com.ns-developer maven depenency
Maven Repository/Dependency: merlin-developer | merlin-developer-core
Maven Repository/Dependency of Group ID merlin-developer and Artifact ID merlin-developer-core. Latest version of merlin-developer:merlin-developer-core dependencies. # Version Release Date
What skills are required to be a Hadoop developer?
What skills are required to be a Hadoop developer?  Hi, How to become a good Hadoop Developer? What skills are required to be a Hadoop developer? Thanks
What are job role of Hadoop Developer?
What are job role of Hadoop Developer?  Hi, I am planning to get the the job in Hadoop Development as Hadoop Developer. What are the roles of a Hadoop Developer? Thanks
ModuleNotFoundError: No module named 'developer-tools'
ModuleNotFoundError: No module named 'developer-tools'  Hi, My... named 'developer-tools' How to remove the ModuleNotFoundError: No module named 'developer-tools' error? Thanks   Hi, In your python
Looking to Hire Magento Website Developer?
Looking to Hire Magento Website Developer?  Are you searching for Magento ecommerce development solution? Then you have arrived on the right place... at reasonable prices. You can hire Magento ecommerce developer from us
google developer machine learning bootcamp
google developer machine learning bootcamp  Hi, I am beginner... to learn: google developer machine learning bootcamp Try to provide me good examples or tutorials links so that I can learn the topic "google developer
What is the salary of Python developer in India?
What is the salary of Python developer in India?  Hi, I am beginner... to learn: What is the salary of Python developer in India? Try to provide me... is the salary of Python developer in India?". Also tell me which is the good
Searching Mobile developer for image recognition
Searching Mobile developer for image recognition  Hi, I have an idea for an application that requires image recognition. I have decided to use... of calling web services. Developer should have at least 5 years of experience
Hire Java Developer, Hire Java Programmer
Hire Java Developer/Programmer Hire Java Developers and experienced Java Programming team to develop world class enterprise applications. Hiring Java... hire the Java developers to maintain your project. Our development team
software developer
software developer
Version of com.ns-developer>tagcloudview dependency
How to become a PHP Developer?
PHP developer. This explains you all the technologies you have to learn to become a PHP Developer. You will definitely find this step-by-step tutorial very.... To become a PHP developer following the following steps:ADS_TO_REPLACE_1 How
PHP Application Developer in India
PHP Application Developer in India We offer PHP Application Developer in India at very affordable cost. You can hire our dedicated developers to work... using PHP language. Roseindia, a leading PHP developer India has a strong

Ads