ucsb-cs56-w20 / ucsb-courses-search

Spring Boot App to show similar information to that found at UCSB Curriculum Search page
https://ucsb-courses-search.herokuapp.com
2 stars 5 forks source link

as - Add flash message support into the app #241

Closed pconrad closed 4 years ago

pconrad commented 4 years ago

The other two web apps (mapache-search. and open-lab-scheduler) have support for flash messages.

Flash messages are a way of communicating error messages to the user in a lightweight manner, and are a common feature of web applications.

To add them, you need to add the divs shown:

Add those <div> elements into src/main/resources/templates/fragments/bootstrap_nav_header.html immediately after the </nav> closing tag.

Then, you can convert messages such as this one in src/main/java/edu/ucsb/cs56/ucsb_courses_search/controller/SearchByInstructorController.java

model.addAttribute("error_message", "Error: instructor name must not be empty");

To use flash messages similar to this code from open-lab-scheduler