Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
3.5 A Resume Posting Service
81
Listing 3.6 SubmitResume.java (continued)
      "}\n" +
      "A:hover { color: red; }\n" +
      "  >\n" +
      "";
    return(styleSheet);
  }
  // Replaces null strings (no such parameter name) or
  // empty strings (e.g., if textfield was blank) with
  // the replacement. Returns the original string otherwise.
  
  private String replaceIfMissing(String orig,
                                  String replacement) {
    if ((orig == null) || (orig.length() == 0)) {
      return(replacement);
    } else {
      return(orig);
    }
  }
  // Replaces null strings, empty strings, or the string
  // "default" with the replacement.
  // Returns the original string otherwise.
  
  private String replaceIfMissingOrDefault(String orig,
                                           String replacement) {
    if ((orig == null) ||
        (orig.length() == 0) ||
        (orig.equals("default"))) {
      return(replacement);
    } else {
      return(orig + ", ");
    }
  }
  // Takes a string representing an integer and returns it
  // as an int. Returns a default if the string is null
  // or in an illegal format.
    
  private int getSize(String sizeString, int defaultSize) {
    try {
      return(Integer.parseInt(sizeString));
    } catch(NumberFormatException nfe) {
      return(defaultSize);
    }
  }
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved