Re: [ANN] [SECURITY] Announcing CVE-2019-0230 (Possible RCE) and CVE-2019-0233 (DoS) security issues

2020-08-13 Thread Rene Gielen
In Java and Java EE, typical vectors for RCEs, injecting code to be
executed, include expressions where expression languages are supprted
(JUEL, SpEL or, in the case of Struts 2, OGNL) or serialization attacks.

Once the code is injected, it operates with the OS rights of the running
user (e.g. UID of Tomcat process) within the given limit of the JVM (is
the JVM security sandbox enabled or not? what is accesible on your
classloader?). Additional protections may apply, such as Struts adding
preventions for accessig certain classes or packages when OGNL
expressions are evaluated.

This has happended A LOT in the last 20 years, not only with Struts.

Am 14.08.20 um 02:07 schrieb Zahid Rahman:
> Maybe I misunderstand , there has always existed an apache solution to
> prevent anyone executing code on the application server.
> Its like 20 years old solution.
> 
> See www.backbutton.co.uk for more details.
> https://backbutton.co.uk/
> 
> 
> 
> 
> On Thu, 13 Aug 2020, 11:18 Rene Gielen,  wrote:
> 
>> Two new Struts Security Bulletins have been issued for Struts 2 by the
>> Apache Struts Security Team: [1]
>>
>> S2-059 - Forced double OGNL evaluation, when evaluated on raw user input
>> in tag attributes, may lead to remote code execution (CVE-2019-0230) [2]
>>
>> S2-060 - Access permission override causing a Denial of Service when
>> performing a file upload (CVE-2019-0233) [3]
>>
>> Both issues affect Apache Struts in the version range 2.0.0 - 2.5.20.
>> The current version 2.5.22, which was released in November 2019, is not
>> affected.
>>
>> CVE-2019-0230 has been reported by Matthias Kaiser, Apple Information
>> Security. By design, Struts 2 allows developers to utilize forced double
>> evaluation for certain tag attributes. When used with unvalidated, user
>> modifiable input, malicious OGNL expressions may be injected. In an
>> ongoing effort, the Struts framework includes mitigations for limiting
>> the impact of injected expressions, but Struts before 2.5.22 left an
>> attack vector open which is addressed by this report. [2]
>>
>> However, we continue to urge developers building upon Struts 2 to not
>> use %{...} syntax referencing unvalidated user modifiable input in tag
>> attributes, since this is the ultimate fix for this class of
>> vulnerabilities. [4]
>>
>> CVE-2019-0233 has been reported by Takeshi Terada of Mitsui Bussan
>> Secure Directions, Inc. In Struts before 2.5.22, when a file upload is
>> performed to an Action that exposes the file with a getter, an attacker
>> may manipulate the request such that the working copy of the uploaded
>> file or even the container temporary upload directory may be set to
>> read-only access. As a result, subsequent actions on the file or file
>> uploads in general will fail with an error. [3]
>>
>> Both issues are already fixed in Apache Struts 2.5.22, which was
>> released in November 2019.
>>
>> We strongly recommend all users to upgrade to Struts 2.5.22, if this has
>> not been done already. [5][6]
>>
>> The Apache Struts Security Team would like to thank the reporters for
>> their efforts and their practice of responsible disclosure, as well as
>> their help while investigating the report and coordinating public
>> disclosure.
>>
>> [1] https://struts.apache.org/announce.html#a20200813
>> [2] https://cwiki.apache.org/confluence/display/ww/s2-059
>> [3] https://cwiki.apache.org/confluence/display/ww/s2-060
>> [4]
>>
>> https://struts.apache.org/security/#use-struts-tags-instead-of-raw-el-expressions
>> [5] https://cwiki.apache.org/confluence/display/WW/Version+Notes+2.5.22
>> [6] https://struts.apache.org/download.cgi#struts-ga
>>
>> --
>> René Gielen
>> http://twitter.com/rgielen
>>
>>
> 

-- 
René Gielen
http://twitter.com/rgielen

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



[ANN] [SECURITY] Announcing CVE-2019-0230 (Possible RCE) and CVE-2019-0233 (DoS) security issues

2020-08-13 Thread Rene Gielen
Two new Struts Security Bulletins have been issued for Struts 2 by the
Apache Struts Security Team: [1]

S2-059 - Forced double OGNL evaluation, when evaluated on raw user input
in tag attributes, may lead to remote code execution (CVE-2019-0230) [2]

S2-060 - Access permission override causing a Denial of Service when
performing a file upload (CVE-2019-0233) [3]

Both issues affect Apache Struts in the version range 2.0.0 - 2.5.20.
The current version 2.5.22, which was released in November 2019, is not
affected.

CVE-2019-0230 has been reported by Matthias Kaiser, Apple Information
Security. By design, Struts 2 allows developers to utilize forced double
evaluation for certain tag attributes. When used with unvalidated, user
modifiable input, malicious OGNL expressions may be injected. In an
ongoing effort, the Struts framework includes mitigations for limiting
the impact of injected expressions, but Struts before 2.5.22 left an
attack vector open which is addressed by this report. [2]

However, we continue to urge developers building upon Struts 2 to not
use %{...} syntax referencing unvalidated user modifiable input in tag
attributes, since this is the ultimate fix for this class of
vulnerabilities. [4]

CVE-2019-0233 has been reported by Takeshi Terada of Mitsui Bussan
Secure Directions, Inc. In Struts before 2.5.22, when a file upload is
performed to an Action that exposes the file with a getter, an attacker
may manipulate the request such that the working copy of the uploaded
file or even the container temporary upload directory may be set to
read-only access. As a result, subsequent actions on the file or file
uploads in general will fail with an error. [3]

Both issues are already fixed in Apache Struts 2.5.22, which was
released in November 2019.

We strongly recommend all users to upgrade to Struts 2.5.22, if this has
not been done already. [5][6]

The Apache Struts Security Team would like to thank the reporters for
their efforts and their practice of responsible disclosure, as well as
their help while investigating the report and coordinating public
disclosure.

[1] https://struts.apache.org/announce.html#a20200813
[2] https://cwiki.apache.org/confluence/display/ww/s2-059
[3] https://cwiki.apache.org/confluence/display/ww/s2-060
[4]
https://struts.apache.org/security/#use-struts-tags-instead-of-raw-el-expressions
[5] https://cwiki.apache.org/confluence/display/WW/Version+Notes+2.5.22
[6] https://struts.apache.org/download.cgi#struts-ga

-- 
René Gielen
http://twitter.com/rgielen



signature.asc
Description: OpenPGP digital signature


[ANN] Launch of the 2020 ASF Community Survey

2019-12-06 Thread Rene Gielen
On behalf the ASF Diversity & Inclusion Committee:

Hello everyone,

If you have an apache.org email, you should have received an email with
an invitation to take the 2020 ASF Community Survey. Please take 15
minutes to complete it.

If you do not have an apache.org email address or you didn’t receive a
link, please follow this link to the survey:
https://communitysurvey.limequery.org/454363

This survey is important because it will provide us with scientific
information about our community, and shed some light on how we can
collaborate better and become more diverse. Our last survey of this kind
was implemented in 2016, which means that our existing data about Apache
communities is outdated. The deadline to complete the survey is January
4th, 2020. You can find information about privacy on the survey’s
Confluence page [1].

Your participation is paramount to the success of this project! Please
consider filling out the survey, and share this news with your fellow
Apache contributors. As individuals form the Apache community, your
opinion matters: we want to hear your voice.

If you have any questions about the survey or otherwise, please reach
out to us!

Kindly,
ASF Diversity & Inclusion
https://diversity.apache.org/


[1]
https://cwiki.apache.org/confluence/display/EDI/Launch+Plan+-+The+2020+ASF+Community+Survey


-- 
René Gielen
http://twitter.com/rgielen

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



[ANN] [SECURITY] Corrected affected version ranges in historic Apache,Struts security bulletins and CVE entries

2019-08-15 Thread Rene Gielen
The Apache Struts Security Team would like to announce that a number of
historic Struts Security Bulletins [1] and related CVE database entries
contained incorrect affected release version ranges.

The issue was reported by Christopher Fearon and the Black Duck Research
Team within the Synopsys Cybersecurity Research Center. The reporting
entity conducted thorough investigations on this matter, leading to a
report to the Apache Struts Security Team. The Apache Struts Security
Team worked with the reporters to cross-check said issues and map them
to affected Apache Struts General Availability (GA) releases.

This effort led to the issue of Struts Security Bulletin S2-058,
referencing 15 historic Struts Security Bulletins and respective CVE
entries [2] that have been updated to reflect corrections in affected GA
version ranges as well as minimum GA versions to contain appropriate
fixes for the issues at hand.

The full Security Bulletin can be found here:
https://cwiki.apache.org/confluence/display/WW/S2-058

The Struts Security Team stresses that while the reporters reference
more affected issues and resulting affected version ranges, the Struts
Security Bulletins only cover GA versions designated for production use.
This led to less corrected Security Bulletins and CVE entries [2]
compared to the number of covered issues in the original report.

It is very important to understand that while the individual listed
bulletins contain updated minimum fix versions, it is strongly
recommended to update to the versions recommended by the latest Security
Bulletin, which is S2-057 [3] by the time of this announcement.
Following this advice, the recommended minimum Struts versions to
operate in production are Struts 2.3.35 or Struts 2.5.17.

The Apache Struts Security Team would like to thank the reporters for
their efforts and their practice of responsible disclosure, as well as
their help while investigating the report and coordinating public
disclosure.

[1] https://cwiki.apache.org/confluence/display/WW/Security+Bulletins
[2] https://github.com/CVEProject/cvelist/pull/2423/files
[3] https://cwiki.apache.org/confluence/display/WW/S2-057

-- 
René Gielen
http://twitter.com/rgielen

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



Travel Assistance for ApacheCon NA Las Vegas 2019 now open.

2019-05-21 Thread Rene Gielen
Extending on behalf of the Apache Travel Committee.

---

The Travel Assistance Committee (TAC) are pleased to announce that
travel assistance applications for ApacheCon NA 2019 are now open!

We will be supporting ApacheCon NA Las Vegas, Nevada on 9th - 12th
September 2019

 TAC exists to help those that would like to attend ApacheCon events,
but are unable to do so for financial reasons.
For more info on this years applications and qualifying criteria, please
visit the TAC website at
< http://www.apache.org/travel/  >.
Applications opened today and will close around the 21st June.

Important: Applications close on June 21st, 2019. Applicants have until
the closing date above to submit their applications (which should
contain as much supporting material as required to efficiently and
accurately process their request), this will enable TAC to announce
successful awards shortly afterwards.

As usual, TAC expects to deal with a range of applications from a
diverse range of backgrounds. We therefore encourage (as always) anyone
thinking about sending in an application to do so ASAP.
We look forward to greeting many of you in Las Vegas!

Kind Regards,
Gavin - (On behalf of the Travel Assistance Committee)

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



REMINDER - TAC Applications closes in 2 weeks for ACNA Montréal

2018-04-18 Thread Rene Gielen
Reminder that travel assistance applications for ApacheCon NA 2018 are
still open but only for another*2 weeks*!
Please get your applications in NOW.

We will be supporting ApacheCon NA Montréal, Canada on 24th - 29th
September 2018

 TAC exists to help those that would like to attend ApacheCon events,
but are unable to do so for financial reasons. 
For more info on this years applications and qualifying criteria, please
visit the TAC website at < http://www.apache.org/travel/ >. Applications
are now open and will close 1st May. 

*Important*: Applications close on May 1st, 2018. Applicants have until
the closing date above to submit their applications (which should
contain as much supporting material as required to efficiently and
accurately process their request), this will enable TAC to announce
successful awards shortly afterwards. 

As usual, TAC expects to deal with a range of applications from a
diverse range of backgrounds. We therefore encourage (as always) anyone
thinking about sending in an application to do so ASAP.   
We look forward to greeting many of you in Montreal

Kind Regards, 
Gavin - (On behalf of the Travel Assistance Committee)


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



Jodd/Madvoc MVC framework

2016-01-22 Thread Rene Gielen
Hi folks,

has anyone seen this before?
http://jodd.org/doc/madvoc/index.html

Looks like they are taking basic Struts 2 concepts and mixing it with
some Spring MVC and Seam.

It might be interesting to evaluate which of their concepts might be
nice to integrate in S2.5/3 - just sayin' ... :)

- René

-- 
René Gielen
http://twitter.com/rgielen

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



Re: Differences between struts 2.0.14 and 2.3.16.3

2015-02-01 Thread Rene Gielen
Looks like you have some work ahead of you:
http://struts.apache.org/docs/migration-guide.html

It is highly recommended to upgrade ASAP. 2.3.20 is recommended over
2.3.16.3

- René

Am 31.01.15 um 17:05 schrieb viswanathan.sugu...@accenture.com:
> Hi,
> 
> I have application running on struts 2.0.14.
> 
> Due to the following security issues
> https://cwiki.apache.org/confluence/display/WW/S2-020
> https://cwiki.apache.org/confluence/display/WW/S2-021
> 
> we are planning to upgrade struts version to 2.3.16.3
> 
> I m assessing the impact of upgrading to the 2.3.16.3 version. I would like 
> to know, on what APIs have been removed or changed in this version.
> 
> Kindly help to advice on the API changes in the version 2.3.16.3
> 
> 
> Thanks & Regds.,
> Viswanathan S
> 
> 
> 
> 
> This message is for the designated recipient only and may contain privileged, 
> proprietary, or otherwise confidential information. If you have received it 
> in error, please notify the sender immediately and delete the original. Any 
> other use of the e-mail by you is prohibited. Where allowed by local law, 
> electronic communications with Accenture and its affiliates, including e-mail 
> and instant messaging (including content), may be scanned by our systems for 
> the purposes of information security and assessment of internal compliance 
> with Accenture policy.
> __
> 
> www.accenture.com
> 

-- 
René Gielen
http://twitter.com/rgielen

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



Re: commons-fileupload security vulnerability (Struts 1.3)

2014-05-20 Thread Rene Gielen
Hi,

Struts 1 is out of maintenance. I have no information whether
commons-fileupload 1.3.1 works as a drop-in replacement for 1.1.1 in
Struts 1.3 based applications. Most probably you will have to give it a
test drive.

Regards,
René

Am 30.04.14 02:02, schrieb Leopoldo Miranda Martinez/Mexico/IBM:
> Hello Struts users community,
> 
> Looking into this URL 
> http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0050, it states a 
> security vulnerability for Apache Commons FileUpload before 1.3.1.
> 
> I'm using Struts v1.3 which bundles commons-fileupload-1.1.1.jar and the 
> question I have is whether I can safely replace v1.1.1 by 
> commons-fileupload-1.3.1.jar, the one that's bundled in the latest Struts 
> version (2.3.16.2). The idea is to remediate the security issue but also, 
> keeping functionality across the Struts v1.3.
> 
> Any help / advice would be really appreciated.
> 
> Thanks.
> 

-- 
René Gielen
http://twitter.com/rgielen

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



[ANN][SECURITY] Struts 1 - CVE-2014-0114 -Mitigation Advice Available, Possible RCE Impact

2014-05-01 Thread Rene Gielen
As confirmed in our last announcement, the Apache Struts 1 framework in
all versions is affected by a ClassLoader manipulation vulnerability
(CVE-2014-0114) similar to a recently fixed vulnerability in Struts 2
(CVE-2014-0112, CVE-2014-0094) [1].

Thanks to the efforts of Alvaro Munoz and the HP Fortify team, the
Apache Struts project team can recommend a first mitigation that is
relatively simple to apply. It involves the introduction of a generic
Servlet filter, adding the possibility to blacklist unacceptable request
parameters based on regular expressions. Please see the corresponding HP
Fortify blog entry [2] for detailed instructions.

The HP Fortify team also informed us that the vulnerability may be
exploited for Remote Code Execution (RCE) in certain environments. Based
on this information, the Apache Struts project team recommends to apply
the mitigation advice *immediately* for all Struts 1 based applications.

Struts 1 has had its End-Of-Life announcement more than one year ago
[3]. However, in a cross project effort the Struts team is looking for a
correction or an improved mitigation path. Please stay tuned for further
information regarding a solution.

This is a cross-list posting. If you have questions regarding this
report, please direct them to secur...@struts.apache.org only.

[1] http://struts.apache.org/release/2.3.x/docs/s2-021.html
[2]
http://h30499.www3.hp.com/t5/HP-Security-Research-Blog/Protect-your-Struts1-applications/ba-p/6463188#.U2J7xeaSxro
[3] http://struts.apache.org/struts1eol-announcement.html

-- 
René Gielen
http://twitter.com/rgielen

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



[ANN][SECURITY] ClassLoader manipulation issue confirmed for Struts 1 - CVE-2014-0114

2014-04-29 Thread Rene Gielen
The Apache Struts project team confirms that Struts 1 in all versions is
affected by a ClassLoader manipulation vulnerability similar to a
recently fixed vulnerability in Struts 2 (CVE-2014-0112, CVE-2014-0094) [1].

This is a different underlying flaw. For future reference, please use
CVE-2014-0114 in regards to this issue.

Struts 1 has had its End-Of-Life announcement one year ago. In a cross
project effort, the Struts team is looking for a correction or
mitigation path though. Please stay tuned for further information
regarding a solution.

This is a cross-list posting. If you have questions regarding this
report, please direct them to secur...@struts.apache.org only.

[1] http://struts.apache.org/release/2.3.x/docs/s2-021.html

-- 
René Gielen
http://twitter.com/rgielen

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



Re: [ANN] Struts 2 up to 2.3.16.1: Zero-Day Exploit Mitigation (security | critical)

2014-04-24 Thread Rene Gielen
Yes.

Am 24.04.14 19:37, schrieb em...@cse.concordia.ca:
> Hello List,
> 
> I am using tiles-default:
> 
> extends="tiles-default">
>   
>   class="org.apache.struts2.views.tiles.TilesResult" />
>   
> 
>class="ExampleAction">
>  success_gui
>  
> /WEB-INF/pages/errorinfo/ajax_error_check.jsp
>   
>   
> Do I need this update below as well?  Thank you!
> 
> On 04/24/2014 11:32 AM, Rene Gielen wrote:
>> In Struts 2.3.16.1, an issue with ClassLoader manipulation via request
>> parameters was supposed to be resolved. Unfortunately, the correction
>> wasn't sufficient.
>>
>> A security fix release fully addressing this issue is in preparation and
>> will be released as soon as possible.
>>
>> Once the release is available, all Struts 2 users are strongly
>> recommended to update their installations.
>>
>> * Until the release is available, all Struts 2 users are strongly
>> recommended to apply the mitigation described [1] *
>>
>> Please follow the Apache Struts announcement channels [2][3][4][5] to
>> stay updated regarding the upcoming security release. Most likely the
>> release will be available within the next 72 hours. Please prepare for
>> upgrading all Struts 2 based production systems to the new release
>> version once available.
>>
>> - The Apache Struts Team.
>>
>> [1] http://struts.apache.org/announce.html#a20140424
>> [2] http://struts.apache.org/mail.html
>> [3] http://struts.apache.org/announce.html
>> [4] https://plus.google.com/+ApacheStruts/posts
>> [5] https://twitter.com/TheApacheStruts
> 
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 

-- 
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
Cel: +49-(0)163-2844164
http://twitter.com/rgielen

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



[ANN] Struts 2 up to 2.3.16.1: Zero-Day Exploit Mitigation (security | critical)

2014-04-24 Thread Rene Gielen
In Struts 2.3.16.1, an issue with ClassLoader manipulation via request
parameters was supposed to be resolved. Unfortunately, the correction
wasn't sufficient.

A security fix release fully addressing this issue is in preparation and
will be released as soon as possible.

Once the release is available, all Struts 2 users are strongly
recommended to update their installations.

* Until the release is available, all Struts 2 users are strongly
recommended to apply the mitigation described [1] *

Please follow the Apache Struts announcement channels [2][3][4][5] to
stay updated regarding the upcoming security release. Most likely the
release will be available within the next 72 hours. Please prepare for
upgrading all Struts 2 based production systems to the new release
version once available.

- The Apache Struts Team.

[1] http://struts.apache.org/announce.html#a20140424
[2] http://struts.apache.org/mail.html
[3] http://struts.apache.org/announce.html
[4] https://plus.google.com/+ApacheStruts/posts
[5] https://twitter.com/TheApacheStruts

-- 
René Gielen
http://twitter.com/rgielen

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



[ANN] Struts 2.3.15.1 GA (fast track | security | critical)

2013-07-16 Thread Rene Gielen
The Apache Struts group is pleased to announce that Struts 2.3.15.1 is
available as a "General Availability" release. The GA designation is
our highest quality grade.

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

Two security issues were solved with this release, one of which is rated
critical - see [1] and [2] for detailed information:
* Remote code execution vulnerability when using short-circuit
navigation parameter prefixes
* Open redirect vulnerability when using short-circuit redirect
parameter prefixes

All developers are strongly advised to immediately update existing
Struts 2 applications to Struts 2.3.15.1.

Struts 2.3.15.1 is available in a full distribution or as separate
library, source, example and documentation distributions, from the
releases page. The release is also available through the central Maven
repository under Group ID "org.apache.struts". The release notes are
available online [3].

The 2.3.x series of the Apache Struts framework has a minimum
requirement of the following specification versions: Servlet API 2.4,
JSP API 2.0, and Java 5.

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket.


- The Apache Struts Team.

[1] http://struts.apache.org/release/2.3.x/docs/s2-016.html
[2] http://struts.apache.org/release/2.3.x/docs/s2-017.html
[3] http://struts.apache.org/release/2.3.x/docs/version-notes-23151.html

-- 
René Gielen
http://twitter.com/rgielen

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



ANN] Struts 2.3.14.2 GA (fast track | security)

2013-05-26 Thread Rene Gielen
The Apache Struts group is pleased to announce that Struts 2.3.14.2 is
available as a "General Availability" release. The GA designation is
our highest quality grade.

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

A critical security issue was solved with this release - see [1] for
detailed information:
* A vulnerability introduced by forcing parameter inclusion in the URL
and Anchor Tag allows remote command execution, session access and
manipulation and XSS attacks

All developers are strongly advised to immediately update existing
Struts 2 applications to Struts 2.3.14.2.

Struts 2.3.14.2 is available in a full distribution or as separate
library, source, example and documentation distributions, from the
releases page. The release is also available through the central Maven
repository under Group ID "org.apache.struts". The release notes are
available online [2].

The 2.3.x series of the Apache Struts framework has a minimum
requirement of the following specification versions: Servlet API 2.4,
JSP API 2.0, and Java 5.

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket.


- The Apache Struts Team.

[1] http://struts.apache.org/release/2.3.x/docs/s2-014.html
[2] http://struts.apache.org/release/2.3.x/docs/version-notes-23142.html
-- 
René Gielen
http://twitter.com/rgielen

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



[ANN] Apache Struts 1.x End-Of-Life (EOL) Announcement

2013-04-06 Thread Rene Gielen
The Apache Struts Project Team would like to inform you that the Struts
1.x web framework has reached its end of life and is no longer
officially supported.

Started in 2000, Struts 1 had its last release - version 1.3.10 - in
December 2008. In the meantime the Struts community has focused on
pushing the Struts 2 framework forward, with as many as 23 releases as
of this writing. Taking this into account, announcing Struts 1 EOL is
just the official statement that we have been lacking volunteer support
for some time now and that users should not rely on a properly
maintained framework state when utilizing Struts 1 in projects. See the
following Q/A section for more details.

Q: With the announcement of Struts 1 EOL, what happens to Struts 1
resources?
A: All resources will stay where they are. The documentation will still
be accessible from the Apache Struts homepage, as well as the downloads
for all released Struts 1.x versions. All of the Struts 1 source code
can be found in the Apache Struts subversion repository, now and in
future. All released Maven artifacts will still be accessible in Maven
Central.

Q: Given a major security problem or a serious bug is reported for
Struts 1 in near future, can we expect a new release with fixes?
A: As of now, actually no - that is what the EOL announcement
essentially is about. Since the end of support is reached, you will
either need to find mitigations, patch the existing Struts 1 source code
yourself or migrate your project to another web framework.

Q: Is there an immediate need to eliminate Struts 1 from my projects?
A: As far as the Struts team is currently aware of, there is no urgent
issue posing the immediate need to eliminate Struts 1 usage from your
projects. However, you should be aware that security and bug fixes will
no longer be provided. If in future such flaws are found you will need
to take action as described in the preceding answer.

Q: We plan to start a new project based on Struts 1. Can we still do so?
A: Basically yes, but we would not recommend doing so. As long as no
code line is written it is very easy to conceptually select an
alternative web framework such as Struts 2.

Q: We want to migrate our project from Struts 1 to another web
framework. What would you recommend?
A: You should be aware that there is currently no "drop-in" replacement
for Struts 1. You will need to adapt your existing code to the framework
of choice. Basically every action based Java web framework is a possible
candidate. We as the Apache Struts Team can highly recommend
investigating Struts 2 as a successor framework - it is modern, highly
decoupled, feature rich, well maintained and successfully running in
many mission critical projects in the wild. It shares the same basic
principles with Struts 1, but offers a highly improved architecture and
API. Other alternatives are e.g. Spring Web MVC, Grails or Stripes.

Q: My friends / colleagues and I would like to see Struts 1 being
maintained again. What can we do?
A: You are free to put effort in Struts 1. There are basically two
possible ways to do so: either fork the existing source, or engage in
community building within the Apache Struts Project. If there are enough
people demonstrating their will and ability to provide patches,
maintenance and oversight in the long run, there is nothing holding us
back from putting Struts 1 back into maintenance with the help of these
volunteers.

Online Resources:
http://struts.apache.org/struts1eol-announcement.html
http://struts.apache.org/struts1eol-press.html

René Gielen
- Apache Struts PMC Chair -

-- 
http://twitter.com/rgielen

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



ApacheConEU started - join us

2012-11-06 Thread Rene Gielen
Hi there,

ACEU 2012 in Sinsheim has started. Several Struts team members will be
present at the conference, such as Johannes Geppert (@jogep), Christian
Grobmeier (@grobmeier) and me (@rgielen).

If you are attending and interested in a chat about Struts 2 or the
state of the universe in general, feel free to drop by or ping. I'd be
happy to meet some Struts 2 users and share some thoughts.

Shameless plug: today at 14:00 Johannes and I will be giving a talk on
"Modern Web Application Development with Struts 2" - hope to see you
there :)

Cheers
René

-- 
René Gielen
http://twitter.com/rgielen

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



Re: Benefits of using Filter as front controller

2012-08-22 Thread Rene Gielen
Thanks for this information, very interesting - seems like we're not
alone with FiterDispatcher :)

- René

Am 15.08.12 00:45, schrieb Joseph Mocker:
> FWIW, JAX-RS/Jersey provides both a Filter and a Servlet option as a 
> controller, however the Servlet came first.
> 
> http://java.net/jira/browse/JERSEY-122
> 
> Note the bug mentions Wicket also uses a Filter. The bug also provides an 
> interesting reason for the use of a filter
> 
> to intercept "all HTTP calls against a path but only consumes those 
> calls it can handles. All other calls are
> allowed to continue and get handled by another Servlet or Filter."
> 
>   --joe
> 
> 
> Joseph Mocker   |   Velti   |   Senior Software Architect
> t +1.650.566.7033   m +1.408.676.6625
> e jmoc...@velti.com   @Mobclix
> 
> The leading global technology provider of
> mobile marketing and advertising solutions
> 
> On Aug 14, 2012, at 12:41 PM, Rene Gielen wrote:
> 
>> No worries, always good to question - review - rethink
>>
>> If there is serious interest in an alternative servlet dispatcher besides 
>> FilterDispatcher, contributions are welcome. From the top of my head, the 
>> old dispatcher is still around as deprecated, and most of the dispatcher 
>> functionality resides in a delegate.
>>
>> - René
>>
>> Sent from my iPad
>>
>> On 14.08.2012, at 20:21, Struts Two  wrote:
>>
>>>>> I remember more than one case where I found WAS / Websphere Portal to 
>>>>> implement a very ... say ... at least ... imaginative interpretation of 
>>>>> the specs
>>>
>>> That is exactly the point,the compromise of "clear-cut" sections of spec in 
>>> favor of "unclear, murky, interpretive" sections of spec in struts 2 much 
>>> like IBM. There is no "interpretation" on whether a Servlet can/should be 
>>> used to server resource but when it comes to filters there is. And quite 
>>> rightfully so,  as there may be darn compelling reasons to do so, since 
>>> things quite few often do not follow patterns put in black and white. I am 
>>> not trying to stir an endless discussion on what interpretation is correct 
>>> as there will be no consensus. And I do not know what has been the darn 
>>> compelling reason that could have not gotten away with using a Servlet as 
>>> front controller in struts 2, but I would have loved to have the option of 
>>> using a Servlet as my front controller in struts 2.
>>>
>>> With all said, I did not mean to belittle struts 2 or take a jab at any 
>>> struts 2 contributor in my previous comment. And I believe it is very 
>>> honorable of you to try make the tool available to the development 
>>> community for free by putting a lot of work in your free and personal time. 
>>> I just wanted to reflect the opinion for some spectrum of struts user 
>>> community though may be small in numbers.
>>>
>>>
>>> - Original Message -
>>> From: Rene Gielen 
>>> To: Struts Users Mailing List 
>>> Cc:
>>> Sent: Tuesday, August 14, 2012 12:10:56 PM
>>> Subject: Re: Benefits of using Filter as front controller
>>>
>>> So far I fail to see where Struts 2 deviates from or violates the spec.
>>> The fact that _usually_ a front controller - a concept not to be found
>>> at all in the servlet spec - is implemented as servlet does not mean
>>> that it _has_ to be implemented that way, unless the spec says or
>>> clearly implies otherwise. For what I found in the and cited earlier,
>>> this is not the case.
>>>
>>> That WAS *interprets* the spec in a different way - especially when it
>>> comes to a tooling level that has nothing to do with the spec whatsoever
>>> (parsing web.xml to generate loadbalancing / proxy webserver
>>> configuration) - is a totally different story. To some extent I
>>> understand the rationale behind this, implying a servlet mapping should
>>> exist for a given URL - but besides IBM claiming this has to be the
>>> case, I haven't found any evidence so far. Interestingly, when it comes
>>> to IBM support saying Struts 2 deviates from the spec, I remember more
>>> than one case where I found WAS / Websphere Portal to implement a very
>>> ... say ... at least ... imaginative interpretation of the specs. I'm
>>> not quite sure if them saying that Struts 2 deviates makes a case for
>>> this being a fact to count on. But again, I'm happy to he

Re: S2 support for index action?

2012-08-21 Thread Rene Gielen
I think I see the use case - while accessing /cart/ should be a valid request 
to the cart topic landing page (index), default action might map to a default 
"unknown URI" page, which has say a humble error message and some suggestions 
what URIs the user would want to access.
-- 
Sent from my mobile phone



Lukasz Lenart  schrieb:

2012/8/20 Paul Benedict :
> Are you familiar with index actions in HTTP servers? It's the page
> that loads when a directory is specified. It's the default when no
> specific resource is requested. That's different than the "default
> action" in S2 which runs if no suitable action can be found.
>
> Pretend there is a default package called "checkout" with "viewCart"
> set to the default action. Here are some example actions in that
> package:
> /checkout/addToCart.action = Adds item to cart
> /checkout/viewCart.action = Views items in cart
> /checkout/ = runs default action
> /checkout/zz = runs default action too
> /checkout/qwerty = runs default action too
>
> As you can see, S2 interprets the default action to mean "I can't find
> anything so let's execute the default." I am saying, we should allow a
> more narrow configuration that says run the default action only if NO
> specific resource in the package is being requested.

But isn't the same as default action per package ? Where you can
specify the index action:






index.jsp




Or would you have a more sophisticated mechanism which will
automagically discover index action instead of specifying default
action for each package ?

The case is that there can be more than one class used to implement
actions for given namespace.


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: getText syntax for jsp tags

2012-08-14 Thread Rene Gielen
The key attribute is for simple resource properties lookup only, without
MessageFormat. The  tag is able to deal with MessageFormat in
particular.

In your case you could either use specialized properties in your bundle:

reject.to=Reject to
reject.to.larry=%{getText('reject.to')} Larry

or use the getText call in your tag:



or, if users is a collection to iterate over, containing user beans with
a property firstName:





See also:
https://cwiki.apache.org/confluence/display/WW/Localization
https://cwiki.apache.org/confluence/display/WW/Formatting+Dates+and+Numbers

- René

Am 15.08.12 03:56, schrieb Cozart, Michele L:
> I've been searching for hours but can't find the correct syntax for sending 
> parameters into the messageResources.properties file and using the resulting 
> message in a tag.
> 
> For instance, I have submit buttons that will say different things depending 
> on the user's role:
> Reject to Larry
> Reject to Moe
> Reject to Curly
> Approve to ...
> 
>  align="center" />
> generates the button text of: Reject to {0}  if I add the parameter like, 
> key="label.button.reject, Role" I get label.button.reject Role
> 
> Thanks,
> Michele Cozart
> 

-- 
René Gielen
http://twitter.com/rgielen

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



Re: Benefits of using Filter as front controller

2012-08-14 Thread Rene Gielen
No worries, always good to question - review - rethink

If there is serious interest in an alternative servlet dispatcher besides 
FilterDispatcher, contributions are welcome. From the top of my head, the old 
dispatcher is still around as deprecated, and most of the dispatcher 
functionality resides in a delegate.

- René

Sent from my iPad

On 14.08.2012, at 20:21, Struts Two  wrote:

>>> I remember more than one case where I found WAS / Websphere Portal to 
>>> implement a very ... say ... at least ... imaginative interpretation of the 
>>> specs
> 
> That is exactly the point,the compromise of "clear-cut" sections of spec in 
> favor of "unclear, murky, interpretive" sections of spec in struts 2 much 
> like IBM. There is no "interpretation" on whether a Servlet can/should be 
> used to server resource but when it comes to filters there is. And quite 
> rightfully so,  as there may be darn compelling reasons to do so, since 
> things quite few often do not follow patterns put in black and white. I am 
> not trying to stir an endless discussion on what interpretation is correct as 
> there will be no consensus. And I do not know what has been the darn 
> compelling reason that could have not gotten away with using a Servlet as 
> front controller in struts 2, but I would have loved to have the option of 
> using a Servlet as my front controller in struts 2. 
> 
> With all said, I did not mean to belittle struts 2 or take a jab at any 
> struts 2 contributor in my previous comment. And I believe it is very 
> honorable of you to try make the tool available to the development community 
> for free by putting a lot of work in your free and personal time. I just 
> wanted to reflect the opinion for some spectrum of struts user community 
> though may be small in numbers.
> 
> 
> - Original Message -
> From: Rene Gielen 
> To: Struts Users Mailing List 
> Cc: 
> Sent: Tuesday, August 14, 2012 12:10:56 PM
> Subject: Re: Benefits of using Filter as front controller
> 
> So far I fail to see where Struts 2 deviates from or violates the spec.
> The fact that _usually_ a front controller - a concept not to be found
> at all in the servlet spec - is implemented as servlet does not mean
> that it _has_ to be implemented that way, unless the spec says or
> clearly implies otherwise. For what I found in the and cited earlier,
> this is not the case.
> 
> That WAS *interprets* the spec in a different way - especially when it
> comes to a tooling level that has nothing to do with the spec whatsoever
> (parsing web.xml to generate loadbalancing / proxy webserver
> configuration) - is a totally different story. To some extent I
> understand the rationale behind this, implying a servlet mapping should
> exist for a given URL - but besides IBM claiming this has to be the
> case, I haven't found any evidence so far. Interestingly, when it comes
> to IBM support saying Struts 2 deviates from the spec, I remember more
> than one case where I found WAS / Websphere Portal to implement a very
> ... say ... at least ... imaginative interpretation of the specs. I'm
> not quite sure if them saying that Struts 2 deviates makes a case for
> this being a fact to count on. But again, I'm happy to hear I'm wrong if
> someone could clearly point out what I might have missed when reading
> the spec.
> 
> Side note - sorry to say, but in my very personal and for sure not
> representative experience, every time a "some application servers might
> have issues" case arises, there is a good chance that _some_ of them
> share a common product line name, starting with "W" :) And well, going
> through hell when deploying apps to WAS* is something I suffered from
> myself many times, with various different frameworks and technology
> stacks in use.
> 
> I'll try to wrap up my points:
> - the filter-based dispatching addressed real and serious technical
> integration issues, and was able to solve them
> - if it would violate the spec, we would *have to* remove it again, or
> at least deliver a then spec conform dispatcher servlet as alternative -
> so far there seems to be no evidence this is the case
> - the Struts team *can for sure do much better* in documenting the
> possible glitches, especially after what we learned from this thread and
> your experiences; we should point out that using a filter dispatcher
> might impose the need to add a default dummy servlet mapping to help
> some application servers
> 
> BTW: I agree, Spring MVC became a great framework once they dropped the
> inheritance-based controller madness, replacing it with annotation based
> POJO configuration and heavy AOP magic. Nevertheless, Struts 2 has

Re: 2.3.4.1 "version notes" link 404 from homepage

2012-08-14 Thread Rene Gielen
We currently seem to have some issues with the export from Confluence,
going to check this - thanks for the notice!

As a workaround, here is the direct link to the notes in Confluence:
https://cwiki.apache.org/confluence/display/WW/Version%20Notes%202.3.4.1

Thanks,
- René

Am 14.08.12 18:14, schrieb struts@spamgourmet.com:
> This page: http://struts.apache.org/index.html has a version notes link for 
> 2.3.4.1 that leads to this 404: 
> http://struts.apache.org/2.x/docs/version-notes-2341.html
> 
> -rgm
> 

-- 
René Gielen
http://twitter.com/rgielen

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



Re: Benefits of using Filter as front controller

2012-08-14 Thread Rene Gielen
So far I fail to see where Struts 2 deviates from or violates the spec.
The fact that _usually_ a front controller - a concept not to be found
at all in the servlet spec - is implemented as servlet does not mean
that it _has_ to be implemented that way, unless the spec says or
clearly implies otherwise. For what I found in the and cited earlier,
this is not the case.

That WAS *interprets* the spec in a different way - especially when it
comes to a tooling level that has nothing to do with the spec whatsoever
(parsing web.xml to generate loadbalancing / proxy webserver
configuration) - is a totally different story. To some extent I
understand the rationale behind this, implying a servlet mapping should
exist for a given URL - but besides IBM claiming this has to be the
case, I haven't found any evidence so far. Interestingly, when it comes
to IBM support saying Struts 2 deviates from the spec, I remember more
than one case where I found WAS / Websphere Portal to implement a very
... say ... at least ... imaginative interpretation of the specs. I'm
not quite sure if them saying that Struts 2 deviates makes a case for
this being a fact to count on. But again, I'm happy to hear I'm wrong if
someone could clearly point out what I might have missed when reading
the spec.

Side note - sorry to say, but in my very personal and for sure not
representative experience, every time a "some application servers might
have issues" case arises, there is a good chance that _some_ of them
share a common product line name, starting with "W" :) And well, going
through hell when deploying apps to WAS* is something I suffered from
myself many times, with various different frameworks and technology
stacks in use.

I'll try to wrap up my points:
- the filter-based dispatching addressed real and serious technical
integration issues, and was able to solve them
- if it would violate the spec, we would *have to* remove it again, or
at least deliver a then spec conform dispatcher servlet as alternative -
so far there seems to be no evidence this is the case
- the Struts team *can for sure do much better* in documenting the
possible glitches, especially after what we learned from this thread and
your experiences; we should point out that using a filter dispatcher
might impose the need to add a default dummy servlet mapping to help
some application servers

BTW: I agree, Spring MVC became a great framework once they dropped the
inheritance-based controller madness, replacing it with annotation based
POJO configuration and heavy AOP magic. Nevertheless, Struts 2 has a lot
of sweet spots even over Spring MVC, as to my opinion as a user of both :)

Cheers,
- René

Am 14.08.12 15:46, schrieb Struts Two:
> What people are missing here is that using filters and deviating from the 
> spec as front controller would cause quite a few issues when some 
> applications servers are used. I quite clearly remember that I went through 
> hell to deploy my applications on WebSphere applications with an Http server 
> as front Web server. WebSphere goes through web.xml files and uses Servlet 
> URL mappings to generate the plugin file for resource mapping and filters are 
> ignored. Even when I opened a pmr, I was told by support that struts 2 
> deviates from the Spec. when you pick a framework, you got to be aware that 
> these things may cost you dearly down the road depending on what application 
> servers you use or you plan to migrate.
> 
> As much as I have been an avid struts user [specially struts 1], I personally 
> think that you should seriously consider Spring MVC / MVC Portlet against any 
> other framework. I ,per se, have had a great experience with Spring MVC which 
> somehow brings up the good memories of struts 1 [once everything is put in 
> the context of its time]
> 
> 
> 
> - Original Message -
> From: "umeshawas...@gmail.com" 
> To: Struts Users Mailing List 
> Cc: 
> Sent: Monday, August 13, 2012 2:05:45 PM
> Subject: Re: Benefits of using Filter as front controller
> 
> Rene
> Thanks for such a detailed explanation and descrbing each and every aspects
> Now even I can say and explains things in much more and good way
> Sent from BlackBerry® on Airtel
> 
> -Original Message-
> From: Rene Gielen 
> Date: Mon, 13 Aug 2012 20:00:04 
> To: Struts Users Mailing List
> Reply-To: "Struts Users Mailing List" 
> Subject: Re: Benefits of using Filter as front controller
> 
> Grabbed me a copy of Servlet Spec 2.4:
> 
> 
> SRV.6.1 What is a filter?
> A filter is a reusable piece of code that can transform the content of
> HTTP requests, responses, and header information. Filters do not
> generally create a response or respond to a request as servlets do,
> rather they modify or adapt the requests for a resource, and 

[ANN] Struts 2.3.4.1 GA release available

2012-08-13 Thread Rene Gielen
The Apache Struts group is pleased to announce that Struts 2.3.4.1 is
available as a "General Availability" release. The GA designation is
our highest quality grade.

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

This release includes two important security fixes:
* improved token mechanism, if used as CSRF attack prevention
* restricted parameter name length to reduce DOS attack risks

All developers are recommended to update existing Struts 2
applications to Struts 2.3.4.1.

Struts 2.3.4.1 is available in a full distribution, or as separate
library, source, example and documentation distributions, from the
releases page.

* http://struts.apache.org/download.cgi#struts2341

The release is also available through the central Maven repository
under Group ID "org.apache.struts". The release notes are available
online.

* https://cwiki.apache.org/confluence/display/WW/Version%20Notes%202.3.4.1

The 2.3.x series of the Apache Struts framework has a minimum
requirement of the following specification versions: Servlet API 2.4,
JSP API 2.0, and Java 5.

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket.appropriate, file a tracking
ticket:

* https://issues.apache.org/struts/secure/Dashboard.jspa

- The Apache Struts Team.

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



Re: Benefits of using Filter as front controller

2012-08-13 Thread Rene Gielen
Grabbed me a copy of Servlet Spec 2.4:


SRV.6.1 What is a filter?
A filter is a reusable piece of code that can transform the content of
HTTP requests, responses, and header information. Filters do not
generally create a response or respond to a request as servlets do,
rather they modify or adapt the requests for a resource, and modify or
adapt responses from a resource.


"do not generally" is way different from "may not", right?

Reading both the relevant parts of the spec and the API docs again, I
cannot see any violation of the servlet specification by using a Filter
for doing the dispatching, rather than a Servlet.

The other part is how requests are mapped, which imposes the question if
a servlet mapping matching the request URL must exist:


SRV.11.1 Use of URL Paths
[...]
1. The container will try to find an exact match of the path of the
request to the path of the servlet. A successful match selects the servlet.
2. The container will recursively try to match the longest path-prefix.
This is done by stepping down the path tree a directory at a time, using
the ’/’ character as a path separator. The longest match determines the
servlet selected.
(ad 2.: Previous versions of this specification made use of these
mapping tech- niques as a suggestion rather than a requirement, allowing
servlet con- tainers to each have their different schemes for mapping
client requests to servlets.)
3. If the last segment in the URL path contains an extension (e.g.
.jsp), the servlet container will try to match a servlet that handles
requests for the extension. An extension is defined as the part of the
last segment after the last ’.’ character.
4. If neither of the previous three rules result in a servlet match, the
container will attempt to serve content appropriate for the resource
requested. If a "default" servlet is defined for the application, it
will be used.


Point 4 is crucial. As to my opinion, it doesn't state clearly if a
default mapping must exist or not, which leaves it IMO up to the container.

That said, most frameworks use dispatcher servlets, and WebWork / Struts
2 once did as well.

The rationale behind switching to the Filter architecture was to deal
better with integrating technologies such a Sitemesh or Portlet, which
both profit from splitting the dispatching in more than one phase. This
could only be accomplished by using filters rather than servlets. Since
then, e.g. all major problems with sitemes integration magically
disappeared.

So my point of view is that there is nothing wrong with using filters
for dispatching. If the container interprets the servlet spec in an
opposite way, a dummy default servlet mapping should do the trick.

Nevertheless I'm happy to hear about points I might have missed or
misinterpreted.

- René

Am 8/13/12 16:01 , schrieb Paul Benedict:
> I'll take back what I said and reserve opinion until further research.
> I'll be interested in what you all find. For the record, the Spring
> Framework has its front-controllers as servlets.
> 
> http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/package-summary.html
> 
> Paul
> 
> On Mon, Aug 13, 2012 at 8:53 AM,   wrote:
>> Yes this was one of the point I was thinking
>> Same question was today asked on SO and this lead me to reaseach as what 
>> advantages and reasons was there to use filter as controller
>> Sent from BlackBerry® on Airtel
>>
>> -Original Message-
>> From: Dave Newton 
>> Date: Mon, 13 Aug 2012 09:49:43
>> To: Struts Users Mailing List
>> Reply-To: "Struts Users Mailing List" 
>> Subject: Re: Benefits of using Filter as front controller
>>
>> IIRC it states filters shouldn't be used to serve resources. I can't look
>> it up at the moment, but will later today.
>>
>> Dave
>>
>> (pardon brevity, typos, and top-quoting; on cell)
>> On Aug 13, 2012 9:44 AM, "Paul Benedict"  wrote:
>>
>>> With all due respect, I think saying Struts 2 violates the Servlet
>>> Spec is a grand stretch of the imagination.
>>>
>>> http://stackoverflow.com/questions/2957165/servlet-vs-filter
>>>
>>> Struts has a filter gives greater control over the kind of dispatching
>>> needed. You can then intercept processing not just web requests, but
>>> forwards, includes, and container errors. See the  child on
>>> the  element in web.xml. AFAIK, these advanced interception
>>> techniques are not available
>>>
>>> Paul
>>>
>>> On Mon, Aug 13, 2012 at 8:14 AM, Martin Gainty 
>>> wrote:

 A good question!
 The issue of "direct access of filters as resources" does appear to
>>> break the 2.4 Servlet spec for the reason that Struts needs access to all
>>> (attributes)
 from the Request

 Another important issue is "who is doing the dispatching" under Strut2

 Martin
 __
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehe

Re: Struts2 session concurrency issue ?

2012-04-25 Thread Rene Gielen
Please remember that the HTTP session is not synchronized. Thus, using the
session.put is a critical method. Most likely, what you really want to do is
counter = session.get("counter");
counter.increment (or incrementAndGet)
In this way you ensure exactly the same object is accessed and incremted /
consumed.

On Wed, Apr 25, 2012 at 4:03 PM, Gabriel Belingueres
wrote:

> The "S2 way" of accessing the session is implementing the SessionAware
> interface.
>
> First you must realize that what you are putting on session scope is
> not the AtomicInteger per se, but its current value at the moment you
> call the first action, so unless you call the first action again, the
> value stored in session will NOT change.
> The second action does not change the value in session, just print
> what was already stored.
>
> When you said that after some time, the results are "stabilized", I
> guess that you are requesting the first action after no other request
> is running so you get the current value again and then call the second
> action serially, giving you the same value.
>
> Also, you have concurrency issues if the first action:
>
> HitCounter.increment();
> ActionContext.getContext().getSession().put("counter",
> HitCounter.getAtomicCounter());
>
> you increment without returning the new value. Instead you call the
> getAtomicCounter() method, which will cause interference between
> threads (ie not thread safe), if the point that every session have a
> different counter value, then you must change the increment method
> like this:
>   public static int increment() {
>   return counter.incrementAndGet();
>   }
> and use that value to store it in session (no call to getAtomicCounter()).
>
> HTH,
> Gabriel
>
> 2012/4/25 Dionis Argiri :
> > Hi!
> >
> > I have some troubles (with understanding?) how session works.
> >
> > For example, I have two actions: First and Second.
> >
> > I have written simple utility, that uses executor service to send 10
> > asynchronous requests to action Second.
> >
> > In First action (which is called only from my browser) I do:
> >
> > HitCounter.increment();
> > ActionContext.getContext().getSession().put("counter",
> > HitCounter.getAtomicCounter());
> > return Action.SUCCESS;
> >
> > In second action I do:
> >
> > System.out.println("From session:
> > "+ActionContext.getContext().getSession().get("counter"));
> > System.out.println("Actual:"+ HitCounter.getAtomicCounter());
> > return Action.SUCCESS;
> >
> > And the output I see(and it really makes me mad):
> >
> > From session: 2
> > Actual: 69352
> >
> > After some time when I use this Fitst action/Second action only from my
> > browsers and no concurrent requests come(generated by my load utility),
> > results "are stabilized" to actual values. Thus, it seems that I have
> > concurrency issues with session or I'm missing some points.
> >
> > Is there a standard way that I should use to solve this problem, when
> using
> > Struts2 ?
> >
> > P.S. HitCounter realisation:
> >
> > public class HitCounter {
> >private static AtomicInteger counter = new AtomicInteger(0);
> >
> >public static void increment() {
> >counter.incrementAndGet();
> >}
> >public static int getAtomicCounter() {
> >return counter.get();
> >}
> > }
> >
> > BR,
> >
> > Dionis
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: 'Best' Struts Development Envirnoment?

2012-01-24 Thread Rene Gielen
+1, all the way

On 24.01.12 18:24, Wes Wannemacher wrote:
> I have nothing but good things to say about IntelliJ IDEA's Struts 2
> support... I have not used Struts 1 in a while, but I can tell you
> that I really appreciate the following features:
> 
> 1. It is aware that class files are Actions and/or spring beans.
> Therefore, you can jump straight to the class's action configuration
> or spring configuration.
> 2. Tag autocompletion. It is aware of the parameters for all of the tags.
> 3. OGNL awareness (I think this is new in IDEA 11), I believe it
> matches variables back to properties on the action class, etc.
> 
> Some of the other features that make it a pleasure to use:
> - proper support for maven (this is my primary problem with Eclipse)
> - very intuitive debugger
> - JPQL console
> 
> -Wes
> 
> On Tue, Jan 24, 2012 at 12:10 PM, Burton Rhodes  
> wrote:
>> I think this has been addressed before on this list, but I am wondering
>> what you guys have found is the best environment to develop Struts.
>> Currently I use Eclipse Indigo and don't really see any 'good' plugins.
>>
>> Since I use the XML method rather than annotations to map my actions, I
>> find myself scrolling my incredibly long XML file to find the related
>> action mappings. Surely there is a better way to do this?
>>
>> Also, a better auto complete feature for Struts tags in jsps would be nice.
>>
>> Am I willing to pay for software so I am not limited to eclipse for net
>> beans. But the switch would need to offer a compelling reason to switch.
>>
>> Any advice would be welcome.
>>
>> Thanks, Burton
> 
> 
> 

-- 
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
Cel: +49-(0)163-2844164
http://twitter.com/rgielen

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



Re: struts2.3.1.2 exception

2012-01-24 Thread Rene Gielen
Hi Emi,

see inline

On 24.01.12 21:29, Emi Lu wrote:
> Thank you everyone!
> 
> The problem is fixed.
> 
> ognl3.0.4 is a must and can be the only ognl jar!
> 
> 
> The following are some background info:
> ==
> . struts2.3.1.1 allows ognl3.0.2.jar + ognl3.0.2-source.jar + ognl3.0.1
> at the same time
> . struts2.3.1.2 can only have ognl3.0.4, but remove other versions
> 
> . user@struts.apache.org is very slow! I already got the author's replay
> but my question has not been shown in the mailing list yet! - still a
> very helpful list and i got almost got 100% answer for each my question :-)
> 

Well, actually user@struts.a.o is not slow at all - it's moderators are
slow, since they are all human.

To make things faster, just subscribe to the list as described in
http://struts.apache.org/mail.html - you get 100% pure lightning fast
computer only message delivery as a benefit, without human moderators
being involved to review and ocassionally let pass your mail manually.

Each message of an unsubscribed user gets moderated, which makes it both
slower and and more work intensive for mailing list moderators!

Regards,
- René

> Happy new year all!
> 
> Emi
> 
> 
> On 01/24/2012 03:08 PM, Dave Newton wrote:
>> How did you upgrade? Looks like the wrong version of OGNL.
>>
>> On Tue, Jan 24, 2012 at 11:16 AM, Emi Lu > > wrote:
>>
>> Good morning,
>>
>> Upgraded to struts2.3.1.2, but got the following exception.
>>
>> Could someone tell me which jar I missed please?
>>
>> thanks a lot!
>> Emi
>>
>>
>> java.lang.NoSuchMethodError:
>> ognl.SimpleNode.isEvalChain(__Lognl/OgnlContext;)Z
>> at
>>
>> com.opensymphony.xwork2.ognl.__OgnlUtil.isEvalExpression(__OgnlUtil.java:223)
>>
>> at
>> com.opensymphony.xwork2.ognl.__OgnlUtil.setValue(OgnlUtil.__java:214)
>> at
>>
>> com.opensymphony.xwork2.ognl.__OgnlValueStack.trySetValue(__OgnlValueStack.java:186)
>>
>> at
>>
>> com.opensymphony.xwork2.ognl.__OgnlValueStack.setValue(__OgnlValueStack.java:173)
>>
>> at
>>
>> com.opensymphony.xwork2.ognl.__OgnlValueStack.setParameter(__OgnlValueStack.java:151)
>>
>> at
>>
>> com.opensymphony.xwork2.__interceptor.__ParametersInterceptor.__setParameters(__ParametersInterceptor.java:__292)
>>
>> at
>>
>> com.opensymphony.xwork2.__interceptor.__ParametersInterceptor.__doIntercept(__ParametersInterceptor.java:__203)
>>
>> at
>>
>> com.opensymphony.xwork2.__interceptor.__MethodFilterInterceptor.__intercept(__MethodFilterInterceptor.java:__98)
>>
>> at
>>
>> com.opensymphony.xwork2.__DefaultActionInvocation.__invoke(__DefaultActionInvocation.java:__249)
>>
>> at
>>
>> com.opensymphony.xwork2.__interceptor.__ParametersInterceptor.__doIntercept(__ParametersInterceptor.java:__211)
>>
>> at
>>
>> com.opensymphony.xwork2.__interceptor.__MethodFilterInterceptor.__intercept(__MethodFilterInterceptor.java:__98)
>>
>> at
>>
>> com.opensymphony.xwork2.__DefaultActionInvocation.__invoke(__DefaultActionInvocation.java:__249)
>>
>> at
>>
>> com.opensymphony.xwork2.__interceptor.__StaticParametersInterceptor.__intercept(__StaticParametersInterceptor.__java:190)
>>
>> at
>>
>> com.opensymphony.xwork2.__DefaultActionInvocation.__invoke(__DefaultActionInvocation.java:__249)
>>
>> at
>>
>> org.apache.struts2.__interceptor.__MultiselectInterceptor.__intercept(__MultiselectInterceptor.java:__75)
>>
>> at
>>
>> com.opensymphony.xwork2.__DefaultActionInvocation.__invoke(__DefaultActionInvocation.java:__249)
>>
>> at
>>
>> org.apache.struts2.__interceptor.__CheckboxInterceptor.intercept(__CheckboxInterceptor.java:90)
>>
>> at
>>
>> com.opensymphony.xwork2.__DefaultActionInvocation.__invoke(__DefaultActionInvocation.java:__249)
>>
>> at
>>
>> org.apache.struts2.__interceptor.__FileUploadInterceptor.__intercept(__FileUploadInterceptor.java:__243)
>>
>> at
>>
>> com.opensymphony.xwork2.__DefaultActionInvocation.__invoke(__DefaultActionInvocation.java:__249)
>>
>> at
>>
>> com.opensymphony.xwork2.__interceptor.__ModelDrivenInterceptor.__intercept(__ModelDrivenInterceptor.java:__100)
>>
>> at
>>
>> com.opensymphony.xwork2.__DefaultActionInvocation.__invoke(__DefaultActionInvocation.java:__249)
>>
>> at
>>
>> com.opensymphony.xwork2.__interceptor.__ScopedModelDrivenInterceptor.__intercept(__ScopedModelDrivenInterceptor.__java:141)
>>
>> at
>>
>> com.opensymphony.xwork2.__DefaultActionInvocation.__invoke(__DefaultActionInvocation.java:__249)
>>
>> at
>>
>> com.opensymphony.xwork2.__interceptor.__ChainingInterceptor.intercept(__ChainingInterceptor.java:145)
>>
>> at

Re: Struts 2 and OSGi

2012-01-24 Thread Rene Gielen
Chad,

so far not too mcuh discussion has happened on improved OSGI support in
future Struts 2 versions. But as always, someone needs to kick things
off and share ideas :)

That said, you might want to consider moving this discussion over to
dev@struts.a.o, which is the better place for talking about developing
the framework itself.

Regards,
René

On 17.01.12 23:28, chad.da...@emc.com wrote:
> I know that there is an OSGi plugin for struts 2 that allows modular 
> additions to made to a struts 2 web app.  However, I also came across a 
> roadmap type document for significant improvements to the core of the 
> framework itself that would also leverage OSGi.
> 
> https://cwiki.apache.org/S2WIKI/struts-25-based-on-osgi.html
> 
> Is this something that is under development? Or already in the framework 
> perhaps?
> 

-- 
René Gielen
http://twitter.com/rgielen

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



[ANNOUNCEMENT] Struts 2.0.14 End of Life Announcement

2011-12-19 Thread Rene Gielen
The Apache Struts Team likes to inform you that the Struts 2.0 branch has
reached it's end of life and is no longer supported. All users of Struts
2.0.14 or earlier Struts 2 versions are strongly advised to update their
existing applications to Struts 2.3.x.

Struts 2.0.14 was for some time maintained in parallel to the 2.1 and 2.2
branches, since Struts 2.1 introduced some API and plugin changes that were
likely to break existing user code on top of Struts 2. However, the
community interest in maintaining the Struts 2.0.x branch was not strong
enough to keep it sufficiently up to date, especially in terms of security
fixes. There are several serious security problems that, while being
continuously addressed in later Struts 2 versions, did not make it into the
2.0.x branch. For that reason the Apache Struts PMC decided to remove
2.0.14 as a supported version.

For more information on how to upgrade existing applications running on top
of Struts 2.0.x to Struts 2.1 and later, please read the Guide to Migrating
from Struts 2.0.x to 2.1.x [1].

- René Gielen
Apache Struts PMC Chair

[1]
https://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html

-- 
René Gielen
http://twitter.com/rgielen


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



[ANN] Reminder: TAC Assistance to ApacheCon NA 2011 closes July 8th

2011-07-07 Thread Rene Gielen
Forwarded on behalf of the Travel Assistance Committee:

Hi All,

Just a friendly (and final)  reminder that applications for financial
help to attend ApacheCon NA 2011 in Vancouver close this coming Friday
8th July (2200 BST : UTC+1)

Financial assistance is available for Travel (planes, trains, whatever),
Accomodation (at the conference venue hotel) and Conference entrance
fees. Dependant on your circumstances will decide how much of that you
would be given.

Please visit http://apache.org/travel for more information and a link to
the application form.

Remember: We DO help people get to ApacheCon and other Apache events
every year, we DO want to help people get there who otherwise could not,
that is why we exist.

Spread the word, you are welcome to tweet, blog, email, post, phone or
smoke signal to anyone who you think might benefit from attending
ApacheCon this year.

Kind Regards,

The Travel Assistance Committee.

-- 
René Gielen
http://twitter.com/rgielen

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



Travel Assistance applications now open for ApacheCon NA 2011

2011-06-06 Thread Rene Gielen
The Apache Software Foundation (ASF)'s Travel Assistance Committee (TAC)
is now accepting applications for ApacheCon North America 2011, 7-11
November in Vancouver BC, Canada.

The TAC is seeking individuals from the Apache community at-large
--users, developers, educators, students, Committers, and Members-- who
would like to attend ApacheCon, but need some financial support in order
to be able to get there. There are limited places available, and all
applicants will be scored on their individual merit.

Financial assistance is available to cover flights/trains, accommodation
and entrance fees either in part or in full, depending on circumstances.
However, the support available for those attending only the BarCamp (7-8
November) is less than that for those attending the entire event
(Conference + BarCamp 7-11 November). The Travel Assistance Committee
aims to support all official ASF events, including cross-project
activities; as such, it may be prudent for those in Asia and Europe to
wait for an event geographically closer to them.

More information can be found at http://www.apache.org/trave/index.html
including a link to the online application and detailed instructions for
submitting.

Applications will close on 8 July 2011 at 22:00 BST (UTC/GMT +1).

We wish good luck to all those who will apply, and thank you in advance
for tweeting, blogging, and otherwise spreading the word.

Regards,
The Travel Assistance Committee


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



Re: Need suggestion to get started Struts 2

2011-05-18 Thread Rene Gielen
Hi,

in addition to what others said:

On 18.05.11 02:57, prashid wrote:
> Hi,
> 
> I am new to Java but learning it fast. I have been working in ASP.NET C# for
> a long time now. Just want to learn Java EE. 
> 
> Just started Strut2 reading online material. Took lots of time to configure
> Netbeans 7 to work with Struts2 for HelloWorld example but finally did it.
> 
> I have few things that I want to ask.
> 
> 1 - Is it right to learn Struts2 without learning JSP first?

If you go for JSP, you might want to check out The Java EE 5 Tutorial:
JSP http://download.oracle.com/javaee/5/tutorial/doc/bnagx.html.
Alternatively you have others options in Struts 2, such as Freemarker or
Velocity templating languages

> 2 - Is there any CRUD for Struts2?. I don't find much online to see how
> Struts2 application is organise and coded.

Check out the example applications that come with the Struts 2
distribution - there are explicit CRUD examples, and S2 provides quite
elegant solutions for this topic -
http://struts.apache.org/download.cgi#struts223

> 3 - Big question, Where should I start and what is needed to learn Struts2
> (Addons etc) ?

Struts 2 in Action is an excellent book, but not that up to date - it
covers only 2.0, not 2.1 or 2.2. Another excellent and more up to date
option is Dave Newton's "Apache Struts 2 Web Application Development"
(Packt)

- René

> 4 - Does Struts2 support templating for Web forms?
> 
> Hope someone will help me with these Questions.
> 
> Thanks
> 
> --
> View this message in context: 
> http://struts.1045723.n5.nabble.com/Need-suggestion-to-get-started-Struts-2-tp4405261p4405261.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 

-- 
René Gielen
http://twitter.com/rgielen

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



Re: request

2011-05-18 Thread Rene Gielen
Sorry, postings can not be deleted - that's the nature of a mailing list.

On 18.05.11 22:54, Alexandru wrote:
> I kindly ask all the moderators to delete this and previous message that came 
> from this account.
> 
> Thank you in advance!!
> 

-- 
René Gielen
http://twitter.com/rgielen

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



[ANN][SECURITY] Security Announcement: XSS Vulnerability in Struts 2 before 2.2.3

2011-05-10 Thread Rene Gielen
Problem:

A security vulnerability affecting all versions of Struts 2 before
Struts 2.2.3 has been reported by Dr. Marian Ventuneac (Genworth). The
vulnerability allows an attacker to inject malicious client side
Javascript code in Struts 2 based applications that have Dynamic Method
Invocation allowed (which is the default) AND do not have a global error
handling page configured.

For further details, see:
https://cwiki.apache.org/WW/s2-006.html
https://issues.apache.org/jira/browse/WW-3579

Solution:
-
We advice all users of Struts 2 for all their Struts 2 based
applications to either

upgrade to Struts 2.2.3, which fixes the issue; it can be obtained from
http://struts.apache.org/download.cgi#struts223

or

disable Dynamic Method Invocation in struts.xml, as described in
https://cwiki.apache.org/WW/s2-006.html

or

define a global error page in struts.xml, as described in
https://cwiki.apache.org/WW/s2-006.html


- The Apache Struts Team.

-- 
René Gielen
http://twitter.com/rgielen

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



[ANN] Struts 2.2.1 GA release available

2010-08-16 Thread Rene Gielen
The Apache Struts group is pleased to announce that Struts 2.2.1 is
available as a "General Availability" release. The GA designation is our
highest quality grade.

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

This release includes a number of new features and bug fixes since the
2.1.8.1 GA release, including important security fixes regarding remote
server context manipulation by injecting OGNL expressions in request
parameters. For more information about the exploits and possible
mitigation workarounds, see the corresponding security bulletins S2-005:
* http://struts.apache.org/2.2.1/docs/s2-005.html

All developers are strongly advised to update existing Struts 2
applications to Struts 2.2.1.

Struts 2.2.1 is available in a full distribution, or as separate
library, source, example and documentation distributions, from the
releases page:

* http://struts.apache.org/download.cgi#struts221

The release is also available through the central Maven repository under
Group ID "org.apache.struts". The release notes are available online:

* http://struts.apache.org/2.2.1/docs/version-notes-221.html


The 2.2.x series of the Apache Struts framework has a minimum
requirement of the following specification versions: Servlet API 2.4,
JSP API 2.0, and Java 5.

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket:

* https://issues.apache.org/struts/secure/Dashboard.jspa

-- The Apache Struts group.

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



Re: Fwd: Model Driven Action doesn't return value when model gets reassigned to some other value - hibernate problem

2010-06-29 Thread Rene Gielen
Hi Greg,

the thing about ModelDriven is that the model object gets pushed on the
value stack _before_ your action method is executed. To initialize the
model object before the ModelDrivenInterceptor comes into play, just
implement Preparable and do your initialization in prepare() (as Lukasz
already suggested)

- René

Greg Stasica schrieb:
> hi,
> 
> the scenario is as follow:1
> 1. class EditMyBeanAction implements Model...
> 2. url mapping calls edit method on the EditMyBeanAction
> 3. the result should be that once edit method returns (it loads MyBean
> object from the database) MyBean should be displayed on the jsp
> 
> the problem is that it seems like with hibernate it doesn't work at least
> when used as below (reassigned object addresses)
> 
> classs EditMyBeanAction  implements Model ..
> 
> private MyBean bean = new MyBean();
> 
> public MyBean getModel()
> {
> return bean;
> }
> 
> public String edit()
> {
>  MyBean mb = hibernateFacade.loadMyBeanObjectById(123);
> // bean.setName("test")- 2
> bean = mb;// 3
> return "success";
> 
> }
> 
> 
> i suspect that the problem is somewhere around proxy classes either in
> hibernate or ognl (i would rather start to look here though) because if i
> uncomment line 2 and comment out 3 i'm getting the test value on the name
> property.
> 
> surely the workaround is to:
> 1. copy properties from one object to another but again this is simply a
> waste of memory :)
> 2. get the MyBean object in getModel() method but i don't think this method
> should do any dao/business operations
> 

-- 
René Gielen
http://twitter.com/rgielen

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



Re: CRUD with a OneToMany association under Struts 2 / Hibernate 3

2010-04-01 Thread Rene Gielen
Given the model you presented in the first post, your problem seems to
be that the posted values have not the correct name for the children's
form fields. The parameters names you would need are

id
name
values[0].id
values[0].name
values[1].id
values[2].name
...

for the parameters interceptor to work properly when applying the posted
values.

See here for more details:
http://struts.apache.org/2.1.8/docs/tabular-inputs.html

- René

bruno grandjean schrieb:
> Dear Rene,
> 
> Thks a lot for replying to me because I am feeling a little bit alone with
> my CRUD ;-). In fact I am trying to build a dynamic MetaCrud.
> My pb is simple: in the same jsp page I would like to update a Parent
> object
> and its Childs (values):
> 
> 
> 
>   name="name" label="Nom" />
> 
>  
>
>
> 
> 
> 
> 
> 
> From an existing Parent object with many Childs objects I can easily modify
> parent.name for instance but the collection of Child objects (values) is
> always empty in the ParentAction (saveOrUpdate() method) after submitting.
> However I can display each values[i].name in the jsp page with the correct
> value.
> So it is not an issue with Hibernate but with the jsp or ModelDriven
> interface I don't know..Do you have any idea?
> Basically I was not able to find a struts or spring documentation about
> CRUD
> & association between two entities on the same jsp page.
> best regards
> bruno
> 
> 
> 
> --
> From: "Rene Gielen" 
> Sent: Wednesday, March 31, 2010 7:12 PM
> To: "Struts Users Mailing List" 
> Subject: Re: CRUD with a OneToMany association under Struts 2 / Hibernate 3
> 
>> I'm not sure if I understand what your actual question is, nor whether
>> it is particularly Struts 2 related (rather than just Hibernate) - but
>> you might want to have a look in the CRUD demo section of the Struts 2
>> showcase application. Maybe you will also find this demo useful:
>> http://github.com/rgielen/struts2crudevolutiondemo
>>
>> - René
>>
>> bruno grandjean schrieb:
>>> Hi
>>>
>>> I am trying to implement a simple CRUD with a OneToMany association
>>> under Struts 2 / Hibernate 3.
>>> I have two entities Parent and Child:
>>>
>>> @Entity
>>> @Table(name="PARENT")
>>> public class Parent {
>>>  private Long id;
>>>  private Set values = new HashSet();
>>> ..
>>> @Entity
>>> @Table(name="CHILD")
>>> public class Child {
>>>  private Long id;
>>>  private String name;
>>> ..
>>>
>>> I can easily create, delete Parent or read the Child Set (values) but
>>> it is impossible to update Child Set.
>>> The jsp page (see below) reinit the values Set, no record after
>>> updating!
>>> Could u explain to me what's wrong?
>>>
>>> here are my code:
>>>
>>> @Entity
>>> @Table(name="PARENT")
>>> public class Parent {
>>>  private Long id;
>>>  private Set values = new HashSet();
>>>  @Id
>>>  @GeneratedValue
>>>  @Column(name="PARENT_ID")
>>>  public Long getId() {
>>>   return id;
>>>  }
>>>  public void setId(Long id) {
>>>   this.id = id;
>>>  }
>>>  @ManyToMany(fetch = FetchType.EAGER)
>>>  @JoinTable(name = "PARENT_CHILD", joinColumns = { @JoinColumn(name =
>>> "PARENT_ID") }, inverseJoinColumns = { @JoinColumn(name = "CHILD_ID") })
>>>  public Set getValues() {
>>>   return values;
>>>  }
>>>  public void setValues(Set lst) {
>>>   values = lst;
>>>  }
>>> }
>>>
>>> @Entity
>>> @Table(name="CHILD")
>>> public class Child {
>>>  private Long id;
>>>  private String name;
>>>  @Id
>>>  @GeneratedValue
>>>  @Column(name="CHILD_ID")
>>>  public Long getId() {
>>>   return id;
>>>  }
>>>  public void setId(Long id) {
>>>   this.id = id;
>>>  }
>>>  @Column(name="NAME")
>>>  public String getName() {
>>>   return name;
>>>  }
>>>  public void setName(String val) {
>>>   name = val;
>>>  }
>>> }
>>>
>>> public interface ParentDAO {
>>>  public void saveOrUpdateParent(Parent cl);
>>>  public void saveParent(Parent cl);
>>>  

Re: CRUD with a OneToMany association under Struts 2 / Hibernate 3

2010-03-31 Thread Rene Gielen
I'm not sure if I understand what your actual question is, nor whether
it is particularly Struts 2 related (rather than just Hibernate) - but
you might want to have a look in the CRUD demo section of the Struts 2
showcase application. Maybe you will also find this demo useful:
http://github.com/rgielen/struts2crudevolutiondemo

- René

bruno grandjean schrieb:
> Hi
> 
> I am trying to implement a simple CRUD with a OneToMany association under 
> Struts 2 / Hibernate 3.
> I have two entities Parent and Child:
> 
> @Entity
> @Table(name="PARENT")
> public class Parent {
>  private Long id;
>  private Set values = new HashSet();  
> ..
> @Entity
> @Table(name="CHILD")
> public class Child {
>  private Long id; 
>  private String name; 
> ..
> 
> I can easily create, delete Parent or read the Child Set (values) but it is 
> impossible to update Child Set.
> The jsp page (see below) reinit the values Set, no record after updating!
> Could u explain to me what's wrong?
> 
> here are my code:
> 
> @Entity
> @Table(name="PARENT")
> public class Parent {
>  private Long id;
>  private Set values = new HashSet();  
>  @Id
>  @GeneratedValue
>  @Column(name="PARENT_ID") 
>  public Long getId() {
>   return id;
>  }
>  public void setId(Long id) {
>   this.id = id;
>  }
>  @ManyToMany(fetch = FetchType.EAGER)
>  @JoinTable(name = "PARENT_CHILD", joinColumns = { @JoinColumn(name = 
> "PARENT_ID") }, inverseJoinColumns = { @JoinColumn(name = "CHILD_ID") })  
>  public Set getValues() {  
>   return values;
>  }
>  public void setValues(Set lst) {
>   values = lst;  
>  }
> }
> 
> @Entity
> @Table(name="CHILD")
> public class Child {
>  private Long id; 
>  private String name; 
>  @Id
>  @GeneratedValue
>  @Column(name="CHILD_ID") 
>  public Long getId() {
>   return id;
>  }
>  public void setId(Long id) {
>   this.id = id;
>  }
>  @Column(name="NAME")
>  public String getName() {  
>   return name;
>  }
>  public void setName(String val) {
>   name = val;
>  } 
> }
> 
> public interface ParentDAO {
>  public void saveOrUpdateParent(Parent cl);
>  public void saveParent(Parent cl);
>  public List listParent();
>  public Parent listParentById(Long clId);
>  public void deleteParent(Long clId);
> }
> 
> public class ParentDAOImpl implements ParentDAO {
>  @SessionTarget
>  Session session;
>  @TransactionTarget
>  Transaction transaction;
> 
>  @Override
>  public void saveOrUpdateParent(Parent cl) {  
>   try {
>session.saveOrUpdate(cl);
>   } catch (Exception e) {
>transaction.rollback(); 
>e.printStackTrace();
>   }
>  }
> 
>  @Override
>  public void saveParent(Parent cl) {
>   try {
>session.save(cl);
>   } catch (Exception e) {
>transaction.rollback();
>e.printStackTrace();
>   }
>  }
>  
>  @Override
>  public void deleteParent(Long clId) {
>   try {
>Parent cl = (Parent) session.get(Parent.class, clId);
>session.delete(cl);
>   } catch (Exception e) {
>transaction.rollback();
>e.printStackTrace();
>   } 
>  }
>  
>  @SuppressWarnings("unchecked")
>  @Override
>  public List listParent() {
>   List courses = null;
>   try {
>courses = session.createQuery("from Parent").list();
>} catch (Exception e) {
>e.printStackTrace();
>   }
>   return courses;
>  }
> 
>  @Override
>  public Parent listParentById(Long clId) {
>   Parent cl = null;
>   try {
>cl = (Parent) session.get(Parent.class, clId);
>   } catch (Exception e) {
>e.printStackTrace();
>   }
>   return cl;
>  }
> }
> 
> public class ParentAction  extends ActionSupport implements 
> ModelDriven {
> 
>  private static final long serialVersionUID = -2662966220408285700L;
>  private Parent cl = new Parent();
>  private List clList = new ArrayList(); 
>  private ParentDAO clDAO = new ParentDAOImpl();
>  
>  @Override
>  public Parent getModel() {
>   return cl;
>  }
>  
>  public String saveOrUpdate()
>  {
>   clDAO.saveOrUpdateParent(cl);  
>   return SUCCESS;
>  }
> 
>  public String save()
>  {  
>   clDAO.saveParent(cl);  
>   return SUCCESS;
>  }
> 
>  public String list()
>  {
>   clList = clDAO.listParent();
>   return SUCCESS;
>  }
>  
>  public String delete()
>  {
>   HttpServletRequest request = (HttpServletRequest) 
> ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
>   clDAO.deleteParent(Long.parseLong(request.getParameter("id")));
>   return SUCCESS;
>  }
> 
>  public String edit()
>  {
>   HttpServletRequest request = (HttpServletRequest) 
> ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
>   cl = clDAO.listParentById(Long.parseLong(request.getParameter("id")));
>   return SUCCESS;
>  }
>  
>  public Parent getParent() {
>   return cl;
>  }
> 
>  public void setParent(Parent cl) {
>   this.cl = cl;
>  }
> 
>  public List getParentList() {
>   return clList;
>  }
> 
>  public void setParentList(List clList) {
>   this.clList = clList;
>  }
> }
> 
> and finally the jsp page:
> 
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
>  p

Re: textfield with Date object

2010-03-31 Thread Rene Gielen
The same problem as with any localized web app. Typical Struts 2
solution to explicitly switch the locale context:

Switch to German Locale

The value will remain throughout the session. Still would not parse the
date manually in the action then.

- René

Greg Lindholm schrieb:
> Don't get me wrong, I think Struts does the best it can, the problem
> is many developers who have never written an I18N app seem to expect
> it to "just work" auto-magically and it doesn't.
> One of the issues is the only "automatic" handling relies on the
> browsers "accept-language" header.
> An experience shows that you just cannot rely on the accept-language
> header always being present or set correctly.
> 
> The developer may put a field on the screen and ask the user to enter
> a date yet the application may have no idea what locale that user is
> in and thus no idea what properly formatted date should look like.
> 
> The best approach for getting a date from the user (if you can't use a
> javascript control) is to always specify the format you are expecting.
> 
> "Enter start date (mm/dd/): [   ]"
> 
> You can adjust the prompt based on the locale you "think" the user is
> in. So if you think the user is in Canada your en_CA bundle can
> specify the prompt like this:
> 
> "Enter start date (dd/mm/): [   ]"
> 
> My main point is the developer needs to manage the Locale and let the
> user know what is expected and that struts will not handle it
> automatically.
> 
> 
> On Wed, Mar 31, 2010 at 7:21 AM, Rene Gielen  wrote:
>> Hi,
>>
>> (copied from an earlier thread on numbers)
>>
>> see
>> http://struts.apache.org/2.1.8.1/docs/formatting-dates-and-numbers.html
>>
>> It is important to know that Struts 2 has always a locale context
>> request for each request, which affects both formating and parsing dates
>> and numbers. The request locale is determined as follows:
>>
>> 1. Request parameter
>> (http://struts.apache.org/2.1.8/docs/i18n-interceptor.html)
>> 2. Session attribute
>> (http://struts.apache.org/2.1.8/docs/i18n-interceptor.html)
>> 3. Browser preference
>> 4. Server side JVM default
>>
>> The first matching lookup wins.
>>
>> The type conversion mechanism tries to parse dates and numbers in the
>> current locale context, thus you should be fine when you ensure that you
>> have a consistent locale request setting both for the first request
>> (rendering the form and the current value in the textfield) and the
>> second request (processing the submitted form).
>>
>> - René
>>
>> Wick, Dan schrieb:
>>> I accept your answer, but Struts2 should just handle this! :-(
>>>
>>> I guess I'll write a number of helper methods like you did.
>>>
>>>> -Original Message-
>>>> From: Greg Lindholm [mailto:greg.lindh...@gmail.com]
>>>> Sent: Tuesday, March 30, 2010 10:14 AM
>>>> To: Struts Users Mailing List
>>>> Subject: Re: textfield with Date object
>>>>
>>>> (Seems like I just answered this question... but here it is again this
>>>> time for Dates)
>>>>
>>>> In my experience it's better to define number (and time) input fields
>>>> as String and perform the conversion and validation in your action
>>>> using java.text.NumberFormat (and java.text.DateFormat).  This puts
>>>> you in control of the
>>>> process and let's you handle I18N issues that way you want to without
>>>> fighting Struts.
>>>>
>>>> I typically have a couple of helper methods I put into the base Action
>>>> class that simplify getting the users Locale and DateFormat.
>>>> Depending on the app the users Locale may come from a Login object or
>>>> the browser request (which Struts can retrieve) or from a cookie.
>>>>
>>>> On Tue, Mar 30, 2010 at 10:34 AM, Wick, Dan 
>>>> wrote:
>>>>> Does anyone know how to change the format of dates coming in on a
>>>> text input being backed by a java.util.Date in the Action?  If I enter
>>>> dates in US format (ex: 3/31/2010 for March 31, 2010) everything is
>>>> fine.  This requires a different style input though, using
>>>> Day/Month/Year (31/3/2010).  I suppose I could take in a string & parse
>>>> it for a date myself, but I'm wondering if there's a Right way to do
>>>> it.
>>&

Re: textfield with Date object

2010-03-31 Thread Rene Gielen
Hi,

(copied from an earlier thread on numbers)

see
http://struts.apache.org/2.1.8.1/docs/formatting-dates-and-numbers.html

It is important to know that Struts 2 has always a locale context
request for each request, which affects both formating and parsing dates
and numbers. The request locale is determined as follows:

1. Request parameter
(http://struts.apache.org/2.1.8/docs/i18n-interceptor.html)
2. Session attribute
(http://struts.apache.org/2.1.8/docs/i18n-interceptor.html)
3. Browser preference
4. Server side JVM default

The first matching lookup wins.

The type conversion mechanism tries to parse dates and numbers in the
current locale context, thus you should be fine when you ensure that you
have a consistent locale request setting both for the first request
(rendering the form and the current value in the textfield) and the
second request (processing the submitted form).

- René

Wick, Dan schrieb:
> I accept your answer, but Struts2 should just handle this! :-(
> 
> I guess I'll write a number of helper methods like you did.
> 
>> -Original Message-
>> From: Greg Lindholm [mailto:greg.lindh...@gmail.com]
>> Sent: Tuesday, March 30, 2010 10:14 AM
>> To: Struts Users Mailing List
>> Subject: Re: textfield with Date object
>>
>> (Seems like I just answered this question... but here it is again this
>> time for Dates)
>>
>> In my experience it's better to define number (and time) input fields
>> as String and perform the conversion and validation in your action
>> using java.text.NumberFormat (and java.text.DateFormat).  This puts
>> you in control of the
>> process and let's you handle I18N issues that way you want to without
>> fighting Struts.
>>
>> I typically have a couple of helper methods I put into the base Action
>> class that simplify getting the users Locale and DateFormat.
>> Depending on the app the users Locale may come from a Login object or
>> the browser request (which Struts can retrieve) or from a cookie.
>>
>> On Tue, Mar 30, 2010 at 10:34 AM, Wick, Dan 
>> wrote:
>>> Does anyone know how to change the format of dates coming in on a
>> text input being backed by a java.util.Date in the Action?  If I enter
>> dates in US format (ex: 3/31/2010 for March 31, 2010) everything is
>> fine.  This requires a different style input though, using
>> Day/Month/Year (31/3/2010).  I suppose I could take in a string & parse
>> it for a date myself, but I'm wondering if there's a Right way to do
>> it.
>>> --Dan
>>>
>>> <-- Snip of jsp page -->
>>> Date Of Birth*
>>> > cssClass="staticBody" cssErrorClass="formError"/>
>>> <-- End snip of jsp page -->
>>>
>>>
>>> <-- Snip of Action -->
>>>
>>>private Date dob;
>>>public Date getDob() {
>>>return dob;
>>>}
>>>@RequiredStringValidator(message="Date of Birth is required.",
>> trim=true)
>>>public void setDob(Date dob) {
>>>this.dob = dob;
>>>}
>>> <-- End snip of Action -->
>>>
>>>
>>>
>>> -
>>> 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
>>
> 
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 

-- 
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
Cel: +49-(0)163-2844164
http://twitter.com/rgielen

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



Re: [s2] number format s:textfield tag

2010-03-31 Thread Rene Gielen
Hi,

see
http://struts.apache.org/2.1.8.1/docs/formatting-dates-and-numbers.html

It is important to know that Struts 2 has always a locale context
request for each request, which affects both formating and parsing dates
and numbers. The request locale is determined as follows:

1. Request parameter
(http://struts.apache.org/2.1.8/docs/i18n-interceptor.html)
2. Session attribute
(http://struts.apache.org/2.1.8/docs/i18n-interceptor.html)
3. Browser preference
4. Server side JVM default

The first matching lookup wins.

The type conversion mechanism tries to parse dates and numbers in the
current locale context, thus you should be fine when you ensure that you
have a consistent locale request setting both for the first request
(rendering the form and the current value in the textfield) and the
second request (processing the submitted form).

- René

Juanjo C schrieb:
> Any idea?
> 
> 2007/10/23 Pedro Herrera 
> 
>> Hi,
>>   I have a currency input field (BigDecimal). In my location the decimal
>> point is comma, eg, 10,00(==10.00) must be permitted.  Struts is throwing a
>> message error : Invalid field value for field "valor".
>>
>>
>> Thanks
>>
>> Herrera
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-s2--number-format-s%3Atextfield-tag-tf4680318.html#a13373598
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 

-- 
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
Cel: +49-(0)163-2844164
http://twitter.com/rgielen

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



Re: Preload of database data?

2009-05-22 Thread Rene Gielen
The main downside is that you will have nothing injected into your
action by the time the constructor code is executed. Also, the params
interceptor (as others placed before preparable) should not have taken
any effects when action is instantiated.
Another advantage of the prepare interceptor is the use of the
paramsPrepareParams pattern which is extremly cool for CRUD stuff

Luis Medina schrieb:
> Does anyone know which is the diference between "prepare data" using the
> Action Constructor and the prepare method?
> 
> On Thu, May 21, 2009 at 6:18 AM,  wrote:
> 
>> You can prepare data by implemeting Preparable in your action
>>
>> On Tue, May 19, 2009 at 4:48 PM, Christian Benjamin Ries <
>> christian_benjamin.r...@fh-bielefeld.de> wrote:
>>
>>> Hi there,
>>>
>>> I have a small site with some informations which are stored in a
>>> database. A method for administrations reason is added to change the
>>> content (names) of the datasets.
>>>
>>> Now, I will add these names to my navigation.
>>>
>>> I have a action like this:
>>>
>>> 
>>>   ...
>>> 
>>>
>>> This action edits the content of the bean "System".
>>>
>>> I will add this bean content to all other actions in my navigation, but
>>> I don't know the right way to solve this problem. Any suggestions?
>>>
>>> Thx!
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
> 
> 
> 

-- 
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
Cel: +49-(0)177-3194448
http://twitter.com/rgielen

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



Re: s:iterator and form submission

2009-05-07 Thread Rene Gielen

http://struts.apache.org/2.1.6/docs/tabular-inputs.html

cm132005 schrieb:


   
   
 
  

  
  
  
  




When the Edit is submitted, the aId passed in is actually a String of comma
separated aIds of all aVOs. The requirement is such that I need to use the
same form instead of having a s:form tag within the iterator. How to submit
the correct indexed value? 


Thanks.


--
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
http://twitter.com/rgielen

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



Re: @Transactional Spring Annotation in a Struts2 Action does not work

2009-05-07 Thread Rene Gielen
You should consider to have a look into the paramsPrepareParams pattern 
(see struts-default.xml for a brief description) and to write and use a 
TransactionInterceptor. The latter one gives you the same cross cutting 
TX approach you want from your @Transational annotation, but in addition 
to that it supports lazy loading of hibernate proxied properties when 
the view is rendered. Basically, this is similar to the 
OpenSessionInView Hibernate pattern.


Jeroen De Ridder schrieb:

Hi Dustin,

Yes, I do require the ability to be able to manually set transaction 
boundaries from controller code. The main reason is because Hibernate 
updates database records when a persistent object changes state during a 
transaction. It picks up on the changes made to the object when the 
transaction is committed and persists them to the database. Using the 
service layer to do that wouldn't really make sense because you would 
have to create methods for every set of changed properties you require. 
And even if you did that, you still wouldn't be able to combine the 
transaction with any other controller logic.


Basically, I try to use service layer calls as much as possible without 
an explicit transaction created in the controller if not necessary. 
Updates to persistent instances virtually always require the controller 
to start a transaction though, for the reason outlined above. So for 
example, I have a service for products which has a method to grab a 
product instance by ID. If all I need is the product instance to read 
some stuff from, I'll do:


Product p = productService.getProduct(myProductId);

Notice that I didn't create a transaction in the controller code, so the 
service method will create one for itself, and that's fine. When I 
update a product however, I'll do this:


txr.execute(new TransactionalExecution(){
   public void execute() {
Product p = productService.getProduct(myProductId);
   if(p == null) throw new MyException("No such product exists!");
p.setName(name);
   p.setPrice(price);
   p.setColor(color);
}
});

The reason here is that I need the product instance to be updated with 
my Struts 2 parameter data (name, price and color), so I need to change 
its properties during a transaction. I think you'll agree that it really 
doesn't make sense to create a service layer method updateProduct(name, 
price, color) or something like that for every possible combination of 
properties you want to change. As I mentioned before, the controller 
logic that updates the instance's properties can use arbitrary service 
layer functionality all within the same transaction, courtesy of 
propagation=REQUIRED. I think this makes for pretty clear and easy to 
understand code.


Does this answer your question?


Jeroen,

This setup is so that you can initiate and control the properties of the
transaction from the controller, if that is a pattern you require?

Do you do this for all your calls to the service layer from 
controllers, and

how is it better/different from a calling a service method annotated with
@Transactional(propagation=Propagation.REQUIRED) normally from the
controller?   Is it just so you can control the propagation 
characteristics? 
It seems like an interesting pattern, I am just wondering how it is used.


Jeroen De Ridder wrote:
 
I'll agree that a service layer alone won't cut it, simply because of 
the way JPA/Hibernate works. Updating an instance for example is just 
something that doesn't belong in a service. I'm by no means an expert 
of best practices in JPA/Hibernate and Spring, but I've found a 
combination of services and anonymous runner interface instances to 
work quite well.


Basically, the idea is that you create a bunch of services to do 
routine stuff to improve code clarity and avoid code duplication in 
your actions. You'd mark these services with propagation=REQUIRED, so 
that they can run by themselves if needed as well as run along with 
any existing transactions. For logic that needs more than a single 
call to a service, I then do something like this:


txr.execute(new TransactionalExecution(){
public void execute() {
   Foo foo = fooService.getFoo(id);
if(foo != null) throw new FooException("No such foo exists!");
   foo.setName(name);
   }
});

TransactionalExecution is just an interface with a single method 
execute() that exists just so we can create anonymous instances of it 
to pass to txr, which would be an instance of 
TransactionalExecutionRunner:


public class JpaSpringTransactionalExecutionRunner implements 
TransactionalExecutionRunner {

   @Transactional(propagation=Propagation.REQUIRED)
public void execute(TransactionalExecution t) {
t.execute();
}
   @Transactional(propagation=Propagation.REQUIRES_NEW)
public void executeRequiresNew(TransactionalExecution t) {
t.execute();
}
   @Transactional(propagation=

Re: Date/time formatting

2009-05-07 Thread Rene Gielen

http://struts.apache.org/2.1.6/docs/formatting-dates-and-numbers.html

Jon Pearson schrieb:

Right, but I don't want to specify the format explicitely, since it should 
depend on the localization of the browser. But when I don't specify it, I don't 
get the time included in the output. Is there a way to get both?
 


-Original Message-
From: Martin Gainty [mailto:mgai...@hotmail.com] 
Sent: Wednesday, May 06, 2009 2:20 PM

To: Struts Users Mailing List
Subject: RE: Date/time formatting


you can also use the Struts date tag
<%...@taglib prefix="s" uri="/struts-tags" %> name="person.birthday" format="dd/MM/" /> if no format is 
specified format defaults to DateFormat.MEDIUM (in US = MMM 
d, )http://struts.apache.org/2.0.14/docs/date.html


HTH
Martin
__
Disclaimer and Confidentiality/Verzicht und 
Vertraulichkeitanmerkung/Note de déni et de confidentialité 
This message is confidential. If you should not be the 
intended receiver, then we ask politely to report. Each 
unauthorized forwarding or manufacturing of a copy is 
inadmissible. This message serves only for the exchange of 
information and has no legal binding effect. Due to the easy 
manipulation of emails we cannot take responsibility over the 
the contents.
Diese Nachricht ist vertraulich. Sollten Sie nicht der 
vorgesehene Empfaenger sein, so bitten wir hoeflich um eine 
Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer 
Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche 
Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von 
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous 
n'êtes pas le destinataire prévu, nous te demandons avec 
bonté que pour satisfaire informez l'expéditeur. N'importe 
quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et 
n'aura pas n'importe quel effet légalement obligatoire. Étant 
donné que les email peuvent facilement être sujets à la 
manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.






Date: Wed, 6 May 2009 14:04:33 -0400
From: terry.gard...@sun.com
Subject: Re: Date/time formatting
To: user@struts.apache.org

java.text.SimpleDateFormat formats a java.util.Date according to a 
locale and a patter specified by the client.


On May 6, 2009, at 1:10 PM, Jon Pearson wrote:

If I wanted to output a date/time value in the user's locale, is 
there a simple way to do that? I see there is a  tag which 
would be helpful for getting the date format correct without 
manually specifying it, but what about a similar  tag? Am I 
going to need to manually specify the standard date 
format as "M/D/y 
h/mm/ss a" for US English, and just require any translation to 
specify its own?


Thanks,
~Jonathan





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


_
Hotmail® has ever-growing storage! Don't worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM
_WL_HM_Tutorial_Storage1_052009



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



--
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
http://twitter.com/rgielen

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



Re: IllegalArgumentException using struts2-convention-plugin-2.1.6.jar on JBoss

2009-05-07 Thread Rene Gielen
Filed https://issues.apache.org/struts/browse/WW-3121
Added better error message with hint to disable class reloading.

Correct fix needs addtional XWork work, will check tomorrow.

Musachy Barroso schrieb:
> to add to what Lukasz said, don't rely too much on the reloading class
> loader which is experimental, there is a flag to disable it, check the
> docs.
> 
> musachy
> 
> On Thu, May 7, 2009 at 8:42 AM, Lukasz Lenart
>  wrote:
>> Could you try to use the latest snapshot build?
>> http://people.apache.org/builds/struts/nightlies/2.x/
>>
>> If that doesn't help, please register an issue with Jira, JBoss 5
>> introduced new virtual file system and that the origin of problems
>> https://issues.apache.org/struts/browse/
>>
>>
>> Regards
>> --
>> Lukasz
>> http://www.lenart.org.pl/
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> 
> 

-- 
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
Cel: +49-(0)177-3194448
http://twitter.com/rgielen

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



Who's going to Devoxx conference, Antwerp?

2008-12-02 Thread Rene Gielen
Probably the biggest European Java conference, Devoxx (formerly known as 
Javapolis) is happening next week in Antwerp, Belgium.


At least two Struts2 developers, namely Rainer Hermanns and me, will be 
attending. Are any Struts2 users also attending? If yes, how about 
scheduling an informal get-together besides the conference?


Regards,
- Rene

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



[ANN] Struts 2.0.14 GA release available

2008-11-24 Thread Rene Gielen

The Apache Struts group is pleased to announce that Struts 2.0.14 is
available as a "General Availability" release. The GA designation is our
highest quality grade.

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

This release is a bugfix release for version 2.0.12, which provided
important security fixes. Struts 2.0.14 addresses two major bugs
introduced with these security fixes, keeping the FilterDispatcher from
serving built in static resources, and keeping conversion error messages
from being displayed.

All developers are strongly encouraged to update existing Struts 2
applications to Struts 2.0.14.

Struts 2.0.14 is available in a full distribution, or as separate library,
source, example and documentation distributions, from the releases page:

* http://struts.apache.org/download.cgi#struts2014

The release is also available through the central Maven repository under
Group ID "org.apache.struts". The release notes are available online:

* http://struts.apache.org/2.0.14/docs/release-notes-2014.html

The 2.0.x series of the Apache Struts framework has a minimum requirement
of the following specification versions: Servlet API 2.4, JSP API 2.0,
Java 5, Backported Java 4 JARs are also available.

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket:

* https://issues.apache.org/struts/secure/Dashboard.jspa

-- The Apache Struts group.



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



Re: s:datetimepicker doesn' t work after upgraded to struts2.0.12

2008-11-02 Thread Rene Gielen
Due to a lack of internet connection, Rainer will not be able to do a 
xwork release before monday. As soon as we have it out, a 2.0.14 build 
will follow.


Musachy Barroso schrieb:

We don't have a full 2.0.14 build yet, we will provide a snapshot of
xwork(or you can build it yourself, it is not hard), and you can just drop
the jar in your app. Rene, any news on the snapshot?

regards
musachy

On Fri, Oct 31, 2008 at 3:13 AM, <[EMAIL PROTECTED]> wrote:


The only testing I can do is to use 2.0.14 with my application.
I am a beginner in the matter of struts.
Where to get the complete version of 2.0.14?




-Ursprüngliche Nachricht-
Von: Musachy Barroso [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 30. Oktober 2008 15:20
An: Struts Users Mailing List
Betreff: Re: s:datetimepicker doesn' t work after upgraded to
struts2.0.12

We are trying to get people to test the latest xwork before releasing
2.0.14, if you could try it would help.

regards
musachy

On Thu, Oct 30, 2008 at 9:43 AM, <[EMAIL PROTECTED]> wrote:


Thanks for information.

A Bug in 2.0.12 and I was working on a solution for hours.
Stuff it!

Is there the possibility to download a complete 2.0.13

version of struts?




-Ursprüngliche Nachricht-
Von: Nils-Helge Garli Hegvik [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 30. Oktober 2008 13:46
An: Struts Users Mailing List
Betreff: Re: s:datetimepicker doesn' t work after upgraded to
struts2.0.12

It might be related to this issue:
https://issues.apache.org/struts/browse/WW-2849

Nils-H

On Thu, Oct 30, 2008 at 1:20 PM,  <[EMAIL PROTECTED]> wrote:

Hello,

I am using the s:datetimepicker in struts 2.0.11.2.
After updating to version 2.0.12 I got the error "dojo

not defined".

Is there someting different in the new version.
Or, perhaps a bug?

Does anybody have the same problem?




-

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]




--
"Hey you! Would you help me to carry the stone?" Pink Floyd


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







--
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
Cel: +49-(0)177-3194448

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



Re: Struts 2.0.12 - XML Validation with Websphere 6.1

2008-10-29 Thread Rene Gielen

The release notes at
http://cwiki.apache.org/confluence/display/WW/Release+Notes+2.0.12
point to the closed issues for that release:
https://issues.apache.org/struts/secure/ReleaseNote.jspa?projectId=10030&styleName=Html&version=21870

The issue you are looking for is
https://issues.apache.org/struts/browse/WW-2709

Struts Developer schrieb:

There was a know issue with struts 2.0.11.2 that the integrated XWork 2.0.5
jar may cause problems when used in a combination of WebSphere 6.1 runtime
environments with validation configuration via XML file.

Is this fixed with struts 2.0.12?. I do not see any information on the
apache website.




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



Re: struts 2.0.14

2008-10-29 Thread Rene Gielen

David,

the latest problem with conversion errors not being copied to the safe 
stack is fixed in xwork svn, and we need it to be released before we 
could promote a 2.0.14 build.


For now, you could check out the current xwork 2.0.x branch and build a 
jar which you could use as a drop in replacement for the xwork 2.0.6 jar 
 provided with the 2.0.13 test build.


We're working on a solution to get a full release out, but any feedback 
from users whether our problems are fixed with the current codebase 
would be really helpful!


Sorry for the inconvenience,
Rene

David Harland schrieb:

Hi,

Is there any chance of getting a 2.0.14 build please.

Thanks

Dave.


  


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



[ANN] Struts 2.0.12 GA release available

2008-10-22 Thread Rene Gielen
The Apache Struts group is pleased to announce that Struts 2.0.12 is
available as a "General Availability" release. The GA designation is our
highest quality grade.

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

This release includes a number of bug fixes since the 2.0.11.2 GA release,
including important security fixes regarding remote server context
manipulation by injecting OGNL expressions in request parameters and
possible server filesystem resources read access in certain application
server environments. For more information about the exploits, see the
corresponding security bulletins S2-003 and S2-004:

* http://struts.apache.org/2.0.12/docs/s2-003.html
* http://struts.apache.org/2.0.12/docs/s2-004.html

All developers are strongly advised to update existing Struts 2
applications to Struts 2.0.12.

Struts 2.0.12 is available in a full distribution, or as separate library,
source, example and documentation distributions, from the releases page:

* http://struts.apache.org/download.cgi#struts2012

The release is also available through the central Maven repository under
Group ID "org.apache.struts". The release notes are available online:

* http://struts.apache.org/2.0.12/docs/release-notes-2012.html

The 2.0.x series of the Apache Struts framework has a minimum requirement
of the following specification versions: Servlet API 2.4, JSP API 2.0,
Java 5, Backported Java 4 JARs are also available.

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket:

* https://issues.apache.org/struts/secure/Dashboard.jspa

-- The Apache Struts group.


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



[ANN] Struts 2.0.11.2 General Availability Release with Important Security Fix

2008-07-15 Thread Rene Gielen
Apache Struts 2.0.11.2 is now available from
.

This release is a fast track security fix release, including a security
fixed version 2.0.5 of XWork, which corrects a serious vulnerability in
ParametersInterceptor allowing malicious users to remotely change server
side context objects. For more information about the exploit, visit our
security bulletins page at
.

IMPORTANT ADDITIONAL NOTES:
There are two known issues with this release:
1. the integrated XWork 2.0.5 jar may cause problems when used in a
combination of WebSphere 6.1 runtime environments with validation
configuration via XML files.
Possible Workarounds:
- use annotation based validation definition instead XML based
- stay with Struts 2.0.11.1 including XWork 2.0.4, applying the
  following exclude rule to your parameter interceptor refs in
  struts.xml
  
  .*[[^\\p{Graph}][#:=]].*
  
2. the filtering mechanism implemeted in XWork's ParametersInterceptor
to fix the described security issue does not completely avoid any
possible malicious parameter name.
Possible Workaround:
- apply the following exclude rule to your parameter interceptor refs in
  struts.xml to avoid the usage of backslash characters in parameter
  names
  
  .*\\.*
  
Both issues will be addressed in a soon upcoming XWork 2.0.6 release,
followed by a new Struts 2.0 GA release including this new XWork version.

* All developers are advised to either update Struts 2 applications to
Struts 2.0.11.2 or manually exchange usages of xwork-2.0.x.jar with the
fixed xwork-2.0.5.jar to prevent remotety induced context manipulations.

For the complete release notes for Struts 2.0.11.2, see
.


- The Apache Struts Team.





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



Re: Advice on dynamic form elements

2008-04-14 Thread Rene Gielen

You could also think of using a component, which would help to avoid writing
a tag with tld generation and all that:
http://struts.apache.org/2.0.11.1/docs/component.html


Sparecreative wrote:
> 
> Thanks Laurie,
> 
> I actually thought of a tag file but thought it might be the lazy way out.
> We actually use them extensively for dropping in html components.
> 
> I feel a lot better now.
> 
> Thanks
> 
> Z.
>> 
>> Zoran Avtarovski wrote:
>>> > Hi,
>>> > 
>>> > We porting/upgrading a relatively simple survey tool over to struts2
>>> from
>>> an
>>> > old php version.
>>> > 
>>> > The tool manages questions which can one of a fixed type (radio, drop,
>>> > checkbox, text) and then persists responses to DB.
>>> > Where I need some advice is how to implement the struts 2 display
>>> mechanism..
>>> > 
>>> > I figure there are two options:
>>> > 
>>> > 1. Write a custom tag which takes the question as an attribute.
>>> Something
>>> > like 
>> 
>> Well, it wouldn't be s:question unless you're planning on modifying the
>> Struts taglib ;=) but a custom tag would be one way to do this. Using a
>> .tag file might be the easiest, depending how complex your rendering
>> logic is.
>> 
>>> > 2. I could have a small jsp fragment that I would include to render
>>> the
>>> > appropriate html.
>>> > 
>>> > I figured I¹d do something like :
>>> > 
>>> > 
>>> > 
>>> > 
>>> > 
>>> > 
>> 
>> The tag-based solution is obviously more concise to use, although the
>> s:push is unnecessary here (s:iterator pushes the value automatically).
>> 
>>> > And pagefragment.jspf would have some logic and use the appropriate
>>> form
>>> > tags to render the HTML.
>> 
>> If you can express what you want to do in a JSP, it should be trivial to
>> do it in a .tag file, which would give you the more concise usage.
>> Otherwise, a custom tag may be worth it.
>> 
>> L.
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Advice-on-dynamic-form-elements-tp16603555p16674012.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: S2 Textfield tag date formatting

2008-04-11 Thread Rene Gielen
As a followup to my own posting: Sorry for not reading properly, of
course your problem does not really relate to output formatting.

Guillaume is right here IMO, for a fixed Date format a custom
TypeConverter should be the way to go, as long as the datepicker does
not work for you.

Regards,
Rene

Rene Gielen schrieb:
> You might want to read here:
> http://struts.apache.org/2.x/docs/formatting-dates-and-numbers.html
> 
> Cheers,
> Rene
> 
> 
> akinss wrote:
>> I'm trying to use a textfield tag for date input.  I need to format this
>> in
>> the form dd/MM/ HH:mm:ss
>>
>> The teaxtfield tag formats the date to a Locale based format
>> DateFormat.SHORT  via XWorkBasicConverter.  For my locale this turns out
>> to
>> be dd/MM/yy. This is not the format I want.
>>
>> > name="filter.dateTimeStart"/>
>>
>> DateTimePicker wont allow you to apply a style class to the input field so
>> it wont format.  Bug has been reported in Struts JIRA (WW-1778) and a fix
>> made.  Need to wait for Struts 2.1 before this will work so I can't use
>> this.
>>
>> Using the value parameter and a date tag won't work because this
>> overwrites
>> the value entered.  If the user enters a value that can't be converted to
>> a
>> date it isn't re-displayed, the field is displayed empty.
>>
>> > name="filter.dateTimeStart">
>>   
>> 
>>   
>> 
>>
>> In the S2 guide for Type Conversion (
>> http://struts.apache.org/2.x/docs/type-conversion.html) it has a note
>> saying
>> not to use Type Conversion for dates.
>>
>> Does anyone know of a way to do this?
>>
>>
>> Thanks in advance.
>>
>>
> 

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



Re: S2 Textfield tag date formatting

2008-04-11 Thread Rene Gielen

You might want to read here:
http://struts.apache.org/2.x/docs/formatting-dates-and-numbers.html

Cheers,
Rene


akinss wrote:
> 
> I'm trying to use a textfield tag for date input.  I need to format this
> in
> the form dd/MM/ HH:mm:ss
> 
> The teaxtfield tag formats the date to a Locale based format
> DateFormat.SHORT  via XWorkBasicConverter.  For my locale this turns out
> to
> be dd/MM/yy. This is not the format I want.
> 
>  name="filter.dateTimeStart"/>
> 
> DateTimePicker wont allow you to apply a style class to the input field so
> it wont format.  Bug has been reported in Struts JIRA (WW-1778) and a fix
> made.  Need to wait for Struts 2.1 before this will work so I can't use
> this.
> 
> Using the value parameter and a date tag won't work because this
> overwrites
> the value entered.  If the user enters a value that can't be converted to
> a
> date it isn't re-displayed, the field is displayed empty.
> 
>  name="filter.dateTimeStart">
>   
> 
>   
> 
> 
> In the S2 guide for Type Conversion (
> http://struts.apache.org/2.x/docs/type-conversion.html) it has a note
> saying
> not to use Type Conversion for dates.
> 
> Does anyone know of a way to do this?
> 
> 
> Thanks in advance.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/S2-Textfield-tag-date-formatting-tp16600189p16627894.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



[ANN] Struts 2.0.11.1 General Availability Release with Important Security Fix

2008-03-05 Thread Rene Gielen
Apache Struts 2.0.11.1 is now available from
.

This release is a fast track security fix release, including important
security fixes regarding possible cross site scripting exploits when
using the  or  Struts 2 tags. For more information about the
exploits, visit our security bulletins page at
.

* All developers are strongly advised to update Struts 2 applications to
Struts 2.0.11.1 to prevent cross site scripting attacks through Struts 2
tags.

For the complete release notes for Struts 2.0.11.1, see
.


- The Apache Struts Team.

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



Re: ognl, url and text

2007-08-23 Thread Rene Gielen

should do the trick.

J&M schrieb:
> Greetings,
> 
> I want to get the text of an url from a resource bundle. I have the
> following test snippet from a jsp:
> 
> 
> 
>  
> test: 
> test: 
> 
> 
> What I get on the output is something like this:
> 
> 1. test:
> 2. test: /images/en/flash/intro.swf
> 
> Can anyone explain why the first version does not work? I get the basic idea
> from
> http://struts.apache.org/2.0.9/docs/i18n.html
> 
> Cheers

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



Re: problems about

2007-08-23 Thread Rene Gielen
Try to provide an id for the  tag

Andvar Woo schrieb:
> When I try to use  ,it does not work.
> below is a segment of the exception thrown
> Expression parameters.formName is undefined on line 76, column 43 in
> template/simple/doubleselect.ftl.
> The problematic instruction:
> --
> ==> ${parameters.formName} [on line 76, column 41 in
> template/simple/doubleselect.ftl]
>  in include "/${parameters.templateDir}/simple/doubleselect.ftl" [on line 3,
> column 1 in template/xhtml/doubleselect.ftl]
> --
> 
> Java backtrace for programmers:
> --
> freemarker.core.InvalidReferenceException: Expression parameters.formName is
> undefined on line 76, column 43 in template/simple/doubleselect.ftl.
>  at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
>  at freemarker.core.Expression.getStringValue(Expression.java:118)
>  at freemarker.core.Expression.getStringValue(Expression.java:93)
>  at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
>  at freemarker.core.Environment.visit(Environment.java:196)
>  at freemarker.core.MixedContent.accept(MixedContent.java:92)
> below is the complete code.I use doubleselect.action to test the page,
> doubleselect.jsp is also tested,both donot work.
> 
> <%@ page pageEncoding="utf-8" %>
> <%@ page contentType="text/html;charset=utf-8" %>
> <%request.setCharacterEncoding("utf-8"); %>
> <%@ taglib prefix="s" uri="/struts-tags" %>
> 
>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>   http://www.w3.org/1999/xhtml";>
>   
>   Struts 2 Cool Tags - 
>   
>   
>   
>   
>   
>  value="# {'Java': {'Spring', 'Hibernate', 'Struts 2'}, '.Net': {'Linq', '
> ASP.NET 2.0'}, 'Database': {'Oracle', 'SQL Server', 'DB2', 'MySQL'}}" />
>doubleName="technology"
>doubleList="#foobar[top]"
>label="Technology" />
>
>
>
> 

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



Re: [S2] 2 Select Boxes, one based on the other

2007-08-17 Thread Rene Gielen
The doubleselect tag provides easy to use encapsulation of your usecase,
with binding to the s2 based model. But in the very end, it's use will
render javascript code in the resulting html, and there is no way around
 because of how html / http is designed.

Skip Hollowell schrieb:
> Rene,
> 
> It sounds you are are saying that there IS a way, using this
>   Correct?
> 
> Rene Gielen wrote:
>> Indeed there is no way without Javascript. The s2 tag Skip is searching
>> for is
>> http://cwiki.apache.org/confluence/display/WW/doubleselect
>>
>> Zoran Avtarovski schrieb:
>> > Any solution has to be javascript based. The question is wether you
>> want a
>> > server side visit or not. And that is dependant on how much data
>> variability
>> > there is in your second select list.
>> >
>> > In our case if there are only a limited number of variations we
>> download
>> > them all as part of the initial page and use pure javascript, but if
>> there
>> > lots then we employ a simple ajax call.
>> >
>> > Z.
>> >
>> >> I apologize profusely for what has got to be a FAQ, but I can't find
>> >> reference to this at all, either Googling or in my message archives.
>> >>
>> >> I have the classic problem of 2 select boxes, and the values of the
>> >> second select will change based upon the choice in the first box.
>>  I am
>> >> using a simple theme at the present time, and have no immediate
>> plans to
>> >> move to anything AJAX related for this release.
>> >>
>> >> I have seen ComboBox and AutoComplete, but these don't seem to come
>> >> close to what is needed.  IS there a Struts 2 based way to do this, or
>> >> am I back to JavaScript?
>> >> 
> 
> 
> 
> -
> 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: [S2] 2 Select Boxes, one based on the other

2007-08-16 Thread Rene Gielen
Indeed there is no way without Javascript. The s2 tag Skip is searching 
for is

http://cwiki.apache.org/confluence/display/WW/doubleselect

Zoran Avtarovski schrieb:

Any solution has to be javascript based. The question is wether you want a
server side visit or not. And that is dependant on how much data variability
there is in your second select list.

In our case if there are only a limited number of variations we download
them all as part of the initial page and use pure javascript, but if there
lots then we employ a simple ajax call.

Z.


I apologize profusely for what has got to be a FAQ, but I can't find
reference to this at all, either Googling or in my message archives.

I have the classic problem of 2 select boxes, and the values of the
second select will change based upon the choice in the first box.  I am
using a simple theme at the present time, and have no immediate plans to
move to anything AJAX related for this release.

I have seen ComboBox and AutoComplete, but these don't seem to come
close to what is needed.  IS there a Struts 2 based way to do this, or
am I back to JavaScript?

Thanks for any help, and again, I very much apologize for posting what
must be a very basic question.

Skip Hollowell


-
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: Extension mapping question

2007-08-16 Thread Rene Gielen

You might want to read here:

http://cwiki.apache.org/confluence/display/WW/RestfulActionMapper
http://cwiki.apache.org/confluence/display/WW/Zero+Configuration
http://cwiki.apache.org/confluence/display/WW/Codebehind+Plugin

Brian Mc schrieb:

I want to be able to send this URL:

www.mysite.com/list/3

Which calls the list action, and can use 3 as a parameter

Also, how do I make this URL: 


www.mysite.com/name/

goto the name.jsp

Thanks I'm using struts 2.0.9 and jBoss 4.2.0




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



Re: popping messages from an action

2007-08-05 Thread Rene Gielen

Session,

your question is not very much related to struts in the first place, but 
more to understanding web technologies such as html, http and 
javascript. The brief answer to your question is: yes, it works, but it 
is a bit complicated due to the http request/response system and usually 
introduces the need to write some javascript code.
How about starting more simple at first? Use the struts2 form elements 
along with validation, and see how the information for bad input is 
rendered automatically within the form after validation process, at next 
to no costs in terms of having to program lots of js/html magic.


Regards,
Rene

Session A Mwamufiya schrieb:

Hi,

I know that I've sent many questions today, so please bear with me once more.  
I'd like to have my action popup a message to the user if a submit button is 
pressed and the entered data is incorrect.  Is that possible?  Or if not from 
struts 2, is there a way for struts 2 to execute html code from within an 
action (which I could code to have a message box popup).

Thanks,
Session


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




--
Rene Gielen  | http://it-neering.net/
Aachen   | PGP-ID: BECB785A
Germany  | gielen at it-neering.net

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



Re: obtaining a user selection, please help

2007-08-05 Thread Rene Gielen

Session,

please make sure your read (at least) the following chapters carefully:
http://struts.apache.org/2.x/docs/crud-demo-i.html
http://struts.apache.org/2.x/docs/type-conversion.html

After that, it would be quite good to have a look into the showcase app 
distributed with struts2. Most of your usage questions should be covered 
there, with handy and easy to understand examples.


Regards,
Rene

Session A Mwamufiya schrieb:

Hi,

I've posted a number of times regarding this subject, but have not gotten a 
reply.  I would think that others have used s:select before and know how to 
obtain a user's selection in data.  Please help, because I have been stuck for 
a number of hours now.

Thanks,
Session


-
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: Locale - make available to JSP

2007-08-02 Thread Rene Gielen
Could it be that you are looking for I18nInterceptor?

http://struts.apache.org/2.x/docs/i18n-interceptor.html

Ray Clough schrieb:
> The first page of my app is a Login page.  Every other page is correctly
> localized, because the app gets the user's preferred locale from a DB, and
> Struts handles it, but until they have logged in the DB is not available.  I
> want it to be localized from cookies.  I created a filter which intercepts
> the requests, gets the cookie from the request, and creates a Locale object
> for that language.  The cookie was stored when the user selected a Locale in
> a previous session.  The question is, where do I store this locale so that
> it is available to the login page.  I looked into the source code for the
> ActionContext class, LocaleProvider class, etc, and it seems like this code
> should work, but it doesn't:   
> ActionContext.getContext().put(ActionContext.LOCALE, locale);
> 
> Any help or advise will be greatly appreciated.
> 
> Thank you,
> Ray Clough
> 

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



Re: [S2] Design Advice Needed

2007-08-02 Thread Rene Gielen
You should definitely have a look into the struts2-jasperreports-plugin
- both for checking out how to write own results and evaluating if you
might want to use jasper over FOP, since full s2 result support is
already available for jasper.

The plugin is part of the struts2 source distribution.

Regards,
Rene

Hoying, Ken schrieb:
> I could use some advice from some folks with more experience and
> knowledge of Struts2 than I to assist me in determining the correct way
> (or lay out some viable options) to design a solution for the following
> senario:
> 
> We need to generate a PDF report real time based on data in a database
> that is available for download.  What we believe that we would like to
> do is utilize FOP (http://xmlgraphics.apache.org/fop/) and use a JSP
> page to actually generate the formatting objects and then run the
> formatting objects through the FOP processor to generate and stream the
> PDF back to the user.  
> 
> However, we are not real sure how to implement this in Struts2.  How do
> we invoke the JSP page and then get access to the results?  Do we just
> use the stream result type and then use a http call to the JSP as the
> input source?  This would seem like it would not be optimal from a
> performance standpoint, as we are making another http call to get the
> formatting objects from the jsp.  It also adds the complexity of passing
> security credentials in the call.  Or do we need to somehow create or
> own result type and if so how do we get those JSP results?  I have not
> really found any good documentation or example on writing your own
> result types.
> 
> Thanks in advance!
> 
> 
> 
> -
> ***Note:The information contained in this message may be privileged
> and confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient,
> you are hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited. If you have
> received this communication in error, please notify the Sender
> immediately by replying to the message and deleting it from your
> computer. Thank you. Premier Inc.  

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



Re: Number Validator

2007-08-02 Thread Rene Gielen
Since entering a NAN value for a number property should result in
conversion errors, you might want to checkout this:
http://cwiki.apache.org/confluence/display/WW/conversion+validator

Richard Sayre schrieb:
> Is there a way to use the XML validation to check to see if a field is
> a number?  I used integer to check for min and max but if I enter any
> text into the field it passes the validation.
> 
> Thanks,
> 
> Rich
> 
> -
> 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: [S2] Is there some BigDecimal validator and conversion routines?

2007-08-02 Thread Rene Gielen
You are right, there is no bundled BigDecimal related validator in
place, but it should be quite easy to implement (eg. extend
FieldValidatorSupport). For registering, see
http://cwiki.apache.org/confluence/display/WW/Validation

BTW, is it really validation you are searching for, or is it conversion
(or both)? Note that these are two different topics.

Regards,
Rene

Gabriel Belingueres schrieb:
> Hi,
> 
> I want to enter numeric data in my form and I want it to go into a
> BigDecimal action value, however it seems that I can't validate it
> using some "bigdecimal" validator in the *-validation.xml file.
> 
> There is a double validator, but I don't know if it will introduce
> rounding or truncation errors into my BigDecimal value.
> 
> Any ideas?
> 
> TIA,
> Gabriel
> 
> -
> 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: CSS / JavaScript menu libraries for Struts 2 Showcase application

2007-08-02 Thread Rene Gielen
I pretty much like the webfx stuff:
http://webfx.eae.net/

They recently changed their license from GPL to ASL2, so no licensing
issues here.

Note: one of my what-i-would-do-if-i-only-had-time-list point was
encapsulating the webfx menu stuff into some s2 tags...

Regards,
Rene

James Holmes schrieb:
> I'm looking into updating the Struts 2 Showcase application with a new menuing
> system so that it is easier to use. Anyone have any recommendations on 
> existing
> CSS / JavaScript libraries? The library will need to be open source and have a
> license that is "compatible" with Struts 2.
> 
> I'd like to hear what type of menu people would like to see as well. Should 
> it be
> a drop down style? Tabs?
> 
> It would probably be nice if the menu has a built-in mechanism for 
> breadcrumbs or
> at least support working with them in some way.
> 
> All feedback is helpful.
> 
> Thanks,
> 
> James
> 
> -
> 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: [s2] Developing Portlets with Eclipse tutorial available

2007-08-02 Thread Rene Gielen
Nils, I love you for that :)
It was on my wishlist for so long, but I never found the time to get
into it.

Cheers,
Rene

Nils-Helge Garli schrieb:
> I think I've managed to get all the steps written down:
> http://portletwork.blogspot.com/2007/07/mvnjetty-and-portlets.html
> 
> Also, I took a struts 2 portlet archetype project and added the
> necessary files and configurations and put it on my site for download.
> You can find the link in the blog.
> 
> Please let me know if you find any errors.
> 
> Nils-H
> 
> On 7/29/07, Don Brown <[EMAIL PROTECTED]> wrote:
>> Very cool!  That has been one of those things I keep meaning to work
>> on.  If nothing else, add the lines (commented out, of course) to our
>> portlet archetype.
>>
>> Don
>>
>> On 7/29/07, Nils-Helge Garli <[EMAIL PROTECTED]> wrote:
>>> Good tutorial, and a nice way to get started with portlet development!
>>>
>>> Maybe not entirely on topic, but inspired by your tutorial and some
>>> information I found earlier in the pluto FAQ about embedding pluto, I
>>> started playing around with making the maven-jetty-plugin work with a
>>> portlet project. The goal was to be able to start up and test my
>>> portlet just by typing "mvn jetty:run". After collecting information
>>> from various sources, and looking through the pluto-portal-driver and
>>> the pluto-portal sources, I have finally managed to run my portlet
>>> with pluto embedded in jetty, as a real portlet, avoiding the need to
>>> run it emulated as a servlet. It wasn't really that hard (just had to
>>> add a filter and a listener to the web.xml), and the overhead is
>>> hardly noticeable.
>>>
>>> I'll try to write a tutorial and/or package it as a maven plugin, but
>>> until then, if anybody is interested in the details, just let me know.
>>>
>>> Nils-H
>>>
>>> On 7/27/07, Don Brown <[EMAIL PROTECTED]> wrote:
 I wrote up a simple tutorial showing how to start developing portlets
 using Struts 2 and Eclipse.  It takes advantage of the fact that
 Struts 2 portlets can be deployed as normal web applications, the
 tutorial is more how to use a Maven 2 archetype with Eclipse, but with
 portlet-specific bits.

 I'm a newbie with Eclipse, so I'd appreciate any corrections,
 suggestions, etc.  Or better yet, submit a CLA and get write access to
 fix it yourself ;)

 http://struts.apache.org/2.x/docs/developing-a-portlet-using-eclipse.html

 Don

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

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



Re: How to keep users from accessing to *.jsp strightforword?

2007-07-14 Thread Rene Gielen
Yes. I use this for years now , works perfect

M.Liang Liu schrieb:
> Sounds good.
> My friend said that spring mvc prefer this style.
> 
> How can I deal with the *result* mapping then ?
> 
> thanks.
> 
> Rene Gielen wrote:
>> You can place your jsps in the WEB-INF directory. They will be
>> accessible for the Struts request dispatcher then, but not by direct
>> user call.
>>
>> M.Liang Liu schrieb:
>>> I just would like to block users to get to the login.jsp through the
>>> url:http://somedomain.com/login.jsp.
>>> Instead,users can login with the url
>>> :http://somedomain.com/login.action---
>>> actually the login.jsp page.
>>>
>>> With the help of code-in-behind-plugin,users can just login with the
>>> url:http://somedomain.com/login.action.
>>>
>>> And what I would like to do is block the direct *.jsp access.
>>>
>>> Any comment would be greatly appreciated.
>>>
>> -
>> 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: How to keep users from accessing to *.jsp strightforword?

2007-07-14 Thread Rene Gielen
You can place your jsps in the WEB-INF directory. They will be
accessible for the Struts request dispatcher then, but not by direct
user call.

M.Liang Liu schrieb:
> I just would like to block users to get to the login.jsp through the
> url:http://somedomain.com/login.jsp.
> Instead,users can login with the url :http://somedomain.com/login.action---
> actually the login.jsp page.
> 
> With the help of code-in-behind-plugin,users can just login with the
> url:http://somedomain.com/login.action.
> 
> And what I would like to do is block the direct *.jsp access.
> 
> Any comment would be greatly appreciated.
> 

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



Re: [s2]how to detect changes in the available values in a list using optionstransferselect

2007-07-11 Thread Rene Gielen
If you look into the resulting html source rendered from your page, you
will notice a dojo.event.connect javascript call for the form submit
event (originated at
struts2-core/src/main/resource/template/simple/form-close.ftl).
You can use this kind of event model yourself for the onclick events of
the buttons you want to monitor.
See http://dojotoolkit.org for more information.

petchia schrieb:
> I need to be able to detect when an item is added (or removed) from the right
> side of an optionstransferselect component. Basically if an item on the left
> side is added to the right side, I want to be able to run some JavaScript
> code to update another part of the page. I tried using the "doubleOnchange"
> attribute to assign a piece of JavaScript code, but that only gets called
> when you actually click on an item in the list on the right. I want the
> Javascript to be called when items are added or removed.
> 
> Any ideas?
> 
> -Bill

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



Re: [S2] Interceptor Question (Thread Safety)

2007-07-10 Thread Rene Gielen
[...]
[this] means that there are no thread safety issues
*of the discussed kind* with interceptor instance variables.
[...]

should have been clear from the discussion context, but thanks for
further clarification :)


Dave Newton schrieb:
> --- Rene Gielen <[EMAIL PROTECTED]> wrote:
>> [this] means that there are no thread safety issues 
>> with interceptor instance variables.
> 
> Well, not in terms of a property of the same name set
> in different interceptor references in a config file
> (er... it made sense in my head) but interceptors
> still need to keep thread safety in mind, just like
> servlets or S1 actions--instance variables are still
> shared across the applications, it's just that each
> interceptor-ref is a separate instance.
> 
> d.
> 
> 
> 
>
> 
> Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, 
> news, photos & more. 
> http://mobile.yahoo.com/go?refer=1GNXIC
> 
> -
> 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: [S2] Interceptor Question (Thread Safety)

2007-07-10 Thread Rene Gielen
I'll add some words on that to the docs.

Am Di, 10.07.2007, 13:42, schrieb Hoying, Ken:
> Thank you, Rene!
>
> This is a great help to me and allows me to move forward with my current
> implementation.  It might be a good idea for someone from the Struts2
> project to update the documentation with Rene's finding, as I am sure
> others will also find this unclear and concerning.
>
> Thank you again!
>
> -Original Message-
> From: Rene Gielen [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 10, 2007 2:38 AM
> To: Struts Users Mailing List
> Subject: Re: [S2] Interceptor Question (Thread Safety)
>
> Ken, others,
>
> now for the definitive answer:
> There is one instance per interceptor ref, thus interceptor instances
> being unique within the scope they are referenced in.
>
> Example:
> 
>  
>  
>  
>  
>  
>  barfoobar
>  
>  /index.jsp
>  
>  
>  
>  barfoo
>  
>  /index.jsp
>  
> 
>
> This will cause two instances of FooInterceptor being created, one with
> bar property set to "barfoobar" and one with "barfoo". The interceptors
> parameters given in struts.xml are only set once per instance, which
> means that there are no thread safety issues with interceptor instance
> variables.
>
> HTH,
> Rene
>
>
> Rene Gielen schrieb:
>> Uahhh,
>>
>> thanks for pointing out this information, I was way to fast to reply
>> on the said question - I recalled it wrong. Indeed documentation is
>> right here, they need to be thread safe - sorry for causing
>> misunderstanding here.
>>
>> Anyway, this does not answer the question if interceptor parameters
>> introduce thread safety issues. The builder mechanism is a little
>> complicated here, but AFAIK Interceptor instances are unique to the
>> scope they are configured in. I will check this tonight to ensure we
>> do not face a problem here with current implementation and hopefully
>> can provide a reliable answer then.
>>
>> Regards,
>> Rene
>>
>> http://struts.apache.org/2.x/docs/writing-interceptors.html
>>>
>>> Thread Safety
>>> Interceptors must be thread-safe!
>>>
>>> A Struts 2 Action instance is created for every request and do not
>>> need to be thread-safe. Conversely, Interceptors are shared between
>>> requests and must be thread-safe.
>>>
>>> -Original Message-
>>> From: Rene Gielen [mailto:[EMAIL PROTECTED]
>>> Sent: Sunday, July 08, 2007 7:00 AM
>>> To: Struts Users Mailing List
>>> Subject: Re: [S2] Interceptor Question (Thread Safety)
>>>
>>> Ken,
>>>
>>> there is no problem at all since s2 interceptor instances, as well as
>
>>> action instances, are created per ActionInvokation, which means they
>>> are always operated in a single thread.
>>>
>>> Regards,
>>> Rene
>>>
>>> Hoying, Ken schrieb:
>>>> From what I understand from reading the documentation, interceptors
>>>> are suppose to be thread safe.  However, I have noticed that some of
>
>>>> the interceptors do  contain instance variables and I have seen some
>
>>>> examples where these variables are set or modified from with in the
>>>> action configurations.
>>>>
>>>> For example, the File Upload interceptor allows you to set the
>>>> maximumSize and allowedTypes.  Is this going to work if I have 2
>>>> different actions each allowing different maximumSize and
>>> allowedTypes?
>>>> This does not seem thread safe to me.  Is there only one instance of
>
>>>> the interceptors or does maybe each action mapping have its own
>>>> instance of the interceptors?
>>>>
>>>> Thanks in advance,
>>>> Ken
>>>>
>>>>
>>>>
>>>> -
>>>> ***Note:The information contained in this message may be privileged
>>>> and confidential and protected from disclosure. If the reader of
>>>> this message is not the intended recipient, or an employee or agent
>>>> responsible for delivering this message to the intended recipient,
>>>> you are hereby notified that any dissemination, distribution or
>>>> copying of this communication is strictly prohibited. If you have
>>>> received this communication in error, please notify the Sender
>>

Re: [S2] Interceptor Question (Thread Safety)

2007-07-09 Thread Rene Gielen

Ken, others,

now for the definitive answer:
There is one instance per interceptor ref, thus interceptor instances 
being unique within the scope they are referenced in.


Example:






barfoobar

/index.jsp



barfoo

/index.jsp



This will cause two instances of FooInterceptor being created, one with 
bar property set to "barfoobar" and one with "barfoo". The interceptors 
parameters given in struts.xml are only set once per instance, which 
means that there are no thread safety issues with interceptor instance 
variables.


HTH,
Rene


Rene Gielen schrieb:

Uahhh,

thanks for pointing out this information, I was way to fast to reply on
the said question - I recalled it wrong. Indeed documentation is right
here, they need to be thread safe - sorry for causing misunderstanding
here.

Anyway, this does not answer the question if interceptor parameters
introduce thread safety issues. The builder mechanism is a little
complicated here, but AFAIK Interceptor instances are unique to the scope
they are configured in. I will check this tonight to ensure we do not face
a problem here with current implementation and hopefully can provide a
reliable answer then.

Regards,
Rene


Thanks, Rene!

Someone might want to update the documentation to make this clearer.
The following document seems to indicate otherwise:

http://struts.apache.org/2.x/docs/writing-interceptors.html

Thread Safety
Interceptors must be thread-safe!

A Struts 2 Action instance is created for every request and do not need
to be thread-safe. Conversely, Interceptors are shared between requests
and must be thread-safe.

-Original Message-----
From: Rene Gielen [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 08, 2007 7:00 AM
To: Struts Users Mailing List
Subject: Re: [S2] Interceptor Question (Thread Safety)

Ken,

there is no problem at all since s2 interceptor instances, as well as
action instances, are created per ActionInvokation, which means they are
always operated in a single thread.

Regards,
Rene

Hoying, Ken schrieb:

From what I understand from reading the documentation, interceptors
are suppose to be thread safe.  However, I have noticed that some of
the interceptors do  contain instance variables and I have seen some
examples where these variables are set or modified from with in the
action configurations.

For example, the File Upload interceptor allows you to set the
maximumSize and allowedTypes.  Is this going to work if I have 2
different actions each allowing different maximumSize and

allowedTypes?

This does not seem thread safe to me.  Is there only one instance of
the interceptors or does maybe each action mapping have its own
instance of the interceptors?

Thanks in advance,
Ken



-
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, you
are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received this
communication in error, please notify the Sender immediately by
replying to the message and deleting it from your computer. Thank you.
Premier Inc.





--
Rene Gielen  | http://it-neering.net/
Aachen   | PGP-ID: BECB785A
Germany  | gielen at it-neering.net

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



RE: [S2] Interceptor Question (Thread Safety)

2007-07-09 Thread Rene Gielen
Uahhh,

thanks for pointing out this information, I was way to fast to reply on
the said question - I recalled it wrong. Indeed documentation is right
here, they need to be thread safe - sorry for causing misunderstanding
here.

Anyway, this does not answer the question if interceptor parameters
introduce thread safety issues. The builder mechanism is a little
complicated here, but AFAIK Interceptor instances are unique to the scope
they are configured in. I will check this tonight to ensure we do not face
a problem here with current implementation and hopefully can provide a
reliable answer then.

Regards,
Rene

http://struts.apache.org/2.x/docs/writing-interceptors.html
>
> Thread Safety
>   Interceptors must be thread-safe!
>
> A Struts 2 Action instance is created for every request and do not need
> to be thread-safe. Conversely, Interceptors are shared between requests
> and must be thread-safe.
>
> -Original Message-
> From: Rene Gielen [mailto:[EMAIL PROTECTED]
> Sent: Sunday, July 08, 2007 7:00 AM
> To: Struts Users Mailing List
> Subject: Re: [S2] Interceptor Question (Thread Safety)
>
> Ken,
>
> there is no problem at all since s2 interceptor instances, as well as
> action instances, are created per ActionInvokation, which means they are
> always operated in a single thread.
>
> Regards,
> Rene
>
> Hoying, Ken schrieb:
>> From what I understand from reading the documentation, interceptors
>> are suppose to be thread safe.  However, I have noticed that some of
>> the interceptors do  contain instance variables and I have seen some
>> examples where these variables are set or modified from with in the
>> action configurations.
>>
>> For example, the File Upload interceptor allows you to set the
>> maximumSize and allowedTypes.  Is this going to work if I have 2
>> different actions each allowing different maximumSize and
> allowedTypes?
>> This does not seem thread safe to me.  Is there only one instance of
>> the interceptors or does maybe each action mapping have its own
>> instance of the interceptors?
>>
>> Thanks in advance,
>> Ken
>>
>>
>>
>> -
>> ***Note:The information contained in this message may be privileged
>> and confidential and protected from disclosure. If the reader of this
>> message is not the intended recipient, or an employee or agent
>> responsible for delivering this message to the intended recipient, you
>
>> are hereby notified that any dissemination, distribution or copying of
>
>> this communication is strictly prohibited. If you have received this
>> communication in error, please notify the Sender immediately by
>> replying to the message and deleting it from your computer. Thank you.
>
>> Premier Inc.
>
>
> --
> Rene Gielen  | http://it-neering.net/
> Aachen   | PGP-ID: BECB785A
> Germany  | gielen at it-neering.net
>
> -
> 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]
>
>


--
Rene Gielen  | http://it-neering.net/
Aachen   | PGP-ID: BECB785A
Germany  | gielen at it-neering.net


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



Re: [S2] Interceptor Question (Thread Safety)

2007-07-08 Thread Rene Gielen

Ken,

there is no problem at all since s2 interceptor instances, as well as
action instances, are created per ActionInvokation, which means they are
always operated in a single thread.

Regards,
Rene

Hoying, Ken schrieb:

From what I understand from reading the documentation, interceptors are
suppose to be thread safe.  However, I have noticed that some of the
interceptors do  contain instance variables and I have seen some
examples where these variables are set or modified from with in the
action configurations.  


For example, the File Upload interceptor allows you to set the
maximumSize and allowedTypes.  Is this going to work if I have 2
different actions each allowing different maximumSize and allowedTypes?
This does not seem thread safe to me.  Is there only one instance of the
interceptors or does maybe each action mapping have its own instance of
the interceptors?

Thanks in advance,
Ken



-
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.  



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



Re: Struts 2 - Array of Text Fields

2007-07-08 Thread Rene Gielen

With s2, you can do tabular forms quite elegantly. Although the page
needs some updates (will try to get on this the next days), the basic
principle is shown here:
http://cwiki.apache.org/confluence/display/WW/Tabular+inputs

You might want to make sure you understand type conversion principles
beforehands, especially for collection types.

M Cody schrieb:

I'm new to struts 2 and I'm trying to setup an edit form that will have an 
array of text boxes that will transfer their values back to the action for 
processing.

I've tried a couple things, but I'm thinking I'm just approaching it all wrong 
or missing some key link somewhere and I can't find an example for struts 2 
that directly addresses what I'm trying to do. I'll psuedocode out what I've 
tried, but if anyone has a an example that my google-fu is too weak to find, or 
can give me a simple run down on the right approach that would be great.


ItemClass
String getProp1()
setProp1(String)

String getProp2()
setProp2(String)

Action class
execute
save

String getMessage()
setMessage(String)

ItemClass[] getItems  ()
setItems (ItemClass[])

JSP

form (posts to save)
TextField  - name=message

(I've tried this part two ways)
TextField - name=items[0].prop1
   TextField - name=items[0].prop2
   TextField - name=items[1].prop1

   TextField - name=items[1].prop2

(Second try)

Iterator id=it value=items
TextField - name=it.prop1
TextField - name=it.prop2


I was able to get both methods to display the data correctly in all the text 
fields, and the message value is being posted to the action correctly on 
submit, but the items array is always null after submit no matter what I do. 
I've done nothing special in the struts config files to desginate that this 
property is an array. Could that be it?


Thanks

Mike





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



Re: optionstransferselect tag

2007-07-08 Thread Rene Gielen

Bill Johnson schrieb:

I'm having the same problem and it appears to be
because the default theme is requiring DOJO to
automatically select all the select options before
submitting the form. I'm not sure if there is a JIRA
bug opened for this or not, but there probably should
be. The default (non-ajax) theme should not require
DOJO for the optionstransferselect tag to work.

I think the way to fix this is to have the default
theme use plain JavaScript to do the "select all"
functionality and not DOJO.

-Bill


Without using dojo, it's quite complicated to code a generic solution
for the tag as it is now. Dojo allows you to add one or more event
listeners, and that is done with the selectAllOptionsExceptSome
function: it is bound to the onsubmit event with dojo.event.connect,
with the needed code being able to be bound to the component template.

Coding the needed javascript by hand, might cause trouble in future when
implementation details might be changed. So maybe using dojo for adding
a js event model to your page is not the worst option ...




--- [EMAIL PROTECTED] wrote:


Hi all,
I have a problem with the optiontransferselect tag.
When I click on the submit button,nothing is set on
the listeSelectedKeys 
attribute of my updateActionClass.

Can someone tells me what i've missed.
here is an extract of my jsp.







   

 headerValue="--- 
Veuillez selectionner un compartiments ---"

 headerKey="-1"

 emptyOption="false"
 list="#application.vlisteCompartiments"
 listValue="libelleCompartiment"

 listKey="id" 
 buttonCssClass="bouton"

 cssStyle="width: 
350px;" 
 allowSelectAll="false"
 
 
 doubleList="listeCompartiments"

 
doubleName="listSelectedKeys"

 doubleHeaderValue="--- Veuillez selectionner un
compartiments ---"
 doubleHeaderKey="-1"
 doubleEmptyOption="false"
 buttonCssStyle="bouton"
 doubleCssStyle="width: 350px;"

  />

  cssClass="bouton" type="submit"  value="Modifier" 
/> 

  



thank in advance.

meissa.

L'integrite de ce message n'etant pas assuree sur
internet, Natixis ne peut etre tenu responsable de
son contenu. Toute utilisation ou diffusion non
autorisee est interdite. Si vous n'etes pas
destinataire de ce message, merci de le detruire et
d'avertir l'expediteur.
Ensemble, faisons un geste pour l'environnement :
n'imprimons nos mails que si necessaire

The integrity of this message cannot be guaranteed
on the Internet. Natixis can not therefore be
considered responsible for the contents. Any
unauthorized use or dissemination is prohibited. If
you are not the intended recipient of this message,
then please delete it and notify the sender.
Let us mind the environment : let's print our mails
only when necessary.





   


Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php

-
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: optionstransferselect tag

2007-07-08 Thread Rene Gielen

Bill Johnson schrieb:

I'm having the same problem and it appears to be
because the default theme is requiring DOJO to
automatically select all the select options before
submitting the form. I'm not sure if there is a JIRA
bug opened for this or not, but there probably should
be. The default (non-ajax) theme should not require
DOJO for the optionstransferselect tag to work.

I think the way to fix this is to have the default
theme use plain JavaScript to do the "select all"
functionality and not DOJO.

-Bill


Without using dojo, it's quite complicated to code a generic solution 
for the tag as it is now. Dojo allows you to add one or more event 
listeners, and that is done with the selectAllOptionsExceptSome 
function: it is bound to the onsubmit event with dojo.event.connect, 
with the needed code being able to be bound to the component template.


Coding the needed javascript by hand, might cause trouble in future when 
implementation details might be changed. So maybe using dojo for adding 
a js event model to your page is not the worst option ...





--- [EMAIL PROTECTED] wrote:


Hi all,
I have a problem with the optiontransferselect tag.
When I click on the submit button,nothing is set on
the listeSelectedKeys 
attribute of my updateActionClass.

Can someone tells me what i've missed.
here is an extract of my jsp.







   

 headerValue="--- 
Veuillez selectionner un compartiments ---"

 headerKey="-1"

 emptyOption="false"
 list="#application.vlisteCompartiments"
 listValue="libelleCompartiment"

 listKey="id" 
 buttonCssClass="bouton"

 cssStyle="width: 
350px;" 
 allowSelectAll="false"
 
 
 doubleList="listeCompartiments"

 
doubleName="listSelectedKeys"

 doubleHeaderValue="--- Veuillez selectionner un
compartiments ---"
 doubleHeaderKey="-1"
 doubleEmptyOption="false"
 buttonCssStyle="bouton"
 doubleCssStyle="width: 350px;"

  />

  cssClass="bouton" type="submit"  value="Modifier" 
/> 

  



thank in advance.

meissa.

L'integrite de ce message n'etant pas assuree sur
internet, Natixis ne peut etre tenu responsable de
son contenu. Toute utilisation ou diffusion non
autorisee est interdite. Si vous n'etes pas
destinataire de ce message, merci de le detruire et
d'avertir l'expediteur.
Ensemble, faisons un geste pour l'environnement :
n'imprimons nos mails que si necessaire

The integrity of this message cannot be guaranteed
on the Internet. Natixis can not therefore be
considered responsible for the contents. Any
unauthorized use or dissemination is prohibited. If
you are not the intended recipient of this message,
then please delete it and notify the sender.
Let us mind the environment : let's print our mails
only when necessary.





   


Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php

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




--
Rene Gielen  | http://it-neering.net/
Aachen   | PGP-ID: BECB785A
Germany  | gielen at it-neering.net

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



Re: Struts 2 - Array of Text Fields

2007-07-08 Thread Rene Gielen
With s2, you can do tabular forms quite elegantly. Although the page 
needs some updates (will try to get on this the next days), the basic 
principle is shown here:

http://cwiki.apache.org/confluence/display/WW/Tabular+inputs

You might want to make sure you understand type conversion principles 
beforehands, especially for collection types.


M Cody schrieb:

I'm new to struts 2 and I'm trying to setup an edit form that will have an 
array of text boxes that will transfer their values back to the action for 
processing.

I've tried a couple things, but I'm thinking I'm just approaching it all wrong 
or missing some key link somewhere and I can't find an example for struts 2 
that directly addresses what I'm trying to do. I'll psuedocode out what I've 
tried, but if anyone has a an example that my google-fu is too weak to find, or 
can give me a simple run down on the right approach that would be great.


ItemClass
String getProp1()
setProp1(String)

String getProp2()
setProp2(String)

Action class
execute
save

String getMessage()
setMessage(String)

ItemClass[] getItems  ()
setItems (ItemClass[])

JSP

form (posts to save)
TextField  - name=message

(I've tried this part two ways)
TextField - name=items[0].prop1
   TextField - name=items[0].prop2
   TextField - name=items[1].prop1

   TextField - name=items[1].prop2

(Second try)

Iterator id=it value=items
TextField - name=it.prop1
TextField - name=it.prop2


I was able to get both methods to display the data correctly in all the text 
fields, and the message value is being posted to the action correctly on 
submit, but the items array is always null after submit no matter what I do. 
I've done nothing special in the struts config files to desginate that this 
property is an array. Could that be it?


Thanks

Mike





--
Rene Gielen  | http://it-neering.net/
Aachen   | PGP-ID: BECB785A
Germany  | gielen at it-neering.net

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



Re: [S2] Interceptor Question (Thread Safety)

2007-07-08 Thread Rene Gielen

Ken,

there is no problem at all since s2 interceptor instances, as well as 
action instances, are created per ActionInvokation, which means they are 
always operated in a single thread.


Regards,
Rene

Hoying, Ken schrieb:

From what I understand from reading the documentation, interceptors are
suppose to be thread safe.  However, I have noticed that some of the
interceptors do  contain instance variables and I have seen some
examples where these variables are set or modified from with in the
action configurations.  


For example, the File Upload interceptor allows you to set the
maximumSize and allowedTypes.  Is this going to work if I have 2
different actions each allowing different maximumSize and allowedTypes?
This does not seem thread safe to me.  Is there only one instance of the
interceptors or does maybe each action mapping have its own instance of
the interceptors?

Thanks in advance,
Ken



-
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.  



--
Rene Gielen  | http://it-neering.net/
Aachen   | PGP-ID: BECB785A
Germany  | gielen at it-neering.net

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



Re: [S2] How to change "Invalid field value for field" message intr

2007-05-04 Thread Rene Gielen
Forgot to mention:
http://struts.apache.org/2.x/docs/type-conversion.html

at the very end ...

Am Fr, 4.05.2007, 12:14, schrieb Rene Gielen:
> On Thu, 3 May 2007 22:29:26 -0700 (PDT), Struts2 Fan
> <[EMAIL PROTECTED]> wrote:
>>
>> Yes I checked them. I didn't write any validation for these fields.
>> Struts
>> 2
>> controls double, int, date fields and if they are not valid it writes
>> the
>> message "Invalid field value for field "property.intValue" . I couldn't
>> find
>> where the message is defined. So I couldn't write the message for
>> Turkish
>> locale.
>>
>> Here is the error message displayed. I didn't write anything for
>> validation.
>> It is a "integer" type field.
>> http://www.nabble.com/file/8209/invalidFieldError.JPG
>>
>>
>
> To provide your own conversion error message for a specific field, you
> will have to provide a resource message following the naming convention
>
> invalid.fieldvalue.yourpropertyname
>
> This should override the default message.
>
> - Rene
>
>
> -
> 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: [S2] How to change "Invalid field value for field" message intr

2007-05-04 Thread Rene Gielen
On Thu, 3 May 2007 22:29:26 -0700 (PDT), Struts2 Fan <[EMAIL PROTECTED]> wrote:
> 
> Yes I checked them. I didn't write any validation for these fields. Struts
> 2
> controls double, int, date fields and if they are not valid it writes the
> message "Invalid field value for field "property.intValue" . I couldn't
> find
> where the message is defined. So I couldn't write the message for Turkish
> locale.
> 
> Here is the error message displayed. I didn't write anything for
> validation.
> It is a "integer" type field.
> http://www.nabble.com/file/8209/invalidFieldError.JPG
> 
> 

To provide your own conversion error message for a specific field, you will 
have to provide a resource message following the naming convention

invalid.fieldvalue.yourpropertyname

This should override the default message.

- Rene


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



Re: Forward a action from one action programmatically in STruts 2.0

2007-03-20 Thread Rene Gielen
Maybe this is the option you are searching for:

struts.xml:
---

  ${targetUrl}


in your acme.Action1 class:
---
String targetUrl;

public String getTargetUrl() {
return this.targetUrl;
}

public String execute() {
if (...) {
this,targetUrl = "1.jsp";
} else ...
}
}

Regards,
- Rene

arunkumar S schrieb:
> Hi,
> 
> 
> 
> Thanks for the inputs. my req. will not satisfy your suggestion.
> 
> 
> 
> My req. is I have to load different Jsps depending on the user
> profile. eg . for user with profile = "abc",
> 
> i will have JSps like 1_abc.jsp,2_abc.jsp,3_abc.jsp
> 
> for user with profile = def , i will have jsps like 1_def.jsp,2_def.jsp
> etc..
> 
> 
> 
> 
> 
> 
> 
> one way of solving this is to mention all the Jsp for users with
> different profile in the results and then forward
> 
> it in the action itself.
> 
> 
> 
> like
> 
> 
> 
> 
> 
> 
> 
>  1_abc.jsp
> 
>  1_def.jsp
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  2_abc.jsp
> 
>  2_def.jsp
> 
> 
> 
> 
> 
> return corresponding result in each action based on the users profile.
> 
> 
> 
> but the pblm here for each action the application developer has to
> define results for each user.
> 
> I am thinking of moving this to framework.
> 
> 
> 
> Below is the new approach.
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  1.jsp
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  2.jsp
> 
> 
> 
> 
> 
> 
> 
> /{1}.jsp
> 
> 
> 
> 
> 
> 
> 
> Now , in an action1.class & action2.class depending on the user
> profile i construt 1_abc.action or
> 
> 1_def.action and 2_abc.action or 2_def.action respectively . and if
> i can forward with 1_abc.action the below
> 
> definition present in the STruts.xml will take care of forwarding it
> to 1_abc.jsp /1_def.jsp  depending on the user automatically.
> 
> 
> 
> 
> 
> /{1}.jsp
> 
> 
> 
> 
> 
> FOr this i need to programmatically forward to an action so that i can
> leverage the above mentioned facility.
> 
> 
> 
> I hope i have made things clear.Let me know if have any suggestions.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Regards,
> 
> Arun.
> 
> 
> 
> 
> 
> The way I solve this is by returning the value you want and setting up the
> action chain on struts.xml file:
> 
> Example:
> 
>   class MyAction 1 .. {
> 
>   public String execute(){
> if(foo)
> return "foo";
> else
> return "bar";
>  }
> 
> Then on the Strutus XML file:
> 
>  
>   FooAction
>   BarAction
> ...
> 
> 
> PS. Make sure you use type="chain"!
> Hope this helps.
> 
> Harring
> On 3/15/07, arunkumar S <[EMAIL PROTECTED]> wrote:
> 
> Hi,
> 
> I have a requirement where in the action has to be forwarded based on
> certain runtime conditions.The destination will be decided only on the
> runtime.
> ---
> if(Input = "Case1" )
> forward action1
> else
> forward action2.
> ---
> 
> Basically i want to acheive a simple forward( requestdispatcher.forward()
> ) in
> ActionClass in Struts 2.0.
> 
> How can we acheive this in Struts 2.0. I dont have any API to acheive
> this.
> 
> Any inputs pls?
> 
> 
> Regards,
> Arun
> 

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



Re: Forward a action from one action programmatically in STruts 2.0

2007-03-20 Thread Rene Gielen
Maybe this is the option you are searching for:

struts.xml:
---

  ${targetUrl}


in your acme.Action1 class:
---
String targetUrl;

public String getTargetUrl() {
return this.targetUrl;
}

public String execute() {
if (...) {
this,targetUrl = "1.jsp";
} else ...
}
}

Regards,
- Rene

arunkumar S schrieb:
> Hi,
> 
> 
> 
> Thanks for the inputs. my req. will not satisfy your suggestion.
> 
> 
> 
> My req. is I have to load different Jsps depending on the user
> profile. eg . for user with profile = "abc",
> 
> i will have JSps like 1_abc.jsp,2_abc.jsp,3_abc.jsp
> 
> for user with profile = def , i will have jsps like 1_def.jsp,2_def.jsp
> etc..
> 
> 
> 
> 
> 
> 
> 
> one way of solving this is to mention all the Jsp for users with
> different profile in the results and then forward
> 
> it in the action itself.
> 
> 
> 
> like
> 
> 
> 
> 
> 
> 
> 
>  1_abc.jsp
> 
>  1_def.jsp
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  2_abc.jsp
> 
>  2_def.jsp
> 
> 
> 
> 
> 
> return corresponding result in each action based on the users profile.
> 
> 
> 
> but the pblm here for each action the application developer has to
> define results for each user.
> 
> I am thinking of moving this to framework.
> 
> 
> 
> Below is the new approach.
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  1.jsp
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  2.jsp
> 
> 
> 
> 
> 
> 
> 
> /{1}.jsp
> 
> 
> 
> 
> 
> 
> 
> Now , in an action1.class & action2.class depending on the user
> profile i construt 1_abc.action or
> 
> 1_def.action and 2_abc.action or 2_def.action respectively . and if
> i can forward with 1_abc.action the below
> 
> definition present in the STruts.xml will take care of forwarding it
> to 1_abc.jsp /1_def.jsp  depending on the user automatically.
> 
> 
> 
> 
> 
> /{1}.jsp
> 
> 
> 
> 
> 
> FOr this i need to programmatically forward to an action so that i can
> leverage the above mentioned facility.
> 
> 
> 
> I hope i have made things clear.Let me know if have any suggestions.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Regards,
> 
> Arun.
> 
> 
> 
> 
> 
> The way I solve this is by returning the value you want and setting up the
> action chain on struts.xml file:
> 
> Example:
> 
>   class MyAction 1 .. {
> 
>   public String execute(){
> if(foo)
> return "foo";
> else
> return "bar";
>  }
> 
> Then on the Strutus XML file:
> 
>  
>   FooAction
>   BarAction
> ...
> 
> 
> PS. Make sure you use type="chain"!
> Hope this helps.
> 
> Harring
> On 3/15/07, arunkumar S <[EMAIL PROTECTED]> wrote:
> 
> Hi,
> 
> I have a requirement where in the action has to be forwarded based on
> certain runtime conditions.The destination will be decided only on the
> runtime.
> ---
> if(Input = "Case1" )
> forward action1
> else
> forward action2.
> ---
> 
> Basically i want to acheive a simple forward( requestdispatcher.forward()
> ) in
> ActionClass in Struts 2.0.
> 
> How can we acheive this in Struts 2.0. I dont have any API to acheive
> this.
> 
> Any inputs pls?
> 
> 
> Regards,
> Arun
> 


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