web-design

Ads
 

web-design

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.

Ads









Related Tutorials/Questions & Answers:
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
what is php used for in web design
what is php used for in web design  what is php used for in web design
Advertisements
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
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 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
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
Top 10 Web Design Tools
of people accessing the web on their handheld device, web design is no more... across the devices. The task of choosing top 10 web design tools is no longer... on handheld devices. In choosing the best web design tools we have nevertheless
Top 10 Web Design Mistakes
Blaming the web design mistakes is a common behavior when a website faces... aspects is lost. There are many philosophies on classifying the web design mistakes... design mistakes nothing is as severe as presenting the content in back foot. Web
10 Common Web Design Mistakes
10 Common Web Design Mistakes Designing a website is the most crucial part... of business deliverables and outcomes. Web design is no more of just ornamental... discussion on top 10 common web design mistakes we must understand the effectiveness
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
Top 10 Web Design Trends
Top 10 Web Design Trends Website design is no more is just about looks... web design trends tend to evolve with change in technology and user interface... and appreciation, there have been different philosophies of web design that continued
Summer Internship Program for Web Development and Web Design
Summer Internship Program for Web Development and Web Design - Rose India... and knowledge in web development and design beside introducing you with the latest... will just be the ideal option for internship programs in web development and design
Top 10 Web Design Principles to Follow
Top 10 Web Design Principles to Follow Usefulness, utility and responsiveness... the effectiveness of your web presence. Web design principles mainly focus on how you can better create an interactive space for your audience or users. Web design trends
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
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
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
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 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
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
Top 10 Web Developer Tools
, content editor, web design, etc. While some categories of web tools... with Adobe web design capability, it is a perfect tool. Its fluid layouts and CSS3... tool. More than trendy design and sophistication attributes for a web
Top 10 Web Applications
, web security, web chat, social media, SEO, web design, online education or E.... Web Design Adobe Photoshop Yes, even though it is much well known...When new and newer range of web based applications are virtually changing our
Domain Registration in India, Domain Name Registration India, Cheap Domain Name Registration in India
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

Ads