Tuesday, May 5, 2009

Workshop 6: Enjoying the Ride: Web framework alternatives, scalability and flexibility

Developers may continue to build upon work with the OTBS using the topic reading to help with user registration and advanced login features from Hartl et al (2008).

o generate a controller and an action by adding a method(s) to a controller;
o create a view template for each action and to link to actions from views;
o use AJAX to improve the user experience;
Share your success by posting

progress comments and links etc to the Developers sub-forum site that has been set up for the Red team.


By following the example of the e-book "RailsSpace", I create the Home page of OTBS in my computer:


By clicking on the link: 'Register', The screen redirected to the user registration page:


The fields validation check for user registration:


Typing valid user information into the User Registration form, then submit it by clicking on 'Register!' button:


The return result of new user created successfully:


The user record in the database OTBS:


It is not easy to complete the above user registration page. I follow all the steps from charter 2 to charter 4 in the e-book 'RailsSpace', modify the contents to fit the need of the OTBS. Repeat of the debugging process by review the charters again and again.

I have learn from charter 2 to 4 in the e-book 'RailsSpace' for user registration:
  • Changing the route for home page display
  • The uses cascading style sheet (CSS)
  • Do repeat yourself (DRY) works in Ruby on Rails (ROR)?
  • The uses of migration to create and modify table
  • The uses of model validations
  • Form debug
  • Integrate uses of MOV in ROR
By following the charter 6 to 7 in the e-book "RailsSpace", I create the advanced login page of OTBS in my computer. By clicking on the link: 'Login', The screen redirected to the user login page:


Input of invalid user name and password, and select remember me option:


Input of valid user name and password, then redirect to 'Welcome' page:


The database record of the user:


The database record of the user's session:


I have learn from charter 6 to 7 in the e-book 'RailsSpace' for advanced login :
  • Test programs
  • Handle of login session
  • Protecting pages
  • Login forwarding
  • Logout & clear password
  • Use of cookie functions to remember user passward
  • More secure cookie by a secure hashing algorithm
AJAX stands for Asynchronous JavaScipt and XML. AJAX includes several technologies:
  • XHTML for the markup of Web pages
  • CSS for styling
  • Dynamic display and interaction using DOM
  • Data manipulation and interchange using XML
  • Data retrieval using XMLHttpRequest
  • JavaScript as the glue that meshes all this together
The Web page without being refreshed the contents of the entire page, when you retrieve data for a Web page by AJAX. In basic web architecture, when user clicks a link or submits a form, the form is submitted to the server. Then the server sends back a response new page to the user.
When AJAX is used, it loads an AJAX engine in the background. The engine is written in JavaScipt and its responsibility is to both communicate with the web server and display the results to the user. The server returns an HTML fragment that contains the server's response and displays only the data that is new or changed as opposed to refreshing the entire page.

Rails has a simple, consistent model to implements AJAX operations. Once the brower has render and displayed the initial web page different user actions trigger an AJAX operation:
  • Some trigger fires: by user clicking on a button or link, user making changes to the data on a form or in a field
  • The web client calls the server: A JavaScript method, XMLHttpRequest, send data associated with the trigger to an action handler on the server.
  • The server does processing: The server-side action handler does something with the data and returns an HTML fragment to the client.
  • The client receive the response: The client-side JavaScript, which Rails creates automatically, receives the HTML fragment and uses it to update a specified part of the current pages.

No comments:

Post a Comment