tech-freaks.com
  • Java Programming
    • Java Basics
    • JSP & Servlets
    • Javascript
    • Code Snippets
    • Websphere Commerce
  • Python
  • App Development
    • Jetpack Compose
  • Joomla
  • Gadgets Review
  1. You are here:  
  2. Home

Simple Registration Application using JSP, Servlets and JDBC connectivity to MySQL

Details
Written by: Tech Programmer
Category: JSP & Servlets
Created: 17 February 2013
Hits: 6232

Requirement

  • Create a Registration Form to enter user name, password, first name, last name, email address, secret question, answer and register a new user to system.
  • Validate if the user name and password is not blank. Display error message to user, if either of them is blank.
  • Validate if the user name already exists and display an error message to the user
  • In the event of an error, ensure that registration form is displayed again with all prefilled information
  • On successful registration, set the user name in session and forward to home page.

Pre-requisites

  • MySQL and Tomcat is already installed
  • You have basic knowledge of MySQL to create tables and insert / update records
  • You have basic knowledge of Java and J2EE web applications
  • Have your favorite IDE for developing / reviewing code
  • This workshop adds the registration functionality to the previous article Simple Login Application. Reviewing that article prior to this article would help.

Concepts Covered

  • JDBC connectivity to MySQL from Servlet
  • Simple application of JSTL tag
  • Using request attribute and request parameters
  • Basic error handling concepts

NOTE: Don't even think of using the code as is for a production environment 
This is just for education purpose but you can take inspiration from this code.

Read more …

Simple Login Application using JSP, Servlets and JDBC connectivity to MySQL

Details
Written by: Tech Programmer
Category: JSP & Servlets
Created: 15 June 2012
Hits: 9395
2 comments on “Simple Login Application using JSP, Servlets and JDBC connectivity to MySQL”

Requirement

  • Create a Login page to enter user name and password
  • On submit, validate the user name / password against MySQL database
  • If the authentication is successful, forward to home page showing welcome message along with the user name
  • If the authentication fails, return back to the login page with appropriate error message.
  • If there is exception / errors during authentication process return back to login page with appropriate error message.

Pre-requisites

  • MySQL and Tomcat is already installed
  • You have basic knowledge of MySQL to create tables and insert / update records
  • You have basic knowledge of Java and J2EE web applications
  • Have your favorite IDE for developing / reviewing code.

Concepts Covered

  • JDBC connectivity to MySQL from Servlet
  • Simple application of JSTL tag
  • Using session variable in Servlet
  • Polymorphism concept using JDBC
  • Basic error handling concepts

NOTE: Don't even think of using the code as is for a production environment
This is just for education purpose but you can take inspiration from this code.


Checkout our similar article on simple login application using Struts 2 Framework


Read more …

Session Based Shopping Cart

Details
Written by: Tech Programmer
Category: JSP & Servlets
Created: 23 September 2008
Hits: 12035
50 comments on “Session Based Shopping Cart”

User Rating: 1 / 5

This workshop is for you, if:

  • You want to get hands on feel of JSP and Servlets in real life scenarios
  • You are dying to write some code and see it work
  • You have heard enough about shopping carts and finally want to see what the heck, they are made of!

This workshop is not for you, if:

  • You do not have any idea about JSP, Servlets or core Java
  • You are looking for a production quality or ready to use shopping cart

Pre-requisites:

  • Knowledge of Java fundamentals and collection framework
  • JSP and servlet knowledge, especially, about session handling and JSTL
  • Setup of environment: Tomcat and IDE. Check article
    Eclipse Tomcat integration

Read More...

Multiple ways to add sub elements to XML elements using Python

Details
Written by: Tech Programmer
Category: Python
Created: 27 February 2024
Hits: 4080
2 comments on “Multiple ways to add sub elements to XML elements using Python”

Recently, I have been working on manipulating xmls and csvs using Python. I was amazed by how quick and easy it is manipulate these files in Python. In this article I cover the flexibility of the python and xml.etree.ElementTree API. Let us jump into it.

Problem

Given a dictionary of words and meaning in multiple language. We want to manipulate the xml and add another meaning in French language for the word beauty. 

Read more …

Jetpack Compose Custom Datetime Picker

Custom datetime picker composable with jetpack compose

Details
Written by: Tech Programmer
Category: Jetpack Compose
Created: 20 March 2024
Hits: 3398
No comments on “Custom datetime picker composable with jetpack compose”

Recently, I started working on a new Android project using Jetpack compose. I wanted to have two datetime field to capture start datetime and end datetime using the inbuilt pickers. The date and time selected from the picker should populate single text field with date and time together or two separate text fields representing the date and time respectively.

Much to my surprise there are no datetime picker composable as of now. Furthermore, I realized that  DatePickerDialog and DatePicker exists but managing populating the text field with DatePicker state needs to be done by custom code. Finally, for time, TimePicker exists but there is no out of the box TimePickerDialog as of now. In the post, I am sharing the custom datetime composable that I created to accomplish my requirements.

Read more …

Copyright © 2024 www.tech-freaks.com. All Rights Reserved.