Professional Java For Web Applications

所需积分/C币:10 2018-03-12 16:27:45 10.65MB PDF

英文版,Java Web 高级编程,《Java Web高级编程:涵盖WebSockets、Spring Framework、JPA 》面向的读者是已经了解Java SE、SQL和基本的HTML,准备将他们的Java编码技能提升到更高水平的程序员。软件开发者可以按顺序阅读本书或者在遇到特定的编程问题时将某个章节用作参考。
PROFESSIONAL Java for Web Applications Nicholas s. Williams VOX a Wiley brand firs. indd l 19-U2-2)1412:20:4l Professional Java@ for Web Applications Published by John Wiley Sons, It 0475 Crosspoint boulevard indianapolis, IN 46256 www.wiley.com Copyright o 2014 by John Wiley Sons, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN:978-111865646-4 ISBN:978-1-118-65651-8(ebk) ISBN:978-1-118-90931-7(cbk Manufactured in the united states of a merica 10987654321 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the publisher or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers MA,(978)750-8400, fax(978)646-8600 Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley Sons, Inc, 111 River Street, Hoboken, NI 07030, (201)748-6011, fax(201) 748-6008,oronlineathttp://www.wiley.com/go/permissions. Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required the services of a competent professional person should be sought. Neithe the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read For general information on our other products and services please contact our Customer Care Department within the United States at(877)762-2974, outside the United States at (317)572-3993 or fax (317)572-4002 Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not bc included in c-books or in print-on-dcmand If this book rcfcrs to media such as a CD or dvd that is not included in the version you purchased, you may download this material at http://booksupport.wileycomfoRmoreinformationaboutWileyproductsvisitwww.wiley.com. Library of Congress Control Number: 2013958292 Trademarks: Wiley, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley Sons, Inc. and/or its affiliates, in the United States and other countries, and ima not be used without written permission. java is a registered trademark of Oracle america, Inc. all other trademarks are the property of their respective owners. John Wiley Sons, Inc, is not associated with any product or vendor mentioned in this book ifrs indd 2 24-U2-21412:35:52 ABOUT THE AUTHOR NICK WILLIAMS is a Software Engineer for UL Workplace Health and Safety in Franklin, Tennessee. A computer science graduate from Belmont University, he has been active in commercial and open source software projects for more than 9 years. He is the founder of dnscrawler, com, a site for free dNS and IP troubleshooting tools, and nWTS Java Code, an open source community that specializes in obscure Java libraries that meet niche needs. In 2010, the Nashville technology Council named him the Software Engineer of the Year for Middle Tennessee. Nick is a committer for Apache Logging(including Log4j)and Jackson Data Processor JSR 310 Data 'types. He has also contributed new features to pache Tomcat 8.0, Spring Framework 4.0, Spring Sccurity 3. 2, Spring Data Commons 1.6, Spring Data JPA 1. 4, and jBoss logging 3. 2 serves as a contributor on several other projects, including OpenJDK; and is a member of the Java Community Process (jCP Nick currently lives in Tennessee with his wife Allison. You can find him on Twitter @Java_Nick ABOUT THE TECHNICAL EDITORS JAKE RADAKOVICH joined UL Workplace Hcalth and Safcty in 2009, and currently serves as Software Developer on the Occupational Health Manager product. Prior to that, he was a research assistant at Middle Tennessee State University working on AlgoTutor, a web-based algorithm development tutoring system. He holds a bs in Computer Science and mathematics from Middle Tennessee State University. You can follow Jake on Twitter @Jakeradakovich MANUEL JORDAN ELERA is an autodidactic developer and researcher who enjoys learning new technologies for his own experiments and creating new integrations. lIe won the 2010 Springy Award and was a Community Champion and Spring Champion in 2013. In his little free time, he reads the Bible and composes music on his guitar. Manuel is a Senior Member in the Spring Community Forums known as dr_pompeii. You can read about him and contact him through his blog and you can follow him on his twitter account, @dr_pompeii firs. indd 3 24-U2-21412:35:55 CREDITS ACQUISITIONS EDITOR MARKETING MANAGER Mary James Ashley Zurcher PROJECT EDITOR BUSINESS MANAGER Mau ars u Amy Knie TECHNICAL EDITORS VICE PRESIDENT AND EXECUTIVE GROUP chael jo n elera PUBLISHER Jake Radakovich Richard Wadley TECHNICAL PROOFREADER ASSOCIATE PUBLISHER athan giles SENIOR PRODUCTION EDITOR PROJECT COORDINATOR COVER Kathleen wiso Todd Klemme COPY EDITOR PROOFREADERS Apostrophe Editing Service Nancy carrasco Josh Chase, Word One EDITORIAL MANAGER Mary Beth Wakefield INDEXER Robert swanson FREELANCER EDITORIAL MANAGER R。 semarie Grahan COVER DESIGNER Wiley ASSOCIATE DIRECTOR OF MARKETING David Mayhew COVER IMAGE Stockphoto. com/Elementallmaging 24-U2-21412:35:55 ACKNOWLEDGMENTS THANKS TO My wife Allison, whose unwavering support and persistent reminders about deadlines durin this stressful year made this book possible My parents and siblings, who told me that i could do anything i put my mind to Drs. Joyce Blair Crowell and William Hooper, whose dedicated instruction and mentoring made my career possible Dr. Sarah Ann Stewart, who bclicvcd in mc when I thought surely calculus and proofs spelled doom for my education Mrs. Lockhart, who inspired me to write. Jay, for introducing me to Mary, and to Mary and maureen for making this book a reality. Jake, for being absurd. Oh, and for agreeing to be my technical editor firs. indd 5 24-U2-21412:35:55 firs indd 6 24-U2-21412:35:55 CONTENTS INTRODUCTION PART I: CREATING ENTERPRISE APPLICATIONS CHAPTER 1: INTRODUCING JAVA PLATFORM ENTERPRISE EDITION 3 A Timeline of java Platforms In the Beginning 4 The Birth of Enterprise Jay Java se and Java ee evolving Together 6 Understanding the Most Recent Platform Features A Continuing Evolution Understanding the Basic Web Application Structure 13 Servlets, Filters, liste and jSP 13 Directory Structure and WAR Files 14 The deployment descriptor 15 Class loader architecture 16 Enterprise Archives ummar 18 CHAPTER 2: USING WEB CONTAINERS 19 Choosing a Web container 19 Apache tomcat 20 Glass Fish 21 JBoss and wildly 22 Other Containers and Application Servers 22 Why You'll Use Tomcat in This book 23 Installing Tomcat on Your Machine 23 Installing as a Windows Service 24 Installing as a Command-Line Application 24 Configuring a Custom JSP Compiler 26 Deploying and Undeploying Applications in Tomcat 27 Performing a Manual Deploy and Undeploy 28 Using the tomcat manager 28 CONTENTS Debugging Tomcat from Your IDE 30 Using Intelli IDEA 30 Ising eclipse 35 Summa 39 CHAPTER 3: WRITING YOUR FIRST SERVLET 41 Creating a Servlet class 42 What to Extend 42 Using the Initializer and destroyer 45 Configuring a Servlet for Deployment 46 Adding the Servlet to the Descriptor 46 Mapping the servlet to a URL 47 Running and Debugging Your Servlet 49 Understanding doGet(), doPost), and Other Methods 51 What Should Happen during the service method Execution? UsinghttpServletrequest 52 Jsing HttpservletreSponse 55 Using Parameters and accepting form Submissions 56 Configuring your Application Using Init Parameters Using context Init Parameters 61 Using Servlet Init Parameters 62 Uploading Files from a Form 64 ntroducing the Customer Support Project 65 Configuring the Servlet for File Uploads 65 Accepting a File Upload 68 Making Your Application Safe for Multithreading 69 Understanding Requests, Threads, and Method Execution 69 Protecting Shared Resources 70 Summary 71 CHAPTER 4: USING JSPS TO DISPLAY CONTENT 73 <br / Is Easier Than output. printin("<br />" 74 Why JSPs Are Better 75 What Happens to a JSP at Run Time 76 Creating Your First JSP 78 Understanding the File Structure 78 Directives, Declarations, Scriptlets, and Expressions 79 Commenting your Code 81 Adding Imports to Your JSP 82 ftoc. indd 8 l1-U2-2)1408:39:54

...展开详情
img

关注 私信 TA的资源

上传资源赚积分,得勋章
最新资源