Showing posts with label JSP. Show all posts
Showing posts with label JSP. Show all posts

Tuesday, 17 December 2013

How to redirect first jsp page to another jsp page using login page ,apache tomcat [ J2EE PART 8 ]

How to redirect first jsp page to another jsp page

by using Login page


Now create A new jsp



Name it Account→



Finish→


Now type this code on Login.jsp

Full source code Login.jsp
  <%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>My Login Page</h1>
        <%
        String UN=request.getParameter("user");
        String PW=request.getParameter("pass");
        if(UN.equals("admin")&&PW.equals("123"))
                       {
            response.sendRedirect("Account.jsp");
        }
        
       %>
       
</html>


Type this code in Accout.jsp


Full Source code for Accout.jsp
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Welcome to my Account</h1>
        Login Success
    </body>
</html>


Full  Source code for index.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
         <form action="Login.jsp" method="get">
            <label>Username </label> <input type="text" name="user"> 
            <label>Password</label> <input type="password" name="pass">
            <input type="submit" name="Submit">            

            
        </form> 
    </body>
    </body>
</html>       


Output→run file



How to jump from first jsp page to another jsp page ,apache tomcat [ J2EE PART 7 ]

How to jump from first jsp page to another jsp page

In this tutorial we are going to study following:-
☻How to make textfield. 
    <input type="text" name="user"> 
☻How to make a password field
   <input type="password" name="pass">
☻How to make a label.

       
 <label> Username </label>
or
 <label> Username

☻How to make a form.Introducing method "get post"
    <form action="Login.jsp" method="get">
 </form> 
☻how to make a submit button.
    <input type="submit" name="Submit">

Create a new JSP page
Name to Login


Then finish


Source code for index.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
         <form action="Login.jsp" method="get">
            <label>Username </label> <input type="text" name="user"> 
            <label>Password</label> <input type="password" name="pass">
            <input type="submit" name="Submit">            

            
        </form> 
    </body>
    </body>
</html>       


Source code for Login.jsp
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>My Login Page</h1>
       
</html>

  

Output→click "run file"
----------------------------


On click→Submit→


Monday, 16 December 2013

How to make a JSP using Netbeans ,apache tomcat [ J2EE PART 6 ]

My First JSP 

First you want to open netbeans
then create a new project 
Next follow steps
☻Select  Java web →


☻ web Application→


☻Next give Project name→"MyJSP"→



☻Next you want select your server glass fish or apache tomcat
you must have one these server ( for installation of tomcat go here)


Now you already have a code to display hello world , to test it just right click→
"run file"→



Facebook Twitter Delicious Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | coupon codes