Showing posts with label wt jntuh. Show all posts
Showing posts with label wt jntuh. Show all posts
Thursday, 9 March 2017
Wednesday, 15 February 2017
Handling Sessions in Servlets web technologies jntuh
A web application takes a name as input and on submit it show a hello<name> page where <name> is taken from the request, it shows the start time and a logout button on clicking this button it should show a logout page with thank you<name> and duration of usage(use session).
To implement the above program in servlets following folder structure is to be followed:
In the src folder all the required files for our application should be kept.
Below snapshots shows u detail of all the programs
home.html
index.html
op.html
res.html
FirstServlet.java
logout.java
After Compilation of your servlets keep the .class files in classes folder as shown below
Following are the images and css files:
The WEB-INF folder structure is as follows
The output of servlet is as follows:
Sunday, 12 February 2017
wt calculator program using servlets
CALCULATOR PROGRAM
AIM: To implement calculator operations using servlets and access the results stored in database
The below image shows the directory structure to be followed in tomcat server
After compiling java programs place class files in classes folder
To use database we require mysqlconnector.jar file which should be placed in lib folder.
Below is the deployment descriptor which gives the details about servlet,servlet class,url-pattern
All the source code file are kept in src folder.
This is the main page where we are creating frames and accessing servlets in it.
The File which gives the details about left frame.
Calculator html file.Notice the target attribute here.
The file for another frame where results are showed.
This is the calculator servlet.
Calculator HTML file.
Calculator results page.
Calculator db servlet.
Tomcat Manager page.U can see the deployed calc project.
Calculator index page running on tomcat server.
Calculator table in Database.
Saturday, 24 October 2015
OBJECT ORIENTED PROGRAMMING
OBJECT ORIENTED PROGRAMMING
In this a main program is divided into small objects
depending on the problem. Functions of object are linked with object using
message passing. Data and functions of each individual object act like a single
unit.
Data gets more importance than function in the program.
Each object controls its own data.
Data hiding is possible in OOP which prevents illegal access
of function from outside of it.
More data and function can be added to program if required.
It follows Bottom-up approach for program design. Popular Example: c++,java
From the above para we can infer that an object is an
important part over here.So what an object is?
It has many definitions.Lets get to the basic one
thatis “it is a real world entity”.It
could be a desk,T.V, bicycle etc.
These objects share two characteristic:
1.
State
2.
Behaviour
AN example would be :
A desktop lamp which has 2 states – (on and off) and 2
behavior (turn on && turn off).
An object stores its state in fields (variables) and exposes
its behaviour through methods(functions).
Methods operate on an objects internal state and serve as
the primary mechanism for object-object communication.
Features of OOP:
1.class
2.object
3.encapsulation
4.abstraction
5.inheritance
6.message passing
7.polymorphism.
Lets discuss each in detail.
1.
Class
Can be said as a
blueprint to create objects.This blueprint has attributes and methods that all
created object share.
A class can be a person,place or thing.Fundamentally it
encapsulates state andbehavior
Syntax of class:
class class_name{
properties(variables);
Action(methods);
}
Variables inside a class are called instance
variables(Things that object knows about itself).
Variables inside a method are called method variables.
Methods are things an object can do.
When we create a class think about the objects that will be created from that class type.
Example program for class explanation:
The below program describes the importance of objects .
Wednesday, 30 September 2015
First Java Program
Before initiating this let me make it very clear "Java is Case Sensitive Language".For example if u have a method called forth() n if u have written Forth() while accessing this method than it is not correct as compiler might throw an error saying method not found.
To begin with we require following:
1.An IDE--- NetBeans 8.0 for windows 8.U can use different version compatible with your Operating System.
So Over here what u do is create a Java Application n start with your first program.
The First program is shown below:
You can view the output as shown.
If you just want to opt for manual editor like notepad for executing java program then here are the screens which demonstrate the procedure.
You might be wondering why there is no import stmt just like how we include header files in C, because even if we don't mention the package gets imported by default over here.This package is java.lang.* package.
To begin with we require following:
1.An IDE--- NetBeans 8.0 for windows 8.U can use different version compatible with your Operating System.
So Over here what u do is create a Java Application n start with your first program.
The First program is shown below:
You can view the output as shown.
If you just want to opt for manual editor like notepad for executing java program then here are the screens which demonstrate the procedure.
You might be wondering why there is no import stmt just like how we include header files in C, because even if we don't mention the package gets imported by default over here.This package is java.lang.* package.
Subscribe to:
Posts (Atom)
