Commit fdfd13e3 by Patryk Czarnik

WebSklep - Poprawka konfiguracji

parent c48e2a06
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.release>21</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<junit.version>5.10.0</junit.version>
</properties> </properties>
<dependencies> <dependencies>
...@@ -25,25 +23,37 @@ ...@@ -25,25 +23,37 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>${junit.version}</version> <version>3.0.0</version>
<scope>test</scope> <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>3.0.1</version>
<!-- jbc Maven pozwala też podawać zakresy wersji, ale wtedy mamy 'niestabilne buildy'
<version>[3.0.0, 4)</version>-->
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.postgresql</groupId>
<artifactId>junit-jupiter-engine</artifactId> <artifactId>postgresql</artifactId>
<version>${junit.version}</version> <version>42.7.3</version>
<scope>test</scope> <scope>runtime</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version> <version>3.4.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
......
package pl.alx.kjava.pc24sklepweb;
import java.io.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;
@WebServlet(name = "helloServlet", value = "/hello-servlet")
public class HelloServlet extends HttpServlet {
private String message;
public void init() {
message = "Hello World!";
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("text/html");
// Hello
PrintWriter out = response.getWriter();
out.println("<html><body>");
out.println("<h1>" + message + "</h1>");
out.println("</body></html>");
}
public void destroy() {
}
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sklep - spis treści</title>
<link rel="stylesheet" type="text/css" href="styl.css">
</head>
<body>
<h1>Sklep Web</h1>
<h2>Lista produktów w różnych wersjach</h2>
<h3>Wersje niedoskonałe, nie do naśladowania.</h3>
<ul>
<li><a href="products0">wersja 0</a> - samodzielny prosty serwlet</li>
<li><a href="products1">wersja 1</a> - serwlet oparty o klasy DAO</li>
<li><a href="products2">wersja 2</a> - serwlet oparty o klasy DAO z HTMLem</li>
<li><a href="products3.jsp">wersja 3</a> - JSP ze skryptletami</li>
<li><a href="products4.jsp">wersja 4</a> - JSP z tagami SQL</li>
</ul>
<h3>Wersje przyzwoite ;-)</h3>
<ul>
<li><a href="products5.jsp">wersja 5</a> - JSP oparty o klasę bean</li>
<li><a href="products6.jsp">wersja 6</a> - wyszukiwanie wg ceny - bean</li>
<li><a href="products7.jsp">wersja 7</a> - fotki</li>
<li><a href="products8.jsp">wersja 8</a> - koszyk</li>
<li><a href="products9.jsp">wersja 9</a> - edycja produktów</li>
</ul>
<h3>Dodatkowe strony</h3>
<ul>
<li><a href="photo?productId=2">Foto</a> - przykładowe zdjęcie</li>
<li><a href="photo_upload.jsp?productId=2">Zmień zdjęcie</a> nr 2</li>
<li><a href="edit_product?productId=1">Edytuj produkt nr 1</a></li>
<li><a href="edit_product">Dodaj nowy produkt</a></li>
</ul>
</body>
</html>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<title>JSP - Hello World</title>
</head>
<body>
<h1><%= "Hello World!" %>
</h1>
<br/>
<a href="hello-servlet">Hello Servlet</a>
</body>
</html>
\ No newline at end of file
body {
background-color: #FFFFDD;
font-family: 'Arial', sans-serif;
}
/* komentarz w CSS */
h4 {
text-align: center;
}
h2, h3, h4 {
margin-top: 0;
}
.product {
border: solid 2px blue;
margin: 1em auto 1em 50px;
padding: 1em;
background-color: white;
width: 800px;
min-height: 230px;
clear: right;
}
.koszyk {
position: fixed;
right: 0;
top: 0;
width: 300px;
height: 400px;
background-color: white;
border: outset 3px green;
}
#wyszukiwarka {
background-color: #AAEEFF;
width: 800px;
border: 2px black solid;
margin: 1em 400px 1em 50px;
padding: 1em;
}
.error {
background-color: #FFFFFF;
border: 6px double red;
margin: 20px;
padding: 10px;
color: red;
}
.photo {
display: block;
float: right;
max-width: 300px;
max-height: 200px;
margin: 5px;
}
.description {
font-size: smaller;
font-style: italic;
}
div.action {
font-size: smaller;
font-family: 'Arial', sans-serif;
font-weight: bold;
background-color: #DDDDDD;
border: 2px #444466 outset;
padding: 6px;
margin: 4px auto 4px 4px;
max-width: 200px;
}
.action:hover {
background-color: #EEEEEE;
border: 2px #4455CC outset;
}
.action:active {
background-color: #EEEEEE;
border: 2px #CC4455 inset;
}
.action a {
display: inline-block;
color: inherit;
text-decoration: none;
width: 100%;
}
.action a:hover {
color: #0000CC;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment