Re: Struts2 Checkboxlist

2019-02-04 Thread Prasanth Pasala
I am using the defaultStack but the ArrayList used for the checkboxes is of 
type Long. If we change it to ArrayList of Boolean would the interceptor set 
the values to false? Or is this only applicable
if you have individual checkboxes rather than checkboxlist?

Thanks,
Prasanth

On 2/4/19 4:29 PM, Paul Zepernick wrote:
> Yes, setFoo is only called if the checkbox is checked.  However, Struts 2 
> does have a checkbox interceptor: 
> https://struts.apache.org/core-developers/checkbox-interceptor.html
>
> This interceptor defaults checkbox Boolean's to False if the box is not 
> checked.  This is part of the default interceptor stack.
>
> Paul
>
> -Original Message-
> From: Prasanth Pasala 
> Sent: Monday, February 4, 2019 5:21 PM
> To: user@struts.apache.org
> Subject: Re: Struts2 Checkboxlist
>
> NOTICE: This email originated from outside of the organization. Do not click 
> links or open attachments unless you recognize the sender and know the 
> content is safe.
>
> Is that how Struts2 is expected to work? Meaning setFoo would not be called 
> if non of the Foo checkboxes are selected? I know that is how Struts1 worked.
>
> Thanks,
> Prasanth
>
> On 2/2/19 7:08 PM, Prasanth Pasala wrote:
>> Hi Yasser,
>>
>> When none of the checkboxes is selected the setFoo is not getting called.
>>
>> Thanks
>> Prasanth
>>
>> On February 2, 2019 8:02:07 AM CST, Yasser Zamani  
>> wrote:
>>> Hi Prasanth,
>>>
>>> AFAIK this tag is like this:
>>>
>>> 
>>>
>>> It calls getBar method of your action or finds bar in value stack to
>>> find out what to display. Same for baz to find out which to be
>>> selected. Then it calls yourAction.setFoo to post selected items. i.e.
>>> it is up to you what you do with it in setFoo method. Normally you
>>> should clear baz and fill it with them again to update selected items.
>>>
>>> Thanks for using Struts!
>>>
>>> Kind Regards.
>>>
 -Original Message-
 From: Prasanth 
 Sent: Saturday, February 2, 2019 1:08 AM
 To: user@struts.apache.org
 Subject: Struts2 Checkboxlist

 Hi,

 I am using a checkboxlist on a jsp page which corresponds to a
>>> ArrayList in the
 form class, which is used to store form data from a multi page wizard.
>>> I am using
 scope interceptor to store the form class in session so that the
 data
>>> persists as
 the user navigates the wizard. When the user selects some check
 boxes
>>> it is
 correctly populated in the form class but if the user navigates back
>>> in the wizard
 and unchecks the check box (non of the check boxes selected) struts
>>> doesn't set
 the ArrayList to empty. It will still contain the old selection.
 What
>>> is the best way
 to solve this issue?

 My Options:
 1. Should I use Preparable and set this ArrayList to empty? Since
 this
>>> is a wizard
 (multiple pages submitting to the same action) have to make sure it
 is
>>> done only
 when submitting the page that have these checkboxes.
 2. Create two separate ArrayLists, one to get values from Struts and
>>> another to
 save the original selection and clear the first array list. Down
 side
>>> is I need to
 populate the list linked to the form when user navigates back to
 that
>>> page.
 Neither of them seem elegant. Is there a way to make struts set the
>>> ArrayList to
 empty when user doesn't select any check box?

 Using Struts 2.3.35

 Thanks,
 Prasanth
>>> -
>>> To unsubscribe, e-m
> Disclaimer: This communication and any files transmitted with it may contain 
> information that is privileged, confidential and/or exempt from disclosure 
> under applicable law. If you are not the intended recipient, you are hereby 
> notified that any disclosure, copying, distribution, or use of the 
> information contained herein (including any reliance thereon) is strictly 
> prohibited. If you received this communication in error, please immediately 
> contact the sender and destroy the material in its entirety, whether in 
> electronic or hard copy format. Thank you.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>



RE: Struts2 Checkboxlist

2019-02-04 Thread Paul Zepernick
Yes, setFoo is only called if the checkbox is checked.  However, Struts 2 does 
have a checkbox interceptor: 
https://struts.apache.org/core-developers/checkbox-interceptor.html

This interceptor defaults checkbox Boolean's to False if the box is not 
checked.  This is part of the default interceptor stack.

Paul

-Original Message-
From: Prasanth Pasala 
Sent: Monday, February 4, 2019 5:21 PM
To: user@struts.apache.org
Subject: Re: Struts2 Checkboxlist

NOTICE: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.

Is that how Struts2 is expected to work? Meaning setFoo would not be called if 
non of the Foo checkboxes are selected? I know that is how Struts1 worked.

Thanks,
Prasanth

On 2/2/19 7:08 PM, Prasanth Pasala wrote:
> Hi Yasser,
>
> When none of the checkboxes is selected the setFoo is not getting called.
>
> Thanks
> Prasanth
>
> On February 2, 2019 8:02:07 AM CST, Yasser Zamani  
> wrote:
>> Hi Prasanth,
>>
>> AFAIK this tag is like this:
>>
>> 
>>
>> It calls getBar method of your action or finds bar in value stack to
>> find out what to display. Same for baz to find out which to be
>> selected. Then it calls yourAction.setFoo to post selected items. i.e.
>> it is up to you what you do with it in setFoo method. Normally you
>> should clear baz and fill it with them again to update selected items.
>>
>> Thanks for using Struts!
>>
>> Kind Regards.
>>
>>> -Original Message-
>>> From: Prasanth 
>>> Sent: Saturday, February 2, 2019 1:08 AM
>>> To: user@struts.apache.org
>>> Subject: Struts2 Checkboxlist
>>>
>>> Hi,
>>>
>>> I am using a checkboxlist on a jsp page which corresponds to a
>> ArrayList in the
>>> form class, which is used to store form data from a multi page wizard.
>> I am using
>>> scope interceptor to store the form class in session so that the
>>> data
>> persists as
>>> the user navigates the wizard. When the user selects some check
>>> boxes
>> it is
>>> correctly populated in the form class but if the user navigates back
>> in the wizard
>>> and unchecks the check box (non of the check boxes selected) struts
>> doesn't set
>>> the ArrayList to empty. It will still contain the old selection.
>>> What
>> is the best way
>>> to solve this issue?
>>>
>>> My Options:
>>> 1. Should I use Preparable and set this ArrayList to empty? Since
>>> this
>> is a wizard
>>> (multiple pages submitting to the same action) have to make sure it
>>> is
>> done only
>>> when submitting the page that have these checkboxes.
>>> 2. Create two separate ArrayLists, one to get values from Struts and
>> another to
>>> save the original selection and clear the first array list. Down
>>> side
>> is I need to
>>> populate the list linked to the form when user navigates back to
>>> that
>> page.
>>> Neither of them seem elegant. Is there a way to make struts set the
>> ArrayList to
>>> empty when user doesn't select any check box?
>>>
>>> Using Struts 2.3.35
>>>
>>> Thanks,
>>> Prasanth
>> -
>> To unsubscribe, e-m

Disclaimer: This communication and any files transmitted with it may contain 
information that is privileged, confidential and/or exempt from disclosure 
under applicable law. If you are not the intended recipient, you are hereby 
notified that any disclosure, copying, distribution, or use of the information 
contained herein (including any reliance thereon) is strictly prohibited. If 
you received this communication in error, please immediately contact the sender 
and destroy the material in its entirety, whether in electronic or hard copy 
format. Thank you.


Re: Struts2 Checkboxlist

2019-02-04 Thread Prasanth Pasala
Is that how Struts2 is expected to work? Meaning setFoo would not be called if 
non of the Foo checkboxes are selected? I know that is how Struts1 worked.

Thanks,
Prasanth

On 2/2/19 7:08 PM, Prasanth Pasala wrote:
> Hi Yasser,
>
> When none of the checkboxes is selected the setFoo is not getting called.
>
> Thanks
> Prasanth
>
> On February 2, 2019 8:02:07 AM CST, Yasser Zamani  
> wrote:
>> Hi Prasanth,
>>
>> AFAIK this tag is like this:
>>
>> 
>>
>> It calls getBar method of your action or finds bar in value stack to
>> find out what to display. Same for baz to find out which to be
>> selected. Then it calls yourAction.setFoo to post selected items. i.e.
>> it is up to you what you do with it in setFoo method. Normally you
>> should clear baz and fill it with them again to update selected items.
>>
>> Thanks for using Struts!
>>
>> Kind Regards.
>>
>>> -Original Message-
>>> From: Prasanth 
>>> Sent: Saturday, February 2, 2019 1:08 AM
>>> To: user@struts.apache.org
>>> Subject: Struts2 Checkboxlist
>>>
>>> Hi,
>>>
>>> I am using a checkboxlist on a jsp page which corresponds to a
>> ArrayList in the
>>> form class, which is used to store form data from a multi page wizard.
>> I am using
>>> scope interceptor to store the form class in session so that the data
>> persists as
>>> the user navigates the wizard. When the user selects some check boxes
>> it is
>>> correctly populated in the form class but if the user navigates back
>> in the wizard
>>> and unchecks the check box (non of the check boxes selected) struts
>> doesn't set
>>> the ArrayList to empty. It will still contain the old selection. What
>> is the best way
>>> to solve this issue?
>>>
>>> My Options:
>>> 1. Should I use Preparable and set this ArrayList to empty? Since this
>> is a wizard
>>> (multiple pages submitting to the same action) have to make sure it is
>> done only
>>> when submitting the page that have these checkboxes.
>>> 2. Create two separate ArrayLists, one to get values from Struts and
>> another to
>>> save the original selection and clear the first array list. Down side
>> is I need to
>>> populate the list linked to the form when user navigates back to that
>> page.
>>> Neither of them seem elegant. Is there a way to make struts set the
>> ArrayList to
>>> empty when user doesn't select any check box?
>>>
>>> Using Struts 2.3.35
>>>
>>> Thanks,
>>> Prasanth
>> -
>> To unsubscribe, e-m



Re: [struts-user] XML based configuration

2019-02-04 Thread Dave
Hi Lukasz,

Here's a summary of how Roller uses Struts and Tiles:

Roller uses the StrutsPrepareAndExecute filter and maps it to all requests
ending with “.rol”
https://github.com/apache/roller/blob/master/app/src/main/webapp/WEB-INF/web.xml

Roller’s actions are defined in struts.xml and return results of type
“tiles”
https://github.com/apache/roller/blob/master/app/src/main/resources/struts.xml

Roller’s JSP pages are kept under /WEB-INF/jsps to prevent direct access to
them. You can see that in the tiles.xml file
https://github.com/apache/roller/blob/master/app/src/main/webapp/WEB-INF/tiles.xml

Hope that is helpful. What else can I tell you about Roller and it's use of
Struts & Tiles?

Best regards,
Dave



On Fri, Feb 1, 2019 at 2:41 AM Lukasz Lenart 
wrote:

> pt., 1 lut 2019 o 00:38 Dave  napisał(a):
> > Thanks for helping to track down this problem, Jason; Roller (and Struts
> in
> > general) should work at any path. Maybe this error is occuring because
> > Roller is using Struts/Tiles in a non-best practices way?
>
> Could you describe how do you use Struts/Tiles in Roller? Maybe I
> would be able to help :)
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: Escaping dollar sign and curly brackets

2019-02-04 Thread Micael Carreira

Hey Lukasz, thanks for your reply.

Actually, I don't want to use struts tag replacement mechanism, but one 
of my own.


I already solved my problem as you probably read by now.

Cheers and thanks for your help.

On 04/02/19 10:10, Lukasz Lenart wrote:

Using ${} or %{} is a proper way to inject values into a message
https://struts.apache.org/getting-started/message-resource-files.html#message-resource-property-files

In your case a "getPlaceholder()" will be used to fetch the value from
the current action.


Regards


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Escaping dollar sign and curly brackets

2019-02-04 Thread Micael Carreira

Hey Yasser,

Thanks for your reply. I tought I tried every combination you suggested, 
but it seems that I missed the *$'{placeholder}'* variant.


This works for me. Thanks for your help!


On 02/02/19 13:25, Yasser Zamani-2 [via Struts] wrote:

From: Micael Carreira 
Sent: Friday, February 1, 2019 6:56 PM
To: user@struts.apache.org
Subject: Escaping dollar sign and curly brackets

Hey,

In my action I'm using getText(myKey) to get a localized string. This string has
some placeholders of mine, in ${placeholder} format. Consider my original key is
defined as this in my properties file:

     myKey = Some text ${placeholder} more text.

I've read in Struts documentation that it uses MessageFormat. So, if I want
literals, I need to use single quotes. This is what I did in my properties file:

     myKey = Some text '${placeholder}' more text.

However, when I call getText(myKey) I get: Some text ' more text. Why does this
happen?

It seems firstly ${placeholder} is evaluated to empty by Struts then '' is 
evaluated to ' by MessageFormat.


I also noticed that the problem is the dollar sign AND curly brackets without 
any
character in between. If I have this definition:

     myKey = Some text '$' text '{placeholder}' more text.

It gets resolved to: Some text $ text {placeholder} more text.

Can somebody explain me how can I escape the dollar and curly brackets
characters?

I guess '$'{placeholder} or $'{placeholder}' or '$''{placeholder}' should work 
:\ could you please report back the result for each one? And which Struts 
version you test?

Thanks for using Struts!

Kind Regards.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Re: Escaping dollar sign and curly brackets

2019-02-04 Thread Lukasz Lenart
Using ${} or %{} is a proper way to inject values into a message
https://struts.apache.org/getting-started/message-resource-files.html#message-resource-property-files

In your case a "getPlaceholder()" will be used to fetch the value from
the current action.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

pt., 1 lut 2019 o 16:25 Micael Carreira  napisał(a):
>
> Hey,
>
> In my action I'm using getText(myKey) to get a localized string. This
> string has some placeholders of mine, in ${placeholder} format. Consider
> my original key is defined as this in my properties file:
>
>  myKey = Some text ${placeholder} more text.
>
> I've read in Struts documentation that it uses MessageFormat. So, if I
> want literals, I need to use single quotes. This is what I did in my
> properties file:
>
>  myKey = Some text '${placeholder}' more text.
>
> However, when I call getText(myKey) I get: Some text ' more text. Why
> does this happen?
>
> I also noticed that the problem is the dollar sign AND curly brackets
> without any character in between. If I have this definition:
>
>  myKey = Some text '$' text '{placeholder}' more text.
>
> It gets resolved to: Some text $ text {placeholder} more text.
>
> Can somebody explain me how can I escape the dollar and curly brackets
> characters?
>
> Thanks in advance, have a nice weekend.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org