Re: Imbeding a struts tag in another ?

2003-03-28 Thread Jean-Michel Auguste
Thanks for your help. This is exactly what I was looking for (but I could
not found because I was using Struts 1.0)

- Original Message -
From: apachep2 [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 18:38
Subject: RE: Imbeding a struts tag in another ?


 idName is the name of that bean

 html:radio idName=obj value=prop property=selection/

 -Original Message-
 From: Jean-Michel Auguste [mailto:[EMAIL PROTECTED]
 Sent: March 27, 2003 12:25 PM
 To: [EMAIL PROTECTED]
 Subject: Imbeding a struts tag in another ?

 Hi,

 I'm having the following problem.
 I need to display a radio button in a Jsp but the attribute value of
 this radio button must be set with the property of a bean located in the
 request.
 How can I code that using struts tags only ?

 I tried the following but does not work.

 html:radio property=selection value=bean:write name=obj
 property=prop  /  /

 Any idea ?
 Thanks

 Jean-Michel Auguste

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


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



Using JSP struts tag logic:iterate

2003-03-27 Thread Jean-Michel Auguste
Hi,
I'm a bit confusing using the jsp struts tag logic:iterate.
Here is my problem.

In my business logic I've created an object (let's call it objA) that contains a 
Hashtable which itself contain a list of objects (objB) . The Hastable object 
(hTable) can be accessed through getter and setter from objA. 
I want now to display as a table the property prop of all objB objects contained 
in the Hashtable hTable (prop is a String  and can be accessed through getter and 
setter from objB. 

Before launching the jsp I've put objA in the HTTP request.

Then I've coded the following  in the Jsp : 

jsp:useBean id=objA class=ObjA scope=request/jsp:useBean

logic:iterate name=objA property=hTable id=objB indexId=ind 
Next element is bean:write name=objB property=prop / [bean:write 
name=ind/]
/logic:iterate 
  
Coding this, I get the following error : 

[Servlet Error]-[No getter method for property prop of bean objB]: 


I tried then to code :

jsp:useBean id=objA class=ObjA scope=request/jsp:useBean

logic:iterate name=objA property=hTable id=objB indexId=ind type=ObjB 
Next element is bean:write name=objB property=prop / [bean:write 
name=ind/]
/logic:iterate 

In this case I get the following error :
  
[Servlet Error]-[JSP 1.2 Processor]: java.lang.ClassCastException: 
java.util.Hashtable$Entry

Can anyone tell me what I am doing wrong please ?

Thanks for your help

Jean-Michel Auguste



Re: Using JSP struts tag logic:iterate

2003-03-27 Thread Jean-Michel Auguste
Thanks for your help Nico,
As you recommend I've checked into my ObjB class and the property prop
looks well formed :

- prop is of type String
- there is only one getter (getProp() ) and one setter (setProp(String p) )
- getProp() is public

As I mentionned in my first append, I used two ways to code the
logic:iterate tag.
I can understand the first error message as there is no mention anywhere of
the type of  objB (as objB is stored as an Object type in the
Hashtable). But I don't understand the second error message (invalid Cast)
as I specify the type for objB.


- Original Message -
From: Nicolas De Loof [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 11:27
Subject: Re: Using JSP struts tag logic:iterate


 You don't need jsp:useBean as struts tags look into scope themself.
(usebean create a scriptlet variable from a bean)

 Your code looks fine. Look at objB code, getter should not be well formed.
 - be carreful about uppercase beginig properties
 - be carreful not to have mulitple setters with different data types
(IFAIK it will break javaBean PropertyInfo)
 - be carreful getter is public

 Nico.



 Hi,
 I'm a bit confusing using the jsp struts tag logic:iterate.
 Here is my problem.

 In my business logic I've created an object (let's call it objA) that
contains a Hashtable which itself contain a list
 of objects (objB) . The Hastable object (hTable) can be accessed
through getter and setter from objA.
 I want now to display as a table the property prop of all objB objects
contained in the Hashtable hTable (prop
 is a String  and can be accessed through getter and setter from objB.

 Before launching the jsp I've put objA in the HTTP request.

 Then I've coded the following  in the Jsp :

 jsp:useBean id=objA class=ObjA scope=request/jsp:useBean

 logic:iterate name=objA property=hTable id=objB indexId=ind 
 Next element is bean:write name=objB property=prop /
[bean:write name=ind/]
 /logic:iterate

 Coding this, I get the following error :

 [Servlet Error]-[No getter method for property prop of bean objB]:


 I tried then to code :

 jsp:useBean id=objA class=ObjA scope=request/jsp:useBean

 logic:iterate name=objA property=hTable id=objB indexId=ind
type=ObjB 
 Next element is bean:write name=objB property=prop /
[bean:write name=ind/]
 /logic:iterate

 In this case I get the following error :

 [Servlet Error]-[JSP 1.2 Processor]: java.lang.ClassCastException:
java.util.Hashtable$Entry

 Can anyone tell me what I am doing wrong please ?

 Thanks for your help

 Jean-Michel Auguste



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


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



Re: Using JSP struts tag logic:iterate

2003-03-27 Thread Jean-Michel Auguste
Hi Nicolas,
After some reading, I wrote the following code that works pretty well...

 logic:iterate name=objA property=hTable id=objB 
  Next element is bean:write name=objB property=value.prop /
[bean:write name=objB property=key /]
 /logic:iterate

I don't fully understand how the cast from Object to ObjB is performed but
it works
Thanks for your help.


- Original Message -
From: Nicolas De Loof [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 12:24
Subject: Re: Using JSP struts tag logic:iterate


 YOu can read this on struts-logic doc :

 Normally, each object exposed by the iterate tag is an element of the
underlying collection you are iterating over.
 However, if you iterate over a Map, the exposed object is of type
Map.Entry that has two properties:

 key - The key under which this item is stored in the underlying Map.
 value - The value that corresponds to this key.

 So, you should use :

 logic:iterate name=objA property=hTable id=objB indexId=ind
type=ObjB 
  Next element is bean:write name=objB property=value.prop /
  [bean:write name=value.ind/]
 /logic:iterate

 Nico.

  Thanks for your help Nico,
  As you recommend I've checked into my ObjB class and the property prop
  looks well formed :
 
  - prop is of type String
  - there is only one getter (getProp() ) and one setter (setProp(String
p) )
  - getProp() is public
 
  As I mentionned in my first append, I used two ways to code the
  logic:iterate tag.
  I can understand the first error message as there is no mention anywhere
of
  the type of  objB (as objB is stored as an Object type in the
  Hashtable). But I don't understand the second error message (invalid
Cast)
  as I specify the type for objB.
 
 
  - Original Message -
  From: Nicolas De Loof [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Thursday, March 27, 2003 11:27
  Subject: Re: Using JSP struts tag logic:iterate
 
 
   You don't need jsp:useBean as struts tags look into scope themself.
  (usebean create a scriptlet variable from a bean)
  
   Your code looks fine. Look at objB code, getter should not be well
formed.
   - be carreful about uppercase beginig properties
   - be carreful not to have mulitple setters with different data types
  (IFAIK it will break javaBean PropertyInfo)
   - be carreful getter is public
  
   Nico.
  
  
  
   Hi,
   I'm a bit confusing using the jsp struts tag logic:iterate.
   Here is my problem.
  
   In my business logic I've created an object (let's call it objA)
that
  contains a Hashtable which itself contain a list
   of objects (objB) . The Hastable object (hTable) can be accessed
  through getter and setter from objA.
   I want now to display as a table the property prop of all objB
objects
  contained in the Hashtable hTable (prop
   is a String  and can be accessed through getter and setter from
objB.
  
   Before launching the jsp I've put objA in the HTTP request.
  
   Then I've coded the following  in the Jsp :
  
   jsp:useBean id=objA class=ObjA scope=request/jsp:useBean
  
   logic:iterate name=objA property=hTable id=objB indexId=ind 
   Next element is bean:write name=objB property=prop /
  [bean:write name=ind/]
   /logic:iterate
  
   Coding this, I get the following error :
  
   [Servlet Error]-[No getter method for property prop of bean objB]:
  
  
   I tried then to code :
  
   jsp:useBean id=objA class=ObjA scope=request/jsp:useBean
  
   logic:iterate name=objA property=hTable id=objB indexId=ind
  type=ObjB 
   Next element is bean:write name=objB property=prop /
  [bean:write name=ind/]
   /logic:iterate
  
   In this case I get the following error :
  
   [Servlet Error]-[JSP 1.2 Processor]: java.lang.ClassCastException:
  java.util.Hashtable$Entry
  
   Can anyone tell me what I am doing wrong please ?
  
   Thanks for your help
  
   Jean-Michel Auguste
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


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


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



Re: Using JSP struts tag logic:iterate

2003-03-27 Thread Jean-Michel Auguste
Ok, now I understand.
Thanks a lot.

- Original Message -
From: Nicolas De Loof [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 15:43
Subject: Re: Using JSP struts tag logic:iterate


 Simply they're is no Cast at all !
 Tags use commons-beanUtils. This package uses javaBean standard to get
properties from objects. In fact they use the
 java.beans.PropertyDescriptor class to get property getter and setter,
without having to know the class used.

 Nico.



  Hi Nicolas,
  After some reading, I wrote the following code that works pretty well...
 
   logic:iterate name=objA property=hTable id=objB 
Next element is bean:write name=objB property=value.prop /
  [bean:write name=objB property=key /]
   /logic:iterate
 
  I don't fully understand how the cast from Object to ObjB is performed
but
  it works
  Thanks for your help.
 
 
  - Original Message -
  From: Nicolas De Loof [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Thursday, March 27, 2003 12:24
  Subject: Re: Using JSP struts tag logic:iterate
 
 
   YOu can read this on struts-logic doc :
  
   Normally, each object exposed by the iterate tag is an element of the
  underlying collection you are iterating over.
   However, if you iterate over a Map, the exposed object is of type
  Map.Entry that has two properties:
  
   key - The key under which this item is stored in the underlying Map.
   value - The value that corresponds to this key.
  
   So, you should use :
  
   logic:iterate name=objA property=hTable id=objB indexId=ind
  type=ObjB 
Next element is bean:write name=objB property=value.prop /
[bean:write name=value.ind/]
   /logic:iterate
  
   Nico.
  
Thanks for your help Nico,
As you recommend I've checked into my ObjB class and the property
prop
looks well formed :
   
- prop is of type String
- there is only one getter (getProp() ) and one setter
(setProp(String
  p) )
- getProp() is public
   
As I mentionned in my first append, I used two ways to code the
logic:iterate tag.
I can understand the first error message as there is no mention
anywhere
  of
the type of  objB (as objB is stored as an Object type in the
Hashtable). But I don't understand the second error message
(invalid
  Cast)
as I specify the type for objB.
   
   
- Original Message -
From: Nicolas De Loof [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 11:27
Subject: Re: Using JSP struts tag logic:iterate
   
   
 You don't need jsp:useBean as struts tags look into scope
themself.
(usebean create a scriptlet variable from a bean)

 Your code looks fine. Look at objB code, getter should not be well
  formed.
 - be carreful about uppercase beginig properties
 - be carreful not to have mulitple setters with different data
types
(IFAIK it will break javaBean PropertyInfo)
 - be carreful getter is public

 Nico.



 Hi,
 I'm a bit confusing using the jsp struts tag logic:iterate.
 Here is my problem.

 In my business logic I've created an object (let's call it objA)
  that
contains a Hashtable which itself contain a list
 of objects (objB) . The Hastable object (hTable) can be
accessed
through getter and setter from objA.
 I want now to display as a table the property prop of all objB
  objects
contained in the Hashtable hTable (prop
 is a String  and can be accessed through getter and setter from
  objB.

 Before launching the jsp I've put objA in the HTTP request.

 Then I've coded the following  in the Jsp :

 jsp:useBean id=objA class=ObjA scope=request/jsp:useBean

 logic:iterate name=objA property=hTable id=objB
indexId=ind 
 Next element is bean:write name=objB property=prop /
[bean:write name=ind/]
 /logic:iterate

 Coding this, I get the following error :

 [Servlet Error]-[No getter method for property prop of bean objB]:


 I tried then to code :

 jsp:useBean id=objA class=ObjA scope=request/jsp:useBean

 logic:iterate name=objA property=hTable id=objB
indexId=ind
type=ObjB 
 Next element is bean:write name=objB property=prop /
[bean:write name=ind/]
 /logic:iterate

 In this case I get the following error :

 [Servlet Error]-[JSP 1.2 Processor]: java.lang.ClassCastException:
java.util.Hashtable$Entry

 Can anyone tell me what I am doing wrong please ?

 Thanks for your help

 Jean-Michel Auguste



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

Imbeding a struts tag in another ?

2003-03-27 Thread Jean-Michel Auguste
Hi,

I'm having the following problem.
I need to display a radio button in a Jsp but the attribute value of this radio 
button must be set with the property of a bean located in the request.
How can I code that using struts tags only ?

I tried the following but does not work.

html:radio property=selection value=bean:write name=obj property=prop  /  /

Any idea ?
Thanks 

Jean-Michel Auguste


Re: Imbeding a struts tag in another ?

2003-03-27 Thread Jean-Michel Auguste
Sorry, I'm new with Struts. What's Struts-EL tags?
Where can I find info please ? 
Thanks

- Original Message - 
From: Wendy Smoak [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 18:28
Subject: RE: Imbeding a struts tag in another ?


  I'm having the following problem.
  I need to display a radio button in a Jsp but the attribute 
  value of this radio button must be set with the property of a bean
 located in the request.
  How can I code that using struts tags only ?
  I tried the following but does not work.
  html:radio property=selection value=bean:write name=obj
 property=prop  /  /
 
 Can you use the Struts-EL tags?
 html:radio property=selection value=${obj.prop} /
 
 -- 
 Wendy Smoak
 Applications Systems Analyst, Sr.
 Arizona State University PA Information Resources Management
 


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