Bonsoir
Je voudrais afficher une image en html.
J'ai pu l'afficher dans une seule : page d'accueil mais pas pour les autres .
voici mon code de première page html:
avec le controlleur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <%@ include file="/WEB-INF/jsp/include.jsp" %> <html> <head><title>Hello :: Spring Application</title></head> <body> <center> <h1>Demo GRH APPLICATION</h1> </center> <p> <img src="Proxym.png"> </p> <h1><img class="png" src="Proxym.png" /></h1> <p>Greetings, it is now in Sousse <c:out value="${now}"/></p> <form action=""> <table border="1"> <tr> <td><a href="<c:url value="vacation/list.htm"/>">Ajouter un Congé</a> </td> </tr> </table> </form> </body> </html>
l'image est affichée dans cette page d'accueil
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 import org.springframework.web.servlet.mvc.multiaction.MultiActionController; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.util.Date; public class AcceuilController extends MultiActionController { protected final Log logger = LogFactory.getLog(getClass()); public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String now = (new Date()).toString(); logger.info("Returning hello view with " + now); return new ModelAndView("accueil", "now", now); } }
voici la deuxième page
avec le controlleur associé:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 <%@ page import="java.text.*" %> <%@ page import="java.util.*" %> <%@ include file="/WEB-INF/jsp/include.jsp" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <style type="text/css"> .even { background-color: silver; } </style> <title>Registration Page</title> </head> <body> <% SimpleDateFormat dateFormatter = new SimpleDateFormat(); %> <center> <h1>Ajouter un Congé</h1> </center> <p> <img src="Proxym.JPG"> </p> <form:form action="add.htm" commandName="vacation"> <table> <tr> <td>Date :</td> <td><%= dateFormatter.format(new Date()) %></td> </tr> <tr> <td>Date début:</td> <td><form:input path= "startDate" /></td> </tr> <tr> <td>Date fin :</td> <td><form:input path="endDate" /></td> </tr> <!-- JSP content --> <sweetdev:form action="date-builder.do"> <sweetdev:date property="date"/> </sweetdev:form> <!-- JSP content --> <tr> <td>Durée:</td> <td><form:input path="duration" /></td> </tr> <tr> <td>jours ouvrables:</td> <td><form:input path="numberOfWorkingDays" /></td> </tr> <tr> <td>absence:</td> <td><form:input path="halfDay" /></td> </tr> <tr> <td>Date de création:</td> <td><form:input path="createdAt" /></td> </tr> <tr> <td>Date de suppression:</td> <td><form:input path="deletedAt" /></td> </tr> <tr> <td colspan="2"><input type="submit" value="Register"></td> </tr> </table> </form:form> <c:if test="${fn:length(vacationList)> 0}"> <table cellpadding="5"> <tr class="even"> <th>Date début</th> <th>Date fin </th> <th>Durée</th> <th>jours ouvrables</th> <th>absence</th> <th>Date de création</th> <th>Date de suppression</th> </tr> <c:forEach items="${vacationList}" var="vacation" varStatus="status"> <tr class="<c:if test="${status.count % 2 == 0}">even</c:if>"> <td>${vacation.startDate}</td> <td>${vacation.endDate}</td> <td>${vacation.duration}</td> <td>${vacation.numberOfWorkingDays}</td> <td>${vacation.halfDay}</td> <td>${vacation.createdAt}</td> <td>${vacation.deletedAt}</td> </tr> </c:forEach> </table> </c:if> <a href="<c:url value="/accueil.htm"/>">Home</a> </body> </html>
C'est très urgent SVP
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 package com.proxymit.grh.web; import java.io.IOException; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.ui.ModelMap; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.multiaction.MultiActionController; import com.proxymit.grh.model.Vacation; import com.proxymit.grh.service.interf.VacationManager; public class VacationController extends MultiActionController { private VacationManager vacationManager; protected final Log logger = LogFactory.getLog(getClass()); public void setVacationManager(VacationManager vacationManager) { this.vacationManager = vacationManager; } public ModelAndView add(HttpServletRequest request, HttpServletResponse response, Vacation vacation) throws Exception { vacationManager.createVacation(vacation); String now = (new Date()).toString(); logger.info("Returning hello view with " + now); return new ModelAndView("redirect:list.htm", "now", now); } public ModelAndView list(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelMap modelMap = new ModelMap(); modelMap.addAttribute("vacationList",vacationManager.findallVacation()); modelMap.addAttribute("vacation", new Vacation()); return new ModelAndView("vacationForm", modelMap); } }! est ce que quelqu'un peut m'aider?
![]()
Partager