shaziya
web-design
2 Answer(s)      4 years and 10 months ago
Posted in : JSP-Servlet

View Answers

August 8, 2008 at 5:53 PM


Hi



package javacode;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import javax.net.*;

public class GetSession extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
HttpSession session = req.getSession(true);
res.setContentType("text/html");
PrintWriter out = res.getWriter();
String title = "Searching the Web";
String heading;
Integer count = new Integer(0);;
if(session.isNew()) {
heading = "Welcome, To GetID";
}
else {
heading = "Welcome Back";
Integer oldcount = (Integer)session.getValue("count");
if (oldcount != null) {
count = new Integer(oldcount.intValue() + 1);
}
}
session.putValue("count", count);
out.println(ServletValue.headWithTitle(title) +
"<body BGCOLOR=\"pink\">\n" +
"<h1 ALIGN=\"CENTER\">" + heading + "</h1>\n" +
"<center><H2>Information on Your Session:</H2></center>\n" +
"<TABLE BORDER=1 ALIGN=CENTER>\n" +
"<tr BGCOLOR=\"green\">\n" +
" <TH>Info Type<TH>Value\n" +
"<tr>\n" +
" <td><b>ID</b>\n" +
" <td>" + session.getId() + "\n" +
"<tr>\n" +
" <td><b>Creation Time</b>\n" +
" <td>" + new Date(session.getCreationTime()) + "\n" +
"<tr>\n" +
" <td><b>Time of Last Access</b>\n" +
" <td>" + new Date(session.getLastAccessedTime()) + "\n" +
"<tr>\n" +
" <td><b>Number of Previous Accesses</b>\n" +
" <td>" + count + "\n" +
"</table>\n" +
"</body></html>");

}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}

August 8, 2008 at 5:55 PM


web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>



<web-app xmlns="http://java.sun.com/xml/ns/javaee";

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";

version="2.5">



<description>

Servlet and JSP Examples.

</description>

<display-name>Servlet and JSP Examples</display-name>
<servlet>
<servlet-name>getsession</servlet-name>
<servlet-class>javacode.GetSession</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>getsession</servlet-name>
<url-pattern>/jsp/GetSession</url-pattern>
</servlet-mapping>
</web-app>

------------------------------------------------

Read for more information.

http://www.roseindia.net/servlets/

Thanks.









Related Pages:
web design
web design   Hii.. I have to design one registration page in java... (here i have to design captcha) submit (while clicking on submit... design that. Please help me asap Thanks a lot
WEB Design
WEB Design  Write a program to open the link in first frame in another frame?   Please visit the following link: Webservices Tutorials
Web design program - WebSevices
Web design program  Design an HTML page to create the standard calculator. When user will click on the button, display the caption of selected button in new document
Web Design Training
Web Design Training  Hi, How to learn Web Design? What is the best courses in Web Design Training? Thanks   Hi, These days websites... design in PSD format, maintaining the websites etc. As a web designer you should
Web design program - WebSevices
Web design program  Design an HTML page to accept Name (text box), Address (multiline textbox), Gender (radio button), Qualification (single selection), Specialisation (multiple selection), Languages (checkbox), Submit
Web design program - WebSevices
Web design program  Create the .css file. Write different styles for table cell to assign background colour. Incorporate the style in .html file. Create a table of 4 rows, 2 columns in the .html file. Using style, change
Web design program - WebSevices
Web design program  Design an HTML page to accept information of the employee (important 5 details). Use appropriate controls. Give title â... controls using horizontal line. Design the web page with relevant background image
Web design program - WebSevices
Web design program  Accept any two numbers using text box. Provide four buttons Add, Divide, Square, and Modulus (remainder of division). On clicking corresponding button, display the relevant result in new window.  
Web design program - WebSevices
Web design program  Provide two links. Display an image in new document on clicking corresponding link. The image displayed using second link should have 3 links to open 3 different files. Note : Each image should have border
Web design program - WebSevices
Web design program  Create a dynamic page using CSS as follows. a) The text displayed using should have background color â??Brownâ?? and text color â??whiteâ??, font â?? Arial. (2 marks) b) The paragraph can be displayed
web-design - JSP-Servlet
web-design  hi, i wanted to know what is web design.. is it the servlet that we write producing the output on the web page????????  Hi... out = res.getWriter(); String title = "Searching the Web"; String heading
what is php used for in web design
what is php used for in web design  what is php used for in web design
web design - WebSevices
web design  I want to use macromedia Dreamweaver for designing the web pages for my j2ee web application, But i do not know how to use Dreamweaver so please help me. Thanks
web design - WebSevices
web design  I want to use macromedia Dreamweaver for designing the web pages for my j2ee web application, But i do not know how to use Dreamweaver so please help me. Thanks
Web design company in Delhi
Web design company in Delhi We are professional web design and development... design premium templates for your online website and web portals...; Cafe and Restaurant We design website and web applications
web design - Design concepts & design patterns
web design  hello sir. my quesstion is same please guide me. please reply my question .because it very urgrent. I want make header like-http://www.sigmainfotech.com.au/ this site but in this site header make in flash, I
What are Web Design Services
What are Web Design Services The term web design looks simple that refers to arranging contents... of the customer. A perfect web design service not only enhance the traffic
Professional Web Design Services For You Web Site
Professional Web Design Services For You Web Site  ... design of the web site.... However there are also some guidelines to the use of graphics on the web
Web Design Portfolio
Web Design Portfolio The Roseindia?s Web Designer develops Website... of the web design meets the web standard parameters. Followings are the guidelines that we follow while web design are: Usability Consistency Simplicity
Web Design Books
Web Design Books       Page-1 This site explains in very simple terms how to design, build and publish a website. If you haven't done it before, Internet publishing can
Web Design books-Page1
Web Design books-Page1       The web design guide This site explains in very simple terms how... server space.   The advanced web design There are great
Web Design Packages, Website Design Packages
an extensive range of web design solutions for all, from individuals to corporate...: HTML Basic Web Design Packages HTML Basic + Web Design Packages HTML Silver Web Design Packages
Animated Web Design
Animated Web Design Animation needs the higher skill of work and experience, and animation on web not only need the art but also need the technical skills... Web page design optimization Graphic design Presentations
Corporate Web Design Services
Corporate Web Design Services The corporate website is an informative website that is operated by a business company and provides comprehensive information... and business. Contact to us to our specialist corporate web designers to create
Web Design Books Page 2
Web Design Books Page 2      ...; The Useful Web Design Books This page has been created to provide information on useful books themed around all aspects of web design. Whether you are new
What is E-Commerce Web Design
What is E-Commerce Web Design...’s e-commerce design solutions. Our e-commerce web design comes..., around the corner or around the world using our professional Web design
Web Design Packages, Website Design Packages
design Standard/Custom Shopping cart web design Graphics/ Flash...' and enjoy the advantage of perfect custom business web design solutions... Custom Website Design for Business Custom Website Design has become one
Web Design Packages, Website Design Packages
Custom Website Design Custom website designs means the designing... special service on custom web designing since last few years. The team of our... on the responsibilities of completing the custom web designing project
Web Design Packages, Website Design Packages
Why Custom Website Designing? The Custom Web Designing means the designing... different. Thus to design and to develop the site according to general... website design? The answer is simple. A custom website design reflects the image
Web Development Services,Web Design Development Services,Website Developement Services India
Web Development Services RoseIndia.net is a specialize software firms.../server platform as well as web domain. First of all we do study and understand... information system to fulfill the requirements and design desired by the customer
Fashion Web Templates
, Croquis. The Fashion Design web templates are available in different sizes and types... templates or Fashion Flash Web designing Templates? We offer creative fashion web design templates for Models, Designers, Fashion Magazines and Modeling agencies
What is Tableless Website Design
What is Tableless Website Design The term web design refers to fine art... of the methods of designing is known as tableless web design. The tableless design... that improve the accessibility of the web. Besides, tableless design is more search
Web development - Introduction
a web site for the World Wide Web or an internet that includes web design, web... for a complete website that include Graphic design/web design, Information... Web development - Introduction     
Website Designing Company India
cutting edge superior quality web design solutions to boost your business. Our skilled web designers have a long experience and amazing imagination power... website design, 3-d animation web designing, e-commerce, e-business, shopping
Website Migration Services The Ins And Outs Of A Popular New Trend
Website migration services are an essential part of web design these days... will be happy to know that it is easier than ever before. With web migration... of the necessary information regarding web migration A request to your
real+footer - Java Beginners
real+footer   Copyright 2010 P.A. Property | Web Design Brisbane
Spry framework for Ajax
experience for their users. It is designed to bring Ajax to the web design... Spry framework for Ajax       The Spry framework for Ajax is a JavaScript library for web designers
Software Website Templates
features of software web design templates are hardware, software services, software... for the web developing company. We offer e-commerce software templates... web designs. Our Software Web templates are easily customizable to better
Real Estate WebsiteTemplates
the pressure of making complex web designs. Our one stop solutions for real estate web design are as per professional guidelines. We focus on each small and big... are ready to create a professional real estate web site. If you really need
What is Web Designing
are endless through effective and efficient Web Design. Web Design is an art... and derive solutions so that you can get best of it. Roseindia Web Design...What is Web Designing The Internet has redefined the borders of our modern
Database Technology
design/web design, Information architecture and copywriting/copyediting with web... management, Quality Analysis, software testing, web administration and many other
Web Designing India,Web Designing Company,Delhi Web Designing Company,Web Designing Outsourcing India
Web Design Animation needs the higher skill of work and experience... transaction and online services. Corporate Web Design Services... made design web fulfills the needs of the client?s business or personal
Open Source Templatess
, OpenOffice. The truth is that open source web design works nothing like OS software. The main use for open source web design is inspiration. Clients could... websites. Open source web design doesn?t serve much more usefulness than
What is Static Website
. Roseindia’s Web Designer offers excellent web design solutions for all your online activities. We are reputed web design firm and offer numerous web solutions and services including static web design and static web page
Web Site Goals - Goal of Web Designing
of the company or client, it becomes worthless. So the basic goal of a web design... and the client. What is Custom Web Design? Custom web site is little bit... designing in RoseIndia.net? There are following steps of web design process: Planning
Web Development in India,Web Development in India Outsourcing
responsibility of the web developer to make fine blend of content and design so that it can... design in India goes through a series of process like fixing up the client's web... and web design objectives. Experts who have expertise knowledge of their fields do
Rose India
though Web. We have a wide range of projects completed online ? including software development, web design, creative services, research and more...  Welcome to RoseIndia. The purpose of this web
Corporate Website Design
Corporate Website Design What is Web... is Banner Design Banner is a graphical web.... What is Tableless Website Design The term web

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.