Bonjour,

j'ai tout d'abord une jsp qui contient des images et un css.
De cette page je vais vers un autre controller pour faire un ajout par exemple.
Ensuite je rappelle la première page, mais là les images ne sont plus affichées et le css n'est plus détecté.
Lors du 1er appel de la 1ere page, je vois que l'url est http://localhost:8085/interface, ensuite lorsque je reviens la 2e fois l'url est http://localhost:8085/interface/admin/gestion, du coup forcément les images ne sont plus au bon emplacement. Comment faire pour réobtenir la 1ere URL??

La 1ere jsp:
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
 
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ taglib uri="/spring" prefix="spring"%>
<%@ taglib uri="/spring-form" prefix="form"%>
<%@ taglib uri="/display" prefix="display"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 
<%@page import="hw.model.Consultant"%>
<html>
<head>
<title>Crud Interface</title>
<link rel="stylesheet" href="css/displaytag.css" type="text/css"/>
<script language="javascript">
	function setParam(paramValue){
		with(document.frmConsult){
			paramId.value=paramValue;
		}
		return true;
	}
</script>
</head>
 
<body>
<h2><spring:message text="..." code="list.title" /></h2>
 
<form method="post" name="frmConsult" >	
<input type="hidden" name="action"/>
<input type="hidden" name="paramId"/>
	<table>
		<tr>
			<display:table name="${model.consultantList}" id="consult" class="disp">
				<display:column property="name" titleKey="list.name" />
				<display:column property="firstName" titleKey="list.firstname" />
				<display:column property="site" titleKey="list.site" />
				<display:column property="clientMission" titleKey="list.mission" />
				<display:column>
					<input type="image" name="showUpdate" onclick="return setParam(${consult.consultantId});" 
					src="images/update.gif" alt="Update" title="Update"/>
				</display:column>
				<display:column>
					<input type="image" value="Delete" name="delete" onclick="return setParam(${consult.consultantId});" 
					src="images/delete.png" alt="Delete" title="Delete"/>
				</display:column>
			</display:table>
		</tr>
	    <tr><td colspan="4">&nbsp;</td></tr>
		<tr><td> 
			<input type="image" name="showInsert" src="images/add.gif" alt="Add new consultant" title="Ajouter nouveau consultant"/> 
		</td></tr>
	</table>
</form>
</body>
</html>
et la 2e:
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
 
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ taglib uri="/spring" prefix="spring"%>
<%@ taglib uri="/spring-form" prefix="form"%>
<%@ taglib uri="/display" prefix="display"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 
<html>
<head>
<title>Crud Interface</title>
<link rel="stylesheet" href="css/displaytag.css" type="text/css"/>
</head>
 
<body>
 
	<form:form method="post" commandName="consultant" >	
	<h2><u>Consultant details</u></h2>
		<input type="hidden" name="action"/>
		<table>
			<tr>
				<td><b><spring:message code="list.name" />:</b></td>
				<td><form:input path="name" /></td>
			</tr>
			<tr>
		        <td><b><spring:message code="list.firstname" />:</b></td>
		        <td><form:input path="firstName" /></td>
		    </tr>
			<tr>
		        <td><b><spring:message code="list.site" />:</b></td>
		        <td><form:input path="site" /></td>
		   </tr>
			<tr>
		        <td><b><spring:message code="list.mission" />:</b></td>
		        <td><form:input path="clientMission" /></td>
			</tr>
			<tr><td colspan="2">&nbsp;</td></tr>
			<tr>
				<td> <input type="submit" value="Sauver" name="_${consultant.actionName}" /> </td>
			</tr>
		</table>	
	</form:form>
</body>
</html>
le servlet.xml
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
 
<?xml version="1.0" encoding="UTF-8"?>
 
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
 
	<bean id="handlerMapping"
		class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
 
	</bean>
 
	<bean name="/gestion" class="hw.web.GestionController">
		<property name="gestionManager" ref="gestionManager" />
		<property name="methodNameResolver">
			<ref local="gestionResolver" />
		</property>
	</bean>
 
	<bean id="gestionResolver"
		class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver">
		<property name="defaultMethodName">
			<value>list</value>
		</property>
		<property name="methodParamNames">
			<list>
				<value>showUpdate</value>
				<value>showInsert</value>
			</list>
		</property>
	</bean>
 
	<bean id="submitActionParamResolver"
		class="hw.web.SubmitParameterPropertiesMethodNameResolver">
		<property name="mappings">
			<props>
				<prop key="_update">update</prop>
				<prop key="_insert">insert</prop>
			</props>
		</property>
		<property name="defaultMethodName">
			<value>list</value>
		</property>
	</bean>
 
	<bean name="/details"
		class="hw.web.CedConsultFormController">
		<property name="gestionManager" ref="gestionManager" />
		<property name="methodNameResolver">
			<ref bean="submitActionParamResolver" />
		</property>
		<property name="sessionForm">
			<value>true</value>
		</property>
		<property name="successView">
			<value>consultantList</value>
		</property>
		<property name="commandName">
			<value>consultant</value>
		</property>
		<property name="formView">
			<value>consultantForm</value>
		</property>
	</bean>
 
	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass">
			<value>org.springframework.web.servlet.view.JstlView</value>
		</property>
		<property name="prefix">
			<value>/jsp/</value>
		</property>
		<property name="suffix">
			<value>.jsp</value>
		</property>
	</bean>
 
</beans>
dans le 1er controller :
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
 
public class GestionController extends MultiActionController {
	private GestionManager gestionManager;
 
	public ModelAndView list(HttpServletRequest request, HttpServletResponse response) {
		List<Consultant> consultantList = gestionManager.getConsultants();
		Map<String, Object> model = new HashMap<String, Object>();
		model.put("consultantList", consultantList);
		model.put("updateConsultant", "no");
		return new ModelAndView("consultantList", "model", model);
	}
 
	public ModelAndView showInsert(HttpServletRequest request, HttpServletResponse response) {
		return new ModelAndView(new RedirectView("admin/details"));
	}
 
	public ModelAndView showUpdate(HttpServletRequest request, HttpServletResponse response) {
		int idConsultant = (new Integer(request.getParameter("paramId"))).intValue();
		request.getSession().setAttribute("consultantId", idConsultant);
		return new ModelAndView(new RedirectView("admin/details"));
	}
 
	public GestionManager getGestionManager() {
		return gestionManager;
	}
 
	public void setGestionManager(GestionManager gestionManager) {
		this.gestionManager = gestionManager;
	}
 
}
et le 2e controller:
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
 
public class CedConsultFormController extends SimpleMultiActionFormController {
	private GestionManager gestionManager;
 
	public void setGestionManager(GestionManager gestionManager) {
		this.gestionManager = gestionManager;
	}
 
	public CedConsultFormController() {
	}
 
	protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
		Integer id = (Integer) request.getSession().getAttribute("consultantId");
		Consultant consultant = new Consultant();
		if (id != null && !id.equals("")) {
			consultant = gestionManager.getConsultant(id.intValue());
			consultant.setActionName("update");
		} else {
			consultant.setActionName("insert");
		}
		return consultant;
	}
 
	public ModelAndView insert(HttpServletRequest request, Object command, BindException errors) throws Exception {
		Consultant consultant = (Consultant) command;
		gestionManager.insertConsultant(consultant);
		return new ModelAndView(new RedirectView("gestion"));
	}
 
	public ModelAndView update(HttpServletRequest request, Object command, BindException errors) throws Exception {
		Consultant consultant = (Consultant) command;
		gestionManager.updateConsultant(consultant);
		request.getSession().removeAttribute("consultantId");
		return new ModelAndView(getSuccessView());
	}
 
	public ModelAndView delete(HttpServletRequest request, Object command, BindException errors) throws Exception {
		int consultantId = (new Integer(request.getParameter("paramId"))).intValue();
		gestionManager.deleteConsultant(consultantId);
		return new ModelAndView(new RedirectView("gestion"));
	}
 
	protected Map referenceData(HttpServletRequest request) throws Exception {
		return super.referenceData(request);
	}
}
dans le index. jsp il y a:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
<jsp:forward page="admin/gestion"></jsp:forward>
Pouvez-vous m'aider?
Merci