Compare commits

..

No commits in common. "master" and "dev" have entirely different histories.
master ... dev

42 changed files with 175 additions and 14 deletions

8
.gitignore vendored
View file

@ -2,12 +2,6 @@ target
tomcat.8080
tomcat.5000
# Gradle generated files
.gradle
app/build
app/bin
.settings
# IntelliJ Idea project files
.idea
*.iml
@ -30,4 +24,4 @@ buildNumber.properties
# JDT-specific (Eclipse Java Development Tools)
.classpath
.DS_Store
.DS_Store

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

Binary file not shown.

View file

@ -0,0 +1,2 @@
#Thu Feb 08 14:24:23 CET 2024
gradle.version=8.4

Binary file not shown.

BIN
.gradle/file-system.probe Normal file

Binary file not shown.

View file

View file

@ -0,0 +1,13 @@
#
#Thu Feb 08 14:14:29 CET 2024
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
org.eclipse.jdt.core.compiler.source=21
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.compliance=21
org.eclipse.jdt.core.compiler.debug.sourceFile=generate

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,16 @@
<%@ page import="model.HelloJspViewModel" %>
<html>
<body>
<h2>Hello Jsp, simple data from Servlet: <%=request.getAttribute("simple")%></h2>
<ol>
<%
HelloJspViewModel model = (HelloJspViewModel)request.getAttribute("complex");
for(int el : model.getData()) { %>
<li>
<%=el%>
<% out.print(":" + el); // or as ordinary java code %>
</li>
<% } %>
</ol>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/pure-min.css">
<title>the Book Store</title>
<style>
.main {
padding: 2em;
color: black;
}
</style>
</head>
<body>
<div class="main">
<h1>the Test Site</h1>
Welcome to this Fantastic Web Page.
<p> The following services are available today:
<ul>
<li> <a href = "http://localhost:8080/Survey"> THE SURVEY</a>
</ul>
</div>
</body>
</html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,16 @@
<%@ page import="model.HelloJspViewModel" %>
<html>
<body>
<h2>Hello Jsp, simple data from Servlet: <%=request.getAttribute("simple")%></h2>
<ol>
<%
HelloJspViewModel model = (HelloJspViewModel)request.getAttribute("complex");
for(int el : model.getData()) { %>
<li>
<%=el%>
<% out.print(":" + el); // or as ordinary java code %>
</li>
<% } %>
</ol>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/pure-min.css">
<title>the Book Store</title>
<style>
.main {
padding: 2em;
color: black;
}
</style>
</head>
<body>
<div class="main">
<h1>the Test Site</h1>
Welcome to this Fantastic Web Page.
<p> The following services are available today:
<ul>
<li> <a href = "http://localhost:8080/Survey"> THE SURVEY</a>
</ul>
</div>
</body>
</html>

View file

@ -0,0 +1,14 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package etsf20;
public class App {
public String getGreeting() {
return "Hello World!";
}
public static void main(String[] args) {
System.out.println(new App().getGreeting());
}
}

View file

@ -6,16 +6,29 @@ import java.sql.*;
*/
public class Database implements AutoCloseable {
// The connection to the database
// If you have the mysql server on your own computer use "localhost" as server address.
private static String databaseServerAddress = "vm26.cs.lth.se";
private static String databaseUser = "<your databse user on vm26>"; // database login user
private static String databasePassword = "<your password>"; // database login password
private static String database = "<your database, normally the same as database user>"; // the database to use, i.e. default schema
private Connection conn = null;
public Database() {
// Connect to sqlite
try {
Class.forName("org.sqlite.JDBC");
conn = DriverManager.getConnection("jdbc:sqlite:database.db");
System.out.println("Opened database successfully");
} catch (Exception e) {
try{
conn = DriverManager.getConnection("jdbc:mysql://" + databaseServerAddress + "/" +
database, databaseUser, databasePassword);
// Display the contents of the database in the console.
// This should be removed in the final version
try(Statement stmt = conn.createStatement()) {
ResultSet rs = stmt.executeQuery("select * from Respondents");
while (rs.next()) {
String name = rs.getString("name");
System.out.println(name);
}
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}

View file

@ -0,0 +1,17 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package etsf20;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Disabled;
class AppTest {
@Disabled
@Test void appHasAGreeting() {
App classUnderTest = new App();
assertNotNull(classUnderTest.getGreeting(), "app should have a greeting");
}
}