src/main/webapp/WEB-INF/dynamic_fragments/language.jsp

changeset 39
e722861558bb
parent 29
27a0fdd7bca7
child 72
0646c14e36fb
--- a/src/main/webapp/WEB-INF/dynamic_fragments/language.jsp	Mon May 11 19:09:06 2020 +0200
+++ b/src/main/webapp/WEB-INF/dynamic_fragments/language.jsp	Tue May 12 22:03:00 2020 +0200
@@ -24,20 +24,25 @@
 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 --%>
-<%@page pageEncoding="UTF-8" session="true" %>
+<%@page pageEncoding="UTF-8" %>
 <%@page import="de.uapcore.lightpit.Constants" %>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 
-<c:set scope="page" var="currentLanguage" value="${sessionScope[Constants.SESSION_ATTR_LANGUAGE]}" />
+<jsp:useBean id="languages" type="java.util.List<java.util.Locale>" scope="request"/>
+<jsp:useBean id="browserLanguage" type="java.util.Locale" scope="request"/>
 
-<form method="POST"id="lang-selector">
+<c:set scope="page" var="currentLanguage" value="${sessionScope[Constants.SESSION_ATTR_LANGUAGE]}"/>
+
+<form method="POST" id="lang-selector">
     <c:forEach items="${languages}" var="l">
         <label>
             <input type="radio" name="language" value="${l.language}"
                    <c:if test="${l.language eq currentLanguage.language}">checked</c:if>/>
-            ${l.displayLanguage}
-            (${l.getDisplayLanguage(currentLanguage)}<c:if test="${not empty browserLanguage and l.language eq browserLanguage.language}"><c:set var="browserLanguagePresent" value="true"/>&nbsp;-&nbsp;<fmt:message key="browserLanguage"/></c:if>)
+                ${l.displayLanguage}
+            (${l.getDisplayLanguage(currentLanguage)}
+            <c:if test="${not empty browserLanguage and l.language eq browserLanguage.language}"><c:set
+                    var="browserLanguagePresent" value="true"/>&nbsp;-&nbsp;<fmt:message key="browserLanguage"/></c:if>)
         </label>
     </c:forEach>
     <c:if test="${not browserLanguagePresent}">

mercurial