Search This Blog

part2-servlet assignment and questions

1.) Write an application with 2 Servlet Classes. In one Servlet, get request information from the user and set the collected value as attribute at request and application scopes. Display both attribute values on request of both the Servlets and show the difference between attributes at both levels(scope).
2.) Write a Servlet class, implementing SingleThreadModel and explain the performance degradation occurring with that kind of implementation.
3.) Write a Servlet Class and create new session using the HttpSession object. Display session information to the user, including Session ID, Session creation time and Last Accessed time.
4.) Write an application with a login page,
a. Login Page requires Username and Password for Authentication (matching username and password, already present in DB) and sends request for Home Page.
b. On Authentication, User must be shown the Home Page (servlet) and Session must be created and maintained otherwise show appropriate error message.
c. On the Home Page display 2 links to other Servlets. Similarly other pages must have a link to Home Page.
d. Logout link must be there on all the servlets. User must be given access to all the pages with link to each other, as long as the session is valid. On click of Logout session must be invalidated. If session is destroyed user must be sent to Login Page Again.
5.) In addition to the above question,
a. Use DD configuration to set session time-out value and show how session expires after the specified time.
b. Use setMaxInactiveInterval method to set and overwrite the DD settings and verify the result.
6.) Use getSession(true) method in the above example and check for the condition when the old session is destroyed and new one is created, invalidate the session explicitly by calling invalidate method.
7.) Block (disable) the cookies in the client’s Browser and run the above program.
8.) Use the URL-Rewriting as fall-back mechanism in case the cookies are disabled by the browser with Question (5).
9.) Use Cookie Class object to store username at the Client machine sent by the user in question (5). Display the username retrieved on every page from the cookie object.
10.) Use ServletRequestListener on Home Page (servlet) to create DB connection object to be used for authentication in question(5).Use the HttpSessionEvent to destroy the DB connection object on creation of session in the question (5) .
11.) Write an application with 3 Servlets, 1 Database connection class and a ServletContextListener. Create one Database connection object, before request comes to any one of the 3 Servlet Classes. Use the connection object created, in all the 3 Servlets. 1st Servlet will handle request for emp table, 2nd for dept table and 3rd for salgrade table. Take input from the user in form of drop down menu. Display result in tabular format. Also provide synchronization to the shared database connection object.

part-1 servlet assignment question and solutions

cdac assignment dabc,desd,dac
1.) Write a Servlet to take name as request parameter from the user and display Welcome Page to the user with his name (with Get and Post HTTP methods).
2.) Write a Servlet with doGet method and extract all the request information along with the inputs given by the user in text field, radio button, checkbox and drop down menu.
3.) Create 2 HTML pages, one with GET method and one with POST method, with the action to the same Servlet. Handle both the requests using doGet and doPost methods.
4.) Write a Servlet to extract the multiple values sent with the request by the form with the same name.
5.) Write a Servlet class to extract names of the request headers, client’s browser information, cookies associated, the name of the HTTP method, remote port, local port, server port, content length. Justify the difference between Local Port and Server Port. Also use getIntHeader method and show how is it different from getHeader method.
6.) Write a Servlet class to download a file kept inside a folder within your application, on the request of the user. Take filename as input from the user and if file is not available show the appropriate message.
7.) Write a Servlet based query system, take query as input from the user in the textfield to extract the data from DataBase and display it to the user in tabular format.
8.) Write a Servlet program to redirect the request to some other page using sendRedirect method.
9.) Store email in DD as init-param name value pair. Write a Servlet to extract the initialization parameters inside the init method of your Servlet and display it within your service method.
10.) Write a Servlet program to override init method with ServletConfig parameter and repeat question (9).
11.) Write 3 Servlet classes and show one of them to the user based on the choice of the user taken as input by selecting Radio button.(You can use extra Servlet for logic part)
12.) In continuation to the above program,
a. ) Create a DD , store 3 parameter in the init param tag and one in the context param tag.
b. ) Display one out of 3 init params, on each of the servlet response based on some condition and context param with every response. Justify the difference between context param and init param.
13.) Write a Servlet Class to take empno as input from the user and update the salary of the user by calling the Stored Procedure and display the Updated Salary to the user.
for solutions please comment

what is cdac,how is cdac,what course there and how you can study there and enjoy

best thing i had done in my life is cdac but cdac you need to be smart to learn from there if you are fresher,you need to be smartworker+hradworker ,nights out and like 6 months your are in technical jail with only technical knowledge depends on you how much you can gain.Well i remained for 4 months all day and night in cdac in labs and class without bath sometimes without toothpaste,without food,sleeping on chairs,floors at night in cdac but thats what you need to do,if you are fresher and dont know any language any technical knowledge than just be mad like me.I never studied in my college but no regret as i learned java in 2 month and got job even the market is worst in 2008.Just if you are new to technical knowledge than dont rush in cdac to learn all things concentrate on any 1 language +c basics and create project as many as you can,hlp other people in labs in cdac and sleep only 4hrs and if you want to learn java than go for dabc course,cdac hyderabad .
any queries please comment here.
I am just helping all you guys but just take help from these slides and asssignment and try completing all of them yourself.
goodluck

LAST POST ASSIGNMENT SOLUTION

want to learn java,interview question,technical question in java or basci concepts than please go or core java prsentation core java basics

check assignment question on core java before checking answeres
core java assignment

here are solutions and some other programs assignments solutions in java
DOWNLOAD ALL
garbage collection example
garbage collection example
may be you guys like to know there are 2 alogrithms for garbage collection
1)mark and sweep
2) you search on google :)

Array example
array coping example

System properties of your computer program in java
properties program

System exit in java
exit program

Hashtree example in java
hashtree

linklist example in java
link list

treeset example in java
treeset

arraylist example in java
Arraylist

hashset demo
Hashset

if interested in jdbc tutorial than please go here
jdbc leaks and tutorial

LAST POST -ASSIGNMENT ON COLLECTION FRAMEWORK,GARBAGE COLLECTION,POJO CLASS USE,GETTER AND SETTER

you can go for this assignment as it consist of various modules of core java best of cdac tutorials :)
consist of math class,system properties,diffrences and concepts of fundamental java

Core Java Assignment – III



1. Write a program to demonstrate the use of equals method of Object class and compare its functionality with ( = = ) operator.


2. Modify program 1 with Integer class Object.Use the override equals method of Integer with two different object wrapping same primitive int value ( like - 10).demonstrate the difference in the output from program 1.


3. Demonstrate the use of ceil(), floor(), round(), random(), abs(), max(), min() methods of Math class.


4. Write a program to invoke garbage collector and show the details of free memory before and after the garbage collection.


5. Write a program to print all System properties using system class.


6. Define a method setMyProperty(String, String) to set your own system property and use the same system property in another method.


7. Define the following collections with some values
a. ArrayList
b. HashSet
c. HashMap
d. Hashtable
Iterate through all elements of collection using Enumeration and Iterator Interface and remove an element of each collection using these Interface.


8. Define a class Employee and make Employee classes objects persistent and then read those objects to print the value on console output.

9. Write a program to take the content from user through keyboard and save that content to a file using Buffered Streams.


10. Write a program to show different properties of a file or directory using File class Object.


I am uploading some files here which are java programs and codes for beginners ,newbie,noobs and even experinced in java.

SOLUTIONS-
click for answeres of this assignment

java exception handling solution

may be the files are in different order please open and try them
before solution please check this exception handling diagram
download

download the exception handling solution
download
download part2
download part3
download part4
download part 5
if you did not understood try this
download small tutorial

question and assignment on exception handling

assignment is for core java newbie,beginners,advanced,programmers and coders
exception handling questions and assignments with solution solved and some unsolved

here is

Core Java Assignment - II

1. Write a program to demonstrate the use of try, catch, finally throw and throws keywords and demonstrate the following points in the program.

a) Multiple catch blocks.
b) try-catch-finally combination.
c) try-finally combination.
d) Exception propagation among many methods.
e) Use of getMessage(), printStackTrace() function of Throwable class.
f) Nested try blocks

2. Write a program to throw a checked exception explicitly using 'throw' keyword and

a) Handle the exception in same method.
b) use throws clause and handle the exception in some other method (calling method)
c) Don't either handle or use the throws clause.

3. Repeat program 2 with unchecked Exception and demonstrate the difference in both program.

4. Create a user defined exception to check whether your employee exist in your data structure (use any data structure to store the employees - like array, ArrayList etc) and throw exception if name is not in the employees list. Use the catch and finally block to make an appropriat

SOLUTION FOR ASSIGNMENT BANK APPLICATION

here is solution uploaded on mediafirefor console bank application in core java for newbie,noobs,beginners .
This assignment is better if done itself ..
download
download

HINT FOR ASSIGNMENT

Hint for the assignment
go to java bank application question click here


Java console bank application demo
1) Create Customer class with the following methods.

private String custName = null;
private int ACC_NO = 0;
private Hashtable accountInfo = new Hashtable(); - Key can be one of SB_ACCOUNT or CURR_ACCOUNT defined

void depositeAmount(int ACC_TYPE, int amount) - Deposite amount into the corresponding account type.

void setCustomerName (String name) - Set the customer name

String getCustomerName () - Get the customer name

int getAccountNumber() - Get the account number

void setAccountNumber(int accno) - Set the account number



2) Create BankApplication class with the following methods.

private Hashtable customerInfo = new Hashtable() - Add new customer by taking his name as key and object
reference as value

addNewCustomer(Customer cust) - Add new customer to the bank application.

public void depositeAmount(String name, int ACC_TYPE, int amount) - Add amount to the corresponding customer's
account


3) Create a controlling class named BankingOperation with main method and accordingly instantiate objects of above classes.
This class should be outside the above package.

go for solution for solution click here

CORE JAVA ASSIGNMENT AND QUESTION

here are some java questions and assignment which are solved and unsolved


if you want to learn to solve this assignment go for core java tutorial and prsenation

click here

Java Assignments:

1) Create an employee class with relevant information like name, id, salary and create emplyoee objects.

2) Create Customer class with relevant information like name, address,
account number, current balance. Create BankApplication class and
add customers to the bank application with relevant methods like addCustomer,
deleteCustomer, updateCustomer and getCustomerInfo etc.

3) Create Account class with account type, account number,
minimum balance and current balance and provide corresponding
getter and setter methods along with calInterest method.
Create FixedDepositAccount, CurrAccount classes and
inherit methods from Account class. Use Account class in
Customer class to store account information in the customer object.

4) Create InsufficientBalance exception class and use it appropriately in Account class.

5) After every 5 min query BankApplication Object and display existing customer names.

go for hint-click for hint

go for solution-click for answere to assignment