Convert XML file to String Object in Java.

Hello Friends,

This is one of my tutorials in java with respect to XML. Sometimes while working with web-services we may come accross with the requirements of sending the updates to the web-service via a XML file. For the same you may need to convert the XML file into a stream of String (however we can pass XML file to web-services for updation). But, at some times if you need to update the values or attributes of the XML and then send it as s String then following code will do it for you.

Continue reading

Collections in Java Part III : List

Hello Friends,

 

This is part III for collections tutorial. Earlier we have discussed regarding SET collection interface in part II. In this, we will be focusing on an interface that is used when the sequence of the elements needs to be maintained, yes thats right its LIST interface.

List interface in Java Collection Framework also extends the base interface, Collection. The hierarchy of List interface and its implemented classes can be shown as: Continue reading

Java Print Triangle Example.

Hello Friends,

This is one of the basic examples for newbies who are still in the learning phase. :) Most of you may get an assignment to print an Triangle of * or numbers or serial number etc. So, this example if for all those guys n gals. In this example we will print a Right angle triangle where we will print the sequence something like:

1
23
456
78910

Continue reading

FDMA vs TDMA.

Hello Friends,

This is regarding the terms from Computer Networks TDMA and FDMA. These two pre-3G technologies that have been utilized to improve the performance of the 2G network.

FDMA (Frequency Division Multiplexing Access):

FDMA is a method of dividing a single band into 30 discrete channels. Each channel would then be capable of handling separate traffic, whether it’s a call or a data transfer. This is a higher level of multiplexing and should not be confused with FDM (Frequency Division Multiplexing) which is a low level multiplexing process and occurs on the physical layer. FDMA hardware includes high performance filters that also help it in avoiding near-far problems which can deteriorate the call quality. Continue reading

Including a file into a JSP file.

Hello Friends,

This is one of the simple tutorials on jsp. Most of the time in any of the web application we need some part of the application on almost each of the pages. So, writing the code in each of the pages is really tedious and is not the best practice. For example, if we have a web application where we have to use the Header code and Footer code on every page then its the best practice to write the code once in a separate file and then import that file or its contents into the page where we want it to be displayed.

Continue reading

Login Example: JSP and Servlets: Part II.

Hello Friends,

The Login application tutorial continues here in part II. Check Part I here.

Step 4) Now, we need to create a Servlet file for the redirection of the jsp pages. In the src folder under the package come2niks, add the Servlet file and name it as LoginServlet. As discussed earlier this servlet file will get the user details from the Bean file and then it will create a Session for that user only if the user is a valid user. And accordingly it will redirect to the respective jsp pages. You can use the default code which Eclipse generates while Servlet creation, the only change you need to do is in doGet() method. Continue reading

Login Example – JSP and Servlets: Part I.

Hello Friends,

This is one of the tutorials on JSP and Servlets. In this we will discuss and create a simple login application using servlets and JSP where we will connect to the DB for the user credentials and then authenticate the users accordingly. First of all we will discuss about what we will need for this.

JSP Pages:

We will create three JSP pages which will be the only viewable parts of our code. The three pages will be as Login Page, Login Success page and the Invalid Login page. Continue reading

JDBC – Insert, Update and Delete example.

Hello Friends,

This is the simple example for executing the SQL statements to INSERT, UPDATE or DELETE any records from the database using JDBC. In the below code I have explained all the three operations. When we insert, update or delete any records from the database we are updating the database, hence we use the executeUpdate() function with the Statement.

Continue reading