Check it out — there are two new files in the view package:
jobPostings.html (you will write data here),
backup.html (a copy of jobPostings.html for data recovery if the data in jobPostings.html is erased somehow).
Hover over and right-click jobPostings.html in the project tree on the left. Then click "Open in Browser".
This way you will see the result of your parsing.
It's time to display the job postings.
1. In the HtmlView class's update method, implement the following:
1.1. create a new body for jobPostings.html, which will hold the job postings,
1.2. write the updated body to the jobPostings.html file,
1.3. All exceptions must be handled in this method. Display a stack trace if an exception occurs.
2. To implement item 1, create two empty private methods:
String getUpdatedFileContents(List<JobPosting>) and void updateFile(String),
We will implement them in future tasks.
3. To get to the jobPostings.html file, create a relative path to it.
In the HtmlView class, create a private final String filePath field and assign it the relative path to jobPostings.html.
The path must be relative to the project's root.
Create the path dynamically using this.getClass().GetPackage() and the "/" separator.
Hint: the path must begin with "./".
- In the HtmlView class, create an empty private String getUpdatedFileContents(List<JobPosting>) method.
- In the HtmlView class, create an empty private void updateFile(String) method.
- Using the created methods, implement the update method in accordance with the task conditions.
- In the HtmlView class, create a private final String filePath field and assign it the relative path to jobPostings.html.