I've been tasked with a modifying a jsp project (not Spring). The change is quite simple: Take a static list of links on a page and replace them with a dropdown consisting of said links. The other requirement is that the datasource for the dropdown be a properties file. They want this so that the end users of the site (internal project) can modify/remove links without having to redeploy the app. I'm a javascript guy (AngularJS, EmberJS, jQuery, etc) whose had a brief introduction to jsp about 10 or 12 years ago, so I'm quite green about it. To get my feet wet, I downloaded IntelliJ, setup a Tomcat project and got it to read and display a couple of values in a properties file. WooHoo!. It took a couple of hours of googling just to get this far. Although I've found code that will build a select using jsp, I've not found anything that shows me how to layout a properties file and read in the key/value pairs that I can use as the option/value for the select items.
Here's my properties file:
fname=Courious
lname=George
Here's the markup that displays the values:
<%@page import="java.util.Properties" %>
<%
InputStream stream = application.getResourceAsStream("foo.properties");
Properties props = new Properties();
props.load(stream);
String fname = props.getProperty("fname");
String lname = props.getProperty("lname");
%>
<html>
<head>
<title>$Title$</title>
</head>
<body>
<%
out.println(fname);
out.println(lname);
%>
</body>
And it correctly displays Curious George.
Can someone provide some guidance as to how to proceed with creating a select using a properties file? Thanks