Re: How to set the property of a drop-down select list from an action class?

2006-09-04 Thread Puneet Lakhina

On 9/4/06, Tom Bednarz <[EMAIL PROTECTED]> wrote:


Hi Martin,

Hmm, thanks for the link.

Finally my problem is, that in the generated HTML page NONE of the
option tags has the attribute SELECTED. So my drop-down list box
displays the whole collection as expected, but setPropertyUtils seems to
have no impact otherwise the correct value should be selected.

So probably could someone post the code for a simple problem:

I have a select box eg

0 Value0
1 Value1
2 Value2

Displayed to the user is
Value0
Value1
Value2

If a specific record is looked at, the Value might be 1, so I should set
the property to 1 and the list-box should show
Value1 to the user as selected item.

This should be a very common problem but I simply cant get it working!!!

Tom


AFAIK this is done in the following way





Now the value that will be selected will be the one whose value attribute
equals the property specified in .
i.e. suppose when the page is loaded the property foo has value "NYC" then
the object in the options collection whose someProperty equals "NYC" will be
selected.

So I think what you ought to have in order for the right value to be
selected is






--
Puneet


Re: How to set the property of a drop-down select list from an action class?

2006-09-04 Thread Tom Bednarz

Hi Martin,

Hmm, thanks for the link.

Finally my problem is, that in the generated HTML page NONE of the 
option tags has the attribute SELECTED. So my drop-down list box 
displays the whole collection as expected, but setPropertyUtils seems to 
have no impact otherwise the correct value should be selected.


So probably could someone post the code for a simple problem:

I have a select box eg

0 Value0
1 Value1
2 Value2

Displayed to the user is
Value0
Value1
Value2

If a specific record is looked at, the Value might be 1, so I should set 
the property to 1 and the list-box should show

Value1 to the user as selected item.

This should be a very common problem but I simply cant get it working!!!

Tom

Martin Gainty wrote:

Good Morning Tom

If I understand your question you want to set properties via 
PropertyUtils.setPropertyUtils(InstantiatedBeanObject,BeanAttributeToSet,value)?
An excellent tutorial showing how to construct the Bean as well as 
setPropertyUtils methods is located here
http://brahe.discursive.com/viewcvs/commons-beanutils5/trunk/src/java/org/apache/commons/beanutils/package.html?rev=1

HTH
Martin --
*
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



- Original Message - 
From: "Tom Bednarz" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Monday, September 04, 2006 7:13 AM
Subject: Re: How to set the property of a drop-down select list from an action 
class?


  

Hi,

Thanks for your feedback but it is NOT what I want to do. This looks 
very much like mixing Java and HTML. I like to fill the form properties 
in my ActionClass and use JSP to display them.


So in my Action Class there should be something like

PropertyUtils.setSimpleProperty(form, "expenseType", );

In the JSP as shown in my original message:




  

where expenseTypes is the collection containing instances of expenseType 
class and typeCode is the value and typeDescription the label displayed 
in the drop-down listbox.


I currently don't know how to set the property using PropertyUtils in my 
Action class.


Tom

MADISHETTY, ASHOK [AG-Contractor/8042] wrote:


Hi,

 


You may try following:

 

Enumeration expenseTypeList = expenseTypes.elements();  // Vector of 


ExpenseType class objects

 


ExpenseType type = null;

 




 


if (expenseTypeList != null) {

  while(expenseTypeList.hasMoreElements()) {

   type = (ExpenseType) expenseTypeList.nextElement();

 +type.getTypeDescription()+

 

 } 

} 




 


This will display type description in list box and retrieve typeCode when
you call select.value();

 


Is that what you wanted?

 


Thanks

Ashok

 

 

 

 


-Original Message-
From: Tom Bednarz [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 04, 2006 2:24 PM

To: Struts Users Mailing List
Subject: How to set the property of a drop-down select list from an action
class?

 

I like to display a dop-down select list and select an apropriate entry 


from that list in an action:

 


This fills the list box:

 




   

 

 


The expenseTypes is a Vector of the following class:

 

 


public class ExpenseType

{

   long typeCode;

   String typeDescription;




   public ExpenseType()

   {

   }




   public ExpenseType(long typeCode, String typeDescription)

   {

 super();

 


 this.typeCode = typeCode;

 this.typeDescription = typeDescription;

   }

 


   ... setters and getters

}

 

 

In my Action class I usually use the following code to populate the form 


with values from a business object:

 


PropertyUtils.setSimpleProperty(form, "expenseName", expense.getName());

...

 

How do I pre-select the correct entry in my drop-down list-box? In my 

business object I have a value that matches the typeCode of the above 


class but dispayed should be the typeDescription.

 

The collection is a vector, but I do not know the postition of the item 

to select, I only have its value. So I cannot use 

ProperyUtils.getIndexedProperty(..). But I can also not use 


getMappedProperty() since a vector has no keys

 

So how is this done with Vectors? Or should in general Hashtables be 


taken for drop-down listboxes?

 


Tom

 


-

To unsubscribe, e-mail: [EMAIL PROTECTED]

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

 



-
This e-mail message may contain privileged and/or confidential information, and 
is intended to be received only by persons ent

Re: Token is wrapped by

2006-09-04 Thread Antonio Petrelli

MC Moisei ha scritto:

When I use  with tokens the hidden token is wrapped by div.
Is there a reason for that ? It messes up my layout and seems that
Firefox is most affected by the div...




I think you're right, AFAIK usually the  tag adds also a new-line.
I think that you should ask this question to Struts Developers list:
http://struts.apache.org/mail.html

Ciao
Antonio

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



Re: [tiles] Re: Struts tiles cewolf problem(Resolved)

2006-09-04 Thread Matts
You thinks well antonio!! It has worked without the  tag! 
Thank you very much.
I will try now to integrate it with the real application, and I think I will 
have problems removing  cause I have other resourses that need 
it!!! But well that is another theme!! thanks


- Original Message - 
From: "Antonio Petrelli" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Monday, September 04, 2006 11:40 AM
Subject: Re: [tiles] Re: Struts tiles cewolf problem



Matts ha scritto:

Layout1(at web-inf/tiles):
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ taglib uri="http://struts.apache.org/tags-tiles";
prefix="tiles" %>












Hehe! I (think I) got it!
This is the "infamous"  tag that, with Tiles, uses your 
layout JSP page as the base path, I still don't know why. (Just check your 
produced HTML and look at the  tag).
In these cases I suggest to remove the  tag and use only 
relative paths.


HTH
Antonio

-
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: [tiles] Re: Struts tiles cewolf problem

2006-09-04 Thread Antonio Petrelli

Matts ha scritto:

Layout1(at web-inf/tiles):
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ taglib uri="http://struts.apache.org/tags-tiles";
prefix="tiles" %>












Hehe! I (think I) got it!
This is the "infamous"  tag that, with Tiles, uses your 
layout JSP page as the base path, I still don't know why. (Just check 
your produced HTML and look at the  tag).
In these cases I suggest to remove the  tag and use only 
relative paths.


HTH
Antonio

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



Re: Struts tiles cewolf problem

2006-09-04 Thread Matts

Here's the web.xml (its works without tiles):


2.3//EN"


"http://java.sun.com/dtd/web-app_2_3.dtd";>



Cewolf



action

org.apache.struts.action.ActionServlet



config

/WEB-INF/struts-config.xml



1






CewolfServlet

de.laures.cewolf.CewolfRenderer

1






action

*.do







CewolfServlet

/cewolf/*







index.jsp





/WEB-INF/struts-bean

/WEB-INF/struts-bean.tld





/WEB-INF/struts-logic

/WEB-INF/struts-logic.tld





/WEB-INF/struts-html

/WEB-INF/struts-html.tld





/WEB-INF/c

/WEB-INF/c.tld





/WEB-INF/fmt

/WEB-INF/fmt.tld





/WEB-INF/struts-tiles

/WEB-INF/struts-tiles.tld





/WEB-INF/struts-nested

/WEB-INF/struts-nested.tld





- Original Message - 
From: "Antonio Petrelli" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Monday, September 04, 2006 11:27 AM
Subject: Re: Struts tiles cewolf problem



Matts ha scritto:

It's work fine if i don't use tiles.
The problem is that with tiles the chart are not show.



I don't see anything wrong with your file. What do you exactly mean with 
"the charts are not shown"? The page is completely blank? There is a 
missing piece of the page? Images are not shown, and you see a "broken 
image" in your result?


-
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: Struts tiles cewolf problem

2006-09-04 Thread Matts
The result with tiles is this: image is not show. Its appear with an "X". 
Here's a capture.


- Original Message - 
From: "Antonio Petrelli" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Monday, September 04, 2006 11:27 AM
Subject: Re: Struts tiles cewolf problem



Matts ha scritto:

It's work fine if i don't use tiles.
The problem is that with tiles the chart are not show.



I don't see anything wrong with your file. What do you exactly mean with 
"the charts are not shown"? The page is completely blank? There is a 
missing piece of the page? Images are not shown, and you see a "broken 
image" in your result?


-
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: Struts tiles cewolf problem

2006-09-04 Thread Antonio Petrelli

Matts ha scritto:

It's work fine if i don't use tiles.
The problem is that with tiles the chart are not show.
  


I don't see anything wrong with your file. What do you exactly mean with 
"the charts are not shown"? The page is completely blank? There is a 
missing piece of the page? Images are not shown, and you see a "broken 
image" in your result?


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



Re: [tiles] Re: Struts tiles cewolf problem

2006-09-04 Thread Matts

Layout1(at web-inf/tiles):
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ taglib uri="http://struts.apache.org/tags-tiles"; 


prefix="tiles" %>



































- Original Message - 
From: "Antonio Petrelli" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Monday, September 04, 2006 11:16 AM
Subject: Re: [tiles] Re: Struts tiles cewolf problem



Matts ha scritto:




Can you post also layout1.jsp please?


-
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: [tiles] Re: Struts tiles cewolf problem

2006-09-04 Thread Antonio Petrelli

Matts ha scritto:




Can you post also layout1.jsp please?


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



Re: [tiles] Re: Struts tiles cewolf problem

2006-09-04 Thread Matts

My tiles-def.xml looks like:


Configuration 1.1//EN"


"http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd";>























The page that is supposed to show the chart is greeting.jsp wich has the 
body body-greeting.jsp.

greeting. jsp (at web-root/pages):
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>



body-greeting.jsp (at web-inf/tiles):
<[EMAIL PROTECTED] uri='/WEB-INF/cewolf.tld' prefix='cewolf' %>








<%=request.getAttribute("greeting")%>









xaxislabel="Page" yaxislabel="Views">














thanks for reply.
Matts.

- Original Message - 
From: "Antonio Petrelli" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Monday, September 04, 2006 10:59 AM
Subject: [tiles] Re: Struts tiles cewolf problem



Matts ha scritto:
Hi, I'm developing a web app with struts, tiles. I want to use cewolf to 
render chart. It's work fine if i don't use tiles.

The problem is that with tiles the chart are not show.

Any one nows how to integrate correctly with tiles??



Do you use Tiles definitions? If yes can you post them here, along with 
layout pages and the JSP page supposed to show the chart?

Do you receive any exception? If yes, can you post them?

Ciao
Antonio

-
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]



[tiles] Re: Struts tiles cewolf problem

2006-09-04 Thread Antonio Petrelli

Matts ha scritto:

Hi, I'm developing a web app with struts, tiles. I want to use cewolf to render 
chart. It's work fine if i don't use tiles.
The problem is that with tiles the chart are not show.

Any one nows how to integrate correctly with tiles??
  


Do you use Tiles definitions? If yes can you post them here, along with 
layout pages and the JSP page supposed to show the chart?

Do you receive any exception? If yes, can you post them?

Ciao
Antonio

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



Struts tiles cewolf problem

2006-09-04 Thread Matts
Hi, I'm developing a web app with struts, tiles. I want to use cewolf to render 
chart. It's work fine if i don't use tiles.
The problem is that with tiles the chart are not show.

Any one nows how to integrate correctly with tiles??

Re: How to set the property of a drop-down select list from an action class?

2006-09-04 Thread Martin Gainty
Good Morning Tom

If I understand your question you want to set properties via 
PropertyUtils.setPropertyUtils(InstantiatedBeanObject,BeanAttributeToSet,value)?
An excellent tutorial showing how to construct the Bean as well as 
setPropertyUtils methods is located here
http://brahe.discursive.com/viewcvs/commons-beanutils5/trunk/src/java/org/apache/commons/beanutils/package.html?rev=1

HTH
Martin --
*
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



- Original Message - 
From: "Tom Bednarz" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Monday, September 04, 2006 7:13 AM
Subject: Re: How to set the property of a drop-down select list from an action 
class?


> Hi,
> 
> Thanks for your feedback but it is NOT what I want to do. This looks 
> very much like mixing Java and HTML. I like to fill the form properties 
> in my ActionClass and use JSP to display them.
> 
> So in my Action Class there should be something like
> 
> PropertyUtils.setSimpleProperty(form, "expenseType",  should match ONE entry in my collection>);
> 
> In the JSP as shown in my original message:
> 
> 
> 
> 
> labelProperty="typeDescription"/>
> 
> where expenseTypes is the collection containing instances of expenseType 
> class and typeCode is the value and typeDescription the label displayed 
> in the drop-down listbox.
> 
> I currently don't know how to set the property using PropertyUtils in my 
> Action class.
> 
> Tom
> 
> MADISHETTY, ASHOK [AG-Contractor/8042] wrote:
>> Hi,
>>
>>  
>>
>> You may try following:
>>
>>  
>>
>> Enumeration expenseTypeList = expenseTypes.elements();  // Vector of 
>>
>> ExpenseType class objects
>>
>>  
>>
>> ExpenseType type = null;
>>
>>  
>>
>> 
>>
>>  
>>
>> if (expenseTypeList != null) {
>>
>>   while(expenseTypeList.hasMoreElements()) {
>>
>>type = (ExpenseType) expenseTypeList.nextElement();
>>
>>  +type.getTypeDescription()+
>>
>>  
>>
>>  } 
>>
>> } 
>>
>> 
>>
>>  
>>
>> This will display type description in list box and retrieve typeCode when
>> you call select.value();
>>
>>  
>>
>> Is that what you wanted?
>>
>>  
>>
>> Thanks
>>
>> Ashok
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>> -Original Message-
>> From: Tom Bednarz [mailto:[EMAIL PROTECTED] 
>> Sent: Monday, September 04, 2006 2:24 PM
>> To: Struts Users Mailing List
>> Subject: How to set the property of a drop-down select list from an action
>> class?
>>
>>  
>>
>> I like to display a dop-down select list and select an apropriate entry 
>>
>> from that list in an action:
>>
>>  
>>
>> This fills the list box:
>>
>>  
>>
>> 
>>
>>>
>>   labelProperty="typeDescription"/>
>>
>>  
>>
>>  
>>
>> The expenseTypes is a Vector of the following class:
>>
>>  
>>
>>  
>>
>> public class ExpenseType
>>
>> {
>>
>>long typeCode;
>>
>>String typeDescription;
>>
>> 
>>
>>public ExpenseType()
>>
>>{
>>
>>}
>>
>> 
>>
>>public ExpenseType(long typeCode, String typeDescription)
>>
>>{
>>
>>  super();
>>
>>  
>>
>>  this.typeCode = typeCode;
>>
>>  this.typeDescription = typeDescription;
>>
>>}
>>
>>  
>>
>>... setters and getters
>>
>> }
>>
>>  
>>
>>  
>>
>> In my Action class I usually use the following code to populate the form 
>>
>> with values from a business object:
>>
>>  
>>
>> PropertyUtils.setSimpleProperty(form, "expenseName", expense.getName());
>>
>> ...
>>
>>  
>>
>> How do I pre-select the correct entry in my drop-down list-box? In my 
>>
>> business object I have a value that matches the typeCode of the above 
>>
>> class but dispayed should be the typeDescription.
>>
>>  
>>
>> The collection is a vector, but I do not know the postition of the item 
>>
>> to select, I only have its value. So I cannot use 
>>
>> ProperyUtils.getIndexedProperty(..). But I can also not use 
>>
>> getMappedProperty() since a vector has no keys
>>
>>  
>>
>> So how is this done with Vectors? Or should in general Hashtables be 
>>
>> taken for drop-down listboxes?
>>
>>  
>>
>> Tom
>>
>>  
>>
>> -
>>
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>  
>>
>>
>> -
>> This e-mail message may contain privileged and/or confidential information, 
>> and is intended to be received only by persons entitled to receive such 
>> information. If you have received this e-mail in error, please notify the 
>> sender immediately. Pl

Re: How to set the property of a drop-down select list from an action class?

2006-09-04 Thread Tom Bednarz

Hi,

Thanks for your feedback but it is NOT what I want to do. This looks 
very much like mixing Java and HTML. I like to fill the form properties 
in my ActionClass and use JSP to display them.


So in my Action Class there should be something like

PropertyUtils.setSimpleProperty(form, "expenseType", );

In the JSP as shown in my original message:




  

where expenseTypes is the collection containing instances of expenseType 
class and typeCode is the value and typeDescription the label displayed 
in the drop-down listbox.


I currently don't know how to set the property using PropertyUtils in my 
Action class.


Tom

MADISHETTY, ASHOK [AG-Contractor/8042] wrote:

Hi,

 


You may try following:

 

Enumeration expenseTypeList = expenseTypes.elements();  // Vector of 


ExpenseType class objects

 


ExpenseType type = null;

 




 


if (expenseTypeList != null) {

  while(expenseTypeList.hasMoreElements()) {

   type = (ExpenseType) expenseTypeList.nextElement();

 +type.getTypeDescription()+

 

 } 

} 




 


This will display type description in list box and retrieve typeCode when
you call select.value();

 


Is that what you wanted?

 


Thanks

Ashok

 

 

 

 


-Original Message-
From: Tom Bednarz [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 04, 2006 2:24 PM

To: Struts Users Mailing List
Subject: How to set the property of a drop-down select list from an action
class?

 

I like to display a dop-down select list and select an apropriate entry 


from that list in an action:

 


This fills the list box:

 




   

 

 


The expenseTypes is a Vector of the following class:

 

 


public class ExpenseType

{

   long typeCode;

   String typeDescription;




   public ExpenseType()

   {

   }




   public ExpenseType(long typeCode, String typeDescription)

   {

 super();

 


 this.typeCode = typeCode;

 this.typeDescription = typeDescription;

   }

 


   ... setters and getters

}

 

 

In my Action class I usually use the following code to populate the form 


with values from a business object:

 


PropertyUtils.setSimpleProperty(form, "expenseName", expense.getName());

...

 

How do I pre-select the correct entry in my drop-down list-box? In my 

business object I have a value that matches the typeCode of the above 


class but dispayed should be the typeDescription.

 

The collection is a vector, but I do not know the postition of the item 

to select, I only have its value. So I cannot use 

ProperyUtils.getIndexedProperty(..). But I can also not use 


getMappedProperty() since a vector has no keys

 

So how is this done with Vectors? Or should in general Hashtables be 


taken for drop-down listboxes?

 


Tom

 


-

To unsubscribe, e-mail: [EMAIL PROTECTED]

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

 



-
This e-mail message may contain privileged and/or confidential information, and 
is intended to be received only by persons entitled to receive such 
information. If you have received this e-mail in error, please notify the 
sender immediately. Please delete it and all attachments from any servers, hard 
drives or any other media. Other use of this e-mail by you is strictly 
prohibited.


All e-mails and attachments sent and received are subject to monitoring, reading and archival by 
Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of 
"Viruses" or other "Malware". Monsanto accepts no liability for any damage 
caused by any such code transmitted by or accompanying this e-mail or any attachment.
-


  



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



RE: How to set the property of a drop-down select list from an action class?

2006-09-04 Thread MADISHETTY, ASHOK [AG-Contractor/8042]
Hi,

 

You may try following:

 

Enumeration expenseTypeList = expenseTypes.elements();  // Vector of 

ExpenseType class objects

 

ExpenseType type = null;

 



 

if (expenseTypeList != null) {

  while(expenseTypeList.hasMoreElements()) {

   type = (ExpenseType) expenseTypeList.nextElement();

 +type.getTypeDescription()+

 

 } 

} 



 

This will display type description in list box and retrieve typeCode when
you call select.value();

 

Is that what you wanted?

 

Thanks

Ashok

 

 

 

 

-Original Message-
From: Tom Bednarz [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 04, 2006 2:24 PM
To: Struts Users Mailing List
Subject: How to set the property of a drop-down select list from an action
class?

 

I like to display a dop-down select list and select an apropriate entry 

from that list in an action:

 

This fills the list box:

 



   

 

 

The expenseTypes is a Vector of the following class:

 

 

public class ExpenseType

{

   long typeCode;

   String typeDescription;



   public ExpenseType()

   {

   }



   public ExpenseType(long typeCode, String typeDescription)

   {

 super();

 

 this.typeCode = typeCode;

 this.typeDescription = typeDescription;

   }

 

   ... setters and getters

}

 

 

In my Action class I usually use the following code to populate the form 

with values from a business object:

 

PropertyUtils.setSimpleProperty(form, "expenseName", expense.getName());

...

 

How do I pre-select the correct entry in my drop-down list-box? In my 

business object I have a value that matches the typeCode of the above 

class but dispayed should be the typeDescription.

 

The collection is a vector, but I do not know the postition of the item 

to select, I only have its value. So I cannot use 

ProperyUtils.getIndexedProperty(..). But I can also not use 

getMappedProperty() since a vector has no keys

 

So how is this done with Vectors? Or should in general Hashtables be 

taken for drop-down listboxes?

 

Tom

 

-

To unsubscribe, e-mail: [EMAIL PROTECTED]

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

 


-
This e-mail message may contain privileged and/or confidential information, and 
is intended to be received only by persons entitled to receive such 
information. If you have received this e-mail in error, please notify the 
sender immediately. Please delete it and all attachments from any servers, hard 
drives or any other media. Other use of this e-mail by you is strictly 
prohibited.


All e-mails and attachments sent and received are subject to monitoring, 
reading and archival by Monsanto. The recipient of this e-mail is solely 
responsible for checking for the presence of "Viruses" or other "Malware". 
Monsanto accepts no liability for any damage caused by any such code 
transmitted by or accompanying this e-mail or any attachment.
-



RE: problem in writing scope="session" in actionMappingDefination

2006-09-04 Thread MADISHETTY, ASHOK [AG-Contractor/8042]
Hi,

 

As you know that request scope attributes only live for the life of 1
request. Attributes in session scope are shared across every request a
specific user makes.  

 

However, I googled and found a link. Please see under Put the list in
Session scope in the below link as it may answer your question:

http://www.learntechnology.net/validate-manually.do
 

 

Thanks

Ashok

 

 

 

 

-Original Message-
From: Parvat Singh Ranawat [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 04, 2006 2:26 PM
To: Struts Users Mailing List
Subject: problem in writing scope="session" in actionMappingDefination

 

Hi All,

 

I wanted to know what are the drawbacks of using

SCOPE= "session" in place of "request" in actionMappingDefination

 

  

 

Is it all depend upon our requirement or it is good practice to use

scope="request" in place of session

as if we do so it ll take lot of memory to store list of data in the

sessionScope that may be avoided

 

please do give me some suggestions as in my application some work can be

accomplished by keeping scope="session"

and i can do the work by keeping scope="request" but some additional code is

required to do that .

 

so should I go with scope="session" or not

 

Regards

 

Shakti Singh


-
This e-mail message may contain privileged and/or confidential information, and 
is intended to be received only by persons entitled to receive such 
information. If you have received this e-mail in error, please notify the 
sender immediately. Please delete it and all attachments from any servers, hard 
drives or any other media. Other use of this e-mail by you is strictly 
prohibited.


All e-mails and attachments sent and received are subject to monitoring, 
reading and archival by Monsanto. The recipient of this e-mail is solely 
responsible for checking for the presence of "Viruses" or other "Malware". 
Monsanto accepts no liability for any damage caused by any such code 
transmitted by or accompanying this e-mail or any attachment.
-



problem in writing scope="session" in actionMappingDefination

2006-09-04 Thread Parvat Singh Ranawat

Hi All,

I wanted to know what are the drawbacks of using
SCOPE= "session" in place of "request" in actionMappingDefination

 

Is it all depend upon our requirement or it is good practice to use
scope="request" in place of session
as if we do so it ll take lot of memory to store list of data in the
sessionScope that may be avoided

please do give me some suggestions as in my application some work can be
accomplished by keeping scope="session"
and i can do the work by keeping scope="request" but some additional code is
required to do that .

so should I go with scope="session" or not

Regards

Shakti Singh


How to set the property of a drop-down select list from an action class?

2006-09-04 Thread Tom Bednarz
I like to display a dop-down select list and select an apropriate entry 
from that list in an action:


This fills the list box:


  


The expenseTypes is a Vector of the following class:


public class ExpenseType
{
  long typeCode;
  String typeDescription;

  public ExpenseType()
  {
  }

  public ExpenseType(long typeCode, String typeDescription)
  {
super();

this.typeCode = typeCode;
this.typeDescription = typeDescription;
  }

  ... setters and getters
}


In my Action class I usually use the following code to populate the form 
with values from a business object:


PropertyUtils.setSimpleProperty(form, "expenseName", expense.getName());
...

How do I pre-select the correct entry in my drop-down list-box? In my 
business object I have a value that matches the typeCode of the above 
class but dispayed should be the typeDescription.


The collection is a vector, but I do not know the postition of the item 
to select, I only have its value. So I cannot use 
ProperyUtils.getIndexedProperty(..). But I can also not use 
getMappedProperty() since a vector has no keys


So how is this done with Vectors? Or should in general Hashtables be 
taken for drop-down listboxes?


Tom

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



Re: html:options Hashtable

2006-09-04 Thread nuwan chandrasoma

Hi,

I think you can, according to the  tag code it is possible,
but i havent tried it, give it a try.

Thanks,

Nuwna

On 9/4/06, chamal desilva <[EMAIL PROTECTED]> wrote:


Hi,

Can we display the values of a hashtable in a html
drop down menu using struts tags.



Thanking You,
Chamal.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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




Re: Problems to fill a DropDownListbox on a DynaValidatorActionForm

2006-09-04 Thread Tom Bednarz

Richard,

Many thanks for your feedback. This means I have to store the data 
twice. I tried that but now I get another error:


2006-09-04 09:45:17,339 ERROR [http-8080-1] [/mtweb].[jsp] 
(ApplicationDispatcher.java:704) - Servlet.service() for servlet jsp 
threw exception
javax.servlet.jsp.JspException: Cannot create iterator for 
DynaActionForm[dynaClass=editExpenseForm,.


There seems still be something wrong...

Tom



Richard Yee wrote:

Tom,
Try this for your  tag instead:

 

This will work if your have an attribute called "expenseTypes" in some 
scope (ie. session, request).
The options tag collection attribute expects the name of the collection, 
not the collection itself.


-Richard

Tom Bednarz wrote:
I try to fill a DropDownListbox on a DynaValidatorActionForm and get 
the following exception:


2006-09-03 18:20:45,007 ERROR [http-8080-1] [/mtweb].[jsp] 
(ApplicationDispatcher.java:704) - Servlet.service() for servlet 
jsp threw exception
javax.servlet.jsp.JspException: Cannot find bean under name 
[EMAIL PROTECTED], 
[EMAIL PROTECTED], 
[EMAIL PROTECTED], 
[EMAIL PROTECTED], 
[EMAIL PROTECTED], 
[EMAIL PROTECTED]
at 
org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:366)
at 
org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:186)
at 
org.apache.jsp.form.editExpense_jsp._jspx_meth_html_options_0(org.apache.jsp.form.editExpense_jsp:553) 




I have the follwoing definition in struts-config.xml:

type="org.apache.struts.action.DynaActionForm">

  
  
  
  
  
  
  
  
  
  
  
  


expenseType should be the SELECTED item of a drop-down-listbox. I do 
have a business object containing a java.util.Vector of expenseTypes.

In my JSP file I have:



  
  
I also tried:



  

  
  
but also without any success!


The business object is defined as follows with the containing class 
ExpenseType:


public class TxpExpense extends trixpertObject
{
  .

  private Vector expenseTypes = new Vector();
  ..
  public synchronized Vector getExpenseTypes()
  {
return expenseTypes;
  }
  public synchronized void setExpenseTypes(Vector expenseTypes)
  {
this.expenseTypes = expenseTypes;
  }
  ..
  // somewhere is code which retrieves data
  // from a database to fill instances of
  // class ExpenseType into the Vector
  // expenseTypes

  //
  // an inner class as bean for ExpenseTypes
  //
  public class ExpenseType
  {
long typeCode;
String typeDescription;

public ExpenseType()
{
}
   public ExpenseType(long typeCode, String typeDescription)
{
  this.typeCode = typeCode;
  this.typeDescription = typeDescription;
}

... correct getters and setters
  }
}



What am I doing wrong? Why can the type ExpenseType not be found? Is 
it a problem to define it as inner class?


Many thanks for your help!

Tom

-
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]