Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

java(aim, algorithm) (1)

The document outlines various programming tasks aimed at creating web applications using servlets, JSP, and socket programming. Each task includes an aim and a detailed algorithm for implementation, covering functionalities such as displaying welcome messages, processing purchase orders, calculating student marks, and handling client-server communication. The tasks range from simple form handling to more complex applications like RMI and socket programming.

Uploaded by

varanyogesh789
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

java(aim, algorithm) (1)

The document outlines various programming tasks aimed at creating web applications using servlets, JSP, and socket programming. Each task includes an aim and a detailed algorithm for implementation, covering functionalities such as displaying welcome messages, processing purchase orders, calculating student marks, and handling client-server communication. The tasks range from simple form handling to more complex applications like RMI and socket programming.

Uploaded by

varanyogesh789
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

AIM:

Write a program to display welcome message using servlet.

ALGORITHM:

Step 1: Start the program.


Step 2: Define a servlet named 'first' that handles web requests.
Step 2.1: When a user visits the servlet's URL, it asks for their name.
Step 2.2: Once the user submits their name, the servlet greets them.
Step 3: Create an HTML page named Index.html.
Step 3.1: Display a form asking for the user's name.
Step 3.2: Provide a button to submit the form.
Step 4: Configure the servlet in the web.xml file.
Step 4.1: Map the 'first' servlet to a URL pattern (/first).
Step 4.2: Set the session timeout to 30 minutes.
Step 5: End the program.

_____________________________________

2. AIM:

Write a program to design purchase order from HTML form and Servlet.

ALGORITHM:

Step 1: Start the program.


Step 2: Create an HTML page named Index.html.
Step 3: Display a centered heading "Fruits Land" using <h4> tag.
Step 4: Create a table with borders to organize form elements.
Step 5: Include input fields for the following:
- Customer name (cname)
- Fruit name (fname) and Fruit rate (frate)
- Quantity (quantity) with a dropdown for type (Kg or Nos).
Step 6: Add Submit and Clear buttons to submit or reset the form.
Step 7: Create a Java servlet named 'display' to handle form submission.
Step 8: Override the 'doGet' method to process GET requests.
Step 9: Retrieve form data: customer name, fruit name, fruit rate, and quantity
Step 10: Calculate total price.
Step 12: Print an HTML table with the ordered details:
- Customer name
- Fruit name
- Fruit rate
- Quantity
- Total price.
Step 13: End the program.

_____________________________________

3. AIM:

Develop a program for calculating the percentage of marks of a student using JSP.

ALGORITHM:
Step 1: Start the program.
Step 2: Create an HTML form (Index.html) for entering student details and marks.
- Input fields for register number, name, and marks in three subjects.
- Submit button to send data to the JSP page.
Step 3: Create a JSP page (Marks.jsp) to process the form data &display the mark list.
Step 5: Retrieve parameters from the form: register, name, and subject marks.
Step 6: If any subject mark is less than 40:
Step 7: Display "Not To Evaluate" for total marks, percentage, and grade.
Step 8: If all subject marks are 40 or above:
- Calculate total marks, percentage, and determine grade.
Step 9: Display student's register number, name, total marks, and grade.
Step 10: End the program.

_____________________________________

4. AIM:

Design a purchase order form using Html form and JSP.

ALGORITHM:
Step 1: Start the program.
Step 2: Create an HTML form for users to input purchase details:
- Display a heading "PURCHASE ORDER FORM".
- Include input fields for name, product id, product name (pizza), quantity.
- Provide Submit and Clear buttons.
Step 3: Create a JSP page to process the form data display purchase details:
Step 4: Retrieve form data: name, product id, product name (pizza), quantity.
Step 5: Calculate the price for the selected pizza and drink based on the provided.
Step 6: Display the purchase details including name, product name, product price.
Step 7: End the program.
____________________________________

5. AIM:

Prepare a employee pay slip using JSP.

ALGORITHM:
Step 1: Start the program.
Step 2: Create an HTML form for users to input employee salary details:
- Display a heading "Employee Salary Statement".
- Include input fields for employee name, department, basic salary, TA(%).
- Provide Submit and Reset buttons.
Step 3: Create a JSP page to process the form data and display the salary statement:
Step 4: Retrieve form data: employee name, department, basic salary, TA(%).
Step 5: Calculate TA, DA, HRA, PF, and LIC amounts based on the provided.
- Calculate gross salary as the sum of basic salary and allowance.
-Calculate net salary as the difference between gross salary and deduction.
- Display the salary statement including employee name, department.
Step 4: End the program.

_____________________________________

6. AIM:

Write a program using JDBC for creating a table,Inserting and listout the records.

ALGORITHM:
Step 1: Start the program.
Step 2: Create a Database class:
- Inside the main method:
- Instantiate an object of the abc class.
Step 3: Create an abc class:
Step 3.1: Inside the main method:
- Establish a connection to the database using JDBC.
- Prepare an SQL statement to insert data into the "login" table.
- Set values for the parameters in the SQL statement.
- Execute the SQL statement to insert data into the database.
Step 4 : If the execution is successful:
- Print "Row updated successfully".
Step 5 : End the program.

_____________________________________
7. AIM:

Write a program using java servlet to handle form data.

ALGORITHM:

Step 1: Start the program.


Step 2: Create an HTML form (Index.html):
- Display a login form with fields for username and password.
Step 3: Create a display.java servlet:
Step 4: Get the username and password entered by the user from the request.
Step 5: Check if the password matches a predefined value ("santhoshk").
Step 6: If the password matches:
- Print a welcome message indicating the user is valid.
Step 7: If the password doesn't match:
- Print a message indicating the user is invalid.
Step 8: End the program.

_____________________________________

8. AIM:

Write a simple servlet program to create a table of all the headers it receives along with their
associated values.

ALGORITHM:
Step 1: Start the program.
Step 2: Define a servlet named "table" that handles HTTP requests.
Step 3: Handle HTTP GET requests:
a. Set the response content type to HTML.
b. Create an HTML document structure with a title and header.
c. Retrieve all header names from the request.
d. Close the HTML table and body.
step 4: Handle HTTP POST requests:
- Call the doGet method to handle POST requests.
Step 5: Configure the servlet in the web.xml file:
a. Map the servlet name "display1" to the servlet class "display1".
b. Map the servlet to the URL pattern "/display1".
Step 6:End the program.

_____________________________________

9. AIM:
Write a program in JSP by using session objects.

ALGORITHM:
Step 1: Start the process.
Step 2: User inputs their name in the HTML form (index.html).
Step 3: Upon submitting the form, the name is sent to session.jsp.
Step 4: In session.jsp:
a. The entered name is retrieved.
b. A welcome message is displayed with the entered name.
c. The name is stored in a session variable.
d. A link to output.jsp is provided.
Step 5: In output.jsp:
a. The stored name is retrieved from the session variable.
b. A greeting message is displayed using the retrieved name.
Step 6: End the program.

_____________________________________

10. AIM:

Write a program to build a simple Client Server application using RMI.

ALGORITHM:
Server Side:
Step 1: Define an interface (adder) that extends Remote with add that throws
RemoteException.
Step 2: Implement a class (server) that implements the adder interface and extends
UnicastRemoteObject.
Step 3: Write the add method in the server class to perform addition of two numbers.
Step 4: In the main method of the server class:
a. Create a registry on a specified port using LocateRegistry.createRegistry().
b. Bind the server object to the registry with a specific name using reg.rebind().
Client Side:
Step 1: Create a client class (client).
Step 2: In the main method of the client class:
a. Connect to the registry on the server's IP address and port number using
LocateRegistry.getRegistry().
b. Look up for the remote object by the name it was bound to on the server side using
reg.lookup().
c. Get user input for two numbers.
d. Cal l the add method on the remote object, passing the input numbers.
e. Display the result.
_____________________________________

11. AIM:

Create an applet for a calculator application.

ALGORITHM:
Step 1: Start the program.
Step 2: Set up the calculator layout with a display showing "0" and buttons for digits and
operators.
Step 3: Handle button clicks:
- If a digit button is clicked:
- If it's the first digit, display it.
- If it's not the first digit, append it to the existing number.
- If an operator button is clicked:
- If it's not the first digit, perform previous operation and update the display.
- Remember the operator clicked.
- Return true to indicate the action was handled.
Step 4: Perform calculations:
- If '=', update the saved value with the current value.
- If '+', add the current value to the saved value.
- If '-', set the saved value to the current value.
- If '*', multiply the saved value by the current value.
- If '/', divide the saved value by the current value.
- Update the display with the result.
Step 5: End the program.

_____________________________________

12. AIM:

Program to send a text message to another system and receive the text message from the
system by using socket programming.

ALGORITHM:
Server-Side Algorithm:
Step 1: Start the server program.
Step 2: Listen for incoming connections on port 4999.
Step 3: Accept a connection from a client.
Step 4: Read a message from the client.
Step 5: Print the received message from the client.
Step 6: Send a response message to the client.
Step 7: Close the connection.
Step 8: End the server program.
Client-Side Algorithm:
Step 1: Start the client program.
Step 2: Connect to the server running on localhost and port 4999.
Step 3: Send a message to the server.
Step 4: Receive a response message from the server.
Step 5: Print the received message from the server.
Step 6: Close the connection.
Step 7: End the client program.

_____________________________________

You might also like