dineshiop kumar

Greenhorn
+ Follow
since Mar 05, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by dineshiop kumar

when you install mysql irrespective to the location you should add the jar file to the netbeans and connected it make sure the properties are correctly set
i would like to recommend Head First JSP and learn it is easy way of learning jsp and effective
9 years ago
JSP
sorry i am reediting it


class a
{
}

package a;
class b
{
}


now i get a error class not found coud anybody help me

some of my friend said i should set the class path
12 years ago
i have two class

class possiblepath{
}

package possiblepath ;
class b {
}

i want to invoke class a in class b can anybody help me

could anybody say me about the setting that must be done
12 years ago
i have two jsp and one servlets once the username is been entered i want the session to be creaed in servlet and be transfered to second jsp

here is the first jsp
<html>
12 <head>
13 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
14 <title>JSP Page</title>
15 </head>
16 <body>
17 <form method="POST" action="../WebApplication3/session">
18 <table border="1">
19
20 <tbody>
then a servlet

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/


import java.io.*;
import java.net.*;

import javax.servlet.*;
import javax.servlet.http.*;

/**
*
* @author sys4
*/
public class session extends HttpServlet {

/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String username = request.getParameter("username");
HttpSession session = request.getSession(true);
session.setAttribute("username", out);
RequestDispatcher rd = request.getRequestDispatcher("/second.jsp");
rd.forward(request, response);
}

// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
// </editor-fold>
}


third jsp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
session.getAttribute("username");

%>
hello
</body>
</html>
12 years ago
ANYBODY THERE TO HELP ME
12 years ago
mean to say i should write the clause like this

select user , password from admin where user = a and password = b
even though i use i how to compare the data and display can anybody say
12 years ago
what is the condition please say me
12 years ago
hello friends i have an error int entrance of the login page that is

look i have an jsp and servlet

i have two admin
one admin name : dinesh password :dinesh
another admin :ramesh password :ramesh
the output is success if the admin name is ramesh and error if the admin name is dinesh could somebody explain me


<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html ><head>





<title>UrbanArtist</title>



<link rel="stylesheet" href="seconddata_files/UrbanArtist.css" type="text/css">

</head><body>
<form action="http://localhost:8084/finalhealth/admindatabase" method="POST">


<br><br><br><br><font face="Century Schoolbook"><font size="5">ADMIN LOG ON SCREEN<br><br></font></font>
<CENTER>

<table width="348" border="1" align="center" height="208">
<tbody><tr>
<td> USERNAME</td>
<td> <input type="text" size="15" name="username"></td></tr>
<tr>
<td> PASSWORD</td>
<td> <input type="text" size="15" name="password"></td></tr>
<tr>
<td align="center" valign="middle"> <input type="submit" value="SUBMIT"></td>
<td align="center"> <input type="reset" value="CANCEL"></td></tr>
</tbody></table><br><div align="center">
</div>
</CENTER>






</form>


</body></html>

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/


import java.io.*;
import java.net.*;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.*;
import javax.servlet.http.*;

/**
*
* @author a
*/
public class admindatabase extends HttpServlet {

/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();

String username = null ,password = null;
String user = request.getParameter("username");
String pass = request.getParameter("password");

try {


Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/javatest", "root", "conrad");
Statement stmt = con.createStatement();
String sql = "select * from admin";

ResultSet rs = stmt.executeQuery(sql);
while(rs.next())
{
username = rs.getString("admin_id");
password = rs.getString("admin_password");

}
out.println(username);
out.println(password);
rs.close();
stmt.close();

} catch (SQLException ex) {
out.println(ex);
} catch (ClassNotFoundException ex) {
out.println(ex);
}
if(username.equals(user)&& password.equals(pass))
{
out.println("passed");
}
else
{
out.println("failed");
}

}

// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
// </editor-fold>
}
12 years ago
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>jQuery Example 3</title>

<script type="text/javascript" language="javascript" src="resources/prototype_1.6.0.3/jquery-1.2.6.js"></script>
<script type="text/javascript" language="javascript" src="resources/prototype_1.6.0.3/jquery.validate.js"></script>
<script type="text/javascript" language="javascript">
//Our validation script will go here.
<!--





$(document).ready(function(){


//validation implementation will go here.
$("#TestForm").validate({
rules: {
txtFirstName: {
required: true
},
txtLastName: {
required: true,
minlength: 2
},
txtSpouseName: {
required: true
},
txtGender: {
required: true
},
txtAddress: {
required: true,
minlength: 10
},
txtMobileno: {
required: true,
minlength: 10
},
txtEmail: {
required: true
}
},
messages: {
txtFirstName: {
required: "* Required"
},
txtLastName: {
required: "* Required",
minlength: "* 2 Characters Required."
},
txtSpouseName: {
required: "* Required"
},
txtGender: {
required: "* Required"
},
txtAddress: {
required: "* Required",
minlength: "* 2 Characters Required."
},
txtMobileno: {
required: "* Required",
minlength: "* 2 Characters Required."
},
txtEmail: {
required: "* Required"
}

}

});
})

function myfunction()
{
var outString = "basic.jsp?x1=" +txtFirstName
outString += "&y1=" +txtFirstName
outString += "&x2=" +txtFirstName
outString += "&y2=" +txtFirstName
location.href = outString
}
</script>

<style type="text/css">
#container {
width: 350px;
height: 8em;
border: 1px #009933 solid;
background-color:#66FF66;
display:block;
}

label, input{
margin:2px 0px 1px 4px;
}

label {
margin-top:3px;
font-family:"Times New Roman", Times, serif;
font-size:1.1em;
}
</style>
</head>

<body>
<div id="container">
<form id="TestForm">
<label for="txtFirstName">First Name: </label><br />
<input name="txtFirstName" type="text" id="txtFirstName" title="Please Enter a First Name" /><br />
<label for="txtLastName">Last Name:</label><br />
<input name="txtLastName" type="text" id="txtLastName" title="Pleaes Enter a Last Name"/><br />
<label for="txtSpouseName">Spouse Name: </label><br />
<input name="txtSpouseName" type="text" id="txtSpouseName" title="Please Enter a First Name" /><br />

<label for="txtGender">Gender: </label><br />
<input name="txtGender" type="text" id="txtGender" title="Please Enter a First Name" /><br />
<label for="txtAddress">Address: </label><br />
<input name="txtAddress" type="text" id="txtAddress" title="Please Enter a First Name" /><br />
<label for="txtMobileno">Mobile No: </label><br />
<input name="txtMobileno" type="text" id="txtMobileno" title="Please Enter a First Name" /><br />
<label for="txtEmail">Email: </label><br />
<input name="txtEmail" type="text" id="txtEmail" title="Please Enter a First Name" /><br />


<input type="button" value="Submit" onclick="myfunction()" />
</form>
</div>
</body>
</html>
basic .jsp
<%--
Document : basic
Created on : Mar 10, 2009, 4:17:00 PM
Author : dinesh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>

<%
try {

String x1 = request.getParameter("x1");
String y1 = request.getParameter("y1");
String x2 = request.getParameter("x2");
String y2 = request.getParameter("y2");
out.println(x1 +""+ y1+"" + x2+"" + y2);

} catch (Exception e) {}
%>
</body>
</html>
12 years ago
JSP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>jQuery Example 3</title>

<script type="text/javascript" language="javascript" src="WEB-INF/jquery-1.2.6.js"></script>
<script type="text/javascript" language="javascript" src="WEB-INF/jquery.validate.js"></script>
<script type="text/javascript" language="javascript">
//Our validation script will go here.
$(document).ready(function(){
//validation implementation will go here.
$("#TestForm").validate({
rules: {
txtFirstName: {
required: true
},
txtLastName: {
required: true,
minlength: 2
}
},
messages: {
txtFirstName: {
required: "* Required"
},
txtLastName: {
required: "* Required",
minlength: "* 2 Characters Required."
}
}

});
})
</script>

<style type="text/css">
#container {
width: 350px;
height: 8em;
border: 1px #009933 solid;
background-color:#66FF66;
display:block;
}

label, input{
margin:2px 0px 1px 4px;
}

label {
margin-top:3px;
font-family:"Times New Roman", Times, serif;
font-size:1.1em;
}
</style>
</head>

<body>
<div id="container">
<form id="secondform.jsp" method ="get">
<label for="txtFirstName">First Name: </label><br />
<input name="txtFirstName" type="text" id="txtFirstName" title="Please Enter a First Name" /><br />
<label for="txtLastName">Last Name:</label><br />
<input name="txtLastName" type="text" id="txtLastName" title="Pleaes Enter a Last Name"/><br />
<input type="submit" value="Submit" id="btnSubmit" />
</form>
</div>
</body>
</html>

could any body say me how to get input from javascript and pass to servlet

i would like to get the username and password into servlet
12 years ago