Struts2, REST, JSON content encoding, UTF8

2008-11-13 Thread Alex Milanovic
Hi All,

I am using the REST plugin for Struts 2.1.3-SNAPSHOT. I want to make
sure that the content encoding for the JSON output from the server is
always in UTF8. How can I do this?

Thanks,
Alex

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



Re: Highlighting a field with a validation error in struts 2

2008-11-13 Thread Arpan Debroy
If we use simple theme, then also can we make that?

On Thu, Nov 13, 2008 at 12:18 PM, Andras Balogh [EMAIL PROTECTED] wrote:

 Hi,

 I think the easiest way would be to copy from struts2-core-xx.jar the
 validation.js based on the theme and put it in your source package folder .
 So example I took template/css_xhtml/validation.js from struts.jar and I
 modified the javascript function:
 function addError(e, errorText)
 {
 }
 Here the 'e' is the form element so you can easily style it with
 javascript.
 This applies to the Struts 2.0.11.2, I don't know about newer versions but
 I think you can do the same.

 See here about Overriding Templates:
 http://struts.apache.org/2.0.12/docs/template-loading.html

 Best regards,
 Andras.


 Adam Lister wrote:

 I took a look around, and I can't seem to find any way to select an input
 that has an error associated with it using css.  The samples I've looked at
 have ways to style the error message text, the label, etc, but no way to
 style an input.  I'm not seeing this red border either... does anyone
 recall which theme provides this?

 Thanks,
 -Adam



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




-- 
Thanks  Regards
 Arpan Debroy

AOL Online India Private Ltd
RMZ EcoSpace Campus 1A
Outer Ring Road, Bellandur,
Bangalore - 560037
India
Mobile No :+9886006306
on-board :+91 (80) 4035 4528
E-mail : [EMAIL PROTECTED]


Re: welcome.do ignored in my web.xml

2008-11-13 Thread Nils-Helge Garli Hegvik
Your container probably only supports file resources as welcome files.
Try creating a jsp that forwards to your struts action instead.

Nils-H

On Thu, Nov 13, 2008 at 11:42 AM, Cappelletti Marc
[EMAIL PROTECTED] wrote:
 Hi all,

 I've mapped my struts action *.do in the web.xml file and it works when
 I access a struts action directly with the URL (eg:
 http://localhost:8080/mcbc/welcome.do
 http://localhost:8080/mcbc/welcome.do )

 But, when I go to the root of my webapp (http://localhost:8080/mcbc/ ),
 my welcome-file-list tag, which points to a struts action welcome.do is
 ignored by tomcat. And if I put a jsp file or a servlet in this welcome
 list, it works.

 Does anyone have an idea of the problem?

 Regards

 Marc


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



Re: welcome.do ignored in my web.xml

2008-11-13 Thread diogo pontual
Try creating a empty text file welcome.do in your WebContent dir.

Best regards,

Diogo

On Thu, Nov 13, 2008 at 10:07 AM, Nils-Helge Garli Hegvik
[EMAIL PROTECTED]wrote:

 Your container probably only supports file resources as welcome files.
 Try creating a jsp that forwards to your struts action instead.

 Nils-H

 On Thu, Nov 13, 2008 at 11:42 AM, Cappelletti Marc
 [EMAIL PROTECTED] wrote:
  Hi all,
 
  I've mapped my struts action *.do in the web.xml file and it works when
  I access a struts action directly with the URL (eg:
  http://localhost:8080/mcbc/welcome.do
  http://localhost:8080/mcbc/welcome.do )
 
  But, when I go to the root of my webapp (http://localhost:8080/mcbc/ ),
  my welcome-file-list tag, which points to a struts action welcome.do is
  ignored by tomcat. And if I put a jsp file or a servlet in this welcome
  list, it works.
 
  Does anyone have an idea of the problem?
 
  Regards
 
  Marc
 

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




-- 
Diogo Dauster Pontual
[EMAIL PROTECTED]
61.81850270


welcome.do ignored in my web.xml

2008-11-13 Thread Cappelletti Marc
Hi all,
 
I've mapped my struts action *.do in the web.xml file and it works when
I access a struts action directly with the URL (eg:
http://localhost:8080/mcbc/welcome.do
http://localhost:8080/mcbc/welcome.do )
 
But, when I go to the root of my webapp (http://localhost:8080/mcbc/ ),
my welcome-file-list tag, which points to a struts action welcome.do is
ignored by tomcat. And if I put a jsp file or a servlet in this welcome
list, it works.
 
Does anyone have an idea of the problem?
 
Regards
 
Marc


[S2] Problems including dojo

2008-11-13 Thread Jan Froehlich
Hi there...

I have an existing web application based on a servlet. As I need to
extend it and dont want to mess around with the old code, I want to add
struts2 capabilites and do some reengineering for the extension.

My problem is, that I have registered the struts2 filter with the
url-pattern/ext/*/url-pattern
When I try to include dojo functions in my jsp pages, I get an error
saying djConfig undefined.

I found out, that if I change the url-pattern to /* its working like
expected - but that is not possible.

Can someone give me a hint on how to solve this? I need the pattern
/ext/*

Any help apreciated!

Regards 
Jan Froehlich

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



Problem with debug mode

2008-11-13 Thread Tomi21

Hello everyone,

I wanted to know how to turn on the debug mode in struts2(2.10.12 GA).
I use str:head debug=true/ and it seems not working because no messages
are shown.

Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/Problem-with-debug-mode-tp20478652p20478652.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: Problem with debug mode

2008-11-13 Thread Dave Newton
--- On Thu, 11/13/08, Tomi21 wrote:
 I wanted to know how to turn on the debug mode in
 struts2(2.10.12 GA).
 I use str:head debug=true/ and it seems
 not working because no messages are shown.

That's only for JavaScript/Dojo debugging.

What debugging are you trying to turn on?

Dave


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



RE: [S2] JSON plugin parser error

2008-11-13 Thread Relph,Brian

Thanks for the pointer, you are right, json does not like objects as keys.  I 
re-worked my data structure, and the serialized response was valid. 


Brian Relph

-Original Message-
From: Musachy Barroso [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 11, 2008 8:45 PM
To: Struts Users Mailing List
Subject: Re: [S2] JSON plugin parser error

the problem will be when you try to access that map using javascript.

On Tue, Nov 11, 2008 at 8:38 PM, Relph,Brian [EMAIL PROTECTED] wrote:


 I have an object that is related to a set of other objects.  I suppose 
 I could make 2 maps both keyed by the same primitive, one for the 
 objects, and one to the related objects.  But why?  You say it is not 
 a good idea, but my objects all implement hashcode and equals, and 
 outside of trying to transform the structure to json, it works 
 perfectly.  Is there some json limitation with having object keys?  
 Looking at the transformer in the plugin, it seems to handle object keys just 
 fine.


 Brian Relph

 -Original Message-
 From: Musachy Barroso [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 11, 2008 6:42 PM
 To: Struts Users Mailing List
 Subject: Re: [S2] JSON plugin parser error

 Using objects as keys is probably not a good idea.

 musachy

 On Tue, Nov 11, 2008 at 6:25 PM, Relph,Brian [EMAIL PROTECTED]
 wrote:

 
  Hello,  I am trying to use the JSON plugin in my struts2 application.
  I am getting a parser error on the string returned from the server.  
  I think the plugin is having problems converting my Map to JSON.
 
  Here is my object that I am trying to convert to JSON:
 
  *public** class** RoleDetails** extends* RoleImpl {
 
 * private* ListRole directParents;
 
 * private* MapRole, SetIdentity 
  transitiveParentsWithSources;
 
 * private* ListRole directChildren;
 
 * private* MapRole, SetIdentity 
  transitiveChildrenWithSources;
 
 * private* ListGroup directGroupChildren;
 
 * private* MapGroup, SetIdentity 
  transitiveGroupChildrenWithSources;
 
 * private* ListString directUsernames;
 
 * private* MapString, SetIdentity 
  transitiveUsernamesWithSources;
 
 * private* ListPermission directPermissionParents;
 
 * private* MapPermission, SetIdentity 
  transitivePermissionParentsWithSources;
 
  I have attached the output from one of my requests, but it is pretty 
  long, here is the portion where the json compiler explodes:
 
  json.txt
 
  transitiveChildrenWithSources:{},transitiveGroupChildrenWithSourc
  es
  :*ERROR
  HERE*{{description:super
  users,groupNames:[],name:hin_wasadmins,usernames:[ar016581
  , 
  temp_wasadmin,admin_usertool,relphie,bgraves,newtestuser,
  fk
  3794,samkarl,test_usertool,kp016678,bo017459,bk016677,rw
  01 2795,kchintan,kp014672]}:[{description:Health
  Management
  Advisor,groupNames:[hin_wasadmins],name:HHM_Advisor,userna
  me
  s:[testuser13,kp016678,hmadvisor1,hmadvisor2_cert,hmadviso
  r1 
  _cert,hmadvisor2,hmadvisor3,hmadvsr2,hmadvisor3_cert,hmadv
  sr
  1,hmadvsr3]}]}
 
  So it looks like there is either a problem with my map keyed by 
  object, or the transitiveChildrenWithSources map being empty.  Any
 thoughts?
 
  *Brian Relph* | Software Engineer | Cerner Corporation | 
  816-201-7642
  | **
  [EMAIL PROTECTED] [EMAIL PROTECTED] | 
  ***www.cerner.com*http://www.cerner.com
  --
  CONFIDENTIALITY NOTICE This message and any included attachments are 
  from Cerner Corporation and are intended only for the addressee. The 
  information contained in this message is confidential and may 
  constitute inside or non-public information under international, 
  federal, or state securities laws. Unauthorized forwarding, 
  printing, copying, distribution, or use of such information is 
  strictly prohibited and may be unlawful. If you are not the 
  addressee, please promptly delete this message and notify the sender 
  of the delivery error by e-mail or you may call Cerner's corporate 
  offices in Kansas
 City, Missouri, U.S.A at (+1) (816)221-1024.
 
  
  - 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]




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



Advanced Struts 2 Validation Question...

2008-11-13 Thread Burton Rhodes
How do I use validation in an [Action]-validation.xml file to validate
several fields?

I need to implement the following logic for 3 fields on a form:
Company, FirstName, LastName.

Psedo Code:

If Company empty, then FirstName and LastName must be filled
If FirstName and LastName empty, then Company Must be filled.

I am having trouble seeing how this can be accomplished with the
expression validator type.

Or should I just write some simple javascript to make this happen?!

Thanks!!
Burton

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



Re: Advanced Struts 2 Validation Question...

2008-11-13 Thread Néstor Boscán
if you want javascript validation you will have to create your own theme and
own validation. You will have to create your own validator class and modify
the form-close-validation.ftl. This is what I've done in the past. Once you
figure out the details you start creating and reusing validators.

On Thu, Nov 13, 2008 at 11:06 AM, Burton Rhodes [EMAIL PROTECTED]wrote:

 How do I use validation in an [Action]-validation.xml file to validate
 several fields?

 I need to implement the following logic for 3 fields on a form:
 Company, FirstName, LastName.

 Psedo Code:

 If Company empty, then FirstName and LastName must be filled
 If FirstName and LastName empty, then Company Must be filled.

 I am having trouble seeing how this can be accomplished with the
 expression validator type.

 Or should I just write some simple javascript to make this happen?!

 Thanks!!
 Burton

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




Re: Advanced Struts 2 Validation Question...

2008-11-13 Thread Bill Harper
Implement Valiadateable in your action and the Workflow interceptor will
call validate() before and action method  If your validate() method adds
ActionErrors then the messages go back to the input form.  You will also
need to configure / annotate an input result.  I can't remember off the
top of my head if you need to implement ValidationAware as well in order to
get the methods to add errors and messages.

-bill

On Thu, Nov 13, 2008 at 9:36 AM, Burton Rhodes [EMAIL PROTECTED]wrote:

 How do I use validation in an [Action]-validation.xml file to validate
 several fields?

 I need to implement the following logic for 3 fields on a form:
 Company, FirstName, LastName.

 Psedo Code:

 If Company empty, then FirstName and LastName must be filled
 If FirstName and LastName empty, then Company Must be filled.

 I am having trouble seeing how this can be accomplished with the
 expression validator type.

 Or should I just write some simple javascript to make this happen?!

 Thanks!!
 Burton

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




-- 
-bill
816.841.4755


RE: Advanced Struts 2 Validation Question...

2008-11-13 Thread Jishnu Viswanath
You can write java validation 

Try like this in xml

validator type=fieldexpression
param name=fieldName FirstName /param
param name=expression![CDATA[FirstName!=null 
LastName!=null  Company!=null]]/param
message key=should.not.be.empty/
/validator

Regards,

Jishnu Viswanath

Software Engineer

*(+9180)41190300 - 222(Ext) ll * ( + 91 ) 9731209330ll

Tavant Technologies Inc.,

www.tavant.com

PEOPLE :: PASSION :: EXCELLENCE

-Original Message-
From: Burton Rhodes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 13, 2008 9:06 PM
To: Struts Users Mailing List
Subject: Advanced Struts 2 Validation Question...

How do I use validation in an [Action]-validation.xml file to validate
several fields?

I need to implement the following logic for 3 fields on a form:
Company, FirstName, LastName.

Psedo Code:

If Company empty, then FirstName and LastName must be filled
If FirstName and LastName empty, then Company Must be filled.

I am having trouble seeing how this can be accomplished with the
expression validator type.

Or should I just write some simple javascript to make this happen?!

Thanks!!
Burton

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

Any comments or statements made in this email are not necessarily those of 
Tavant Technologies.
The information transmitted is intended only for the person or entity to which 
it is addressed and may 
contain confidential and/or privileged material. If you have received this in 
error, please contact the 
sender and delete the material from any computer. All e-mails sent from or to 
Tavant Technologies 
may be subject to our monitoring procedures.


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



Re: Migrating to 2.0.12 General Availability Release

2008-11-13 Thread esemba

seems like bug:
http://www.nabble.com/-s2.0.12-Client-validation-not-working-to20372886.html
https://issues.apache.org/struts/browse/WW-2849
http://www.nabble.com/s%3Adatetimepicker-doesn%27-t-work-after-upgraded-to-struts2.0.12-td20245780.html



Tomi21 wrote:
 
 Hi everyone,
 
 I've migrated my web application to the last release 2.0.12 and all things
 that require 'dojo' are not working correctly(datetimepicker, tooltip,
 etc.).
 The error message is dojo is not defined.
 
 Does anyone know how can I solve the problem? With version 2.0.11
 everything was working perfectly!!
 
 Which .jar contains the dojo implementation?
 
 Thanks in advance for the help.
 

-- 
View this message in context: 
http://www.nabble.com/Migrating-to-2.0.12-General-Availability-Release-tp20459086p20481667.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: Struts 2.1.2 type conversion failing for Integer method.

2008-11-13 Thread Carlos Luis Zúñiga Sibaja
Actually, this is a problem in OGNL, because the version bundled with Struts
2.1.2 cannot handle objects with generifyed properties. This definitively
sucks since it prevents a lot of code reuse, in my specific experience I had
a similar implementation for a base ModelObject and an AbstractCrudAction
but because of this error, it is not possible to generify these objects.

There is already a Jira issue about this situation:
https://issues.apache.org/struts/browse/WW-2128

Regards,

  Carlos Luis Zúñiga Sibaja
__
  [EMAIL PROTECTED]

  divide et impera...


On Wed, Nov 12, 2008 at 11:31 PM, Adam Ruggles [EMAIL PROTECTED] wrote:


 I'm trying to figure out why struts/xwork is having issues doing the
 conversion on an Integer property.  Here is the configuration.

 public class MyAction extends ActionSupport implements Preparable,
 ModelDrivenMyObject {
  private MyObject obj;
  public void prepare() throws Exception {
obj = new MyObject();
  }
  public MyObject getModel() {
return obj;
  }
  public String execute() {
// MyObject.id is not set, although ever other field is fine.
  }
 }

 public interface CoreEntityID extends Serializable {
  ID getId();
  void setId(ID id);
 }

 public class MyObject implements CoreEntityInteger {
  private String description;
  private Integer id;

  public Integer getId() {
return id;
  }
  public void setId(final Integer id) {
this.id = id;
  }
  public String getDescription() {
return description;
  }
  public void setDescription(final String description) {
this.description = description;
  }
 }

 The error I'm getting is
 ognl.MethodFailedException: Method setId failed for object
 [EMAIL PROTECTED] Category 2,id=null]
 [java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
 java.lang.Integer]

 It looks like it's having an issue with my use of generics in the
 interface,
 but I don't know for sure.  Is there any way for me to tell struts2/xwork
 that the id field for the model object is a Integer?
 --
 View this message in context:
 http://www.nabble.com/Struts-2.1.2-type-conversion-failing-for-Integer-method.-tp20475044p20475044.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: Advanced Struts 2 Validation Question...

2008-11-13 Thread Dave Newton
--- On Thu, 11/13/08, Burton Rhodes wrote:
 How do I use validation in an [Action]-validation.xml file
 to validate several fields?
 
 I need to implement the following logic for 3 fields on a
 form: Company, FirstName, LastName.
 
 Psedo Code:
 
 If Company empty, then FirstName and LastName must be filled
 If FirstName and LastName empty, then Company Must be filled.
 
 I am having trouble seeing how this can be accomplished
 with the expression validator type.

Besides the expression help already provided, I'd add that personally I'd put 
this in the Java code rather than in the XML file.

It's probably just me, so take it with a grain of salt--as soon as anything 
gets even a little bit complicated (this usage might not qualify as 
complicated since it's trivial, so it's on the edge) I'll put it in a 
validate() method, possibly calling super.validate() to handle simple XML-based 
validations. It's (generally) easier to debug in the Java code.

With regards to doing it via JavaScript, sure, that's a viable solution, but 
until I actually *apply* my patch to allow quick and easy custom JavaScript 
validations you'll have to take the route of modifying the template as another 
poster mentioned, or do it a bit more outside of the S2 JavaScript validation.

(Hopefully I'll get to the patch this weekend, and I'll put it in a JIRA issue 
including the patch so people can use it with previously-released versions.)

Dave


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



Re: Advanced Struts 2 Validation Question...

2008-11-13 Thread Burton Rhodes
Thanks to all!  Implementing Validatable was simple and works great.
I am thinking of moving all my action objects that need it to
Validatable. per Bill's suggestion...  one less file to worry about.
:)

On Thu, Nov 13, 2008 at 9:58 AM, Dave Newton [EMAIL PROTECTED] wrote:
 --- On Thu, 11/13/08, Burton Rhodes wrote:
 How do I use validation in an [Action]-validation.xml file
 to validate several fields?

 I need to implement the following logic for 3 fields on a
 form: Company, FirstName, LastName.

 Psedo Code:

 If Company empty, then FirstName and LastName must be filled
 If FirstName and LastName empty, then Company Must be filled.

 I am having trouble seeing how this can be accomplished
 with the expression validator type.

 Besides the expression help already provided, I'd add that personally I'd put 
 this in the Java code rather than in the XML file.

 It's probably just me, so take it with a grain of salt--as soon as anything 
 gets even a little bit complicated (this usage might not qualify as 
 complicated since it's trivial, so it's on the edge) I'll put it in a 
 validate() method, possibly calling super.validate() to handle simple 
 XML-based validations. It's (generally) easier to debug in the Java code.

 With regards to doing it via JavaScript, sure, that's a viable solution, but 
 until I actually *apply* my patch to allow quick and easy custom JavaScript 
 validations you'll have to take the route of modifying the template as 
 another poster mentioned, or do it a bit more outside of the S2 JavaScript 
 validation.

 (Hopefully I'll get to the patch this weekend, and I'll put it in a JIRA 
 issue including the patch so people can use it with previously-released 
 versions.)

 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]



Re: Validation causing me problems

2008-11-13 Thread lathjer

So as I am trying to figure this out, and it has brought up some questions.


lathjer wrote:
 
 !-- Action to list users on a home page --
 action name=ListUsers class=net.dg.oe.user.UserAction
 method=list
 result type=tilesuser.list/result
 /action
 

That mapping causes the error. When the UserAction.list() method is called
it is looking for the input result type.

So my question (or realization) is that apparently the validation framework
depends on the class and not tied to the action name.  Is this correct, or
am I off base?

Everything I have read and researched seems to tell me that the validation
should be tied to the action name and not the action class.  I guess I
misunderstood.

Thanks,

lathjer


-- 
View this message in context: 
http://www.nabble.com/Validation-causing-me-problems-tp20471257p20486313.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: Multi org support with i18n

2008-11-13 Thread Manish Kumar Wadhwa
Hi,

I found a solution for my problem.

I can create a custom ResourceBundle.Control class where i can define the rules 
to fulfill my requirements.

For this, i need to set my own ResourceBundle object into the stack. 
ResourceBundle.getBundle(baseName, locale, myRBControl)

Can anyone please suggest the right place to do this?

Thanks,
Manish

-Original Message-
From: Manish Kumar Wadhwa [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: 12-Nov-08 4:43 PM
Subject: RE: Multi org support with i18n


Thanks Paweł

My requirement is to surve multiple customers in one application. All customers 
would have the different domain name and different UI. Back end functionality 
would be the same for all customers.

For this I need to provide separate set of locale based resource boundle 
properties.

I heared from someone that we can achieve this by overriding ResourceBundle 
class.

If someone has some information on this, please help. some sample code would 
help me better.

Thanks,
Manish

-Original Message-
From: Pawel Wielgus [mailto:[EMAIL PROTECTED]
Sent: Saturday, November 08, 2008 1:58 AM
To: Struts Users Mailing List
Subject: Re: Multi org support with i18n

Hi Manish,
as i don't know requirements of Your apps, i might be not accurate.
For me localization is something completly different that cutomer customization.
So solving it with same mechanizm might bring You more troubles than solutions.
One important question is if inside one running app more than one
customer will be served.
If yes, than for images and css'es different directory root would do
the job. And for texts different TextProviders maybe?
If no, doing nothing would be best practise i think. Customization
would then be completly not bounded to application.

Best greetings,
Paweł Wielgus.


2008/11/7 Manish Kumar Wadhwa [EMAIL PROTECTED]:
 Hi,

 I need to provide multiple organization support in my struts2 based 
 application.

 My requirement is to customize the text, images and css etc for the different 
 organizations.

 The application also provides the multi-lingual support. To achive all these 
 requirements, I am trying to have organization specific resource bundle 
 property files in the same way, the framework does for multiple languages. 
 For example- ResourceBundle_en_US_MYORG1.properties

 It will be a great help for me if someone can suggest a right way of doing 
 this.

 Thanks,
 Manish

 Thank you very much indeed Wes! That is exactly what I am after.

 I hadn't realised I needed the 'attr' bit in the front, that will teach me
 not to be so pedantic.
 --
 View this message in context: 
 http://www.nabble.com/Use-%3Cjsp%3AgetProperty-as-value-of-struts2-tag-tp20381725p20382581.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]

 -

 DISCLAIMER
 This email and any files transmitted with it are confidential and are solely 
 for the use of the individual or entity to which it is addressed. Any use, 
 distribution, copying or disclosure by any other person is strictly 
 prohibited. If you receive this transmission in error, please notify the 
 sender by reply email and then destroy the message. Opinions, conclusions and 
 other information in this message that do not relate to official business of 
 the company shall be understood to be neither given nor endorsed by NIIT Ltd. 
 Any information contained in this email, when addressed to Clients is subject 
 to the terms and conditions in governing client contract.

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



-

DISCLAIMER
This email and any files transmitted with it are confidential and are solely 
for the use of the individual or entity to which it is addressed. Any use, 
distribution, copying or disclosure by any other person is strictly prohibited. 
If you receive this transmission in error, please notify the sender by reply 
email and then destroy the message. Opinions, conclusions and other information 
in this message that do not relate to official business of the company shall be 
understood to be neither given nor endorsed by NIIT Ltd. Any information 
contained in this email, when addressed to Clients is subject to the terms and 
conditions in governing client contract.

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


Re: Portlet, DirectRenderFromEventAction - how to change the interceptor stack?

2008-11-13 Thread Torsten Krah
On Friday 24 October 2008 09:57:18 Nils-Helge Garli Hegvik wrote:
 If you can, I would suggest that
 you re-organize your application so that every event (usually a post)
 is followed by a redirect (using the redirect action result type).
 That way, the RenderDirect action is never used.

Did what you told but now i have got an really odd behaviour.
I am using this strus config:

action name=jasper class=PDFAction
result name=input/WEB-INF/view/jasper.jsp
/result
result name=success/WEB-INF/view/jasper.jsp
/result
result name=doreport type=redirectAction
param name=actionNamejasper/param
param name=methodgenerate/param
param name=parsetrue/param
param 
name=statisticType${statisticType}/param
param name=chartType${chartType}/param
param name=timeType${timeType}/param
param name=statBegin${statBegin}/param
param name=statEnd${statEnd}/param
param name=tag${tag}/param
param name=consumerId${consumerId}/param
/result
/action

If i do a post to the form using a s:submit button with method doReport 
which returns doreport my generate action gets called twice.
If i do not use the redirectAction, my generate method gets called only once 
like expected.

Why is the method specified at the redirectAction actually called twice? Its 
really annoying because genrating the report involved load to the system (db 
etc.) and it should only occur ones.

Any hints where to search for? Something misconfigured here?

thx

-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect.
-- Linus Torvalds



smime.p7s
Description: S/MIME cryptographic signature


Re: [S2] Problems including dojo

2008-11-13 Thread Musachy Barroso
Look at the output of the s:head tag which links to the dojo files, and fix
the urls to include /ext in it.

musachy

On Thu, Nov 13, 2008 at 5:36 AM, Jan Froehlich
[EMAIL PROTECTED]wrote:

 Hi there...

 I have an existing web application based on a servlet. As I need to
 extend it and dont want to mess around with the old code, I want to add
 struts2 capabilites and do some reengineering for the extension.

 My problem is, that I have registered the struts2 filter with the
 url-pattern/ext/*/url-pattern
 When I try to include dojo functions in my jsp pages, I get an error
 saying djConfig undefined.

 I found out, that if I change the url-pattern to /* its working like
 expected - but that is not possible.

 Can someone give me a hint on how to solve this? I need the pattern
 /ext/*

 Any help apreciated!

 Regards
 Jan Froehlich

 -
 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


Using validation with Hibernate...

2008-11-13 Thread Burton Rhodes
I am having trouble getting Struts 2.x to implement validation and
hibernate using the HibernateSessionRequestFilter (the pattern
suggested on Hibernate.org).  When the validation fails, Hibernate
will still update the object in the database when the HibernateFilter
closes the transaction.  I get why this is happening, but I can't seem
to find anyone who has really figured out an *elegant* solution.  Any
ideas?



public class HibernateSessionRequestFilter implements Filter {

   static Logger log = Logger.getLogger(HibernateSessionRequestFilter.class);

   private SessionFactory sf;

public void doFilter(ServletRequest request,
 ServletResponse response,
 FilterChain chain)
throws IOException, ServletException {

try {

// This starts the Hibernate transaction
sf.getCurrentSession().beginTransaction();

// Call the next filter (continue request processing)
chain.doFilter(request, response);

// Commit and cleanup
sf.getCurrentSession().getTransaction().commit();  
* Data is written here no matter what 

} catch (StaleObjectStateException staleEx) {
log.fatal(This interceptor does not implement optimistic
concurrency control!);
log.fatal(Your application will not work until you add
compensation actions!);
// Rollback, close everything, possibly compensate for any
permanent changes
// during the conversation, and finally restart business
conversation. Maybe
// give the user of the application a chance to merge some
of his work with
// fresh data... what you do here depends on your
applications design.
throw staleEx;

}
// This is a catch-all catch, define other Exceptions here
catch (Throwable ex) {
// Rollback only
ex.printStackTrace();
try {
if (sf.getCurrentSession().getTransaction().isActive()) {
log.fatal(Trying to rollback database transaction
after exception);
sf.getCurrentSession().getTransaction().rollback();
}
} catch (Throwable rbEx) {
log.fatal(Could not rollback transaction after exception!, 
rbEx);
}

// Let others handle it... maybe another interceptor for exceptions?
throw new ServletException(ex);
}
}

public void init(FilterConfig filterConfig) throws ServletException {
log.trace(Initializing filter...);
log.trace(Obtaining SessionFactory from static HibernateUtil
singleton...);
sf = HibernateUtil.getSessionFactory();
}

public void destroy() {}

}

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



Re: Struts 2.1.2 type conversion failing for Integer method.

2008-11-13 Thread Adam Ruggles

Are there any workarounds for this?  I've tried using a conversion properties
file for my action and adding the following:
id=example.MyTypeConverter

but it didn't get called from struts.  I wonder if it's because it should be
model.id or myobject.id.


Carlos Luis Zúñiga Sibaja wrote:
 
 Actually, this is a problem in OGNL, because the version bundled with
 Struts
 2.1.2 cannot handle objects with generifyed properties. This definitively
 sucks since it prevents a lot of code reuse, in my specific experience I
 had
 a similar implementation for a base ModelObject and an AbstractCrudAction
 but because of this error, it is not possible to generify these objects.
 
 There is already a Jira issue about this situation:
 https://issues.apache.org/struts/browse/WW-2128
 
 Regards,
 
   Carlos Luis Zúñiga Sibaja
 __
   [EMAIL PROTECTED]
 
   divide et impera...
 
 
 On Wed, Nov 12, 2008 at 11:31 PM, Adam Ruggles [EMAIL PROTECTED]
 wrote:
 

 I'm trying to figure out why struts/xwork is having issues doing the
 conversion on an Integer property.  Here is the configuration.

 public class MyAction extends ActionSupport implements Preparable,
 ModelDrivenMyObject {
  private MyObject obj;
  public void prepare() throws Exception {
obj = new MyObject();
  }
  public MyObject getModel() {
return obj;
  }
  public String execute() {
// MyObject.id is not set, although ever other field is fine.
  }
 }

 public interface CoreEntityID extends Serializable {
  ID getId();
  void setId(ID id);
 }

 public class MyObject implements CoreEntityInteger {
  private String description;
  private Integer id;

  public Integer getId() {
return id;
  }
  public void setId(final Integer id) {
this.id = id;
  }
  public String getDescription() {
return description;
  }
  public void setDescription(final String description) {
this.description = description;
  }
 }

 The error I'm getting is
 ognl.MethodFailedException: Method setId failed for object
 [EMAIL PROTECTED] Category 2,id=null]
 [java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
 java.lang.Integer]

 It looks like it's having an issue with my use of generics in the
 interface,
 but I don't know for sure.  Is there any way for me to tell struts2/xwork
 that the id field for the model object is a Integer?
 --
 View this message in context:
 http://www.nabble.com/Struts-2.1.2-type-conversion-failing-for-Integer-method.-tp20475044p20475044.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]


 
 

-- 
View this message in context: 
http://www.nabble.com/Struts-2.1.2-type-conversion-failing-for-Integer-method.-tp20475044p20489006.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]



Problems with s:datetimepicker

2008-11-13 Thread Nick Maunder | Oathouse
Hi I'm trying to use s:datetimepicker in my application (Struts2)

 

I have a basic version running correctly on a jsp

 

The problem comes when I try to integrate with tiles

 

The page then loads correctly before wiping and loading constantly.  Im
using firefox and my firebug gives up at 350 ish log entries.

 

 I have commented out all other page content until the only thing that is on
the page is the date time picker and its containing form.

 

Could someone give me a pointer as to where the problem lies?

 

 

Cheers 

 

Nick Maunder



Re: Struts 2.1.2 type conversion failing for Integer method.

2008-11-13 Thread Carlos Luis Zúñiga Sibaja
Adam,

For what I know the only solution to this problem is upgrading the version
of OGNL included in struts, but there are problems by doing that (check out
the JIRA issue). So the workaround for me was to stop using generic
properties in my Model objects.

Please, if somebody has come across a similar issue, feel free to chime in.


  Carlos Luis Zúñiga Sibaja
__
  [EMAIL PROTECTED]

  divide et impera...


On Thu, Nov 13, 2008 at 2:33 PM, Adam Ruggles [EMAIL PROTECTED] wrote:


 Are there any workarounds for this?  I've tried using a conversion
 properties
 file for my action and adding the following:
 id=example.MyTypeConverter

 but it didn't get called from struts.  I wonder if it's because it should
 be
 model.id or myobject.id.


 Carlos Luis Zúñiga Sibaja wrote:
 
  Actually, this is a problem in OGNL, because the version bundled with
  Struts
  2.1.2 cannot handle objects with generifyed properties. This definitively
  sucks since it prevents a lot of code reuse, in my specific experience I
  had
  a similar implementation for a base ModelObject and an AbstractCrudAction
  but because of this error, it is not possible to generify these objects.
 
  There is already a Jira issue about this situation:
  https://issues.apache.org/struts/browse/WW-2128
 
  Regards,
 
Carlos Luis Zúñiga Sibaja
  __
[EMAIL PROTECTED]
 
divide et impera...
 
 
  On Wed, Nov 12, 2008 at 11:31 PM, Adam Ruggles [EMAIL PROTECTED]
  wrote:
 
 
  I'm trying to figure out why struts/xwork is having issues doing the
  conversion on an Integer property.  Here is the configuration.
 
  public class MyAction extends ActionSupport implements Preparable,
  ModelDrivenMyObject {
   private MyObject obj;
   public void prepare() throws Exception {
 obj = new MyObject();
   }
   public MyObject getModel() {
 return obj;
   }
   public String execute() {
 // MyObject.id is not set, although ever other field is fine.
   }
  }
 
  public interface CoreEntityID extends Serializable {
   ID getId();
   void setId(ID id);
  }
 
  public class MyObject implements CoreEntityInteger {
   private String description;
   private Integer id;
 
   public Integer getId() {
 return id;
   }
   public void setId(final Integer id) {
 this.id = id;
   }
   public String getDescription() {
 return description;
   }
   public void setDescription(final String description) {
 this.description = description;
   }
  }
 
  The error I'm getting is
  ognl.MethodFailedException: Method setId failed for object
  [EMAIL PROTECTED] Category 2,id=null]
  [java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
  java.lang.Integer]
 
  It looks like it's having an issue with my use of generics in the
  interface,
  but I don't know for sure.  Is there any way for me to tell
 struts2/xwork
  that the id field for the model object is a Integer?
  --
  View this message in context:
 
 http://www.nabble.com/Struts-2.1.2-type-conversion-failing-for-Integer-method.-tp20475044p20475044.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]
 
 
 
 

 --
 View this message in context:
 http://www.nabble.com/Struts-2.1.2-type-conversion-failing-for-Integer-method.-tp20475044p20489006.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: Using validation with Hibernate...

2008-11-13 Thread Adam Ruggles

Use a struts interceptor instead of a servlet filter.  That way you can check
the return type of the action that gets executed and respond appropriately.



Burton Rhodes wrote:
 
 I am having trouble getting Struts 2.x to implement validation and
 hibernate using the HibernateSessionRequestFilter (the pattern
 suggested on Hibernate.org).  When the validation fails, Hibernate
 will still update the object in the database when the HibernateFilter
 closes the transaction.  I get why this is happening, but I can't seem
 to find anyone who has really figured out an *elegant* solution.  Any
 ideas?
 
 
 
 public class HibernateSessionRequestFilter implements Filter {
 
static Logger log =
 Logger.getLogger(HibernateSessionRequestFilter.class);
 
private SessionFactory sf;
 
 public void doFilter(ServletRequest request,
  ServletResponse response,
  FilterChain chain)
 throws IOException, ServletException {
 
 try {
 
   // This starts the Hibernate transaction
 sf.getCurrentSession().beginTransaction();
 
 // Call the next filter (continue request processing)
 chain.doFilter(request, response);
 
 // Commit and cleanup
 sf.getCurrentSession().getTransaction().commit();  
 * Data is written here no matter what 
 
 } catch (StaleObjectStateException staleEx) {
 log.fatal(This interceptor does not implement optimistic
 concurrency control!);
 log.fatal(Your application will not work until you add
 compensation actions!);
 // Rollback, close everything, possibly compensate for any
 permanent changes
 // during the conversation, and finally restart business
 conversation. Maybe
 // give the user of the application a chance to merge some
 of his work with
 // fresh data... what you do here depends on your
 applications design.
 throw staleEx;
 
 }
 // This is a catch-all catch, define other Exceptions here
 catch (Throwable ex) {
 // Rollback only
 ex.printStackTrace();
 try {
 if (sf.getCurrentSession().getTransaction().isActive()) {
   log.fatal(Trying to rollback database transaction
 after exception);
 sf.getCurrentSession().getTransaction().rollback();
 }
 } catch (Throwable rbEx) {
   log.fatal(Could not rollback transaction after exception!,
 rbEx);
 }
 
 // Let others handle it... maybe another interceptor for
 exceptions?
 throw new ServletException(ex);
 }
 }
 
 public void init(FilterConfig filterConfig) throws ServletException {
   log.trace(Initializing filter...);
   log.trace(Obtaining SessionFactory from static HibernateUtil
 singleton...);
 sf = HibernateUtil.getSessionFactory();
 }
 
 public void destroy() {}
 
 }
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Using-validation-with-Hibernate...-tp20488996p20490241.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]



Struts 2.1.2/2.1.3?

2008-11-13 Thread Kurt Dominik
Hey,

I noticed on this page:
http://struts.apache.org/2.0.12/docs/url.html

The mention of a 2.1.3 release, but I have not found it on the
struts.apache.org site.  I did find the JIRA (
https://issues.apache.org/struts/secure/Dashboard.jspa).

I was wondering if anyone knows if the source code for 2.1.3 is publicly
available for review yet?


Thanks!
Kurt Dominik
Ascension Systems
Kansas, USA


Re: Using validation with Hibernate...

2008-11-13 Thread Burton Rhodes
Many thanks.  I will give that a try.

On 11/13/08, Adam Ruggles [EMAIL PROTECTED] wrote:

 Use a struts interceptor instead of a servlet filter.  That way you can
 check
 the return type of the action that gets executed and respond appropriately.



 Burton Rhodes wrote:

 I am having trouble getting Struts 2.x to implement validation and
 hibernate using the HibernateSessionRequestFilter (the pattern
 suggested on Hibernate.org).  When the validation fails, Hibernate
 will still update the object in the database when the HibernateFilter
 closes the transaction.  I get why this is happening, but I can't seem
 to find anyone who has really figured out an *elegant* solution.  Any
 ideas?



 public class HibernateSessionRequestFilter implements Filter {

static Logger log =
 Logger.getLogger(HibernateSessionRequestFilter.class);

private SessionFactory sf;

 public void doFilter(ServletRequest request,
  ServletResponse response,
  FilterChain chain)
 throws IOException, ServletException {

 try {

  // This starts the Hibernate transaction
 sf.getCurrentSession().beginTransaction();

 // Call the next filter (continue request processing)
 chain.doFilter(request, response);

 // Commit and cleanup
 sf.getCurrentSession().getTransaction().commit();  
 * Data is written here no matter what 

 } catch (StaleObjectStateException staleEx) {
 log.fatal(This interceptor does not implement optimistic
 concurrency control!);
 log.fatal(Your application will not work until you add
 compensation actions!);
 // Rollback, close everything, possibly compensate for any
 permanent changes
 // during the conversation, and finally restart business
 conversation. Maybe
 // give the user of the application a chance to merge some
 of his work with
 // fresh data... what you do here depends on your
 applications design.
 throw staleEx;

 }
 // This is a catch-all catch, define other Exceptions here
 catch (Throwable ex) {
 // Rollback only
 ex.printStackTrace();
 try {
 if (sf.getCurrentSession().getTransaction().isActive()) {
  log.fatal(Trying to rollback database transaction
 after exception);
 sf.getCurrentSession().getTransaction().rollback();
 }
 } catch (Throwable rbEx) {
  log.fatal(Could not rollback transaction after exception!,
 rbEx);
 }

 // Let others handle it... maybe another interceptor for
 exceptions?
 throw new ServletException(ex);
 }
 }

 public void init(FilterConfig filterConfig) throws ServletException {
  log.trace(Initializing filter...);
  log.trace(Obtaining SessionFactory from static HibernateUtil
 singleton...);
 sf = HibernateUtil.getSessionFactory();
 }

 public void destroy() {}

 }

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




 --
 View this message in context:
 http://www.nabble.com/Using-validation-with-Hibernate...-tp20488996p20490241.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]



-- 
Sent from my mobile device

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



Re: Struts 2.1.2/2.1.3?

2008-11-13 Thread Dave Newton
--- On Thu, 11/13/08, Kurt Dominik wrote:
 I was wondering if anyone knows if the source code for
 2.1.3 is publicly available for review yet?

All revisions, including the trunk, are always available.

Dave


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



Re: Struts 2.1.2/2.1.3?

2008-11-13 Thread Wendy Smoak
On Thu, Nov 13, 2008 at 3:42 PM, Kurt Dominik [EMAIL PROTECTED] wrote:

 I was wondering if anyone knows if the source code for 2.1.3 is publicly
 available for review yet?

2.1.3 has not been released yet, but you can always check out the
source code from Subversion.  The trunk which is version
2.1.3-SNAPSHOT is here:
http://svn.apache.org/repos/asf/struts/struts2/trunk/

If you're working with unreleased bits, please come join us on the dev
list.  You can find subscription information at
http://struts.apache.org/mail-lists.html .

-- 
Wendy

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



RE: Advanced Struts 2 Validation Question...

2008-11-13 Thread Shannon, Andrew
I'd have to second that.  Writing validation in java code that is.
We've been creating a few different patterns to try and do this in an
intelligent manner, especially where we might need to go to the database
and get some data or rules or something.  I think one of the biggest
benefits about this is that we can unit test the heck out of it to our
satisfaction which alleviates the burden of working through all the
validation machinatinos in web-based integration tests as well as
trimming real people testing time which is important for the tight
budget on my current project.

- Andrew

-Original Message-
From: Burton Rhodes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 13, 2008 11:25 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: Advanced Struts 2 Validation Question...

Thanks to all!  Implementing Validatable was simple and works great.
I am thinking of moving all my action objects that need it to
Validatable. per Bill's suggestion...  one less file to worry about.
:)

On Thu, Nov 13, 2008 at 9:58 AM, Dave Newton [EMAIL PROTECTED]
wrote:
 --- On Thu, 11/13/08, Burton Rhodes wrote:
 How do I use validation in an [Action]-validation.xml file
 to validate several fields?

 I need to implement the following logic for 3 fields on a
 form: Company, FirstName, LastName.

 Psedo Code:

 If Company empty, then FirstName and LastName must be filled
 If FirstName and LastName empty, then Company Must be filled.

 I am having trouble seeing how this can be accomplished
 with the expression validator type.

 Besides the expression help already provided, I'd add that personally
I'd put this in the Java code rather than in the XML file.

 It's probably just me, so take it with a grain of salt--as soon as
anything gets even a little bit complicated (this usage might not
qualify as complicated since it's trivial, so it's on the edge) I'll
put it in a validate() method, possibly calling super.validate() to
handle simple XML-based validations. It's (generally) easier to debug in
the Java code.

 With regards to doing it via JavaScript, sure, that's a viable
solution, but until I actually *apply* my patch to allow quick and easy
custom JavaScript validations you'll have to take the route of modifying
the template as another poster mentioned, or do it a bit more outside of
the S2 JavaScript validation.

 (Hopefully I'll get to the patch this weekend, and I'll put it in a
JIRA issue including the patch so people can use it with
previously-released versions.)

 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]



Re: Using validation with Hibernate...

2008-11-13 Thread Burton Rhodes
In case anyone is interested, I found this plug-in for the exact
problem that look promising:

http://code.google.com/p/hibernatesession-plugin-for-struts2/


On Thu, Nov 13, 2008 at 3:46 PM, Adam Ruggles [EMAIL PROTECTED] wrote:

 Use a struts interceptor instead of a servlet filter.  That way you can check
 the return type of the action that gets executed and respond appropriately.



 Burton Rhodes wrote:

 I am having trouble getting Struts 2.x to implement validation and
 hibernate using the HibernateSessionRequestFilter (the pattern
 suggested on Hibernate.org).  When the validation fails, Hibernate
 will still update the object in the database when the HibernateFilter
 closes the transaction.  I get why this is happening, but I can't seem
 to find anyone who has really figured out an *elegant* solution.  Any
 ideas?



 public class HibernateSessionRequestFilter implements Filter {

static Logger log =
 Logger.getLogger(HibernateSessionRequestFilter.class);

private SessionFactory sf;

 public void doFilter(ServletRequest request,
  ServletResponse response,
  FilterChain chain)
 throws IOException, ServletException {

 try {

   // This starts the Hibernate transaction
 sf.getCurrentSession().beginTransaction();

 // Call the next filter (continue request processing)
 chain.doFilter(request, response);

 // Commit and cleanup
 sf.getCurrentSession().getTransaction().commit();  
 * Data is written here no matter what 

 } catch (StaleObjectStateException staleEx) {
 log.fatal(This interceptor does not implement optimistic
 concurrency control!);
 log.fatal(Your application will not work until you add
 compensation actions!);
 // Rollback, close everything, possibly compensate for any
 permanent changes
 // during the conversation, and finally restart business
 conversation. Maybe
 // give the user of the application a chance to merge some
 of his work with
 // fresh data... what you do here depends on your
 applications design.
 throw staleEx;

 }
 // This is a catch-all catch, define other Exceptions here
 catch (Throwable ex) {
 // Rollback only
 ex.printStackTrace();
 try {
 if (sf.getCurrentSession().getTransaction().isActive()) {
   log.fatal(Trying to rollback database transaction
 after exception);
 sf.getCurrentSession().getTransaction().rollback();
 }
 } catch (Throwable rbEx) {
   log.fatal(Could not rollback transaction after exception!,
 rbEx);
 }

 // Let others handle it... maybe another interceptor for
 exceptions?
 throw new ServletException(ex);
 }
 }

 public void init(FilterConfig filterConfig) throws ServletException {
   log.trace(Initializing filter...);
   log.trace(Obtaining SessionFactory from static HibernateUtil
 singleton...);
 sf = HibernateUtil.getSessionFactory();
 }

 public void destroy() {}

 }

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




 --
 View this message in context: 
 http://www.nabble.com/Using-validation-with-Hibernate...-tp20488996p20490241.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]



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



Re: welcome.do ignored in my web.xml

2008-11-13 Thread Wes Wannemacher
JSPs, HTML files and Servlets will work, but pointing to an action will
not. This is not a struts limitation, it was part of the spec. 

[quote servlet-2_4-fr-spec.pdf]
The Web server must append each welcome file in the order specified in
the deployment descriptor to the partial request and check whether a
static resource or servlet in the WAR is mapped to that request URI. The
Web container must send the request to the first resource in the WAR
that matches. 
[/quote]

On Thu, 2008-11-13 at 11:42 +0100, Cappelletti Marc wrote:
 Hi all,
  
 I've mapped my struts action *.do in the web.xml file and it works when
 I access a struts action directly with the URL (eg:
 http://localhost:8080/mcbc/welcome.do
 http://localhost:8080/mcbc/welcome.do )
  
 But, when I go to the root of my webapp (http://localhost:8080/mcbc/ ),
 my welcome-file-list tag, which points to a struts action welcome.do is
 ignored by tomcat. And if I put a jsp file or a servlet in this welcome
 list, it works.
  
 Does anyone have an idea of the problem?
  
 Regards
  
 Marc


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



Re: login problem

2008-11-13 Thread Diny

hi...

  I had to put role-names into my web.xml file to solve login
problem. you mentioned in ur post.. i would like to know how it is possible
and how come you are saying tat it will reduce the login problem.. if u dont
mind reply me as soon as possible.





Anet-2 wrote:
 
 Hi
 I have a problem with security-constraint in tomcat 5.5. I use struts
 1.2.
 when we used tomcat 4.1.29, there were no problem with pages needed login.
 with tomcat 5.5.17, I had to put role-names into my web.xml file to solve
 login problem.
 But now I have another problem. 
 I have a form... needs login to be accessed.
 the user logins successfully.the form is shown to him.
 (in the code, saveToken() called )
 now he fills the form,but leaves his work,=gt;his session expired...
 the user comes back.puts the submit button and redirects to login page.
 he logins...and the process of submit should be done.
 (in the code, isTokenValid(Request) called and returns false)
 it is expected to continue the process...
 I didn't have this problem while using tomcat 4.1 .
 Would you mind help me for it? I have no idea...
 thanks.
 Anet.
 
 
   
 

-- 
View this message in context: 
http://www.nabble.com/login-problem-tp17584175p20495105.html
Sent from the Struts - User mailing list archive at Nabble.com.


[s2] OGNL expression for referring to one key-value Map pair

2008-11-13 Thread Pierre Thibaudeau
Say, I have a MapString,String of the kind:

MapString, String pet = new HashMapString, String();
public MapString, String getPet() { return pet; }
public void setPet(MapString,String pet) { this.pet = pet; }

Typically, pet might contain something like:

pet.put(fr, chat);
pet.put(en, cat);

How do I refer to one of the map entries in a texfield?  What is the proper
OGNL expression?
The following doesn't seem to be understood by OGNL:

s:form
Enter the type of pet: s:textfield name=pet['en'] /
/s:form


Re: Validation causing me problems

2008-11-13 Thread Dirk Forchel


lathjer wrote:
 
 So as I am trying to figure this out, and it has brought up some
 questions.
 
 
 lathjer wrote:
 
 !-- Action to list users on a home page --
 action name=ListUsers class=net.dg.oe.user.UserAction
 method=list
 result type=tilesuser.list/result
 /action
 
 
 That mapping causes the error. When the UserAction.list() method is called
 it is looking for the input result type.
 
 So my question (or realization) is that apparently the validation
 framework depends on the class and not tied to the action name.  Is this
 correct, or am I off base?
 
 Everything I have read and researched seems to tell me that the validation
 should be tied to the action name and not the action class.  I guess I
 misunderstood.
 Hope this helps you.
 
 Thanks,
 
 lathjer
 
 
 

Using a validator (xml-based validation) in Struts 2 requires three steps:
1. determine the action whose input is to be validated (in your case the
ListUsers action with the list method)
2. write a validator configuration xml-file which must follow one of these
two patterns: ActionClass-validation.xml or
ActionClass-alias-validation.xml.
The first one is more common. This means, all methods or all actions using
this action class use the same validation rules. But there are cases where
you only want to apply validation on certain actions. For example, the
UserAction class is used with ListUsers action, with DeleteUser action and
with UserAction action (propably not a good name for an action). If all
three actions are to be validated using the same validation rules, you can
simply declare the rules in your UserAction-validation.xml. If ListUsers 
and DeleteUser use different validation rules you must create two different
validator configuration files: UserAction-ListUsers-validation.xml and
UserAction-DeleteUser-validation.xml.
3. determine where the user should be forwarded to when validation fails by
defining a input result element for each action using validation in your
struts.xml file.

In your case UserAction extends AbstractCRUDAction and the action method
ListUsers is probably defined in your AbstractCRUDAction. Therefore your
should define validation rules for this action in a configuration file
AbstractCRUDAction-ListUsers-validation.xml. 
Another useful way is using annotations for validation, but this is another
topic.
  
-- 
View this message in context: 
http://www.nabble.com/Validation-causing-me-problems-tp20471257p20495372.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]