I need to include content in a JSP without using the include directive.
It is easy to do a server-side include with with <%@include file="includeMe.htm" %>
but the content of includeMe.htm
gets added to the JSP before the JSP is converted into a Servlet by the container. This means that if includeMe.htm gets modified, the changes are not reflected in the generated .java
Servlet file. I'm tired of going into Tomcats generated files directory to manually delete the generated java and class files or re-deploy my app every time the included file changes.
Do I need to write a code block to just read in data from the text file line by line and then write it like this?
<%
while( not done reading from file ) {
String line = scanner.nextLine();
response.getWriter().println(line);
} %>
Is there an easier or cleaner way?