Skip to content

Commit

Permalink
fix: move properties injection in another file
Browse files Browse the repository at this point in the history
Signed-off-by: WoodenMaiden <yann.pomie@laposte.net>
  • Loading branch information
WoodenMaiden committed Aug 30, 2024
1 parent 027f802 commit 05a7248
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
15 changes: 1 addition & 14 deletions agrold-javaweb/src/main/webapp/includes.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
${pageContext.ELContext.importHandler.importClass('agrold.config.PropertiesBean')}
<!DOCTYPE html>
<html>
<head>
Expand All @@ -28,19 +27,7 @@ ${pageContext.ELContext.importHandler.importClass('agrold.config.PropertiesBean'
<script type="text/javascript" src="styles/bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="styles/bootstrap/css/bootstrap.css">

<!--Inject system parameters inside js-->
<script type="text/javascript">
// this functions is used parse system parameters inside javascript
// indeed we can't use jsp tags inside javascript, the result comes as raw text
// so we need to parse it if it is equals to null
function parseJsp(text) {
return text === "null" ? null : text;
}
const system_sparqlendpoint = parseJsp('${PropertiesBean.getSparqlEndpoint()}')
const system_faceted_search_url = parseJsp('${PropertiesBean.getFacetedSearchURL()}')
</script>
<script type="text/javascript" src="config/config.js"></script>
<jsp:include page="injectProperties.jsp"></jsp:include>

<link rel="icon" href="images/logo_min.png" />
<link rel="icon" type="image/png" href="images/logo_min.png" />
Expand Down
2 changes: 2 additions & 0 deletions agrold-javaweb/src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
<link rel="stylesheet" type="text/css" href="styles/bordelo.css">
<link rel="icon" href="images/logo_min.png" />
<link rel="icon" type="image/png" href="images/logo_min.png" />

<jsp:include page="injectProperties.jsp"></jsp:include>
</head>
<body>

Expand Down
21 changes: 21 additions & 0 deletions agrold-javaweb/src/main/webapp/injectProperties.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<%--
Document : about
Created on : Jun 29, 2015, 11:55:56 AM
Author : tagny
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
${pageContext.ELContext.importHandler.importClass('agrold.config.PropertiesBean')}
<!--Inject system properties inside js-->
<script type="text/javascript">
// this functions is used parse system parameters inside javascript
// indeed we can't use jsp tags inside javascript, the result comes as raw text
// so we need to parse it if it is equals to null
function parseJsp(text) {
return text === "null" ? null : text;
}
const system_sparqlendpoint = parseJsp('${PropertiesBean.getSparqlEndpoint()}')
const system_faceted_search_url = parseJsp('${PropertiesBean.getFacetedSearchURL()}')
</script>
<script type="text/javascript" src="config/config.js"></script>

0 comments on commit 05a7248

Please sign in to comment.