Posts

Phone book application example - Java

Image
This post will show one example of a PhoneBook Application developed using Java language. All of the contacts will be store into a .txt file without using the database. This is an example only. You can change the layout or add some features to this example. Note: This tutorial using Netbean v 7.4 Step by step: Create a New Project and choose Java Application Rename Project Name to PhoneContact Delete file PhoneContact.java Add New JFrame Form under package phonecontact and change class Name to MainUI Drag and drop java Swing controller into frame. Refer MainUI below. ( Note: you can change the position of button as you like)   Add new JFrame Form under package phonecontact and change class name to AddEditForm. Drag and drop java sing controller into frame, Refer AddEditForm image below. Create 2 Java Class. Contact.java and ContactsUtility.java. Copy paste the code behind of each java class and frame.   MainUI code behind  import java.awt.event.WindowAdapter; import java.awt.event.Win

MVC - URL Routing

Image
   The segments in an examle URL The first segment contains the word Admin , and the second segment contains the word Index . To the human eye, it is obvious that the first segment relates to the controller and the second segment relates to the action. But, of course, we need to express this relationship in a way that the routing system can understand. Here is a URL pattern that does this: {controller}/{action} or {controller}/{action}/id or {controller}/{action}/id?querystring2=&querystring3=  Note : id, querystring2, and querystring 3 is a parameter in the controller . When processing an incoming request, the job of the routing system is to match the URL that has been requested to a pattern and extract values from the URL for the segment variables defined in the pattern. The segment variables are expressed using braces (the { and } characters). The example pattern has two segment variables with the names controller and action , and so the value of the controller segment variable

Understanding the ASP.NET MVC Framework Pattern

Image
In high-level terms, the MVC pattern means that an MVC application will be split into at least three pieces: Models , which contain or represent the data that users work with. These can be simple view models, which just represent data being transferred between views and controllers; or they can be domain models, which contain the data in a business domain as well as the operations, transformations, and rules for manipulating that data. Views , which are used to render some part of the model as a user interface. Controllers , which process incoming requests, perform operations on the model,and select views to render to the user. Models are the definition of the universe your application works in. In a banking application, for example, the model represents everything in the bank that the application supports, such as accounts, the general ledger, and credit limits for customers as well as the operations that can be used to manipulate the data in the model, such as depositing funds and ma