1. Homepage
  2. Programming
  3. Web app development: Baseball

Web app development: Baseball

Engage in a Conversation
UIUCCS427Software Engineering IJavaJSP

Create a web app using statistics from the American sport, baseball. CourseNana.COM

Your app must meet these criteria: CourseNana.COM

  1. Scrape baseball data from at least two web sites. Document what sites you used with an on-screen annotation. CourseNana.COM

  2. Use baseball data from one web API's. Document these sites as above. You must use the gson library to handle JSON records. CourseNana.COM

  3. Include at least two baseball-related images. This can be specific baseball players, pictures of actual games or stadiums. Again, document the source in the output. CourseNana.COM

  4. Be able to handle different user input - in other words, do not show the same information in your output each time - it must be dynamic, not static. It must also be repeatable: if a user enters the same input data another time, the same output should be presented. CourseNana.COM

  5. Be coded primarily in Java and JSP. If you use something else, give a brief but convincing argument why this was necessary and not just a convenience. CourseNana.COM

  6. Present a web site that requires user interaction using a text field and at least two of these: CourseNana.COM

    • button
    • drop-down menu
    • radio buttons
  7. Use at least two web pages for your output. CourseNana.COM

  8. Use the Model-View-Contorller (MVC) pattern and good separation of concerns CourseNana.COM

  9. Handle error conditions in a "reasonable" way. CourseNana.COM

  10. Be well documented - the code, the usage of the app, and the structure/design of the app, any AI-related things as described above. You do not need to, but you are welcome to, use jsoup (https://jsoup.org/) which is a Java HTML Parser, to do the scraping. It is the Java version of Beautiful Soup, which you may have used in Python. The downsides of using jsoup are you will first need to understand the Document Object Model (DOM) and CSS Selectors. These are both useful to know. The upside of using jsoup is that it makes it much easier to find and select content from HTML (i.e. screen scrape). Refer to the JSON Maven notes below; adding jsoup will require a similar process. CourseNana.COM

JSON and gson JSON records are text records containing tag-value pairs, where the tag is the field name - think of it as a dictionary or map with nesting. It is much shorter than XML. In order to find what you need, use the JSON library GSON. To use GSON, download the gson v.2.10.1 jar file to a place you'll remember. To add it to your project, go to File->Project Structure->Modules, choose the Dependencies tab, click the + icon at the bottom choose Jars or Directories, navigate to where you put the jar file, click that, then Apply and OK. It should show up in your pom.xml file as the last entry in as: CourseNana.COM

com.google.code.gson gson 2.10.1

If this does not appear, add the above lines manually to pom.xml. Finally, reload the Maven dependencies to have this new dependency take effect - an icon will probably appear in the pom.xml window, but if you don't see it, got to the Project View window, find the pom.xml entry (it should be near the bottom of the tree), right click it, choose Maven -> Reload Project. (FYI, Maven is a build management tool, different from the usual Gradle build; Maven uses the Project Object Model (pom) file to keep track of properties and dependencies.) Please use gson and not some other JSON library. SSLHandshakeException Most modern sites require you to make https, not http requests. When you do so from your Java program, you will hit an SSLHandshakeException. We will be covering SSL and related topics in a few weeks. In the meantime, you will have to deal with this exception. If you use jsoup, you should use validateTLSCertificates(false). (Refer to the jsoup API to understand this when you need it.) If you do not use jsoup, here is a code to replace the fetch method in InterestingPictureModel to ignore the exception. The parameter "certType" should be set to the string "TLSV1.3". private String fetch(String searchURL, String certType) { try { // Create trust manager, which lets you ignore SSLHandshakeExceptions createTrustManager(certType); } catch (KeyManagementException ex) { System.out.println("Shouldn't come here: "); ex.printStackTrace(); } catch (NoSuchAlgorithmException ex) { System.out.println("Shouldn't come here: "); ex.printStackTrace(); } CourseNana.COM

String response = "";
try {
    URL url = new URL(searchURL);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();

    // Read all the text returned by the server
    BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
    String str;
    // Read each line of "in" until done, adding each to "response"
    while ((str = in.readLine()) != null) {
        // str is one line of text readLine() strips newline characters
        response += str;
    }
    in.close();
} catch (IOException e) {
    System.err.println("Something wrong with URL");
    return null;
}
return response;

} CourseNana.COM

private void createTrustManager(String certType) throws KeyManagementException, NoSuchAlgorithmException{ /** CourseNana.COM

  • Annoying SSLHandShakeException. After trying several methods, finally this
  • seemed to work.
  • Taken from: http://www.nakov.com/blog/2009/07/16/disable-certificate-validation-in-java-ssl-connections/ */ // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; CourseNana.COM

    // Install the all-trusting trust manager SSLContext sc = SSLContext.getInstance(certType); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); CourseNana.COM

    // Create all-trusting host name verifier HostnameVerifier allHostsValid = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; CourseNana.COM

    // Install the all-trusting host verifier HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid); } CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
UIUC代写,CS427代写,Software Engineering I代写,Java代写,JSP代写,UIUC代编,CS427代编,Software Engineering I代编,Java代编,JSP代编,UIUC代考,CS427代考,Software Engineering I代考,Java代考,JSP代考,UIUChelp,CS427help,Software Engineering Ihelp,Javahelp,JSPhelp,UIUC作业代写,CS427作业代写,Software Engineering I作业代写,Java作业代写,JSP作业代写,UIUC编程代写,CS427编程代写,Software Engineering I编程代写,Java编程代写,JSP编程代写,UIUCprogramming help,CS427programming help,Software Engineering Iprogramming help,Javaprogramming help,JSPprogramming help,UIUCassignment help,CS427assignment help,Software Engineering Iassignment help,Javaassignment help,JSPassignment help,UIUCsolution,CS427solution,Software Engineering Isolution,Javasolution,JSPsolution,