Guide to Web Development with Java: Understanding Website Creation

Guide to Web Development with Java: Understanding Website Creation

Tim Downey

Language: English

Pages: 386

ISBN: 1447124421

Format: PDF / Kindle (mobi) / ePub


This comprehensive textbook introduces readers to the three-tiered, Model-View-Controller (MVC) architecture by using Hibernate, JSPs, and Java Servlets. These three technologies all use Java, so that a student with a background in programming will be able to master them with ease, with the end result of being able to create web applications that use MVC, validate user input and save data to a database. Features: presents the many topics of web development in small steps, in an accessible, easy-to-follow style; uses powerful technologies that are freely available on the web to speed up web development, such as JSP, JavaBeans, annotations, JSTL, Java 1.5, Hibernate and Tomcat; discusses HTML, HTML Forms, Cascading Style Sheets and XML; introduces core technologies from the outset, such as the MVC architecture; contains questions and exercises at the end of each chapter, detailed illustrations, chapter summaries, and a glossary; includes examples for accessing common web services.

Deliver First Class Web Sites: 101 Essential Checklists

Getting Started with Backbone Marionette

Client Centric Web Design

Colors, Backgrounds, and Gradients: Adding Individuality with CSS

A Pocket Guide to CSS3 Layout Modules

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

corresponds to the actual JSP that is being displayed. For instance, when the query string contains confirmButton, the JSP being displayed is Confirm.jsp. The address of the JSP 2.2 Using a Controller 53 Fig. 2.16 The process page with data sent from the confirm page does not appear in the URL because the request was made to the controller. The fact that the controller did not complete the request but forwarded it to another JSP is not visible to the browser. There are four key points about

relationship between the form and the accessor/mutator names Element name Accessor name name=“hobby” getHobby name=“aversion” getAversion 3.2.1 element name Mutator name setHobby setAversion Creating a Data Bean Beans should be used to store the elements coming from the form. The names of the properties in the bean should correspond with the names of the form elements in the JSPs. If the form has an input element named hobby, then the bean should have a property with an accessor named

where the JSPs have been placed. Even though the controller is using a helper, the controller is still the class that is visible from the web, because it is the class that extends HttpServlet. The controller helper, helper base and bean classes should not be added to the web.xml file and should not be annotated with WebServlet. They are not visible from the web, so they do not need a URL pattern. Try It http://bytesizebook.com/book/ch3/reorganised/Controller 3.10 Summary 99 This controller

be seen shortly, any map can be accessed easily from a JSP. isValid The isValid method will return true if all the validations succeed; otherwise it will return false. This is the method that must be called in order to do required validation. It will set the error messages and the error map, by calling setErrors, and return a Boolean value indicating if there are any errors. If the error map is empty, then there are no errors, so the data must be valid. 5.1 Required Validation 149 getErrors

error in the error map This is an example where the confirm page should not be in a directory that is accessible by the user. If it were, then a user would be able to call the confirm page directly, thereby circumventing the validation. The method isValid indicates if the data is valid, but it also creates the array of validation messages and the error map. If isValid is not called, then the error messages will not be created. Retrieving Error Messages The error messages can be retrieved from

Download sample

Download