").addClass("row");
@@ -163,8 +204,8 @@ function loadTextToImages(){
});
}
-function loadCrossword(){
- let matrix = [[]]; //TODO: Prendere la matrice
+function loadCrossword(initialState){
+ let matrix = initialState;
let vertical = [];
let horizontal = [];
let crosswordDiv = $("
");
@@ -205,9 +246,15 @@ function loadCrossword(){
}
-function loadCompleteText(){
- let words = [];
+function loadCompleteText(initialState){
+ let words = initialState;
words.forEach((word, index)=>{
+ //TODO: Rimuovere, quando si inserisce nel db si tolgono le lettere
+ const randomIndex = Math.floor(Math.random() * word.length);
+ tempWordArray = word.split('');
+ tempWordArray[randomIndex] = "#";
+ word = tempWordArray.join('');
+
let div=$("
")
div.attr("id", "word"+index);
for (let i=0; i < word.length; i++){
@@ -224,9 +271,13 @@ function loadCompleteText(){
})
}
-function loadRightText(){
+function loadRightText(initialState){
let firstSetOfWords = [];
let secondSetOfWords = [];
+ initialState.forEach((pair)=>{
+ firstSetOfWords.push(pair[0]);
+ secondSetOfWords.push(pair[1]);
+ });
for(let i=0; i
");
@@ -240,5 +291,6 @@ function loadRightText(){
value: secondSetOfWords[i]
});
div.append($("").text(firstSetOfWords[i]), radio1, radio2, $("
").text(secondSetOfWords[i]));
+ exerciseDiv.append(div);
}
}
diff --git a/src/main/webapp/JSP/exercise.jsp b/src/main/webapp/JSP/exercise.jsp
index 8388f90..cd04443 100644
--- a/src/main/webapp/JSP/exercise.jsp
+++ b/src/main/webapp/JSP/exercise.jsp
@@ -1,6 +1,17 @@
+<%@ page import="model.entity.ExerciseGlossary" %>
+<%@ page contentType="text/html; charset=UTF-8"%>
+<%@ page import="com.google.gson.Gson"%>
+
-
+ <%
+ ExerciseGlossary exercise = (ExerciseGlossary) session.getAttribute("exercise");
+ Gson g = new Gson();
+ session.removeAttribute("exercise");
+ %>
+
+ Esercizio <%= exercise.getIdExercise()%>
+
@@ -9,7 +20,7 @@
-
+
<%= exercise.getExerciseName() %>
@@ -17,10 +28,18 @@
+
+
+
diff --git a/src/main/webapp/JSP/exerciseTest.jsp b/src/main/webapp/JSP/exerciseTest.jsp
new file mode 100644
index 0000000..cca37cf
--- /dev/null
+++ b/src/main/webapp/JSP/exerciseTest.jsp
@@ -0,0 +1,11 @@
+
+
+
Title
+
+
+
+
+