Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

jasper exception

Thread view: 
bentaman@caramail.com - 17 Oct 2006 16:23 GMT
hi  i'm new in struts  and i get this error with my code .if someone
can help me i will be really happy
thanks

"org.apache.jasper.JasperException: Exception in JSP:
/vues/formulaire.jsp:24

21:     <table>
22:         <tr>
23:             <td>Nom</td>
24:             <td> <html:text property="nomz" size="20" /> </td>
25:         </tr>
26:         <tr>
27:             <td>Age</td>"

Here is my code

*****************************************************************************************************************************
struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

<form-beans>
<form-bean name="frmPersonne"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="nom" type="java.lang.String" initial=""/>
<form-property name="age" type="java.lang.String" initial=""/>
</form-bean>
</form-beans>

<action-mappings>

<action
path="/main"
name="frmPersonne"
scope="session"
validate="true"
input="/erreurs.do"
type="istia.st.struts.personne.FormulaireAction"

<forward name="reponse" path="/reponse.do"/>
</action>

<action
path="/erreurs"
parameter="/vues/erreurs.jsp"
type="org.apache.struts.actions.ForwardAction"
/>

<action
path="/reponse"
parameter="/vues/reponse.jsp"
type="org.apache.struts.actions.ForwardAction"
/>

<action
path="/formulaire"
parameter="/vues/formulaire.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
</action-mappings>

<message-resources parameter="ressources.personneressources"/>

</struts-config>
*********************************************************************************************

formulaire.jsp

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html>
<meta http-equiv="pragma" content="no-cache">
<head>
<title>Personne - formulaire</title>
<script language="javascript">
function effacer(){
with(document.frmPersonne){
nom.value="";
age.value="";
}
}
</script>
</head>
<body>
<center>
<h2>Personne - formulaire</h2>
<hr>
<html:form action="/main" name="frmPersonne"
    type="istia.st.struts.personne.PersonneDynaForm">
    <table>
        <tr>
            <td>Nom</td>
            <td> <html:text property="nom" size="20" /> </td>
        </tr>
        <tr>
            <td>Age</td>
            <td><html:text property="age" size="3" /></td>
        </tr>
    </table>
    <table>
        <tr>
            <td><html:submit value="Envoyer" /></td>
            <td><html:reset value="Rétablir" /></td>
            <td><html:button property="btnEffacer" value="Effacer"
                onclick="effacer()" /></td>
        </tr>
    </table>
</html:form></center>
</body>
</html>
*****************************************************************************************************
PersonneDynaForm.java

package istia.st.struts.personne;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

@SuppressWarnings("serial")
public class PersonneDynaForm extends DynaActionForm {
    // validation
    public ActionErrors validate(ActionMapping mapping,
            HttpServletRequest request) {
        // gestion des erreurs
        ActionErrors erreurs = new ActionErrors();
        // le nom doit être non vide
        String nom = (String) this.get("nom");
        if (nom == null || nom.trim().equals("")) {
            erreurs.add("nomvide", new ActionError(
                    "personne.formulaire.nom.vide"));
        }
        // l'âge doit être non vide
        String age = (String) this.get("age");
        if (age == null || age.trim().equals("")) {
            erreurs.add("agevide", new ActionError(
                    "personne.formulaire.age.vide"));
        } else {
            // l'âge doit être un entier positif
            if (!age.matches("^\\s*\\d+\\s*$")) {
                erreurs.add("ageincorrect", new ActionError(
                        "personne.formulaire.age.incorrect", age));
                // on rend la liste des erreurs
            }

        } // if
        // on rend la liste d'erreurs
        return erreurs;
    }
}// classe

************************************************************************

Thank you
bentaman@caramail.com - 17 Oct 2006 16:26 GMT
just to say that the eroor is

org.apache.jasper.JasperException: Exception in JSP:
/vues/formulaire.jsp:24

21:     <table>
22:         <tr>
23:             <td>Nom</td>
24:             <td> <html:text property="nom" size="20" /> </td>
25:         </tr>
26:         <tr>
27:             <td>Age</td>

<html:text property="nom"  not <html:text property="nomz"


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.