Problème avec Struts 2 et XML / JDOM / DOM
bonjour,
j'ai les elements suivants dans mon projet en struts2 (mon but c'est d'enregistrer un document dans une base de données xml)
index.html
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <html>
<head>
<title>GED</title>
</head>
<body>
<center>
<h1>Bienvenue au site de la GED</h1>
<h2>Pour se connectez visitez le lien suivant</h2>
<a href="login.action"> Cliquez ici </a>
</center>
</body>
</html> |
struts.xml
Code:
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
| <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<package name="sample" extends="struts-default">
<action name="index" class="beanAction.LoginAction">
<result name="success">./jsp/welcome.jsp</result>
<result name="error">./jsp/error.jsp</result>
</action>
<action name="login">
<result name="success">./jsp/login.jsp</result>
</action>
<action name="logoutAction" class="beanAction.LogoutAction">
<result name="login">./jsp/login.jsp</result>
</action>
<action name="document" class="beanAction.DocumentAction">
<result name="input">./jsp/Document.jsp</result>
<result name="success">./jsp/SuccessDocument.jsp</result>
</action>
</package>
</struts> |
login.jsp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Connexion </title>
</head>
<body>
<center>
<s:form action="index" style="width:50%;margin:auto;background-color:#c1d9fc;padding-bottom:15px;" method="post">
<h2 style="text-align:center;color:white;background-color:#6683b1;">Connexion</h2>
<p style="text-align:center;"><s:textfield label="User Name" name="username" key="username"></s:textfield>
<p style="text-align:center;"><s:password label="Password" name="password" key="password" ></s:password>
<p style="text-align:center;width:50%;margin:auto;"><s:submit value="Se Connecter"></s:submit>
</s:form>
</center>
</body>
</html> |
welcome.jsp
Code:
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 uri="/struts-tags" prefix="s" %>
<html>
<head>
<title>GED</title>
</head>
<body>
<center>
<H1><b>....... Bienvenue ........</b> </H1><br/>
Bienvenue <s:property value="username"/><br></br>
<s:a href="logoutAction.action">Déconnexion</s:a><br>
<s:a href="./jsp/Document.jsp">Ajouter un document</s:a>
</center>
</body>
</html> |
quan je clique sur ajouter un Document de la page welcome.jsp
il m'affiche l'erreur suivante dans la console :
Code:
1 2 3 4
| 17 juil. 2012 15:09:25 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
ATTENTION: No configuration found for the specified action: 'document.action' in namespace: '/jsp'. Form action defaulting to 'action' attribute's literal value.
17 juil. 2012 15:09:25 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
ATTENTION: No configuration found for the specified action: 'document.action' in namespace: '/jsp'. Form action defaulting to 'action' attribute's literal value. |
mais il m'affiche la page document.jsp avec un formulaire
document.jsp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>Customer Form - Struts2 Demo | ViralPatel.net</title>
</head>
<body>
<h2>Formulaire d'ajout de Document</h2>
<s:form action="document.action" method="post" validate="true">
<s:textfield name="titre" key="titre" size="20" />
<s:textfield name="type" key="type" size="20" />
<s:textfield name="format" key="format" size="20" />
<s:textfield name="createur" key="createur" size="20" />
<s:textfield name="dateCreation" key="dateCreation" size="20" />
<s:submit method="addDocument" value="Ajouter un Document" align="center" />
</s:form>
</body>
</html> |
je veux stocker les données de ce formulaire dans un fichier xml , comment faire ca on utilisant les parser xml