Bonjour,
j'ai un petit soucis, mon hello world marche pas.
il n y a pas erreur de lancement serveur tomcat. quand je vais debug il entre pas dans mon code Java.
[ame="http://www.flickr.com/photos/56834047@N06/5243835760/in/photostream/lightbox/"]structure | Flickr - Photo Sharing!@@AMEPARAM@@http://farm6.static.flickr.com/5209/5243835760_e5496b7545_m.jpg@@AMEPARAM@@5243835760@@AMEPARAM@@e5496b7545[/ame]
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 <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="testStruts2" extends="struts-default" > <action name="StevStruts" class="testStruts2.StevStruts"> <result>index.jsp</result> </action> <!-- Add your actions here --> </package> </struts>
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 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <h2>qsdf<s:property value="message" /></h2> </body> </html>[ame="http://www.flickr.com/photos/56834047@N06/5243835732/in/photostream/lightbox/"]struts2 | Flickr - Photo Sharing!@@AMEPARAM@@http://farm6.static.flickr.com/5161/5243835732_2f9f03a9bb_m.jpg@@AMEPARAM@@5243835732@@AMEPARAM@@2f9f03a9bb[/ame]
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 package testStruts2; import com.opensymphony.xwork2.ActionSupport; public class StevStruts extends ActionSupport{ /** * */ private static final long serialVersionUID = 1L; public static final String MESSAGE = "Struts is up and running ..."; public String execute() throws Exception { setMessage(MESSAGE); return SUCCESS; } private String message; public void setMessage(String message){ this.message = message; } public String getMessage() { return message; } }
Question:
1.est-ce que le nom package dans struts.xml il faut égal le nom package dans .java (couleur vert dans image ci dessus) ?
2.est-ce que le nom action dans struts.xml il faut égal le nom class dans .java (couleur bleu dans image ci dessus) ?
Merci d'avance,
Stev
Partager