RE: unsubcribe

2001-05-22 Thread Tony Karas

Please refer to the INSTRUCTIONS for how to unsubscribe:

http://jakarta.apache.org/site/mail2.html


>From: "Tangeti, Ramarao" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>Subject: RE: unsubcribe
>Date: Tue, 22 May 2001 09:15:45 -0500
>
>Please unsubscribe me from list.

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




RE: Comparing two dynamic values

2001-05-16 Thread Tony Karas

thank you - will give that a go.


>From: [EMAIL PROTECTED]
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: RE: Comparing two dynamic values
>Date: Tue, 15 May 2001 12:12:57 -0400
>
>
>
>Tony,
>
>You could make the href point to an action path, and that way you will go
>through the action before displaying page...
>
>Dave
>
>
>
>
>
>"Tony Karas" <[EMAIL PROTECTED]> on
>05/15/2001 07:12:40 AM
>
>Please respond to [EMAIL PROTECTED]
>
>To:   [EMAIL PROTECTED]
>cc:(bcc: David Hay/Lex/Lexmark)
>Subject:  RE: Comparing two dynamic values
>
>
>
>Well I suppose that's a point - problem is that I am not doing a submit -
>just doing a click via a  so my action bean will not get called -
>suppose i could do some kind of javascript but it's all a little messy.
>
>
> >From: Eelco van Kuik <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> >Subject: RE: Comparing two dynamic values
> >Date: Mon, 14 May 2001 15:01:01 +0200
> >
> >It sounds to me like you're putting controller code in de view code.
> >
> >Maybe it is better to try to take care of it in the ActionForm/Action
> >beans.
> >
> >Regards,
> >
> >Eelco
> >
> >
> >
> >-Original Message-
> >From: Tony Karas [mailto:[EMAIL PROTECTED]]
> >Sent: maandag 14 mei 2001 14:29
> >To: [EMAIL PROTECTED]
> >Subject: Comparing two dynamic values
> >
> >
> >I'm trying to compare a parameter value passed in as part of the URL with 
>a
> >bean value.  So I have something like this:
> >
> >
> > 
> > .
> > .
> > 
> >
> >
> >In the "value" field - it says in the documentation that this has to be a
> >constant value - which is pretty useless to me.  I've tried:
> >
> >value="<%= request.getParameter( "id" ) %>
> >
> >but I get an error.  Should this be possible?  Anyone know if there is a
> >more "Struts" way of doing it?
> >
> >Cheers
> >Tony
> >_
> >Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>_
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
>
>
>
>
>

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




RE: Comparing two dynamic values

2001-05-15 Thread Tony Karas

Well I suppose that's a point - problem is that I am not doing a submit - 
just doing a click via a  so my action bean will not get called - 
suppose i could do some kind of javascript but it's all a little messy.


>From: Eelco van Kuik <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>Subject: RE: Comparing two dynamic values
>Date: Mon, 14 May 2001 15:01:01 +0200
>
>It sounds to me like you're putting controller code in de view code.
>
>Maybe it is better to try to take care of it in the ActionForm/Action 
>beans.
>
>Regards,
>
>Eelco
>
>
>
>-Original Message-
>From: Tony Karas [mailto:[EMAIL PROTECTED]]
>Sent: maandag 14 mei 2001 14:29
>To: [EMAIL PROTECTED]
>Subject: Comparing two dynamic values
>
>
>I'm trying to compare a parameter value passed in as part of the URL with a
>bean value.  So I have something like this:
>
>
> 
> .
> .
> 
>
>
>In the "value" field - it says in the documentation that this has to be a
>constant value - which is pretty useless to me.  I've tried:
>
>value="<%= request.getParameter( "id" ) %>
>
>but I get an error.  Should this be possible?  Anyone know if there is a
>more "Struts" way of doing it?
>
>Cheers
>Tony
>_
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




Comparing two dynamic values

2001-05-14 Thread Tony Karas

I'm trying to compare a parameter value passed in as part of the URL with a 
bean value.  So I have something like this:



.
.



In the "value" field - it says in the documentation that this has to be a 
constant value - which is pretty useless to me.  I've tried:

value="<%= request.getParameter( "id" ) %>

but I get an error.  Should this be possible?  Anyone know if there is a 
more "Struts" way of doing it?

Cheers
Tony
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




Re: Error handling with taglibs

2001-05-11 Thread Tony Karas

I would suggest requesting a change to the current struts implementation.  I 
think this has been thought about because there is the facility to include 
the property that has caused the error.  I would also like to do something 
like this.

I suppose there would be at least two ways of going about it:

1) Make the ActionErrors component more accessible in the jsp page - so that 
some kind of logic tag could be used to generate either a normal html:text 
tag or an html:text error tag, or

2) Add an error attribute to the html:text tag (and others) that would 
render the text box differently if an error is associated with it.

These are my thoughts.

Cheers
Tony

>From: Scott Walter <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Re: Error handling with taglibs
>Date: Fri, 11 May 2001 08:02:18 -0700 (PDT)
>
>I have thought about this myself, just a rough guess
>but you could modify the struts input tags (such as
>the textfield) to do:
>
>1.  Search through the errors vector to see if it
>applies to the current property
>2.  Set background color to the text field to red or
>something like that.
>
>scott.
>--- Mike Prader <[EMAIL PROTECTED]> wrote:
> > Hi all
> >
> > My problem is, that I want to mark a textfield red
> > and set the focus
> > to it after I checked the fields in my from the
> > Action Class derived class and I detected an
> > error in this input.
> > I want to use taglibs also.
> >
> > Is there any possibility to do this in my from the
> > ActionForm Class derived class, so that Struts will
> > automatically set this field to another colour and
> > set the focus to it ? If not what is
> > the best solution to mark the attribute in my from
> > the ActionForm Class derived Class that this field
> > isn't ok ?
> >
> > regards
> >
> > mike
> >
>
>
>=
>~~~
>Scott
>
>__
>Do You Yahoo!?
>Yahoo! Auctions - buy the things you want at great prices
>http://auctions.yahoo.com/

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




RE: Posting Collections

2001-05-11 Thread Tony Karas

Thanks Niall.

I'm currently frustrated because I'm finding it hard to discover all the 
information I require.  Seems to be a general lack of documentation on 
struts usage, but it's a learning curve like anything else.

I like Struts in principle, and what it is trying to achieve, I just 
wondered if you considered it ready for building a large-scale project.  For 
example, this change that you have submitted is going to affect a lot of 
code.  So my options are to stick to my current solution without changing 
any of the Struts code, or modify the code so that it does what I want in 
the hope that the change will get propagated through to the next release.  
It doesn't feel like a good way to be working, but I take your point about 
Open Source, and I partly agree.

For the time being I'm going to persevere - and I look forward to seeing 
your custom tags so I don't have to "hack around with the code every time a 
new version comes out".

Cheers ;-)

Tony


>From: "Niall Pemberton" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: <[EMAIL PROTECTED]>
>Subject: RE: Posting Collections
>Date: Thu, 10 May 2001 20:23:31 +0100
>
>This issue applies to all form field tags, not just checkboxes.
>
>Modifying struts tags is currently a pain, but I just subimitted a bugzilla
>enhancement to re-factor the tags so that they are more granualar and make
>it easier to override descrete bits such as generating the name attribute.
>In principle the enhacement has been accepted and I hope to submit a patch
>in the next few days. If it is accepted I will have a set of custom 
>versions
>of these tags for this behviour very soon and you won't have to "start
>hacking around with the code every time a new version comes out" and anyone
>will be welcome to them.
>
>Addtionally this issue is all on the "ToDo" list for 1.1 and I'm sure it
>will be sorted then.
>
>I think struts is excellent, and I love open source because you can always
>look inside to see what they've done. Of course it doesn't do everything 
>yet
>;-) but I can't see it getting anything but better. We have done quite a 
>bit
>of work customizing the ActionServlet and the way its been built is
>excellent, making it really easy to add addtional behaviour (hopefully)
>without having to hack around every time a new version comes out.
>
>Niall
>
> > -Original Message-
> > From: Tony Karas [mailto:[EMAIL PROTECTED]]
> > Sent: 10 May 2001 10:34
> > To: [EMAIL PROTECTED]
> > Subject: RE: Posting Collections
> >
> >
> > Many thanks Niall, that clears things up for me.  Do you know if
> > there is a
> > reason why this is the behaviour for checkboxes?  Is this just with
> > checkboxes or other tags as well?
> >
> > I don't really like the idea of modifying the struts code - the
> > whole point
> > of deciding to use it is for code reuse - I don't want to start hacking
> > around with the code every time a new version comes out.
> >
> > Do you have an opinion on using Struts?  I've been using it for a
> > couple of
> > weeks now and have been struggling because of basic lack of
> > information.  I
> > get most of my training from this news group!  I'm wondering whether I
> > should just jack it in and use something else.
> >
> > Cheers
> > Tony
> >
> >
> > >From: "Niall Pemberton" <[EMAIL PROTECTED]>
> > >Reply-To: [EMAIL PROTECTED]
> > >To: <[EMAIL PROTECTED]>
> > >Subject: RE: Posting Collections
> > >Date: Wed, 9 May 2001 20:51:00 +0100
> > >
> > >The problem is the CheckBox tag currently sets the HTML name attribute 
>to
> > >the property, so your JSP will produced something like this:
> > >
> > > 
> > >
> > >So all the checkbox fields will have the same name.
> > >
> > >In order for Struts to populate your Retailer bean with the delete 
>values
> > >you need the generated HTML to look like this:
> > >
> > >     
> > >  etc etc.
> > >
> > >Struts would then use getRetailer(0).setDelete(boolean) to set the 
>delete
> > >attributes correctly.
> > >
> > >Unfortunately there is no easy solution - many people resort to
> > scriptlets
> > >to generate the name properly and there are quite a few messages in the
> > >archive about this.
> > >
> > >I created my own versions of Struts tags and changed them to generate 
>the
> > >name correctly - I like that much bet

RE: Checkbox Arrays

2001-05-11 Thread Tony Karas

I am amazed (and pleased) at your perseverance :-)


>From: "Deadman, Hal" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: RE: Checkbox Arrays
>Date: Thu, 10 May 2001 13:35:12 -0400
>
>Don't use the html:checkbox, use html:multibox and use bean:write in the
>body of the tag. An html:multibox resolves to an HTML checkbox.
>
>Hal
>
> > -Original Message-
> > From: Tony Karas [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 10, 2001 12:44 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Checkbox Arrays
> >
> >
> > Yeah - I'm looking at that.  My problem now is how to get the
> > value for each
> > checkbox.  My bean has an "id" property - so I have tried
> > this kind of
> > thing:
> >
> > 
> > 
> >  > value=" > name="retailer" property="id"/>"/>
> > 
> > 
> > 
> > 
> >
> > But it doesn't like having the bean:write embedded there.  Am
> > I missing
> > something obvious?
> >
> > Many thanks
> > Tony
> >
> >
> >
> > >From: Peter Alfors <[EMAIL PROTECTED]>
> > >Reply-To: [EMAIL PROTECTED]
> > >To: [EMAIL PROTECTED]
> > >Subject: Re: Checkbox Arrays
> > >Date: Thu, 10 May 2001 11:09:18 -0500
> > >
> > >Im not sure how the ActionForm changes things, but without
> > an actionform
> > >your
> > >could do this
> > >
> > >Each checkbox can have the same name, but a different value.
> > >When the form is submitted, the checkboxes that have been
> > checked are in
> > >the
> > >request.
> > >You can use the request.getParameterValues("checkBoxName")
> > to retrieve a
> > >string
> > >array of the values for the checked boxes.
> > >
> > >HTH,
> > > Pete
> > >
> > >Tony Karas wrote:
> > >
> > > > Can anyone help with this?
> > > >
> > > > I have an array of checkboxes in my ActionForm represented by
> > > >
> > > > boolean[] delete;
> > > >
> > > > and I have a setter function
> > > >
> > > > public void setDelete( boolean[] values )
> > > > {
> > > > delete = values;
> > > > }
> > > >
> > > > The problem is that I have only checkboxes that are
> > checked get sent
> > >back -
> > > > so if one checkbox is checked all I get is an array of length 1.
> > >Therefore,
> > > > it is not possible for me to determine which checkbox has
> > been checked.
> > > >
> > > > In the documentation it tells me to use reset() in ActionForm to
> > >initialise
> > > > the values - but this will only work with single
> > checkboxes and not
> > >arrays.
> > > >
> > > > I think I'm stuck.  Is there anyway I can determine which
> > checkbox has
> > >been
> > > > checked - maybe I can get the value to differ for each
> > checkbox.  Will
> > >look
> > > > in to that.
> > > >
> > > > Cheers
> > > > Tony
> > ><< peter.alfors.vcf >>
> >
> > __
> > ___
> > Get Your Private, Free E-mail from MSN Hotmail at
>http://www.hotmail.com.

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




RE: Checkbox Arrays

2001-05-11 Thread Tony Karas

Ah sorry Hal - thanks for your perseverance - I was assuming, mistakenly, 
that multibox was something else.  I'll take a look at this - cheers.

Tony


>From: "Deadman, Hal" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: RE: Checkbox Arrays
>Date: Thu, 10 May 2001 12:20:58 -0400
>
>I posted this same response to your Posting Collections question yesterday.
>Here it is again. If you use the html:multibox, you can get back an array 
>of
>key values instead of an array of booleans. They key values can be Longs,
>Strings, whatever, as long as it uniquely identifies the row that you want
>to know was checked. If you haven't used multibox, it generates an html
>checkbox. The array that will be set in your form will only contain the key
>values for the rows that were checked.
>
>Here is the post from yesterday:
>
>I think I am doing the same thing that you want to do using the
>html:multibox. When the form is submitted you get an array of the ids that
>are checked and then you can go delete them.
>
>in the jsp form (where restaurant id is a key for the item being deleted):
>
>...
>   
>   
>   
>...
>
>
>
>in the form class:
> private Long favoriteRestaurantRemoveList[] = new Long[0];
>
> public Long[] getFavoriteRestaurantRemoveList() {
> return (this.favoriteRestaurantRemoveList);
> }
>
> public void setFavoriteRestaurantRemoveList(Long
>favoriteRestaurantRemoveList[]) {
> this.favoriteRestaurantRemoveList = favoriteRestaurantRemoveList;
> }
>
>I am not sure if initializing the array to new Long[0] is necessary,
>probably not.
>
> > -Original Message-
> > From: Tony Karas [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 10, 2001 11:52 AM
> > To: Struts User
> > Subject: Checkbox Arrays
> >
> >
> > Can anyone help with this?
> >
> > I have an array of checkboxes in my ActionForm represented by
> >
> > boolean[] delete;
> >
> > and I have a setter function
> >
> > public void setDelete( boolean[] values )
> > {
> > delete = values;
> > }
> >
> > The problem is that I have only checkboxes that are checked
> > get sent back -
> > so if one checkbox is checked all I get is an array of length
> > 1.  Therefore,
> > it is not possible for me to determine which checkbox has
> > been checked.
> >
> > In the documentation it tells me to use reset() in ActionForm
> > to initialise
> > the values - but this will only work with single checkboxes
> > and not arrays.
> >
> > I think I'm stuck.  Is there anyway I can determine which
> > checkbox has been
> > checked - maybe I can get the value to differ for each
> > checkbox.  Will look
> > in to that.
> >
> > Cheers
> > Tony
> >

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




Re: Checkbox Arrays

2001-05-10 Thread Tony Karas

Yeah - I'm looking at that.  My problem now is how to get the value for each 
checkbox.  My bean has an "id" property - so I have tried this kind of 
thing:



"/>





But it doesn't like having the bean:write embedded there.  Am I missing 
something obvious?

Many thanks
Tony



>From: Peter Alfors <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Re: Checkbox Arrays
>Date: Thu, 10 May 2001 11:09:18 -0500
>
>Im not sure how the ActionForm changes things, but without an actionform 
>your
>could do this
>
>Each checkbox can have the same name, but a different value.
>When the form is submitted, the checkboxes that have been checked are in 
>the
>request.
>You can use the request.getParameterValues("checkBoxName") to retrieve a 
>string
>array of the values for the checked boxes.
>
>HTH,
> Pete
>
>Tony Karas wrote:
>
> > Can anyone help with this?
> >
> > I have an array of checkboxes in my ActionForm represented by
> >
> > boolean[] delete;
> >
> > and I have a setter function
> >
> > public void setDelete( boolean[] values )
> > {
> > delete = values;
> > }
> >
> > The problem is that I have only checkboxes that are checked get sent 
>back -
> > so if one checkbox is checked all I get is an array of length 1.  
>Therefore,
> > it is not possible for me to determine which checkbox has been checked.
> >
> > In the documentation it tells me to use reset() in ActionForm to 
>initialise
> > the values - but this will only work with single checkboxes and not 
>arrays.
> >
> > I think I'm stuck.  Is there anyway I can determine which checkbox has 
>been
> > checked - maybe I can get the value to differ for each checkbox.  Will 
>look
> > in to that.
> >
> > Cheers
> > Tony
><< peter.alfors.vcf >>

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




Checkbox Arrays

2001-05-10 Thread Tony Karas

Can anyone help with this?

I have an array of checkboxes in my ActionForm represented by

boolean[] delete;

and I have a setter function

public void setDelete( boolean[] values )
{
delete = values;
}

The problem is that I have only checkboxes that are checked get sent back -
so if one checkbox is checked all I get is an array of length 1.  Therefore,
it is not possible for me to determine which checkbox has been checked.

In the documentation it tells me to use reset() in ActionForm to initialise
the values - but this will only work with single checkboxes and not arrays.

I think I'm stuck.  Is there anyway I can determine which checkbox has been
checked - maybe I can get the value to differ for each checkbox.  Will look
in to that.

Cheers
Tony




Design Error?

2001-05-10 Thread Tony Karas

Cheers Dudley,

I have a solution but I am not happy with it (and I now also have the
additional problem that checkboxes only get sent back if they are set so I
can't tell which checkbox has been checked! - Another one to sort out).

Do you know if this is a design error.  Basically, the problem is this (for
those who haven't been following the thread):

- I have a number of beans held in a Vector.
- In my ActionForm I have a two getters for this vector - one returns the
vector and one returns elements of the vector - so something like this:

public RetailerBean getRetailerBean( int index )
{
return (RetailerBean)retailers.elementAt( index );
}

and

public Vector getRetailers()
{
return retailers;
}

This works fine to populate using the following type of iterate tag:





-->



However, it doesn't repopulate the beans when I do a submit.  This is
because the generated html is something like:



rather than:




which would allow my beans to be repopulated.

The outcome of this is that I have to create arrays for all properties of my
beans in my ActionForm and take the values from there.  This seems like
bodge-heaven and not at all object-oriented.

If the form can be populated directly from the beans then surely it should
work the other way too.

Any struts developers want to comment?

Thanks for all your help.

Cheers
Tony


-Original Message-
From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 1:06 PM
To: 'Tony Karas'
Subject: RE: please help...iteration question...what i Have is...GOT IT
WORKING!! LET ME kNOW IF U GOT IT WORKING


ya sorry about that the one is the actionform attribute and the other is an
attribute of my TaxPayerData[] bean.

-Original Message-
From: Tony Karas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 1:46 PM
To: Dudley Butt@i-Commerce
Subject: RE: please help...iteration question...what i Have is...GOT IT
WORKING!! LET ME kNOW IF U GOT IT WORKING


OK - I see what you're doing - got a little confused with taxpayerName and
taxPayerName but worked it out.  I'm going to give it a go - see what
happens.  Will let you know

-Original Message-
From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 12:29 PM
To: 'Tony Karas'
Subject: RE: please help...iteration question...what i Have is...GOT IT
WORKING!! LET ME kNOW IF U GOT IT WORKING


have a look at this multibox code i see someone also sent to u, i think that
would also work..same idea..just using a Long array

-Original Message-
From: Deadman, Hal [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 09, 2001 10:30 PM
To: [EMAIL PROTECTED]
Subject: RE: Posting Collections


I think I am doing the same thing that you want to do using the
html:multibox. When the form is submitted you get an array of the ids that
are checked and then you can go delete them.

in the jsp form (where restaurant id is a key for the item being deleted):

...



...



in the form class:
private Long favoriteRestaurantRemoveList[] = new Long[0];

public Long[] getFavoriteRestaurantRemoveList() {
return (this.favoriteRestaurantRemoveList);
}

public void setFavoriteRestaurantRemoveList(Long
favoriteRestaurantRemoveList[]) {
this.favoriteRestaurantRemoveList = favoriteRestaurantRemoveList;
}

I am not sure if initializing the array to new Long[0] is necessary,
probably not.


-Original Message-
From: Tony Karas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 1:13 PM
To: Dudley Butt@i-Commerce
Subject: RE: please help...iteration question...what i Have is...GOT IT
WORKING!! LET ME kNOW IF U GOT IT WORKING


Thanks very much - I'll have a look and get back to you asap.

-Original Message-
From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 11:49 AM
To: 'Tony Karas'
Subject: RE: please help...iteration question...what i Have is...GOT IT
WORKING!! LET ME kNOW IF U GOT IT WORKING


i may have a solution for you, let me send u my one that works with a normal
edit box and see if u can change it to work with your checkboxes. i think
the basic idea, is that once your list is displayed, u need a String[]
setter like i have.
let me know...i've attached my files  that actually work..

check it out and look at my comments





-Original Message-
From: Tony Karas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 11:37 AM
To: Dudley Butt@i-Commerce
Subject: RE: please help...iteration question...what i Have is...GOT IT
WORKING!! LET ME kNOW IF U GOT IT WORKING


So you didn't need the extra method then?  I think my problem is to do with
checkboxes and the way that they are implemented.

-Original Message-
From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]]
Sent:

Re: Getting hold of the session

2001-05-10 Thread Tony Karas

I assume that you're bean extends ActionForm.can't you get the required 
information you need from the session during the call to the validate() 
method?  This method receives a request object as a parameter.


>From: "Andrew Steady"<[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Getting hold of the session
>Date: Thu, 10 May 2001 10:39:37 +0100
>
>Hi,
>
>One of my getter methods (called by struts) needs to get hold of an object
>in the Session so that it can populate the values of a drop down box based
>upon a call to the "customer" object which is stored in the session.
>Unfortunatley struts does not pass my method the request or the session
>object and neither does it pass either of these to the form constructor so
>I can't store a local reference to it in the form.
>
>This problem must have been encountered and solved by others already, does
>anyone have any suggestions?
>
>Regards,
>
>Andy S
>
>
>
>
>
>[EMAIL PROTECTED] on 10/05/2001 09:57:55
>
>Please respond to [EMAIL PROTECTED]
>
>To:   [EMAIL PROTECTED]
>cc:(bcc: Andrew Steady/Swindon01/Domino01/Kinesis)
>Subject:  Re: Transactional Tokens in the JSP?
>
>
>
>
>Allen,
>You can set the transactional token in your edit Action class with
>saveToken(request). Then you can test the token in
>the submit action.
>I suggest you have a look at the classes EditRegistration and
>SaveRegistration  in the example application.
>Jean-Noel
>- Original Message -
>From: Allen Walker <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, May 10, 2001 10:37 AM
>Subject: Transactional Tokens in the JSP?
>
> > I would like to use the transaction token logic in the Action class.
> > However I am not able to figure out how to place the Transactional Token
>in
> > the JSP so it can be validated against when isTokenValid() is called
>within
> > my Action class. I looked at the Struts source code to find:
> >
> >  protected boolean isTokenValid(HttpServletRequest request) {
> >
> >  // Retrieve the saved transaction token from our session
> >  HttpSession session = request.getSession(false);
> >  if (session == null)
> >  return (false);
> >  String saved = (String)
>session.getAttribute(TRANSACTION_TOKEN_KEY);
> >  if (saved == null)
> >  return (false);
> >
> >  // Retrieve the transaction token included in this request
> >  String token = (String)
>request.getParameter(Constants.TOKEN_KEY);
> >  if (token == null)
> >  return (false);
> >
> >  // Do the values match?
> >  return (saved.equals(token));
> >
> >  }
> >
> > The Contants class is org.apache.struts.taglib.html.Constants.
> >
> > Thanks for any help
> > -allen-
> >
> >
>
>
>
>
>
>
>
>The information transmitted is intended only for the person or entity to 
>which it is addressed and may contain confidential and/or privileged 
>material.  Any review, retransmission, dissemination or other use of, or 
>taking of any action in reliance upon, this information by persons or 
>entities other than the intended recipient is prohibited.   If you received 
>this in error, please contact the sender and delete the material from any 
>computer.
>
>PricewaterhouseCoopers Kinesis Ltd

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




RE: Posting Collections

2001-05-10 Thread Tony Karas

Many thanks Niall, that clears things up for me.  Do you know if there is a 
reason why this is the behaviour for checkboxes?  Is this just with 
checkboxes or other tags as well?

I don't really like the idea of modifying the struts code - the whole point 
of deciding to use it is for code reuse - I don't want to start hacking 
around with the code every time a new version comes out.

Do you have an opinion on using Struts?  I've been using it for a couple of 
weeks now and have been struggling because of basic lack of information.  I 
get most of my training from this news group!  I'm wondering whether I 
should just jack it in and use something else.

Cheers
Tony


>From: "Niall Pemberton" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: <[EMAIL PROTECTED]>
>Subject: RE: Posting Collections
>Date: Wed, 9 May 2001 20:51:00 +0100
>
>The problem is the CheckBox tag currently sets the HTML name attribute to
>the property, so your JSP will produced something like this:
>
> 
>
>So all the checkbox fields will have the same name.
>
>In order for Struts to populate your Retailer bean with the delete values
>you need the generated HTML to look like this:
>
> 
>  etc etc.
>
>Struts would then use getRetailer(0).setDelete(boolean) to set the delete
>attributes correctly.
>
>Unfortunately there is no easy solution - many people resort to scriptlets
>to generate the name properly and there are quite a few messages in the
>archive about this.
>
>I created my own versions of Struts tags and changed them to generate the
>name correctly - I like that much better - no java in the view.
>
>Niall
>
> > -Original Message-
> > From: Tony Karas [mailto:[EMAIL PROTECTED]]
> > Sent: 09 May 2001 17:50
> > To: [EMAIL PROTECTED]
> > Subject: Posting Collections
> >
> >
> > Briefly, this is what I am trying to achieve:
> >
> > - Retrieve a list of items from a database
> > - Display each item with a corresponding checkbox
> > - Display a "Delete" button - which when pressed deletes all
> > checked items.
> >
> > Unfortunately, although I have managed to display the items correctly 
>and
> > set the checkbox value using boolean values, when I do the form
> > submit - my
> > ActionForm properties do not get filled in.
> >
> > This is the code I have:
> >
> > My ActionForm looks like this:
> >
> > public class RetailerForm extends ActionForm
> > {
> > protected Vector retailer;
> >
> > /*
> >  * On construction, fill the form with all the retailers
> >  */
> > public RetailerForm() throws SQLException
> > {
> >  //here i have some code to generate my vector
> >  //which is comprised of "Retailer" beans.
> > }
> >
> > public Retailer getRetailer( int index )
> > {
> > return (Retailer)retailer.elementAt( index );
> > }
> >
> > public Vector getRetailer()
> > {
> > return retailer;
> > }
> >
> > public void setRetailer( Vector value )
> > {
> > retailer = value;
> > }
> > }
> >
> > My "Retailer" bean has get and set elements for properties called
> > "delete"
> > and "name".
> >
> > My struts code looks like this (obviously within  tags):
> >
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > And this all works ok for displaying the data.  However, when I do the
> > submit my "delete" property for each bean is not set and I have added
> > debugging code to the "set" method and this is not called by struts.  I
> > don't get error messages - it just doesn't happen.
> >
> > I know other people have had this problem, but I am struggling to find a
> > solution.
> >
> > Can anyone help me?  Is there a better way of achieving what I am
> > trying to
> > achieve?  If I am doing the correct thing, what's the reason it's not
> > working.
> >
> > All help appreciated.
> >
> > Cheers
> > Tony
> > 
>_
> > Get Your Private, Free E-mail from MSN Hotmail at 
>http://www.hotmail.com.
> >
> >
>

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




RE: please help...iteration question...what i Have is...

2001-05-09 Thread Tony Karas

I'm struggling with the same problem as you are (well similar) and general
lack of information / not being able to find information.

I think you may need the following method in your ActionForm bean:

public TaxPayerData getTaxPayers( int index )
{
return taxPayers[index];
}

as well as:

public TaxPayerData[] getTaxPayers()
{
TaxPayerData[] taxPayers = new TaxPayerData[list.size()];
  taxPayers = (TaxPayerData[])list.toArray(taxPayers);
return taxPayers;
}

but if anyone else can comment on this - I would also appreciate
enlightenment.

Cheers
Tony




Posting Collections

2001-05-09 Thread Tony Karas

Briefly, this is what I am trying to achieve:

- Retrieve a list of items from a database
- Display each item with a corresponding checkbox
- Display a "Delete" button - which when pressed deletes all checked items.

Unfortunately, although I have managed to display the items correctly and 
set the checkbox value using boolean values, when I do the form submit - my 
ActionForm properties do not get filled in.

This is the code I have:

My ActionForm looks like this:

public class RetailerForm extends ActionForm
{
protected Vector retailer;

/*
 * On construction, fill the form with all the retailers
 */
public RetailerForm() throws SQLException
{
 //here i have some code to generate my vector
 //which is comprised of "Retailer" beans.
}

public Retailer getRetailer( int index )
{
return (Retailer)retailer.elementAt( index );
}

public Vector getRetailer()
{
return retailer;
}

public void setRetailer( Vector value )
{
retailer = value;
}
}

My "Retailer" bean has get and set elements for properties called "delete" 
and "name".

My struts code looks like this (obviously within  tags):








And this all works ok for displaying the data.  However, when I do the 
submit my "delete" property for each bean is not set and I have added 
debugging code to the "set" method and this is not called by struts.  I 
don't get error messages - it just doesn't happen.

I know other people have had this problem, but I am struggling to find a 
solution.

Can anyone help me?  Is there a better way of achieving what I am trying to 
achieve?  If I am doing the correct thing, what's the reason it's not 
working.

All help appreciated.

Cheers
Tony
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.