Compare commits
No commits in common. "master" and "dev" have entirely different histories.
42 changed files with 175 additions and 14 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -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
|
BIN
.gradle/8.4/checksums/checksums.lock
Normal file
BIN
.gradle/8.4/checksums/checksums.lock
Normal file
Binary file not shown.
BIN
.gradle/8.4/dependencies-accessors/dependencies-accessors.lock
Normal file
BIN
.gradle/8.4/dependencies-accessors/dependencies-accessors.lock
Normal file
Binary file not shown.
0
.gradle/8.4/dependencies-accessors/gc.properties
Normal file
0
.gradle/8.4/dependencies-accessors/gc.properties
Normal file
BIN
.gradle/8.4/executionHistory/executionHistory.bin
Normal file
BIN
.gradle/8.4/executionHistory/executionHistory.bin
Normal file
Binary file not shown.
BIN
.gradle/8.4/executionHistory/executionHistory.lock
Normal file
BIN
.gradle/8.4/executionHistory/executionHistory.lock
Normal file
Binary file not shown.
BIN
.gradle/8.4/fileChanges/last-build.bin
Normal file
BIN
.gradle/8.4/fileChanges/last-build.bin
Normal file
Binary file not shown.
BIN
.gradle/8.4/fileHashes/fileHashes.bin
Normal file
BIN
.gradle/8.4/fileHashes/fileHashes.bin
Normal file
Binary file not shown.
BIN
.gradle/8.4/fileHashes/fileHashes.lock
Normal file
BIN
.gradle/8.4/fileHashes/fileHashes.lock
Normal file
Binary file not shown.
BIN
.gradle/8.4/fileHashes/resourceHashesCache.bin
Normal file
BIN
.gradle/8.4/fileHashes/resourceHashesCache.bin
Normal file
Binary file not shown.
0
.gradle/8.4/gc.properties
Normal file
0
.gradle/8.4/gc.properties
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
Binary file not shown.
2
.gradle/buildOutputCleanup/cache.properties
Normal file
2
.gradle/buildOutputCleanup/cache.properties
Normal file
|
@ -0,0 +1,2 @@
|
|||
#Thu Feb 08 14:24:23 CET 2024
|
||||
gradle.version=8.4
|
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
Binary file not shown.
BIN
.gradle/file-system.probe
Normal file
BIN
.gradle/file-system.probe
Normal file
Binary file not shown.
0
.gradle/vcs-1/gc.properties
Normal file
0
.gradle/vcs-1/gc.properties
Normal file
13
app/.settings/org.eclipse.jdt.core.prefs
Normal file
13
app/.settings/org.eclipse.jdt.core.prefs
Normal 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
|
BIN
app/bin/main/etsf20/App.class
Normal file
BIN
app/bin/main/etsf20/App.class
Normal file
Binary file not shown.
BIN
app/bin/main/launch/Main.class
Normal file
BIN
app/bin/main/launch/Main.class
Normal file
Binary file not shown.
BIN
app/bin/main/model/HelloJspViewModel.class
Normal file
BIN
app/bin/main/model/HelloJspViewModel.class
Normal file
Binary file not shown.
BIN
app/bin/main/servlet/Database.class
Normal file
BIN
app/bin/main/servlet/Database.class
Normal file
Binary file not shown.
BIN
app/bin/main/servlet/FormGenerator.class
Normal file
BIN
app/bin/main/servlet/FormGenerator.class
Normal file
Binary file not shown.
BIN
app/bin/main/servlet/HelloJsp.class
Normal file
BIN
app/bin/main/servlet/HelloJsp.class
Normal file
Binary file not shown.
BIN
app/bin/main/servlet/Survey.class
Normal file
BIN
app/bin/main/servlet/Survey.class
Normal file
Binary file not shown.
16
app/bin/main/webapp/jsp/example.jsp
Normal file
16
app/bin/main/webapp/jsp/example.jsp
Normal 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>
|
11
app/bin/main/webapp/static/css/pure-min.css
vendored
Normal file
11
app/bin/main/webapp/static/css/pure-min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
27
app/bin/main/webapp/static/index.html
Normal file
27
app/bin/main/webapp/static/index.html
Normal 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>
|
BIN
app/bin/test/etsf20/AppTest.class
Normal file
BIN
app/bin/test/etsf20/AppTest.class
Normal file
Binary file not shown.
BIN
app/build/classes/java/main/etsf20/App.class
Normal file
BIN
app/build/classes/java/main/etsf20/App.class
Normal file
Binary file not shown.
BIN
app/build/classes/java/main/launch/Main.class
Normal file
BIN
app/build/classes/java/main/launch/Main.class
Normal file
Binary file not shown.
BIN
app/build/classes/java/main/model/HelloJspViewModel.class
Normal file
BIN
app/build/classes/java/main/model/HelloJspViewModel.class
Normal file
Binary file not shown.
BIN
app/build/classes/java/main/servlet/Database.class
Normal file
BIN
app/build/classes/java/main/servlet/Database.class
Normal file
Binary file not shown.
BIN
app/build/classes/java/main/servlet/FormGenerator.class
Normal file
BIN
app/build/classes/java/main/servlet/FormGenerator.class
Normal file
Binary file not shown.
BIN
app/build/classes/java/main/servlet/HelloJsp.class
Normal file
BIN
app/build/classes/java/main/servlet/HelloJsp.class
Normal file
Binary file not shown.
BIN
app/build/classes/java/main/servlet/Survey.class
Normal file
BIN
app/build/classes/java/main/servlet/Survey.class
Normal file
Binary file not shown.
16
app/build/resources/main/webapp/jsp/example.jsp
Normal file
16
app/build/resources/main/webapp/jsp/example.jsp
Normal 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>
|
11
app/build/resources/main/webapp/static/css/pure-min.css
vendored
Normal file
11
app/build/resources/main/webapp/static/css/pure-min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
27
app/build/resources/main/webapp/static/index.html
Normal file
27
app/build/resources/main/webapp/static/index.html
Normal 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>
|
BIN
app/build/tmp/compileJava/previous-compilation-data.bin
Normal file
BIN
app/build/tmp/compileJava/previous-compilation-data.bin
Normal file
Binary file not shown.
14
app/src/main/java/etsf20/App.java
Normal file
14
app/src/main/java/etsf20/App.java
Normal 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());
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
17
app/src/test/java/etsf20/AppTest.java
Normal file
17
app/src/test/java/etsf20/AppTest.java
Normal 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");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue