View RSS Feed

All Blog Entries

  1. Hidden Fields

    by , 01-01-2012 at 05:07 PM
    Hidden Fields present on the pages are able to maintain the state. They are not able to be seen on browsers. The servers treat both non-hidden and hidden fields in similar way.

    <INPUT type=”hidden” name=”Firstname” value=”Peter”>
    <INPUT type=”hidden” name=”Lastname” value=”Smith”>

    The hidden field’s disadvantage is that they might expose certain private or sensitive information, to others.

    Updated 01-14-2012 at 06:56 PM by Servlet

    Categories
    Field
  2. Explain declarative security for WEB applications

    by , 01-01-2012 at 05:03 PM
    Declarative security is implemented by the Servlet containers. Administration takes place via deployment descriptor web.xml file. Servlets & JSP pages along with the declarative security will become security aware code free. URLs could be protected via web.xml as it has been shown below:

    XML Code: This is a web.xml with the security tags
    <web-app>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>PrivateAndSensitive</web-resource-name>
    <url-pattern>/private/*</url-pattern>
    ...

    Updated 01-14-2012 at 06:52 PM by Servlet

    Categories
    Security
  3. What is a filter, and how does it work

    by , 01-01-2012 at 04:57 PM
    Responses and requests are intercepted dynamically by a filter so that to transform the information present in responses of requests. However, responses are not typically created by them. For transformation of the response from JSP or Servlet filters are used before it is sent back to client. Reusability gets improved by the filters by placement of the recurring tasks as a reusable unit in the filter.

    Better way of thinking servlet filters is to consider steps whose response is sent ...

    Updated 01-15-2012 at 08:37 AM by Servlet

    Categories
    Filter
  4. Servlet Life Cycle

    by , 01-01-2012 at 04:53 PM
    In order to manage the life cycle of a Servlets, Web container is mainly responsible. Servlets instance gets created by the web container which calls the init() method. At init() method completion, Servlets is present in a ready state to service the requests from client. Servlets service method is being called by container to handle every request, by spawning new threads. For every request, from thread pool of the web container there also exists the possibility to have one threaded servlet. Before ...

    Updated 01-15-2012 at 08:38 AM by Servlet

    Categories
    Session
  5. HTTP Sessions

    by , 01-01-2012 at 04:50 PM
    One of the recommended approaches is HTTP session. A request is being identified by the session which is originated from similar browser during the conversation time period. Same session could be shared by all servlets. The JSESSIONID gets generated by server and is passed via cookies to the client, Built in SSL mechanism or URL rewriting (if cookies get off). For minimizing the object’s size stored in session, care shall be taken. To obtain the session in Java servlet proceed as following:
    ...

    Updated 01-15-2012 at 08:35 AM by Servlet

    Categories
    Session
  6. J2EE class loaders

    by , 01-01-2012 at 04:44 PM
    See the figure below to see J2EE application server sample class loader hierarchy. As it has been shown in the diagram, “system class path” class loaders are parents of specific class loaders. If parent class loaders are present above “system class path” in hierarchy it means child class loaders have visibility to those classes that have been loaded by parents. However, when a parent class loader is present below “system-Class path” child class loaders will have visibility only into those classes ...

    Updated 01-15-2012 at 08:33 AM by J2EE

    Categories
    Tutorial
  7. Deployment Descriptors

    by , 01-01-2012 at 04:40 PM
    A deployment descriptor consists of a XML based text file along with “.xml” extension which describes deployment settings of a component. J2EE application along with modules consists of their deployment descriptor. Attention shall be paid to those elements that have been marked as bold in deployment descriptor files samples, given below.

    Application.xml: is considered as a standard deployment descriptor of J2EE, which has structural information as following: WEB war modules, EJB jar ...

    Updated 01-14-2012 at 06:41 PM by J2EE

    Categories
    Deployment Descriptor , Deployment
  8. What are ear, war and jar files

    by , 01-01-2012 at 04:34 PM
    ear, jar and war are standard application deployment archive files. As they are considered standard therefore any kind of application server is well aware that how to deploy or unpack them.

    An EAR file (standard JAR file) has an “.ear” extension, which is also known as Enterprise Archive file. J2EE application along with its modules is delivered into EAR file. Other JAR files couldn’t be present in JAR files. However, WAR and EAR files possess JAR files. An EAR file has all WARs and ...

    Updated 01-15-2012 at 08:32 AM by J2EE

    Tags: ear, jar, war Add / Edit Tags
    Categories
    EAR , WAR
  9. Explain MVC architecture relating to J2EE

    by , 01-01-2012 at 04:31 PM
    MVC or Model View Controller architecture divides display functionality and maintains data to reduce the degree of coupling between components.

    Name:  4.JPG
Views: 12870
Size:  60.5 KB

    J2EE MVC

    A model presents the state and core business logic. Data present in database is mapped by the model and holds the core business logic.

    A View renders model’s contents. Data is accessed by a view from the model and display logic is added for presentation of the ...

    Updated 01-15-2012 at 08:30 AM by J2EE

    Categories
    Architecture
  10. The advantages of a 3-tiered or n-tiered application

    by , 01-01-2012 at 04:27 PM
    Multi-tier or 3-tier architectures compel separation between business logic, presentation logic and database logic. Few important benefits are detailed over here:

    Manageability: Every tier can be upgraded, monitored or tuned independently & different duties could be assigned to different tiers.
    Scalability: More hardware could get added up and also permits the clustering that is horizontal scaling.
    Maintainability: Up gradation or other changes are performed ...
    Categories
    Architecture
  11. J2EE tiers

    by , 01-01-2012 at 04:25 PM
    Client tier presents Java, Web browser, or other applications like WAP phone, Applet etc. A request is sent to the Web server by the Client tier. Request is then forwarded to JSP or Servlet, or returns static content in case it is in Web server.

    Presentation tier summarizes the presentation logic that is required for server clients. A JSP or Servlet present in presentation tier intercepts requests of clients, manages logons, or sessions. Business services are being accessed and finally ...

    Updated 01-15-2012 at 08:29 AM by J2EE

    Tags: j2ee, tiers Add / Edit Tags
    Categories
    Architecture
  12. J2EE 3-tier or n-tier architecture

    by , 01-01-2012 at 04:15 PM
    The J2EE platform is basically a multi-tiered system. Functionally, a tier is system’s partitioning. In 3-tier system, every tier has its own unique responsibility. Every tier is loosely coupled and logically separated from each other.

    Name:  2.JPG
Views: 9552
Size:  40.9 KB

    J2EE Architecture

    Updated 01-15-2012 at 08:28 AM by J2EE

    Tags: 3-tier, j2ee, n-tier Add / Edit Tags
    Categories
    Architecture
  13. Java EE Clients

    by , 01-01-2012 at 04:13 PM
    J2EE clients are considered to be those components, services, applications and systems that have access to the J2EE environment so that to access a service or to fulfill a request. Being dependent upon an enterprise J2EE environment’s horizon and scope, there may be simple HTTP requests or complex interactions among different J2EE servers present over the network. J2EE Client Access has following types:
    • Accessing business logic services in EJB:

    • For example, Funds transfer
    ...
    Categories
    Architecture
  14. Java EE Components

    by , 01-01-2012 at 04:08 PM
    The J2EE platform comprises of J2EE services, protocols, components and (API) Application Programming Interfaces. Functionality is being provided by J2EE to develop distributed and multi-tiered Web based applications. A J2EE component is considered to be a functional and self contained software unit which has been assembled to J2EE application, along with related files and classes, to do communication with other components. Following components are present in J2EE.

    1. Applet
    ...

    Updated 01-15-2012 at 08:29 AM by J2EE

    Categories
    Architecture
  15. Look of a Calculator

    by , 12-30-2011 at 06:37 PM
    Java Code:
    package myPackage;
    
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.GridLayout;
    
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    
    public class SimpleCalculator {
    
    	public static void main(String[] args) 
    	{
    		JFrame myFrame = new JFrame( "Testing" );
    ...
    Categories
    Uncategorized
  16. A Simple GridLayout Example

    by , 12-29-2011 at 01:12 AM
    Java Code:
    package myPackage;
    
    import java.awt.Container;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    
    import javax.swing.JButton;
    import javax.swing.JFrame;
    
    public class GridLayoutFrame extends JFrame implements ActionListener
    {
    	
    	private JButton[] buttons; // array of buttons
    	private static final String[] names = {"one", "two", "three"
    ...
    Categories
    Uncategorized
  17. JList Multiple Selection and Copying with a Button to Another JList Example

    by , 12-28-2011 at 11:33 PM
    Java Code:
    package myPackage;
    
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.ListSelectionModel;
    
    public class MultipleSelectionFrame extends JFrame 
    {
    	private static final long	serialVersionUID	= 1L;
    	private JList colorJList;
    ...
    Categories
    Uncategorized
  18. JList Example

    by , 12-28-2011 at 12:17 AM
    Java Code:
    package myPackage;
    
    import java.awt.FlowLayout;
    import java.awt.GridLayout;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.ListSelectionModel;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    
    public class ListFrame extends JFrame
    {
    	JList myJList;
    	String[] colorrs;
    ...
    Categories
    Uncategorized
  19. Compilation of better code advice

    by , 12-27-2011 at 11:14 PM
    Writing Better Java Code
    This is a compilation of advice on writing more efficient Java code. Whenever I find more I'll add them to the list. If you spot something fishy do say so, so that I will correct it.

    Faster code:
    1. Use integer instead of long (long is a 64bit integer, most processors are 32bit so operations can run 2-4 times faster with an int)
    2. Use local variables instead of class members
    3. Use shorthand when evaluation booleans
    Java Code:
    return
    ...

    Updated 12-27-2011 at 11:26 PM by ozzyman

    Categories
    Uncategorized
  20. [SOLVED] optionwindow

    by , 12-26-2011 at 08:20 PM
    Quote Originally Posted by keffie91 View Post
    Hello I have created an optionwindow for my chat program, but if i open the option window and click the cross in the right corner, not only the optionwindow terminates but also the chatprogram. Can someone tell what i can do about it, and are there other ways to make a kind of optionwindow?

    thanks keffie91

    this is the source:

    ChatProgram.java
    Java Code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    ...
    Categories
    Uncategorized
  21. A simple GUI code

    by , 12-18-2011 at 02:25 PM
    Java Code:
    package myPackage;
    import java.awt.Color;
    import java.awt.FlowLayout;
    import javax.swing.*;
    @SuppressWarnings("serial")
    public class SamsLearning extends JFrame {
    	public SamsLearning() {
    		super();
    		this.setTitle("My Title");
    		this.setLookAndFeel();
    		this.setSize(500,500);
    		MyButtonClass myButton = new MyButtonClass("Play");
    		MyButtonClass myButton2 = new MyButtonClass("Stop");
    ...
    Categories
    Uncategorized
  22. Building your first Spring 3 MVC application using Eclipse

    by , 12-10-2011 at 07:51 AM
    Spring is one of the most popular application frameworks for Java development. The framework comes with various projects like Spring Core, Spring Data, Spring Web Services, Spring MVC…Each project suits for a particular area, and for the area of web development, Spring MVC is very well-known.
    Spring MVC makes web development easier by separating the three components: Model, View, and Controller.

    • The model represents the principal data that is managed by the application.
    ...
    Tags: eclipse, mvc, spring 3 Add / Edit Tags
    Categories
    MVC , Spring 3 , Eclipse
  23. How to validate form in Struts 2's action

    by , 12-10-2011 at 06:41 AM
    This article will guide you how to validate a form from Strut’s action classes. We are going to develop a simple web application that allows user to enter email address and password to login. The email and password will be validated on the server side, in the action class.
    You are assumed to be familiar with Java web development using Eclipse IDE and understand how a Struts application works at the fundamental level. You also know how to deploy a Java web application on Tomcat server. ...
  24. How to write a Servlet that sends file to user to download

    by , 12-10-2011 at 05:54 AM
    Downloading files is a very popular task on the World Wide Web. Users click on a download link and the file gets downloaded into their computer. Technically, a download can be achieved by either of the two forms as following:

    • Direct link: the link points directly to a file on a server, for example: http://www.server.com/download/report.xls. This kind of link requires no additional effort on the server side, since the web server automatically hands the file over to users as
    ...
    Categories
    File , Servlet
  25. How to write a Servlet that uploads file to server

    by , 12-10-2011 at 05:19 AM
    Uploading files is a common operation for internet applications. Doing so in Java is pretty simple. This article will guide you through some steps to write a Java servlet that uploads a file then store it on the server.
    Before going on, this article assumes that you have some Java web development experience, you are be able to use Eclipse IDE to write the code and deploy a web application on Tomcat 6.0 server.
    The web application we are going to build contains the following components: ...
    Tags: file, servlet, upload Add / Edit Tags
    Categories
    Servlet , File
  26. Building your first Struts 2 application using Eclipse

    by , 12-09-2011 at 05:30 PM
    Struts is one of the most popular web framework for Java. It comes with 2 major branches, Struts 1 and Struts 2. Both implement MVC architecture but Struts 2 is much simpler, easier to build, deploy and maintain than Struts 1.
    This article will guide you through the steps to build a simple Struts 2 application using Eclipse IDE.

    Download Struts 2 and required libraries

    Download latest version of Struts 2 from Download a Release
    Select the full distribution, ...
    Categories
    Eclipse , Struts
  27. How to use model for your table in Swing application

    by , 12-09-2011 at 10:06 AM
    Swing provides a very flexible widget, it is the JTable. Using the JTable component, you can display tabular data in form of columns and rows, plus allowing the user to edit and save the data if needed.

    Why need to use a model

    The Java Swing architecture separates the view and the model of a UI component. The view is how the component is drawn on the screen and gets changed if the user interacts with the component. The model is how data is structured and organized. The ...

    Updated 12-09-2011 at 04:35 PM by Java Swing

    Categories
    JTable , Model
  28. How to send HTTP request to a URL

    by , 12-09-2011 at 08:28 AM
    Sometimes an application needs to communicate to a web server to send/receive data through HTTP. For example, connecting to a financial service to get stock price, posting user data to server to save in database, or checking for a new version of an application if available.

    This article will guide you to write a generic utility method that can connect to a specified URL with either HTTP’s GET/POST method, and attaching parameters to the request. The method will return server’s response ...
    Tags: http, java, post, request, url Add / Edit Tags
    Categories
    HTTP , URL
  29. How to create a system tray for your application

    by , 12-09-2011 at 07:46 AM
    Since Java SE 6, programmers can add an icon for their applications in the system tray area of the operating system. A common usage scenario of the system tray is having a popup menu showing when users right click on the icon. The popup menu presents to users with common tasks that the application provides. When users double click on the icon, they will access the default action of the program. The screenshot below depicts a tray icon and popup menu of an application in the Taskbar notification ...

    Updated 12-09-2011 at 04:38 PM by Java AWT

    Categories
    Tray , Java AWT
  30. How to sign a Java applet

    by , 12-09-2011 at 07:16 AM
    Why signing an applet?

    By default, a Java applet is running inside a restricted environment called “sandbox”. The sandbox isolates the applet outside the browser environment and user’s computer, preventing maliciously coded applets from running without user’s granted permission.
    Applets are considered to be untrusted if they are not signed with a security certificate. Untrusted applets are also referred to as unsigned applets. Being inside the security sandbox, unsigned applets ...

    Updated 12-09-2011 at 04:41 PM by Java Applet

    Categories
    Java Applet , Tutorial
Page 29 of 48 FirstFirst ... 19272829303139 ... LastLast