request header and response

request header and response

Create a html form that accept user name and password ,if the user name and password is admin it redirects it to adminhome.html,if the user name and password is guest and guest it redirects it to guesthome.html and if these value are not found .it redirects the control to error.html.
View Answers

August 3, 2010 at 5:03 PM

Hi Friend,

Try the following code:

1)login.html:

<html>
<head>
</head>
<body>
<form name="form" method="post" action="http://localhost:8080/examples/modified/checklogin.jsp">;
<br><br>
<table align="center"><tr><td><h2>Login Authentication</h2></td></tr></table>
<table width="300px" align="center" style="border:1px solid #000000;background-color:#efefef;">
<tr><td colspan=2></td></tr>
<tr><td colspan=2>&nbsp;</td></tr>
<tr>
<td><b>Login Name</b></td>
<td><input type="text" name="username" value=""></td>
</tr>
<tr>
<td><b>Password</b></td>
<td><input type="password" name="password" value=""></td>
</tr>

<tr>
<td></td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</table>
</form>

</body>
</html>

2)checklogin.jsp:

<%
String user=request.getParameter("username");
String pass=request.getParameter("password");
if(user.equals("admin") && pass.equals("admin")){
response.sendRedirect("adminhome.html");
}
else if(user.equals("guest") && pass.equals("guest")){
response.sendRedirect("guesthome.html");
}
else{
response.sendRedirect("error.html");
}
%>

Thanks









Related Tutorials/Questions & Answers:
request header and response - Java Beginners
request header and response  count the hits of a user on a site
request header and response - JSP-Servlet
request header and response  Create aservlet that redirects a client to a.html if its morning ,to b.html if its a afternoon else to c.html.
Advertisements
request header and response - JSP-Servlet
request header and response  hi sir, i have facing some problem in this qustion:- Create a servlet that accept a name and a phone number and contain 4 buttons add,update,delete and view .On clicking on the any of the button
request header and response - JSP-Servlet
request header and response  Create a html form that accept user name and password ,if the user name and password is admin it redirects it to adminhome.html,if the user name and password is guest and guest it redirects
simple ajax Request and Response code...
simple ajax Request and Response code...  var request=null; if (window.XMLHttpRequest) { request = new XMLHttpRequest(); } else if (window.ActiveXObject) { request = new ActiveXObject("Microsoft.XMLHTTP"); } if(request
how to display response in request page
how to display response in request page  Sir/Mom, My request page have three text boxes. Enter register number in the first box then click the submit button.This time shows the name and mark to display the second and third boxes
ModuleNotFoundError: No module named 'flask-request-id-header'
ModuleNotFoundError: No module named 'flask-request-id-header'  Hi...: No module named 'flask-request-id-header' How to remove the ModuleNotFoundError: No module named 'flask-request-id-header' error? Thanks   
ModuleNotFoundError: No module named 'flask-request-id-header'
ModuleNotFoundError: No module named 'flask-request-id-header'  Hi...: No module named 'flask-request-id-header' How to remove the ModuleNotFoundError: No module named 'flask-request-id-header' error? Thanks   
ModuleNotFoundError: No module named 'request-response-serializer'
ModuleNotFoundError: No module named 'request-response-serializer'  ...: No module named 'request-response-serializer' How to remove the ModuleNotFoundError: No module named 'request-response-serializer' error? Thanks
Access Request and Response
the request and response object in struts 2 application. To access the request... action class. Accessing the request and response object, you need a struts.xml... request and response object as well as accessed date and time. Output
Request header display in a jsp page
Request header display in a jsp page  ... to display request header information in a jsp page. When user request... to a jsp. In this example, request_header_jsp.jsp is used to display header
How we can integrate ASP .net website to payment gateway using SOAP xml request and response using wsdl.
gateway provider provide us SOAP Xml request and SOAP xml response format along...How we can integrate ASP .net website to payment gateway using SOAP xml request and response using wsdl.  We have a e-commerce website in ASP.net, c
Header Tag:
request header. This tag retrieve the value of the specified request header (may... with the value of the specified request header. multiple... specifies  the name of the request header whose value, or values
http header content length
http header content length  How to check the request header content length in HTTP
swings header
swings header   have a string1 it contains 3 parts,for example "123456 service hello" and string2 contains text "change request " like.... i need logic for this program . i want to apply this to window header part
table header
table header  how set the header to the TableModel
header files
header files   do you have a all header files of java
header() in php
header() in php  hello, Use of header() in php?   hello,ADS_TO_REPLACE_1 header() is used for redirect the page.if you want to redirect one page to another we can use
JSP Response Object
JSP Response Object  JSP response Object ?   The response object denotes the HTTP Response data. The result or the information of a request is denoted with this object. The response object handles the output
Servlet Filter
: Analyse the request header and customize the request and response object if request... of a request and response from server. Generally it does not create response... Restrict to pass the request and response any further. Alters (if required
Header file
Header file  when we use, Scanner input=new Scanner(System.in); this statement in a java program,which header filemust be imported to the program?   Hi Friend, Import the package java.util.*;ADS_TO_REPLACE_1 Thanks
diplay response
diplay response   Sir, How show sum of two tex boxes data to third box   Answer (adsbygoogle = window.adsbygoogle || []).push
php header syntax
php header syntax  What is the correct syntax of PHP Header
swings window header
swings window header  i have a string1 it contains 3 parts,for example "123456 service hello" and string2 contains "change request " like... for this program . i want to apply this to window header part. Thanks
ModuleNotFoundError: No module named 'header'
ModuleNotFoundError: No module named 'header'  Hi, My Python... 'header' How to remove the ModuleNotFoundError: No module named 'header'... to install padas library. You can install header python with following command
alignment for header and footer
alignment for header and footer  header and footer alignment is not fit like footer is not fit in bottom some white space is there in jsf, what to do
Java Servlet : Http Response Headers
, String headerValue) : it sets the response header with specified name... { protected void doGet(HttpServletRequest request, HttpServletResponse response...Java Servlet : Http Response Headers In this tutorial, you will learn how
python requests get headers from response
is available in the header of the response then my program should proceed with the data... a request to the sever response = requests.get(server_url) # print response..." # Make a request to the sever response = requests.get(server_url) # print
python requests get headers from response
If the value is available in the header of the response then my program should...://www.roseindia.net" # Make a request to the sever response = requests.get(server_url..." >>> # Make a request to the sever >>> response = requests.get
PHP header IE - PHP
PHP header IE  I tried the given code in PHP which is working for firefox header('Content-type: '.$theMimeType); ob_clean(); // clean output buffer flush(); // flush output buffer readfile($thePath); exit
E-Mail header extractor
E-Mail header extractor  i want to extract email header with using of java so please show the code of email extractor as result all the field show different color and or it extract ip where the email came
E-Mail header extractor
E-Mail header extractor  i want to extract email header with using of java so please show the code of email extractor as result all the field show different color and or it extract ip where the email came
Resize Header in CSS
Resize Header in CSS  Hi all, Please let me know if we can resize the Header tags in HTML for example H1,H2 and so on... Actually, it looks very...;We can resize header tags in CSS .. and further call that class into you HTML
how to display webservice response in a text box
how to display webservice response in a text box  Hallo, i have created a webservice and when i sended request to my webservice its sending proper response . the point is how to dispaly the response values in a text box usinj
ModuleNotFoundError: No module named 'response'
ModuleNotFoundError: No module named 'response'  Hi, My Python... 'response' How to remove the ModuleNotFoundError: No module named 'response... to install padas library. You can install response python with following
ModuleNotFoundError: No module named 'response'
ModuleNotFoundError: No module named 'response'  Hi, My Python... 'response' How to remove the ModuleNotFoundError: No module named 'response... to install padas library. You can install response python with following
regarding header files - Spring
regarding header files  i am working on linux platform. i a using spring framework 2.5.4.while comlinig the client program i.e from demo which given in tutorial. error is these two package does not exist import
Removal of XML header
Removal of XML header  I need to retrieve a few records from the file at a time to generate xml.But each time while retrieving the records from the file, I dont want the XML header to appear again..How do I achieve this?What
Session Object from request
request object? Why are we adding cookie object into response object? Why are we getting cookie object from request object? I know all methods are available its... , adding cookie object into response, getting object from request object. one
php parse soap response
php parse soap response  What is soap and how can i convert a soap response to XML. Thanks in Advance
ModuleNotFoundError: No module named 'flake8-fancy-header'
ModuleNotFoundError: No module named 'flake8-fancy-header'  Hi, My... named 'flake8-fancy-header' How to remove the ModuleNotFoundError: No module named 'flake8-fancy-header' error? Thanks   Hi
ModuleNotFoundError: No module named 'grip-no-header'
ModuleNotFoundError: No module named 'grip-no-header'  Hi, My... named 'grip-no-header' How to remove the ModuleNotFoundError: No module named 'grip-no-header' error? Thanks   Hi, In your python
Version of taglibs>response dependency
List of Version of taglibs>response dependency
problem in forwarding response
problem in forwarding response  My response is not getting displayed. i have used RequestDispatcher.forward,RequestDispatcher.include...,Update page has fields with the values.after user clicks on update button,response
Server_Gives_Null_Response
at port 6066. My Problem is that when i send response from server (port 6066... the server. Kindly give the solution how can i get response at client class. I
Response Filter Servlet Example
(ServletRequest request, ServletResponse response,  ...;filterchain.doFilter(requestresponse);   response.setContentType... Response Filter Servlet Example   
Pinting restful webservice request on UI.
response in my UI but I am not successful to catch request. Please let me know...Pinting restful webservice request on UI.  I want to print request XML for Restful webservice request in my UI application in swing. When a user
How to send the request and get the request?
How to send the request and get the request?  how to send a request to a JSP file in another domain in the same server and get the request done i.e how to include JSP file of one domain to another doamin JSP within in the same
web page altering while displaying servlet response
(request, response); i have used this code but it is not displaying the page... and i want to display response of that servlet in a div in my index.jsp
Send a Response Status in servlet
. Constants value request and response are used to return status to browser...; IOException {     doPost(requestresponse);   ... .style1 { font-weight: bold; } Send a Response

Ads