Re: logic:present and html:text tags problem

2005-10-18 Thread Emmanuel.Leguy

Laurie Harper a écrit :


Sure.
DynaActionForm dForm = (DynaActionForm) form;
dForm.set( name, person.getName() );

You can also use BeanUtils to copy properties from the Person to the 
Form bean:

BeanUtils.copyProperties( dForm, person );


Il get this error:

javax.servlet.ServletException: Invalid property name 'name'

org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516) 


org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423) 


org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) 


org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)

org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

java.lang.IllegalArgumentException: Invalid property name 'name'

org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:600) 


org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:413)

fr.lifl.existant.struts.action.ChoisirHomonyme.execute(ChoisirHomonyme.java:67) 


org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421) 


org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) 


org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)

org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

?

Thanx,

Manu.



Did you specify a 'name' property in your form bean declaration in 
struts-config.xml? 'Dyna' forms only have the properties you specify. 
I've never used them, but I think the 'lazy' versions allow you to use 
arbitrary properties without having to declare them.


Yes name is specified. I think it needs more explanations. My action 
sequence is:


jsp0 --- Action1 jsp1 - Action2  jsp2
|   |
  Formbean1 Formbean2

I would like to pre-populate Formbean2 in Action1 to put default values 
in jsp1. Formbean2 specifies a name property. Unfortunately, when  i 
code this


DynaActionForm dForm = (DynaActionForm) form;
dForm.set( name, person.getName() );

in Action1 dForm refers to Formbean1 (not Formbean2). Formbean1 is used 
to get informations entered in jsp0. Since Formbean1 does not specify a 
name property (it does not need any), i get an error.


My question is then:

How to populate Formbean2 in Action1?

Thanx,

Manu.

--
Emmanuel Leguy  LIFL - UMR8022 CNRS - Bat M3
Tel: +33 3 28 77 85 32  USTL - Universite de Lille 1
Fax: +33 3 28 77 85 37  59655 VILLENEUVE D'ASCQ CEDEX - FRANCE

mailto:[EMAIL PROTECTED]
http://www.lifl.fr/ANNUAIRE/employee.php?login=leguye

Ce mail est signe par un certificat X509 fourni par le CNRS
La verification de ce certificat peut etre faite a l'adresse suivante: 
http://igc.services.cnrs.fr/CNRS-Standard/recherche.html 



smime.p7s
Description: S/MIME Cryptographic Signature


Re: logic:present and html:text tags problem

2005-10-17 Thread Emmanuel.Leguy

Laurie Harper a écrit :


Emmanuel.Leguy wrote:


Hello,

I use the following code in a jsp:

logic:present name=person
html:text property=name  value='%= person.getName() %'/
/logic:present

If 'person' is not present %= person.getName() % is compiled and I 
get this error: membreLIFL cannot be resolved


If i use this code:

logic:present name=person
input type=text name=name value=bean:write 
name=person property=name//

/logic:present

No problem.

How can i use the html:text tag?



Did you try this?

logic:present name=person
html:text name=person property=name/
/logic:present

L.

No. I didn't try this. That works but if an error ocure (validate), the 
form is displayed with the person.name value and not with the 
formbean.name value.


Thanks,

Manu.

--
Emmanuel Leguy  LIFL - UMR8022 CNRS - Bat M3
Tel: +33 3 28 77 85 32  USTL - Universite de Lille 1
Fax: +33 3 28 77 85 37  59655 VILLENEUVE D'ASCQ CEDEX - FRANCE

mailto:[EMAIL PROTECTED]
http://www.lifl.fr/ANNUAIRE/employee.php?login=leguye

Ce mail est signe par un certificat X509 fourni par le CNRS
La verification de ce certificat peut etre faite a l'adresse suivante: 
http://igc.services.cnrs.fr/CNRS-Standard/recherche.html 



smime.p7s
Description: S/MIME Cryptographic Signature


Re: logic:present and html:text tags problem

2005-10-17 Thread Wendy Smoak

From: Emmanuel.Leguy [EMAIL PROTECTED]

Laurie Harper a écrit :

Did you try this?

logic:present name=person
html:text name=person property=name/
/logic:present

No. I didn't try this. That works but if an error ocure (validate), the 
form is displayed with the person.name value and not with the 
formbean.name value.


In Action code, before forwarding to the JSP, look up the Person object and 
pre-populate the form bean's 'name' property.


Then you have the choice of checking for the 'person' bean or the form 
bean's 'name' property in logic:present before displaying the text field. 
(From what you've posted I'm not sure which is more appropriate.)


--
Wendy 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: logic:present and html:text tags problem

2005-10-17 Thread Emmanuel.Leguy

Wendy Smoak a écrit :


From: Emmanuel.Leguy [EMAIL PROTECTED]


Laurie Harper a écrit :


Did you try this?

logic:present name=person
html:text name=person property=name/
/logic:present

No. I didn't try this. That works but if an error ocure (validate), 
the form is displayed with the person.name value and not with the 
formbean.name value.



In Action code, before forwarding to the JSP, look up the Person 
object and pre-populate the form bean's 'name' property.


Then you have the choice of checking for the 'person' bean or the form 
bean's 'name' property in logic:present before displaying the text 
field. (From what you've posted I'm not sure which is more appropriate.)



Is it possible with a dynaActionForm?

Thanx,

Manu.

--
Emmanuel Leguy  LIFL - UMR8022 CNRS - Bat M3
Tel: +33 3 28 77 85 32  USTL - Universite de Lille 1
Fax: +33 3 28 77 85 37  59655 VILLENEUVE D'ASCQ CEDEX - FRANCE

mailto:[EMAIL PROTECTED]
http://www.lifl.fr/ANNUAIRE/employee.php?login=leguye

Ce mail est signe par un certificat X509 fourni par le CNRS
La verification de ce certificat peut etre faite a l'adresse suivante: 
http://igc.services.cnrs.fr/CNRS-Standard/recherche.html 



smime.p7s
Description: S/MIME Cryptographic Signature


Re: logic:present and html:text tags problem

2005-10-17 Thread Wendy Smoak

From: Emmanuel.Leguy [EMAIL PROTECTED]
Wendy wrote:
In Action code, before forwarding to the JSP, look up the Person object 
and pre-populate the form bean's 'name' property.



Is it possible with a dynaActionForm?


Sure.
DynaActionForm dForm = (DynaActionForm) form;
dForm.set( name, person.getName() );

You can also use BeanUtils to copy properties from the Person to the Form 
bean:

BeanUtils.copyProperties( dForm, person );

--
Wendy 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: logic:present and html:text tags problem

2005-10-17 Thread Emmanuel.Leguy

Wendy Smoak a écrit :


From: Emmanuel.Leguy [EMAIL PROTECTED]
Wendy wrote:

In Action code, before forwarding to the JSP, look up the Person 
object and pre-populate the form bean's 'name' property.





Is it possible with a dynaActionForm?



Sure.
DynaActionForm dForm = (DynaActionForm) form;
dForm.set( name, person.getName() );

You can also use BeanUtils to copy properties from the Person to the 
Form bean:

BeanUtils.copyProperties( dForm, person );


Il get this error:

javax.servlet.ServletException: Invalid property name 'name'

org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)

org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

java.lang.IllegalArgumentException: Invalid property name 'name'

org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:600)
org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:413)

fr.lifl.existant.struts.action.ChoisirHomonyme.execute(ChoisirHomonyme.java:67)

org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

?

Thanx,

Manu.

--
Emmanuel Leguy  LIFL - UMR8022 CNRS - Bat M3
Tel: +33 3 28 77 85 32  USTL - Universite de Lille 1
Fax: +33 3 28 77 85 37  59655 VILLENEUVE D'ASCQ CEDEX - FRANCE

mailto:[EMAIL PROTECTED]
http://www.lifl.fr/ANNUAIRE/employee.php?login=leguye

Ce mail est signe par un certificat X509 fourni par le CNRS
La verification de ce certificat peut etre faite a l'adresse suivante: 
http://igc.services.cnrs.fr/CNRS-Standard/recherche.html 



smime.p7s
Description: S/MIME Cryptographic Signature


[OT]Re: logic:present and html:text tags problem

2005-10-17 Thread Dave Newton

Emmanuel.Leguy wrote:
[nothing]

Why do I not see anything for Emmanuel's emails? I'm running Thunderbird 
on XP SP2.


Dave




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: logic:present and html:text tags problem

2005-10-17 Thread Laurie Harper

Emmanuel.Leguy wrote:

Wendy Smoak a écrit :


From: Emmanuel.Leguy [EMAIL PROTECTED]
Wendy wrote:

In Action code, before forwarding to the JSP, look up the Person 
object and pre-populate the form bean's 'name' property.






Is it possible with a dynaActionForm?




Sure.
DynaActionForm dForm = (DynaActionForm) form;
dForm.set( name, person.getName() );

You can also use BeanUtils to copy properties from the Person to the 
Form bean:

BeanUtils.copyProperties( dForm, person );


Il get this error:

javax.servlet.ServletException: Invalid property name 'name'
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516) 

org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423) 

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) 


org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

java.lang.IllegalArgumentException: Invalid property name 'name'
org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:600) 


org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:413)
fr.lifl.existant.struts.action.ChoisirHomonyme.execute(ChoisirHomonyme.java:67) 

org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421) 

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) 


org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

?

Thanx,

Manu.


Did you specify a 'name' property in your form bean declaration in 
struts-config.xml? 'Dyna' forms only have the properties you specify. 
I've never used them, but I think the 'lazy' versions allow you to use 
arbitrary properties without having to declare them.


L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: logic:present and html:text tags problem

2005-10-15 Thread Aldo Vadillo Batista
It doesn't work because person is not declared in Java. Maybe person is
in session scope (or request scope).
 It's not a good solution using scriptlets but if you want, you have to put
something like this:
 html:text property=name values='%=((Person) request.getSession
().getAttribute(person)).getName()%'/

 
  logic:present name=person
  html:text property=name  value='%= person.getName() %'/
  /logic:present



Re: logic:present and html:text tags problem

2005-10-15 Thread Michael Jouravlev
If Person object is null, he will get the same NPE. Nice thing about
JSTL is that:

* JSTL looks in different contexts;
* JSTL does not throw NPE if accessed object was null

Michael.

On 10/15/05, Aldo Vadillo Batista [EMAIL PROTECTED] wrote:
 It doesn't work because person is not declared in Java. Maybe person is
 in session scope (or request scope).
  It's not a good solution using scriptlets but if you want, you have to put
 something like this:
  html:text property=name values='%=((Person) request.getSession
 ().getAttribute(person)).getName()%'/

  
   logic:present name=person
   html:text property=name  value='%= person.getName() %'/
   /logic:present
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: logic:present and html:text tags problem

2005-10-14 Thread Dave
Try using the -el taglib:
%@ taglib uri=/tags/struts-html-el prefix=html-el %
...
html-el:text property=name value=${person.name} /



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: logic:present and html:text tags problem

2005-10-14 Thread Laurie Harper

Emmanuel.Leguy wrote:

Hello,

I use the following code in a jsp:

logic:present name=person
html:text property=name  value='%= person.getName() %'/
/logic:present

If 'person' is not present %= person.getName() % is compiled and I get 
this error: membreLIFL cannot be resolved


If i use this code:

logic:present name=person
input type=text name=name value=bean:write name=person 
property=name//

/logic:present

No problem.

How can i use the html:text tag?


Did you try this?

logic:present name=person
html:text name=person property=name/
/logic:present

L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]