Mega Code Archive

 
Categories / Java / J2EE
 

Exercise 7

/* First edition copyright 2004 ObjectSource LLC. All rights reserved. This training material and the accompanying lab exercises were prepared  by Srikanth Shenoy for ObjectSource LLC. GRANT OF LICENSE: ObjecSource LLC grants you a non-exclusive license to  use the material. 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 or otherwise, without  the prior written permission of ObjectSource LLC. At its discretion,  ObjectSource LLC may provide limited support through email or discussion  forums at ObjectSource web site. ObjectSource incurs no obligation  to provide any support under this Agreement. */ /* Business Objectives:  The following business objectives will be met at the end of this exercise:  1. Split customer form into multiple pages  2. Prevent the customer from going back and resubmitting and getting a database error.  3. Better Exception handling in the system  Technical Objectives for this exercise:  The technical objectives of this exercise is to learn how to:  19. To fix the bug: when Enter key is pressed in the Customer Search Form, a blank page is shown  20. Use DispatchAction  21. See how things work without exception handling mechanism  22. Provide exception handling mechanism (DuplicateCustomerException)  23. Create custom exception handlers  24. Provide Global exception handling mechanism with JSP  25. Create base ActionForm and Action Classes and use them  26. Create multipage forms. (Expln Only)  27. Handle Duplicate Form Submissions for CustomerForm (Expln Only)  28. Use DynaActionForm for CustomerSearchForm (Expln Only)  Default enter does not do search in Customer Search Form  2. Using DispatchAction  a. Create two methods Create and Edit (notice the case) in ShowCustomerAction so that each  method taking exactly the same input parameters as the execute method.  b. Add appropriate code into each of these methods  c. Comment (or delete) the execute method  1. When Enter key is pressed in the Customer Search Form, a blank page is shown  a. This happens because the CustomerSearchAction performs the search only if serch.x or search.y  are not null. Remove the if condition and it will work for enter key  ........ */ // when I try to deploy the exercise07.jar, some exceptions are printed /* SEVERE: Exception sending context initialized event to listener instance of clas s struts.example.util.ApplicationScopeInit java.lang.NullPointerException         at java.util.Properties$LineReader.readLine(Properties.java:365)         at java.util.Properties.load(Properties.java:293)         at struts.example.util.ApplicationScopeInit.contextInitialized(Unknown S ource)         at org.apache.catalina.core.StandardContext.listenerStart(StandardContex t.java:3637)         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4 073) */                     struts-training.zip( 26,264 k)