Jgalcambra/or any one i need ur help please...
i have anew problem .......... very intresting one..
in my project i use jsp as my front end , database is mssql , web server is apache tomcat........am also using servelts along with these jsp ....
even tomcat is running i am able to open jsp files....
in my project i mean in the front end there is login page for user id & pass word.....when i enter values in those fields i am not able to login..
i am getting an errorpage sayin incorrect login which is designed by me only... i have already haviv these user name & password in my my database.... login page has to basically verify the input values whatever we give with these database values & go to next page but this is not happening....i am not gettin any sort of syntax error....can u please help me in fixin this problem
i checked out all these things...the data is being retrieved from the database and the parameters being passed are also being assigned properly...the two values are not being compared properly and hence access is not allowed...the same code worked on a different system..here is the code....
the following is the servlet:
import java.io.IOException;
import java.io.PrintStream;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.*;
import javax.servlet.http.*;
public class ELogin extends HttpServlet
public ELogin()
public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
throws ServletException, IOException
httpservletresponse.setContentType("text/html");
java.io.PrintWriter printwriter = httpservletresponse.getWriter();
String s = httpservletrequest.getParameter("uid");
String s1= httpservletrequest.getParameter("pw");
String s2 = httpservletrequest.getParameter("dep");
int i=1;
try
HttpSession httpsession = httpservletrequest.getSession(true);
Date date = new Date();
SimpleDateFormat simpledateformat = new SimpleDateFormat("h:mm a");
String s3 = simpledateformat.format(date);
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:3413;DatabaseName=Project", "Product", "product");
Statement statement = connection.createStatement();
ResultSet resultset1 = statement.executeQuery(" select * from emp_log ");
boolean flag = false;
do
i++;
if(!resultset1.next())
break;
user1 = resultset1.getString(1);
pass1 = resultset1.getString(2);
Dep1 = resultset1.getString(3);
/* i think the problem is in the following part of the code*/
if(s.equals(user1) && s1.equals(pass1) && s2.equals(Dep1))
javax.servlet.ServletConfig servletconfig = getServletConfig();
RequestDispatcher requestdispatcher = getServletContext().getRequestDispatcher("/Activity.jsp");
httpsession.setAttribute("Empname", s);
httpsession.setAttribute("Depname", s2);
httpsession.setAttribute("loginTime", s3);
httpsession.setMaxInactiveInterval(0x3938700);
requestdispatcher.forward(httpservletrequest, httpservletresponse);
flag = true;
} while(true);
if(!flag)
String s4 = "Wrong Password,Please retype!!!";
httpsession.setAttribute("DepError1", s4);
httpsession.setMaxInactiveInterval(0x3938700);
RequestDispatcher requestdispatcher2 = httpservletrequest.getRequestDispatcher("/ErrorPageForEmpLogin.jsp");
requestdispatcher2.include(httpservletrequest, httpservletresponse);
catch(Exception exception)
System.out.println((new StringBuilder()).append("SQLException: ").append(exception).toString());
static String user1;
static String pass1;
static String Dep1;
static String DepErrorInEmp;
static String DepErr;
static String user2;
static String pass2;
static String Dep2;
static String DepErrorInAdmin;
static String DepErr1;
this is the login page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page language="java" import="java.util.* ,java.text.SimpleDateFormat ,java.sql.*" %>
<% java.util.Date todayDate = new java.util.Date();
int month = todayDate.getMonth()+1;
int date = todayDate.getDate();
int year = todayDate.getYear()+1900;
int time = todayDate.getHours();
String dateOnly = Integer.toString(month)+ "/" + Integer.toString(date)+ "/" +Integer.toString(year);%>
<html>
<html>
<head>
<title> Activity </title>
<script language="javascript" >
function showText()
var thetime=new Date();
var nhours = <%= todayDate.getHours()%>;
var nmins = <%= todayDate.getMinutes()%>;
var nsecn = <%= todayDate.getSeconds()%>;
var AorP=" ";
/*if (nhours>=12)
AorP="P.M.";
else
AorP="A.M.";*/
if (nhours>=25)
nhours-=24;
if (nhours==0)
nhours=12;
if (nsecn<10)
nsecn="0"+nsecn;
if (nmins<10)
nmins="0"+nmins;
if (nhours<10)
nhours="0"+nhours;
document.clockform.clockStart.value=nhours+":"+nmins+":"+nsecn+" "+AorP;
document.getElementById("time").style.display = '';
</script>
<SCRIPT language="JavaScript">
function startclock()
var thetime=new Date();
var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var nsecn=thetime.getSeconds();
var AorP=" ";
/*if (nhours>=12)
AorP="P.M.";
else
AorP="A.M.";*/
if (nhours>=25)
nhours-=24;
if (nhours==0)
nhours=12;
if (nsecn<10)
nsecn="0"+nsecn;
if (nmins<10)
nmins="0"+nmins;
document.clockform.clockEnds.value=nhours+":"+nmins+":"+nsecn+" "+AorP;
setTimeout('startclock()',1000);
</script>
<script language="javascript" type="text/javascript">
function submitAddfunction()
var type = document.clockform.At;
if(type.value == "Select")
window.alert("Please select activity type");
type.focus();
else
document.clockform.action="http://10.32.244.169:8082/Activity/Add";
document.clockform.submit();
function submitLogfunction()
{ //if(i==2)
var x = window.confirm("Do you want to logout?");
if (x)
document.clockform.action="http://10.32.244.169:8082/Activity/Logout";
document.clockform.submit();
else
var type=document.clockform.At;
type.focus();
</script>
</head>
<body background="background1.JPG" onLoad="startclock()">
<font face= "verdana" size="4" color=#804000>Version 1</font> <br><br>
<% String userName = (String)session.getAttribute("Empname");
session.setAttribute("Empname",userName);
String depName = (String)session.getAttribute("Depname");
session.setAttribute("Depname",depName);
String LoginTime = (String)session.getAttribute("loginTime");
session.setAttribute("loginTime",LoginTime);
session.setMaxInactiveInterval(60000000); %>
<font face= "verdana" size="6" color=#804000>Welcome <%=userName%></font>
<form name="clockform"><br><br>
<font face= "verdana" size="4" color=#400000>
<div style="position:absolute; left:30px; top:120px; width:750px; height:323px;">
Current Time:</font><font size="2" color=#400000> <%= todayDate %></font><br><br><br><br><br><br>
'<%=depName%>'
<INPUT TYPE="text" name="Dep" size="12" value = '<%=depName%>' style="visibility:hidden" ><br>
<INPUT TYPE="text" name="user" size="12" value = '<%=userName%>' style="visibility:hidden" >
<div style="position:absolute; left:150px; top:100px; width:750px; height:323px;">
<font face= "verdana" size="4" color=#400000>
<center><table>
<div style="position:absolute; left:10px; top:10px; width:750px; height:323px;"> Login Time</div>
<div style="position:absolute; left:150px; top:10px; width:750px; height:323px;">
<input type=text name="logintime" size="6" value='<%= LoginTime %>' readonly ></div>
<div style="position:absolute; left:300px; top:10px; width:750px; height:323px;"> Date</div>
<div style="position:absolute; left:350px; top:10px; width:750px; height:323px;">
<input type=text name="date" size="8" value='<%= dateOnly %>' readonly > </div>
<div style="position:absolute; left:10px; top:50px; width:750px; height:323px;">Activity Type</div>
<div style="position:absolute; left:150px; top:50px; width:750px; height:323px;">
<select name="At" onChange="showText()">
<option value="Select">--Select--</option>
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:3413;DatabaseName=Project", "Product", "product");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(" select Activity_Type from Dep_names where Dep_name='"+depName+"'");%>
<% while(rs.next())
String Activity=rs.getString(1);
StringTokenizer z = new StringTokenizer(Activity, ",");
while(z.hasMoreTokens())
{%>
<option><%=z.nextToken()%></option>
<%}
}%>
</select></div>
<div style="position:absolute; left:10px; top:90px; width:750px; height:323px;">Started Time</div>
<div style="position:absolute; left:150px; top:90px; width:750px; height:323px;">
<input type=text name="clockStart" id="time" size="6" style="display:none" readonly></div>
<div style="position:absolute; left:10px; top:130px; width:750px; height:323px;">End Time</div>
<div style="position:absolute; left:150px; top:130px; width:750px; height:323px;">
<INPUT TYPE="text" name="clockEnds" size="6" readonly>
</div>
<div style="position:absolute; left:10px; top:170px; width:750px; height:323px;">Comments</div>
<div style="position:absolute; left:150px; top:170px; width:750px; height:323px;">
<textarea name="comment" cols="50" rows="6" > </textarea>
</div><br><br><br>
<div style="position:absolute; left:145px; top:290px; width:750px; height:323px;">
<input type=button TITLE="Click here to add ur record" name="add" value=" ADD " onClick="submitAddfunction()" >
<input type="button" TITLE="View Records" name="view" value="View" onClick="javascript:window.open('http://10.32.244.169:8082/Activity/XlEmployeeReports.jsp');">
<input type=button name="logout" value=" Logout " onClick="submitLogfunction()">
</div>
</table>
</center>
</font>
</div>
</form>
from the jsp page U R accessing servlet & in servlet comparision is taking place..............
thanks in advance
</body>
</html>
Similar Messages
-
OS is Mountain Lion, upgraded no problems, used an external Hard drive for my time machine, now my iPhoto will not show any of my photo's or ay new ones I import! Help please!!
Do you get this window when you hold down the Command+Option keys and launch iPhoto?
If not then you're not holding down both keys long enough.
OT -
i am having the problem in my 3gs iphone. it says it shouldnt take more than 3 minutes then i get this message Could not activate iphone.
i have taken the sim card out and put it back in even then its of no use.
if any one out there can help us it would be very nice of them. thank you for your time.I can not get to iPhone screen, so no way to get to Settings. That is the problem. When I connect phone to iTunes I get screen asking to insert SIN card. On the phone I'm getting Cinfigure screen asking Launguage , Country or Region, Wi-Fi, ( I can connect to my home wi-fi), and last screen "Activating your iPhone". After two minutes of waiting IM getting message: Your iPhone could not be activated because the activation server in temporary unavailable. try connecting to iTunes or try later or contat apple.com/support.
Like I mention, I went to Bell as well Rogers store and tried to insert active SIM card with no results.
Yes, my friend unlock the phone to use with Rogers but I don't know where -
Remote App on iPad connects but drops after about 20 mins. Need to turn off wait about 1 minute, then turn on wifi on iMac before it can reconnect. Need some help please.
Already gone through troubleshooting guide a zillion times. Thanks.This worked for me... A little time consuming but once you get rolling it goes GREAT... Thanks....
I got my artwork and saved it to my Desktop
Opened up Microsoft Paint and clicked on "File" and "Open" and found it to get it on the screen to resize it
Clicked "resize" and a box for changing it opened up
Checked the box "Pixels" and "Unchecked maintain aspect ratio"
Set Horizontal for 640 and Vertical for 480
Clicked on "OK" and went back to "File" and did a "Save As" and chose JPEG Picture
It came up "File Already Existed" and clicked "OK" (really did not care about the original artwork I found because wrong size)
Went to iTunes and on the movie right clicked on "Get Info", clicked on "Details", then "Artwork"
Go to the little box on the top left that shows your old artwork and click on it to get the little blue border to appear around it and hit "Delete" to make it gone
Click on "Add Artwork" and find it where you put the one from above on your Desktop and hit "Open" and OK and your new artwork is now there and all good.
Sounds like a lot of steps to follow but after around 5 or so you will fly through it. This worked perfect on my iPhone 6 Plus and I have artwork on my Home Videos now. -
Hi, my iphone its in recovery mode and when i restore my iphone 5s loading show the blue screen and show note on itunes (unknown error 14) please i need your help please . thanks
In the article Resolve iOS update and restore errors this is what it says about error 14:
Check your USB connections
Related errors: 13, 14, 1600, 1601, 1602, 1603, 1604, 1611, 1643-1650, 2000, 2001, 2002, 2005, 2006, 2009, 4005, 4013, 4014, or “invalid response."
If the USB connection between your device and computer is interrupted, you may be unable to update or restore.
To narrow down the issue, you can also change up your hardware:
Use the USB cable that came with your device, or a different Apple USB cable.
Plug your cable into a different USB port directly on your computer. Don't plug it into your keyboard.
Try a different computer.
If necessary, resolve any further issues with the USB connection, then with your security software.
If you're still seeing the error message, check for hardware issues by following the next section. -
Hey, i bought an iphone from online shop as a used phone and its locked by orange france, i contact them to unlock it but they refused, they said that we regret to inform you that we'r not able to unlock second hand phones? I need your help please. Its not fair , apple should figure it out
Regards,
OrangeThis is no different with any carrier locked phone. Getting a carrier locked phone officially unlocked is the responsibility of the carrier, not the cell phone manufacturer. A cell phone manufacture cannot unlock a carrier locked phone without the carrier's authorization.
An iPhone sold as officially unlocked when new can be used by others as a second hand phone, and the same with any carrier locked iPhone that can be unlocked by the carrier, and many carriers offer it. -
How i fix and software update i was tried but cant i need your help please and thanks.
"but cant"
That doesnt tell us anything useful. You need to post EXACTLY what you did and EXACTLY what happened, including any error messages. -
Hi! I got Movies on my external hard drive that are AVI kind and won't play on my macbook pro? When I start playing the movie a message pops up and says "a required codec is not available". I tried flip4mac, xvid, divx already and still not playing my video. need some help please!! thanks.
Although vlc mentioned above is a much more powerful and better player you could try installing Perian if you insist on using the quicktime player. It may supply the codec it needs.
Not sure why you wouldn't be able to play straight avi files though in quicktime. -
my iphone 5 is problem facing like that. when i switch off my iphone5 then plugh for charge with data cable or charger adapder or only data cable with no power connect phone is starting why? means on my phone Why? any one can explane this matter please. switched off my phone but on without power button . what is the problem?
Thanks
s.m slimall iphone is same like that
-
I've just installed Mavericks on my Macbook Pro, which took forever to install, and everything appears to be fine except for iPhoto. When I try and open iPhoto I get a popup saying its not supported by this OS. Anyone have any ideas??? Help please.
Click App Store from your Apple menu drop down menu then select Updates from the App Store menu bar.
-
I need your help, PLEASE. How can to fix "NO MOUNTABLE FILE SYSTEM" error of my back up hard drive on Mountain Lion OS?
Did you format the drive for Mac use before you tried to use it as a backup drive?
Are you using Time Machine on the drive? You can't view the contents of its backup database and the only way to access the info is directly from the Time Machine app. -
I need serious help please.. We do translations of schoolbooks, I looked for an over-type function but were unable to find, we are working in indesign CS 5. it takes up allot of time to delete text and type in the new language.
Argh that's frustrating! I never noticed that key did not work in InDesign.
A bit of research and it turns out the MS Office has this as an option in their software. But I cannot find an option in InDesign preferences to make this work.
However, somethings are not listed in the shortcuts and preferences and are hidden triggers in InDesign which can be accessed through a script.
I'm not saying it's possible to activate the Insert Key through a script, but it's plausible that it can be activated.
Maybe ask on the scripting forum? InDesign Scripting
I know this may be a possibility as with InDesign's earlier versions of PDF export to interactive documents there previously was no way to export interactive pdfs as single pages if in Spreads.
But the option to toggle this setting was scriptable. -
i need to buy an iphone from NY store and let FEDEX ship it to me here in EGYPT , would any one give me a feedback please
Thanks All , But i was asking if i bought it online and let apple leave the i phone at NY store , FEDEX will go to the mentioned store and get it
-
Any one faced below error ..please help
ID_FlexCtxtGlobal for the flex field segment Additional information does not exist in the Value set $FLEX$.DF_CONTEXTS
this is the error i am getting for some times in Appraisal pages , can any one help on this issue.Check this thread helps,
Regarding Address in Selfservice
Thanks,
With regards,
Kali.
OSSi. -
Hi I need to change password but forgotten answer to one of question can help please?
Hi I am trying to change my password on I cloud but have forgotten one of the answer to a question can somebody help please?
1) Apple ID: All about Apple ID security questions
2) See Here... ask to speak with the Account Security Team...
Apple ID: Contacting Apple for help with Apple ID account security
Maybe you are looking for
-
X3-02 Sending and receiving mms messages
I got this phone for xmas and having problems sending and receiving photos, please could someone explain what I need to set. Thank you
-
Any way to change speed of a clip in "over-write edit" mode?
I want to change the speed of a clip in the timeline without having to lock all the other tracks or having to move the other following clips out of sync. For example I have a clip which lasts for 1 sec, which I want to change to 3 secs. Normally when
-
BI Content 3.5.3 and xRPM 4.0
Hi I am currently working on xRPM 4.0. I need to know that can we use BI Content 3.5 on the source system(R/3 4.7) as a plugin with xRPM 4.0. In the xRPM masterguide it states BI content 7.0 version is required. Also will it create any consistency is
-
Whats up with my macbook pro?
the mouse, (trackpad) has been moving on its own, randomly "right "clicking on things, and zooming in and out of things. or just zooming and staying zoomed in, this all happens without me touching the trackpad. when i do touch to move the cursor, or
-
How I configure the disketera for have a good working? I have problem of I/O SYSTEM: SunOS rches 5.10 Generic_118855-33 i86pc i386 # mount -F pcfs /dev/diskette /diskette mount: I/O error (check) # ps -ef |grep vold # /etc/init.d/volmgt stop # dd if=