Java EE 6 Development with NetBeans 7 Develop professional enterprise Java EE applications quickly and easily with this popular IDE David R. Heffelfinger [ open source community experience distilled PUBLISHING - BIRMINGHAM MUMBAI
Preface 1 Chapter 1: Getting Started with NetBeans 7 Introduction 7 Obtaining NetBeans 8 Installing NetBeans 12 Microsoft Windows 12 Mac OS X 12 Linux and Solaris 13 Other platforms 13 Installation procedure 13 Starting NetBeans for the first time 20 Configuring NetBeans for Java EE development 21 Integrating NetBeans with a third party application server 21 Integrating NetBeans with a third party RDBMS 25 Adding a JDBC driver to NetBeans 25 Connecting to a third party RDBMS 27 Deploying our first application 29 NetBeans tips for effective development 33 Code completion 33 Code templates 37 Keyboard shortcuts 39 Understanding NetBeans visual cues 43 Summary 45
Chapter 2: Developing Web Applications with Servlets and JSPs 47 Creating our first web application 48 Modifying NetBeans' generated code 53 Developing the input page 54 Developing the output page 65 Servlet development 72 Adding a Servlet to our Application 72 Securing web applications 82 Implementing form-based authentication 83 Implementing the login page 83 Implementing a login error page 85 Configuring our application for form-based authentication 86 JSP fragments 95 Creating a JSP fragment in NetBeans 96 Summary 98 Chapter 3: Enhancing JSP Functionality with JSTL and Custom Tags 99 Core JSTL tags 100 Conditionally displaying part of a page with the <c:if> tag 100 Displaying mutually exclusive markup with the <c:choose> tag 103 Iterating through arrays or collections with the <c:foreach> tag 107 SQL JSTL tags 110 Retrieving database data with the <sql:query> tag 113 Modifying database data with the <sql:update> tag 117 Inserting database data 118 Updating database data 121 Deleting database data 124 Closing remarks about JSTL 127 Custom JSP tags 127 Summary 134 Chapter 4: Developing Web Applications using JavaServer Faces 2.0 135 Introduction to JavaServer faces 135 Developing our first JSF application 136 Creating a new JSF project 136 Modifying our page to capture user data 141 Creating our managed bean 148 Implementing the confirmation page 151 Executing our application 153 JSF validation 155
Facelets templating 159 Adding a Facelets template to our project 161 Using the template 162 Composite components 167 Summary 172 Chapter 5: Elegant Web Applications with PrimeFaces 173 Our first PrimeFaces project 173 Using PrimeFaces components in our JSF applications 176 Tabbed views 181 Wizard interfaces 187 More information 193 Summary 193 Chapter 6: Interacting with Databases through the Java Persistence API 195 Creating our first JPA entity 196 Adding persistent fields to our entity 204 Creating a DAO 205 Automated Generation of JPA Entities 211 Named Queries and JPQL 219 Bean Validation 221 Entity Relationships 221 Generating JSF applications from JPA entities 228 Summary 235 Chapter 7: Implementing the Business Tier with Session Beans 237 Introducing Session Beans 238 Creating a session bean in NetBeans 238 Accessing the bean from a client 248 Executing the client 253 Session bean transaction management 253 Implementing aspect oriented programming with interceptors 255 Implementing the interceptor class 256 Decorating the EJB with the Interceptors annotation 257 EJB timer service 259 Generating session beans from JPA entities 260 Summary 266
Chapter 8: Contexts and Dependency Injection (CDI) 267 Introduction to CDI 268 Qualifiers 275 Stereotypes 280 Interceptor Binding Types 283 Summary 288 Chapter 9: Messaging with JMS and Message Driven Beans 289 Introduction to JMS 289 Creating the project and JMS resources 290 Creating a JMS destination 292 Sending messages to a message destination 296 Processing JMS messages with message driven Beans 301 Summary 305 Chapter 10: SOAP Web Services with JAX-WS 307 Introduction to web services 307 Creating a simple web service 308 Testing our web service 314 Developing a client for our web service 316 Exposing EJBs as web services 321 Implementing new web services as EJBs 321 Exposing existing EJBs as web services 324 Creating a web service from an existing WSDL 327 Summary 330 Chapter 11; RESTful Web Services with JAX-RS 331 Generating a RESTful web service from an existing database 332 Analyzing the generated code 335 Testing our RESTful web service 340 Developing a RESTful web service client 345 Summary 352 Appendix A: Debugging Enterprise Applications with the NetBeans Debugger 353 Debugging enterprise applications 353 Summary 360 Appendix B: Identifying Performance Issues with the NetBeans Profiler 361 Profiling our application 362 Summary 366 Index 367