[S2] Issue with NamedVariablePatternMatcher and ActionConfigMatcher?

2009-06-08 Thread cilquirm


Hi all,

I've been spending time with Struts 2.1.6, and the
NamedVariablePatternMatcher, and I've come across a potential issue. 

The issue comes into play when defining a class such as this :

@Namespace("/content/{year}/{month}")
public class ContentAction extends ActionSupport {

  private Integer year = null, month = null;
  private String article =  null;

  public void setYear(Integer y) { this.year = y; }
  public Integer getYear() { return this.year; }

  public void setMonth(Integer m) { this.month = m; }
  public Integer getMonth() { return this.month; }

  public void setArticle(String a) { this.article = a: }
  public String getArticle() { return this.article; }

  @Action(value = "{article}", results = { @Result(name="success", location
= "/WEB-INF/content/content.jsp" ) } , params = { "article", "{article}" } )
  public String execute() {
 // do some db stuff
 return SUCCESS;
  }

}

In this case, I'm trying to "wildcard" map all my content into a single
action, and be able to get the name of the content being matched.. 

Hence, 
http://webserver.com/myapp/content/2009/01/some-piece-of-content.action
should result in :

year - 2009
month - 1
article = some-piece-of-content
 
The problem it seems, is that while the NamespaceMatcher defers to the
NamedVariablePatternMatcher to parse out and map to parameters in the
Namespace configuration, the ActionConfigMatcher still believes it's using a
simple wildcard matcher, as it calls AbstractMatcher's convertParam, which
only checks for variable names of length ( i assume this is because it's
only looking for parameter names 1 through 9 )

I have a temporary hack where I replace AbstractMatcher with my own slightly
modified version which does it's replacement much like how
NamedVariablePatternMatcher does it ( like a simplistic state-machine )

I would open up a ticket on this but I wanted to understand if i was
possibly doing something wrong, or if I had missed another angle at it, or
better still, if there was already thinking and work done behind this.

Thanks in advance for any help you might be able to provide,

-a
-- 
View this message in context: 
http://www.nabble.com/-S2--Issue-with-NamedVariablePatternMatcher-and-ActionConfigMatcher--tp23930585p23930585.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



Re: MethodFilterInterceptor

2009-07-14 Thread cilquirm



stanlick wrote:
> 
> The logic considers the action name without regard to the package the
> action
> is contained within.
> 

I'm confused by this also.  I thought an example implied either a real-world
or contrived scenario where the problem in question manifests itself.


-- 
View this message in context: 
http://www.nabble.com/MethodFilterInterceptor-%3Cpackage%3E-tp24465361p24491255.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



RE: Struts2 Cookbook Question

2007-10-02 Thread cilquirm

There's nothing preventing you from adding back commons-beanutils or OSCore (
http://www.opensymphony.com/oscore/ ) to get back to that level of
functionality.

I'm not 100% sure why this mechanism is necessary.  If you name your getter
on your TestBean appropriately, S2 should take care of it.




Whitmire, Tracy Carroll wrote:
> 
> Your memory serves you well.  WebWork did have the appropriate class and
> method.  But I don't see it any longer.  So how are people doing it now?
> 
> Migrating an existing project from Struts1 and it seems like it would be
> a logical step in the process.  Maybe not.
> 
> 
> -Original Message-
> From: Dave Newton [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 01, 2007 2:41 PM
> To: Struts Users Mailing List
> Subject: RE: Struts2 Cookbook Question
> 
> BeanUtil, however, was part of WebWork, IIRC.
> 
> --- Rod Bollinger <[EMAIL PROTECTED]> wrote:
> 
>> BeanUtils is part of Apache Commons:
>> http://commons.apache.org/beanutils/
>> 
>> HTH,
>> -Rod
>> 
>> -Original Message-
>> From: Whitmire, Tracy Carroll
>> [mailto:[EMAIL PROTECTED]
>> Sent: Monday, October 01, 2007 13:17
>> To: user@struts.apache.org
>> Subject: Struts2 Cookbook Question
>> 
>> I'd like to use some of the information found in the cookbook
>> 
>>
> http://struts.apache.org/2.x/docs/how-do-i-populate-a-form-bean-and-get-
>> the-value-using-the-taglib.html
>> 
>> But I don't see what/where is BeanUtil.setProperties
>> 
>> Thanks in advance
>> 
>> 
>> 
>>
> -
>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Cookbook-Question-tf4549654.html#a13000112
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: ModelDriven CRUD validation failure still causes JPA update - RESOLVED

2007-10-02 Thread cilquirm

You can throw an exception , which you can specify in your 

@Transactional( rollbackFor = )

to have it rollback.



jon_french wrote:
> 
> Yes. But I am using Spring managed transactions that in my understanding 
> are outside of the struts Interceptor stack. 
> 
> My DAO's are annotated with the 
> org.springframework.transaction.annotation.Transactional annotation and 
> thus have their transactions managed as detailed here:
> 
> http://static.springframework.org/spring/docs/2.0.x/reference/transaction.html
> 
> I'm not an expert (I've only devoted a bit of time to studying the above 
> link), but it is my understanding that Spring wraps my DAO methods with 
> Aspects which control Transaction management (opening/closing).
> 
> best,
>  
> Jon French
> Programmer
> ASRC Management Services
> ECOS Development Team
> [EMAIL PROTECTED]
> 970-226-9290
> 
> Fort Collins Science Center
> US Geological Survey
> 2150 Centre Ave, Building C
> Fort Collins, CO 80526-8116
> 
> 
> 
> "Al Sutton" <[EMAIL PROTECTED]> 
> 10/02/2007 12:14 AM
> Please respond to
> "Struts Users Mailing List" 
> 
> 
> To
> "'Struts Users Mailing List'" 
> cc
> 
> Subject
> RE: ModelDriven CRUD validation failure still causes JPA update - RESOLVED
> 
> 
> 
> 
> 
> 
> Just a thought, are you actually using transactions?
> 
> If so why not modify the interceptor to only commit if a SUCCESS is 
> returned
> or perform a rollback if ERROR is returned from the action invocation.
> 
> Al.
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: 02 October 2007 04:04
> To: Struts Users Mailing List
> Subject: Re: ModelDriven CRUD validation failure still causes JPA update -
> RESOLVED
> 
> 
> OK: I've fixed the problem.
> 
> I'm not sure why this was the case, but here is what was causing the 
> problem:
> 
> In my ModelDriven action, I had a method like this:
> 
> public Collection getAllProjectTypes(){
> return this.projectTypeDao.getAll();
> }
> 
> Notice that instead of returning a simple instance reference, this method 
> actually returned the result of a JPA query (via the DAO method call).
> 
> This method was used by a struts 2 iterator tag to populate a select list 
> on the form and was thus called when my "input" JSP rendered after an 
> invalid request. 
> 
> I noticed that in the stack trace of my Oracle constraint violation, it 
> was actually this query call that was triggering the Session.flush() call 
> that was inappropriately saving the invalid entity state to the database. 
> By "pre-loading" the collection in the prepare() method like so:
> 
> public void prepare() throws Exception {
>
>this.allProjectTypes = this.projectTypeDao.getAll();
> }
> 
> public Collection getAllProjectTypes(){
> return this.allProjectTypes;
> }
> 
> ... the problematic flush() goes away.
> 
> Beats me why this matters. I'm sure a JPA guru could explain something 
> about the Transaction or EntityManager instance being different in the two 
> 
> cases, but I don't understand it yet.
> 
> Jon French
> Programmer
> ASRC Management Services
> ECOS Development Team
> [EMAIL PROTECTED]
> 970-226-9290
> 
> Fort Collins Science Center
> US Geological Survey
> 2150 Centre Ave, Building C
> Fort Collins, CO 80526-8116
> 
> 
> 
> [EMAIL PROTECTED] 
> 10/01/2007 08:29 PM
> Please respond to
> "Struts Users Mailing List" 
> 
> 
> To
> "Struts Users Mailing List" 
> cc
> 
> Subject
> Re: ModelDriven CRUD validation failure still causes JPA update
> 
> 
> 
> 
> 
> 
> Unfortunately, it appears that xworks validation works not on the 
> ServletRequest parameters, but on the properties already set on the Action 
> 
> 
> - or in my case the model bean. So moving the interceptor up the stack 
> would just break validation. 
> 
> From the com.opensymphony.xwork2.validator.ValidationInterceptor javadoc:
> 
>  * This interceptor runs the action through the standard validation 
> framework, which in turn checks the action against
>  * any validation rules (found in files such as 
> ActionClass-validation.xml) and adds field-level and action-level
>  * error messages (provided that the action implements [EMAIL PROTECTED] 
> com.opensymphony.xwork2.ValidationAware}). This interceptor
>  * is often one of the last (or second to last) interceptors applied in a 
> stack, as it assumes that all values have
>  * already been set on the action.
> 
> Thanks,
> 
> Jon French
> Programmer
> ASRC Management Services
> ECOS Development Team
> [EMAIL PROTECTED]
> 970-226-9290
> 
> Fort Collins Science Center
> US Geological Survey
> 2150 Centre Ave, Building C
> Fort Collins, CO 80526-8116
> 
> 
> 
> Dave Newton <[EMAIL PROTECTED]> 
> 10/01/2007 04:42 PM
> Please respond to
> "Struts Users Mailing List" 
> 
> 
> To
> Struts Users Mailing List 
> cc
> 
> Subject
> Re: ModelDriven CRUD validation failure still causes JPA update
> 
> 
> 
> 
> 
> 
> --- [EMAIL PROTECTED] wrote:
>> That's an in

Re: [Struts 2] : Zero Configuraiton : some feedback

2007-10-03 Thread cilquirm


I use Zero Conf and codebehind a lot, and I think they're both incredibly
useful.  especially in this newer world of convention over configuration,
etc...  When I have a package hierarchy all set up, i don't feel the need to
muck with struts.xml, because I can get directly down to coding. 

There are cases where you have to go back to struts.xml ( like wildcarding,
and being able to customize and manage interceptor refs ) , and that needs
some looking into.  

In my opinion, ZeroConf and Codebehind need to be together, and available as
a plugin, because they work so well together. This is sort of where the
smart-urls plugin  ( a great piece of work, too ) comes in.  Maybe effort
should be placed into that to plump that up and 'robusticate it' ( as my
co-worker likes to say )

In my perception of the near-future world, some additions to zc/cb or
smart-urls . some flex-json style ability for the json plugin, a bit of
guice and warp, and you've got a very easy development cycle.

-a






Zarar Siddiqi wrote:
> 
> I think the Zero Configuration idea is a nice idea but the
> implementation is far from sufficient and will probably get better
> over time (hopefully).  The problem mainly is with the limit of
> annotations.  There are things that can be  represented in struts.xml
> that have no chance of being represented via action annotations.  For
> example, package interceptors, global results, multiple execute
> methods in the same action etc. etc.
> 
> Even if you do manage to represent what you want in annotations as you
> have, it quickly turns ugly and you end up wondering why you're even
> bothering mucking up your nice and clean action bean with stuff like
> contentType, text/xml and paths to FTLs.  struts.xml is a very
> powerful little method of making your actions behave any which way you
> want and I'd even prefer it over annotations unless you're doing
> something very, very basic.
> 
> The other issue I think is the lack of the "convention over
> configuration" philosophy being used.  For example, if you have have
> an action called myAction, there's no reason why by default it
> shouldn't look like for something like myAction_success.jsp and
> myAction_input.jsp instead of having this specified by the user.  This
> idea can be extended to interceptors, global results etc.  I'm just
> blurting out what's on the top of my head but there are many more ways
> to make Zero Config better.
> 
> Thanks,
> Zarar
> 
> 
> On 10/2/07, Sami Dalouche <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> On http://struts.apache.org/2.x/docs/release-notes-209.html, I can
>> read : "Please help us test these brave new features. Feedback
>> appreciated".
>>
>> So, here is some feedback about Zero configuration :
>>
>> - the feature is pretty cool, though not much documented. For instance,
>> it was not obvious to me what the "params" parameter meant in the
>> @Result annotation, and I had to dig into the source code to understand
>> that odd indexes where the keys and even ones where the values...
>>
>> So, a freemarker view that would return XML would be described as
>> @Results( { @Result(name = "success", value =
>> "/WEB-INF/views/blabla.ftl", type = FreemarkerResult.class, params = {
>> "contentType", "text/xml" }) })
>>
>> - I have been looking for a way to specify the default package, but it
>> looks like I have to manually copy / paste the following line for my
>> actions to use the "default" package settings :
>> @ParentPackage("default")
>>
>> - And last, I am experiencing some weird problems... Basically, 9 times
>> out of 10, everything is fine, but sometimes, for no particular reason,
>> the @ParentPackage("default") line in my actions seem to have no effect
>> and the zero-conf Actions use the struts provided default stack, not the
>> one that I defined in my default package.. (either the web application
>> boots correctly and works for its whole uptime, or it doesn't work at
>> all. When it doesn't work, the only way to get it working it by
>> rebooting the web application).
>>
>> I have absolutely no idea about the reasons that could cause that...
>> Have you heard of anything similar before ?
>>
>> Regards,
>> Sami Dalouche
>>
>>
>> -
>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-Struts-2--%3A-Zero-Configuraiton-%3A-some-feedback-tf4557863.html#a13023475
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: How to improve dojo performance in Struts 2.0.9

2007-10-09 Thread cilquirm


Sorry to hijack this thread, because I fully agree with Wes that this is
good stuff to put into a wiki.
It's a little trickier with the apache wiki because you need to sign and
send over the CLA ( not terribly hard, but sometimes may not be possible. )

Any thought given to using a secondary wiki ( like Wetpaint or one of the
other myriad of services that come up when you type in wiki into the
mashable search box ) to ease the burden?


Wes Wannemacher wrote:
> 
> Jeromy,
> 
> I didn't verify that this works (because I am pretty sure it probably
> would), but have you thought about putting it in the community wiki?
> This topic comes up quite often and it would be helpful to many
> people.
> 
> -Wes
> 
> On 10/6/07, Jeromy Evans <[EMAIL PROTECTED]> wrote:
>> I thought I'd share the instructions I prepared for creating a dojo
>> 0.4.2 custom profile for Struts 2.0.9.  The objective is to bundle all
>> the required dojo resources into dojo.js to avoid the numerous slow
>> sequential requests for resources. This makes a massive performance
>> improvement to the default ajax theme.
>>
>> Instructions for improving the performance of dojo 0.4.2 in Struts 2.0.9:
>>
>> $resources$ is assumed to be your web resources directory
>>
>> 1. First, configure struts to serve the static files directly from
>> $resources$/struts instead of from within struts-core-2.0.9.jar:
>>
>> a. extract struts2-core-2.0.9.jar/org/apache/struts2/static/* to
>> $resources$/struts/
>> b. edit struts.properties and set struts.serve.static=false
>> c. also extract the javascript and css files from
>> struts2-core-2.0.9.jar/templates/* to $resources$/struts/ as this will
>> be helpful later
>>   eg. $resources$/struts/ajax/dojoRequire.js
>>
>> Confirm that your application still works before proceeding. It's
>> essential that resources are loaded from the directory rather than the
>> jar.
>>
>> 2. Download the source of dojo 0.4.2.  You won't need to modify it.  The
>> download location doesn't matter.  We assume it's in release-0.4.2/
>>
>>> svn export http://svn.dojotoolkit.org/dojo/tags/release-0.4.2
>>
>> This is almost identical to the version bundled with struts2.0.9.
>>
>> 3. Use an editor to create a dojo custom profile as the file
>> release-0.4.2/buildscripts/profiles/struts2.profile.js.  This file
>> defines which dojo resources you use directly.  Essentially it specifies
>> which code will be included in dojo.js.  An example that includes almost
>> everything is provided at the end of this email.
>>
>> 4. Copy the struts widgets into the dojo directory so they can be
>> included within dojo.js.  That is, copy $resources$/struts/dojo/struts/*
>> to release-0.4.2/struts.
>> This is the directory that contains the widget and widgets
>> subdirectories, css and some images.
>>
>> 5. Build dojo using ant.  This will create a new dojo.js file:
>>
>>  > cd release-0.4.2/buildscripts
>>  > ant -Dprofile=struts2 -Dstrip_and_compress=true clean release
>> intern-strings strip-resource-comments
>>
>> (You may be asked to run it twice).
>>
>> Pay some attention to the build process.  In particular, note whether it
>> finds the struts widgets and 'internalises' the related resources. If
>> not, see Step 4.  You'll probably notice a lot of things are included
>> that you don't need.  That will be helpful later for optimizations.
>> Some errors will occur while stripping the comments but these are ok.
>>
>> 6. When the build process completes the release directory will contain
>> all the files you need.  The content of the release directory can be
>> copied over the top of $resources$/struts/dojo.  You'll notice it's
>> almost exactly the same as the original, although dojo.js is probably
>> larger.
>>
>> It's okay to delete the demo, test and release subfolders before copying
>> to your application.  The src subfolder must be distributed with your
>> application as it contains images used by dojo.
>>
>> 7. Clear your browser cache and test your application again.  You should
>> note the larger dojo.js file being loaded and significantly fewer
>> requests for resources by dojo   Hopefully it's also a lot faster.
>>
>> That's it.  Now you can go back and optimize the profile by removing
>> resources you don't need.  There's examples in the profiles directory.
>> Repeat the build/test process to find the right balance.
>> I also recommend editing $resources$/struts/ajax/dojoRequire.js to
>> remove the reference to the Editor2 if you don't use this as it's a
>> very,very heavy-weight resource.
>>
>> Hope that helps someone else.  Improvements & comments welcome.  See
>> reference [3] below for detailed instructions and rationale.
>>
>> regards,
>>  Jeromy Evans
>>
>> Resources
>> [1] http://struts.apache.org/2.x/docs/performance-tuning.html
>> [2]
>> http://www.nabble.com/-s2--Struts-head-tag-KILLS-%28%3E-10s%29-page-load-time-tf4490390.html#a13047981
>> [3]
>> http://www.dojotoolkit.org/book/dojo-book-0-4/part-6-customizi

Re: How to improve dojo performance in Struts 2.0.9

2007-10-09 Thread cilquirm


I hadn't really started fragmenting anything  yet.  I was engaging in
conversation.

I'm not sure if you checked recently but the apache wiki is slow to get
updated.  I don't disagree that having a centralized place for it is
definitely the best route, but there's tons of information out there that
isn't in the wiki for one reason or another.  You're bound to end up
googling or going to your know spots , so the fragmentation issue is less
valid than you would presume.   I find it less about decentralization than
"re-centralization"

My whole point was to get around the barrier of entry of engaging people to
add and modify stuff.  Getting someone else to maybe do it doesn't seem like
a form of engagement.




newton.dave wrote:
> 
> --- cilquirm <[EMAIL PROTECTED]> wrote:
>> Any thought given to using a secondary wiki ( like
>> Wetpaint or one of the other myriad of services that
>> come up when you type in wiki into the mashable 
>> search box ) to ease the burden?
> 
> Please don't start fragmenting community
> documentation.
> 
> 
> 
> If a CLA can't be filed for some legal or corporate
> reason it's a simple matter to ask someone with wiki
> access.
> 
>  
> 
> d.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-improve-dojo-performance-in-Struts-2.0.9-tf4579700.html#a13126170
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] Manually obtain previous action parameters after action "chaining"?

2007-10-10 Thread cilquirm

You can, if you grab the ValueStck and traverse up it till you get to your
previous action. 



Igor Vlasov wrote:
> 
> 
> 
> I have action "one" and it calls action "two" throw:
>  two
> 
> 
> I can use ChainingInterceptor to copy properties of "one" action to "two"
> action.
> 
> I get behaviour : one.param->two.param. 
> But the property "param" must be in  javaBeans specification(have setter
> and getter method for each property).
> 
> Can i MANUALLY get object for "one" action or exact "one.property" from
> :"execute()" method of action "two"?
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Manually-obtain-previous-action-parameters-after-action-%22chaining%22--tf4601173.html#a13137301
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] Change struts-default.xml content

2007-10-24 Thread cilquirm

you can redefine it in your struts.xml, much like how you would specify the
object factory to override the default object factory .

-a



Igor Vlasov wrote:
> 
> Hello.
> I want to change some information in struts-default.xml.
> 
> I can move it to classes directoty and do any change:-)
> 
> Is there any more sofisticated method to do the same from struts.xml?
> 
> For example i want to change TextProvider:
> From 
> class="one class" />
> 
> to
>  class="another class" />
> 

-- 
View this message in context: 
http://www.nabble.com/-S2---Change-struts-default.xml-content-tf4684048.html#a13391033
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] Change struts-default.xml content

2007-10-25 Thread cilquirm

I think the problem might be that there may not be a way to configure a
different TextProvider.

Consider the object factory example, in this case guice :



  

  
  




What this does is create a bean provider with a given name of that type.  

The constant portion is actually the configuration piece.

I tried looking in the source, but I couldn't find how to configure the
textProvider.  
The two pre-configured ones both use the same class so one wouldn't note any
difference.

Maybe someone on the list can help you out more.

Apologies,
-a



Igor Vlasov wrote:
> 
> This action cause an error.
> I will write in struts.xml:
> <struts>
>   
>   <constant name="struts.enable.DynamicMethodInvocation" value="false"
> />
>   
>   <bean type="com.opensymphony.xwork2.TextProvider" name="xwork1"
> class="karakas.struts.RicoTextProvider" />
>   <bean type="com.opensymphony.xwork2.TextProvider" name="struts"
> class="karakas.struts.RicoTextProvider" />
>   <!-- Add packages here -->
>   .
> </struts>
> 
> and use the same type(com.opensymphony.xwork2.TextProvider) and the same
> name(struts) as in struts-defailt.xml 
>  Then i recieve an error in tomcat log: 
> 
> 
> Unable to load bean: type:com.opensymphony.xwork2.TextProvider
> class:karakas.struts.RicoTextProvider - bean -
> /web/WEB-INF/classes/struts.xml:10:109
> 
> Caused by: Bean type interface com.opensymphony.xwork2.TextProvider with
> the name xwork1 has already been loaded by [unknown location] - bean -
> file:/D:/projects/Karakas1.1/build/web/WEB-INF/classes/struts.xml:10:109
> 
> 
> 
> 
> cilquirm wrote:
>> 
>> you can redefine it in your struts.xml, much like how you would specify
>> the object factory to override the default object factory .
>> 
>> -a
>> 
>> 
>> 
>> Igor Vlasov wrote:
>>> 
>>> Hello.
>>> I want to change some information in struts-default.xml.
>>> 
>>> I can move it to classes directoty and do any change:-)
>>> 
>>> Is there any more sofisticated method to do the same from struts.xml?
>>> 
>>> For example i want to change TextProvider:
>>> From 
>>>>> class="one class" />
>>> 
>>> to
>>> >> class="another class" />
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2---Change-struts-default.xml-content-tf4684048.html#a13409191
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] - Types in form parameters

2007-10-25 Thread cilquirm

A failed type conversion will incur a field error as well.  




wild_oscar wrote:
> 
> 
> 
> newton.dave wrote:
>> 
>> --- wild_oscar <[EMAIL PROTECTED]> wrote:
>>> In a form I have a parameter passed like:
>>> 
>>> 
>>> 
>>> where sop is of class I created.
>>> 
>>> When I execute the action I get:
>>> 
>>> "No result defined for action myAction and result
>>> input"
>>> 
>>> Does this have to do with the fact that the variable
>>> is of a custom type (and not a string, int, etc)?
>> 
>> Not directly. Most likely it means that validation has
>> failed and S2 is attempting to take you back to the
>> form's "input" page (result).
>> 
>> 
> 
> The point is that I don't have any validation for it. 
> Debugging it I saw I had a FieldError
> 
> "Invalid field value for field oldSop".
> 
> That's why I assumed I couldn't simply send the Sop object back to the
> server.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2Types-in-form-parameters-tf4690260.html#a13409207
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: EL in tags 2.0.11

2007-10-29 Thread cilquirm


I believe this was a security fix, as there was an issue where ognl
expressions could be used to do something drastic to the application server
( like System.exit ).

I believe the expectation is that you can get around it by creating your own
customized tld or something like :




hth,
-a



Manuel Correa wrote:
> 
> In S2.09 is possible to use EL in the properties tags. For example:
> 
>  
> 
> 
> 
>  
> 
> That because the parameter in tld is rtexprvalue="true"
> 
>  
> 
> In S2.0.11   this is not possible (rtexprvalue="false"). I want to know
> is some property that active and un-active this parameter in the TLD. Or
> what is the best way to use EL in tags.
> 
>  
> 
> Thanks, 
> 
>  
> 
> Manuel
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/S2%3A-EL-in-tags-2.0.11-tf4712519.html#a13471024
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: EL in tags 2.0.11

2007-10-29 Thread cilquirm

you could do this








Basically, stuff the object into the pageContext somehow and then reference
it again via ognl.

It's a pain, but a very slight one.

-a


Manuel Correa wrote:
> 
> How I get the contextPath with OGNL?? Or the other request methods?
> 
> Manuel Correa.
> 
> -Original Message-
> From: Chris Pratt [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 29, 2007 12:17 PM
> To: Struts Users Mailing List
> Subject: Re: S2: EL in tags 2.0.11
> 
> On 10/29/07, Manuel Correa <[EMAIL PROTECTED]> wrote:
>> In S2.09 is possible to use EL in the properties tags. For example:
>>
>> 
>>
>> That because the parameter in tld is rtexprvalue="true"
>>
>> In S2.0.11   this is not possible (rtexprvalue="false"). I want to
> know
>> is some property that active and un-active this parameter in the TLD.
> Or
>> what is the best way to use EL in tags.
>>
> 
> I believe that was done as a security precaution.  Since each EL is
> processed one after the other, it made it possible for some malicious
> user of your system (with enough knowledge of the internals of your
> system) to enter a value that the JSP EL would translate into naughty
> OGNL that your system would happily translate, giving away all your
> secrets.
> 
> What I've done in my tag library (that isn't quite finished yet) is to
> set all the rtexprvalue's to false, but then check the value for
> either the ${ } or %{ } EL variables and process the value through one
> or the other, but never both, EL processors.  It seems to be working
> nicely, is very flexible and shouldn't have the same vulnerabilities
> of the previous struts 2 tags.
>   (*Chris*)
> 
> -
> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/S2%3A-EL-in-tags-2.0.11-tf4712519.html#a13474135
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] S2: EL in tags 2.0.11

2007-10-29 Thread cilquirm


I could be wrong ( and I hope I am ), but I thought the request object in
that case was just a map facade to the underlying request attributes map.

Which is why I supposed you say #request['foo'] vs.
#request.getAttribute('foo').

Same goes for session.  ( #session['foo'] vs  #session.getAttribute('foo') ) 

I just checked Dispatcher and it seems that #request and #session are
instances of RequestMap and SessionMap respectively, in which a Map wraps
the access to getAttribute.

If these were extended to have a getRequest/getSession method, then we might
be able to say 

#request.request.contextPath.





DNewfield wrote:
> 
> cilquirm wrote:
>> you could do this
>> 
>> 
>> 
>> 
>> 
>> 
> 
> Isn't the request on the valuestack?
>  should be all you need...
> 
> http://wiki.opensymphony.com/display/OGNL/OGNL+Basics
> 
> -Dale
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/S2%3A-EL-in-tags-2.0.11-tf4712519.html#a13474669
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] S2: EL in tags 2.0.11

2007-10-29 Thread cilquirm


My apologies if it was misinterpreted.  I did not say it WOULD work, I said
it would take some effort to get it to work, but that it does not work.

At this point, I believe you have a number of options :

1) You can use the method i showed you :

 



2) You can build your own custom copy of struts2 that has the tld with the
rtexpr value enabled, but be advised that you are reenabling a security
risk.


3) you can not use s2 tags, if you're that reliant on the jstl/el expression
language.


-a




Manuel Correa wrote:
> 
> page 
> 
> Didn't work! 
> 
> Have to be a way to active the EL in the Attributes..
> 
> 
> Manuel Correa.
> 
> -Original Message-
> From: cilquirm [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 29, 2007 3:17 PM
> To: user@struts.apache.org
> Subject: Re: [struts] S2: EL in tags 2.0.11
> 
> 
> 
> I could be wrong ( and I hope I am ), but I thought the request object
> in
> that case was just a map facade to the underlying request attributes
> map.
> 
> Which is why I supposed you say #request['foo'] vs.
> #request.getAttribute('foo').
> 
> Same goes for session.  ( #session['foo'] vs
> #session.getAttribute('foo') ) 
> 
> I just checked Dispatcher and it seems that #request and #session are
> instances of RequestMap and SessionMap respectively, in which a Map
> wraps
> the access to getAttribute.
> 
> If these were extended to have a getRequest/getSession method, then we
> might
> be able to say 
> 
> #request.request.contextPath.
> 
> 
> 
> 
> 
> DNewfield wrote:
>> 
>> cilquirm wrote:
>>> you could do this
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> Isn't the request on the valuestack?
>>  should be all you
> need...
>> 
>> http://wiki.opensymphony.com/display/OGNL/OGNL+Basics
>> 
>> -Dale
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/S2%3A-EL-in-tags-2.0.11-tf4712519.html#a13474669
> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/S2%3A-EL-in-tags-2.0.11-tf4712519.html#a13476195
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: javax.el.ExpressionFactory

2007-06-20 Thread cilquirm

This is most probably not related to Struts.

I can't claim to know the intrinsics of your setup but it looks like you're
missing some jars need for JSF.
It might be that you're running an older version of the J2EE stack.

javax.el.ExpressionFactory comes with J2EE 5, and is part of JSF 1.2



GEDA wrote:
> 
> Hi. I created an interceptor which extends AbstractInterceptor and
> implements StrutsStatics. Also I added it in the applicationcontext.xml of
> the Spring framework. My problem is the following and I don't know where
> to get the missing class:
> 
> Jun 20, 2007 2:32:16 PM org.apache.catalina.core.StandardContext
> listenerStart
> SEVERE: Error configuring application listener of class
> com.sun.faces.config.GlassFishConfigureListener
> java.lang.NoClassDefFoundError: javax/el/ExpressionFactory
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
> at java.lang.Class.getConstructor0(Class.java:2699)
> at java.lang.Class.newInstance0(Class.java:326)
> at java.lang.Class.newInstance(Class.java:308)
> at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3678)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)
> at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
> at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
> at
> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)
> at
> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)
> at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
> at
> org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
> at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
> at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
> at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
> at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
> at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
> at
> org.apache.catalina.core.StandardService.start(StandardService.java:450)
> at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
> Jun 20, 2007 2:32:16 PM org.apache.catalina.core.StandardContext
> listenerStart
> SEVERE: Skipped installing application listeners due to previous error(s)
> Jun 20, 2007 2:32:18 PM org.apache.catalina.core.ApplicationContext log
> INFO: Initializing Spring root WebApplicationContext
> 
> Thank you.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/javax.el.ExpressionFactory-tf3951985.html#a11217621
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: javax.el.ExpressionFactory

2007-06-20 Thread cilquirm


Did you see what happens when you take out the interceptor?

As I see it, you should still be getting this error ( since I postulate they
are unrelated :) )

If not, then this indeed is a mystery.




GEDA wrote:
> 
> Thanks anyway for your answer. 
> I have to say there are a great bunch of good guys on this forum.
> The thing is that I am not using intentionally the JSF framewrok. I just
> added an interceptor to the application. What is the problem here ?
> 
> 
> 
> cilquirm wrote:
>> 
>> This is most probably not related to Struts.
>> 
>> I can't claim to know the intrinsics of your setup but it looks like
>> you're missing some jars need for JSF.
>> It might be that you're running an older version of the J2EE stack.
>> 
>> javax.el.ExpressionFactory comes with J2EE 5, and is part of JSF 1.2
>> 
>> 
>> 
>> GEDA wrote:
>>> 
>>> Hi. I created an interceptor which extends AbstractInterceptor and
>>> implements StrutsStatics. Also I added it in the applicationcontext.xml
>>> of the Spring framework. My problem is the following and I don't know
>>> where to get the missing class:
>>> 
>>> Jun 20, 2007 2:32:16 PM org.apache.catalina.core.StandardContext
>>> listenerStart
>>> SEVERE: Error configuring application listener of class
>>> com.sun.faces.config.GlassFishConfigureListener
>>> java.lang.NoClassDefFoundError: javax/el/ExpressionFactory
>>> at java.lang.Class.getDeclaredConstructors0(Native Method)
>>> at
>>> java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>> at java.lang.Class.getConstructor0(Class.java:2699)
>>> at java.lang.Class.newInstance0(Class.java:326)
>>> at java.lang.Class.newInstance(Class.java:308)
>>> at
>>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3678)
>>> at
>>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)
>>> at
>>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
>>> at
>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
>>> at
>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
>>> at
>>> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)
>>> at
>>> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)
>>> at
>>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
>>> at
>>> org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
>>> at
>>> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
>>> at
>>> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>>> at
>>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
>>> at
>>> org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
>>> at
>>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
>>> at
>>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
>>> at
>>> org.apache.catalina.core.StandardService.start(StandardService.java:450)
>>> at
>>> org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
>>> at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at
>>> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
>>> at
>>> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
>>> Jun 20, 2007 2:32:16 PM org.apache.catalina.core.StandardContext
>>> listenerStart
>>> SEVERE: Skipped installing application listeners due to previous
>>> error(s)
>>> Jun 20, 2007 2:32:18 PM org.apache.catalina.core.ApplicationContext log
>>> INFO: Initializing Spring root WebApplicationContext
>>> 
>>> Thank you.
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/javax.el.ExpressionFactory-tf3951985.html#a11221750
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: Set a session value in the view

2007-07-03 Thread cilquirm

You should be able to do



or (I'm assuming you have access to the jstl) , you can always do 


hth,
-a


meeboo wrote:
> 
> 
> Hey all
> 
> How can I achieve something like this:
> <%session.removeAttribute("successMessage");%>
> 
> with the  tag? 
> 
> I tried  but it
> didn't work.
> 
> Thanks!
> 

-- 
View this message in context: 
http://www.nabble.com/Set-a-session-value-in-the-view-tf4018422.html#a11412923
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: Validation dies because of request param array?

2007-07-03 Thread cilquirm

Do you have struts.devMode = true?

I had the same problem and I was forced to change struts.devMode = false

I believe this is a change from 2.0.6  ( and in some regards, a worse one at
that ).

I'm still investigating it, but please try turning devMode off and seeing if
it helps.



Scott Kingdon wrote:
> 
> I am using Struts 2. I get this error whenever I turn on validation. The
> struts automatically returns the input page.
> 
> 07:42:11,349 INFO  [STDOUT] 07:42:11,349 ERROR [ParametersInterceptor]
> ParametersInterceptor - [setParameters]: Unexpected Exception catched:
> Error
> setting expression 'name' with value '[Ljava.lang.String;@188e507'
> 
> There are several parameters that are being passed in to the action. It is
> only failing in this one. I have changed the name of the parameter. But
> the
> problem persists with that name.
> 
> struts.xml action config includes this interceptor:
> 
> 
> If I remove the validation xml the problem goes away. But then I have lost
> validation. If I remove 'name' from the validation in the xml the problem
> is
> still there. That is, even if there is no mention of the 'name' parameter
> in
> the validation xml, I still get the error.
> 
> I have other Actions that are configured the exact same way and work just
> fine.
> 
> I have tried rebuilding from scratch. No fix there.
> 
> It looks like somehow there is are two 'name' parameters being sent in. So
> struts is handling it with an array. To ensure this is struts I have sent
> requests to the server by pasting the url in the browser with only one
> name
> paramater. I still get the error.
> 
> I feel like I have done everything but the one thing that will work.
> g!
> 
> Any ideas?
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Validation-dies-because-of-request-param-array--tf4018521.html#a11413408
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: Validation dies because of request param array?

2007-07-03 Thread cilquirm


I should correct myself. My problem may not be related, since it was due to
the CookieInterceptor's handling of setValue.

Can you post your pojo and your query string?



cilquirm wrote:
> 
> Do you have struts.devMode = true?
> 
> I had the same problem and I was forced to change struts.devMode = false
> 
> I believe this is a change from 2.0.6  ( and in some regards, a worse one
> at that ).
> 
> I'm still investigating it, but please try turning devMode off and seeing
> if it helps.
> 
> 
> 
> Scott Kingdon wrote:
>> 
>> I am using Struts 2. I get this error whenever I turn on validation. The
>> struts automatically returns the input page.
>> 
>> 07:42:11,349 INFO  [STDOUT] 07:42:11,349 ERROR [ParametersInterceptor]
>> ParametersInterceptor - [setParameters]: Unexpected Exception catched:
>> Error
>> setting expression 'name' with value '[Ljava.lang.String;@188e507'
>> 
>> There are several parameters that are being passed in to the action. It
>> is
>> only failing in this one. I have changed the name of the parameter. But
>> the
>> problem persists with that name.
>> 
>> struts.xml action config includes this interceptor:
>> 
>> 
>> If I remove the validation xml the problem goes away. But then I have
>> lost
>> validation. If I remove 'name' from the validation in the xml the problem
>> is
>> still there. That is, even if there is no mention of the 'name' parameter
>> in
>> the validation xml, I still get the error.
>> 
>> I have other Actions that are configured the exact same way and work just
>> fine.
>> 
>> I have tried rebuilding from scratch. No fix there.
>> 
>> It looks like somehow there is are two 'name' parameters being sent in.
>> So
>> struts is handling it with an array. To ensure this is struts I have sent
>> requests to the server by pasting the url in the browser with only one
>> name
>> paramater. I still get the error.
>> 
>> I feel like I have done everything but the one thing that will work.
>> g!
>> 
>> Any ideas?
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Validation-dies-because-of-request-param-array--tf4018521.html#a11413932
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] how to configure Spring's OpenViewInSessionInterceptor for struts2

2007-07-09 Thread cilquirm

I think you may be confusing Struts2 (S2) interceptors with Spring
Interceptors.
The two are not the same.

S2 interceptors provide some "aop-like" functionality by allowing code to
modify request processing in some fashion; however it's not truly based
around an aop standard ( i.e. aopallliance ) ( s2 devs, please feel free to
correct and chide me. )

The OpenSessionInViewInterceptor ( OSVI ) is an analog to the
OpenSessionInViewFilter (OSVF), but I belive it's primarily used for
SpringMVC ( and possibly related, like Grails ).

OSVF is more generic and designed to be used in a larger number of
frameworks.
I believe, in this case, what you probably want is the filter.

hth,
-a






panpan wrote:
> 
> Thank you Toni for your example.
> I'm just wondering about the OpenViewInSessionInterceptor. Don't know how
> to configure it in struts2.
> 
> Thanks again!
> 
> 
-- 
View this message in context: 
http://www.nabble.com/-S2--how-to-configure-Spring%27s-OpenViewInSessionInterceptor-for-struts2-tf4050042.html#a11506464
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: RE : Orthognal OGNL!

2007-07-09 Thread cilquirm

the easiest solution would be to s:set the property name you want to
reference with a different name



and then access it in your loop under the new name.



 





stanlick wrote:
> 
> There is no searching up the stack beyond the top?
> 
> On 7/9/07, Dave Newton <[EMAIL PROTECTED]> wrote:
>>
>> --- Big Stick <[EMAIL PROTECTED]> wrote:
>> > But it's a property on the Action!
>>
>>  pushes each iteration onto the value
>> stack. So what's at the top then? Not the action (or
>> model), but each element of the iteration.
>>
>> d.
>>
>>
>>
>>
>>
>> 
>> Be a better Heartthrob. Get better relationship answers from someone who
>> knows. Yahoo! Answers - Check it out.
>> http://answers.yahoo.com/dir/?link=list&sid=396545433
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> Scott
> [EMAIL PROTECTED]
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Orthognal-OGNL%21-tf4048748.html#a11506986
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] how to configure Spring's OpenViewInSessionInterceptor for struts2

2007-07-09 Thread cilquirm

Assuming your S2 actions are 'pathed' differently ( i.e. s2 actions are
mapped to .action , while s1 actions are mapped to .do ), then specifying
the url pattern only for s2 actions ( /*.action ) will have the intended
effect.

As far as side effects go, it's really dependent on your application.  The
ones they mention on the docs relate to  moving an application that hasn't
been using open session in view to that pattern.  You may have objects that
you keep around for a long time ( i.e.  in a  http session ), which you then
reattach to the session when you want to do do work against it.  When you
have ad-hoc session management, you might have gotten away with
reattaching/detaching/flushing/updating whenever you feel like it because
you're creating a new hib session whenever you need to..  

With OSFV, since the session is already created upon request, you may end up
with a couple exceptions because the session is always there and those
operations ( depending on when you do it, and in what order ) may throw
exceptions.  

At best I can tell you, as the docs do, is to minimize the objects you keep
around for a while.  For those that you do, reattach them early on, and
watch your transaction boundaries.  

Ask away if you have particular questions :-)

hth,
-a

panpan wrote:
> 
> Thank you cilquirm. I think i'm a little bit confused and the filter is
> the one I needed.
> There is one thing which is unclear to me. If I only apply the filter to
> the new developed struts2 action, it will not affect the rest existed
> application(struts1), right? I saw there are some side effect of using the
> OSVF in the Spring docs. Do you have any good idea how to avoid those side
> effects?
> Thanks again!
> 
>  
> 
> 
> cilquirm wrote:
>> 
>> I think you may be confusing Struts2 (S2) interceptors with Spring
>> Interceptors.
>> The two are not the same.
>> 
>> S2 interceptors provide some "aop-like" functionality by allowing code to
>> modify request processing in some fashion; however it's not truly based
>> around an aop standard ( i.e. aopallliance ) ( s2 devs, please feel free
>> to correct and chide me. )
>> 
>> The OpenSessionInViewInterceptor ( OSVI ) is an analog to the
>> OpenSessionInViewFilter (OSVF), but I belive it's primarily used for
>> SpringMVC ( and possibly related, like Grails ).
>> 
>> OSVF is more generic and designed to be used in a larger number of
>> frameworks.
>> I believe, in this case, what you probably want is the filter.
>> 
>> hth,
>> -a
>> 
>> 
>> 
>> 
>> 
>> 
>> panpan wrote:
>>> 
>>> Thank you Toni for your example.
>>> I'm just wondering about the OpenViewInSessionInterceptor. Don't know
>>> how to configure it in struts2.
>>> 
>>> Thanks again!
>>> 
>>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--how-to-configure-Spring%27s-OpenViewInSessionInterceptor-for-struts2-tf4050042.html#a11507548
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: RE : Orthognal OGNL!

2007-07-09 Thread cilquirm


technically, if you knew the index of where the action was in your value
stack, you could use the index notation.
so you might want to try :



assuming the action is the second root down.

but i do agree that'd it be nice to stuff the action into #action.


Chris Pratt wrote:
> 
> Seems like you should be able to say
> 
> 
> 
> But since there's no getAction in the ActionContext, I doubt that will
> work.  Maybe it should be added?
>   (*Chris*)
> 
> On 7/9/07, cilquirm <[EMAIL PROTECTED]> wrote:
>>
>>
>> the easiest solution would be to s:set the property name you want to
>> reference with a different name
>>
>> 
>>
>> and then access it in your loop under the new name.
>>
>> 
>>
>> 
>>
>> 
>>
>>
>>
>> stanlick wrote:
>> >
>> > There is no searching up the stack beyond the top?
>> >
>> > On 7/9/07, Dave Newton <[EMAIL PROTECTED]> wrote:
>> >>
>> >> --- Big Stick <[EMAIL PROTECTED]> wrote:
>> >> > But it's a property on the Action!
>> >>
>> >>  pushes each iteration onto the value
>> >> stack. So what's at the top then? Not the action (or
>> >> model), but each element of the iteration.
>> >>
>> >> d.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> 
>> >> Be a better Heartthrob. Get better relationship answers from someone
>> who
>> >> knows. Yahoo! Answers - Check it out.
>> >> http://answers.yahoo.com/dir/?link=list&sid=396545433
>> >>
>> >> -
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> > --
>> > Scott
>> > [EMAIL PROTECTED]
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Orthognal-OGNL%21-tf4048748.html#a11506986
>> 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/Orthognal-OGNL%21-tf4048748.html#a11507650
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] how to configure Spring's OpenViewInSessionInterceptor for struts2

2007-07-09 Thread cilquirm



panpan wrote:
> 
> The session is open, why do I need to reattach them?
> 

You wouldn't need to if you loaded and discarded your objects in a single
request, but let's say you have objects that lived around longer than a
single request ( i.e., a User object in your http session ).   You might
have  reattached this object to the session every time you wanted to make a
modification to it, because you were creating hibernate sessions on the fly. 
With OSFV,  you might end up with errors because after the first time, the
object is already attached to the session.  

That's probably the most common use case.


panpan wrote:
> 
>  And could you please be more specific about the 'watch transaction
> boundaries'. Sorry, that might be stupid questions.
> 

What i meant by watch transaction boundaries is simply take note where and
how you decide to mark off a transaction.  For example, if you weren't using
Spring's declarative ( or aop-based ) transaction management, you might have
a session.beginTransaction() in one method, and a session.endTransation() in
another method.  If you were creating hib sessions on the fly, if you rolled
back, you can simply wipe out your session and create a new one and go on
your (relatively) merry way.  With OSFV, that session that you rolled back
against is still there, so maybe your objects that you haven't persisted are
not in the db, but still associated with a session.The same thing can
obviously occur with Spring's transaction management as well, but at the
heart of it, I meant that's something to keep in mind.



panpan wrote:
> 
> Really appreciate your help and time.
> 

Always a pleasure.

-a
-- 
View this message in context: 
http://www.nabble.com/-S2--how-to-configure-Spring%27s-OpenViewInSessionInterceptor-for-struts2-tf4050042.html#a11508627
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] Servlet-Config Interceptor Bug?

2007-07-09 Thread cilquirm

The session object is wrapped by a SessionMap, so every time you do a put or
remove, the appropriate underlying method on the session is called.

So, in a nutshell, no, nothing to worry about.
Like most of struts2, it just works :-)

-a




Hoying, Ken-2 wrote:
> 
> I am currently utilizing the Servlet-Config Interceptor in order to
> manage HTTPSession attributes as advised in the following document:
>   
> http://struts.apache.org/2.x/docs/how-do-we-get-access-to-the-session.ht
> ml
> 
> The document states that this is preferred and that:
>   "Any changes made to the session Map are reflected in the actual
> HttpSessionRequest. You may insert and remove session attributes as
> needed."
> 
> This appears to be working.  However if I look at the source code for
> the interceptor, I do not see where it is explicitly calling the
> setAttribute() and removeAttribute() methods.  My question is don't
> these methods not need to be called in order for the Session Binding to
> work and for any container management of sessions to work?  Is STRUTS2
> maybe manageing the map it returns to ensure that this is happening or
> is this a bug that I need to be aware of and code for?
> 
> Thanks,
> 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.
> 

-- 
View this message in context: 
http://www.nabble.com/RE%3A--S2--Servlet-Config-Interceptor-Bug--tf4051319.html#a11511404
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 performance

2007-07-10 Thread cilquirm

I've found that static html pages are blazing fast, especially those that
don't involve stylesheets, images, or javascript includes.  :-)

Seriously, though, I don't think there's any disagreement that ognl ( or any
runtime expression language ) adds a certain amount of overhead, but I've
never seen any of my servers pinned that high, and I've been working with
WW2/S2 for probably around 3 years now. 

At the end of the day, I can argue to my company that we'll get faster
performance by switching to servlets and straight jsp, but I don't want to
be the one debugging that when it all goes to pot. I'm all for the minor
tradeoff on performance for the incredibly superior gains in productivity
and general developer happiness that S2 affords me.

my2c, 
-a

P.S.  One thing you can do, if you're so inclined once you've tried out the
other performance tips, is to give ognl 2.7 a go.  You can get it via the
Tapestry libs download.  It's a straightforward replacement, just drop in 
ognl.jar and javassist.jar and start up.  

I've done it here and it hasn't really changed my perception of my webapp
but YMMV



climbingrose wrote:
> 
> Hi all,
> 
> I've been developing Struts 2 webapp for nearly a year now and have a
> great
> deal of experience with it. Personally, the architecture of Struts 2 is
> much
> cleaner than its predecessor. However, recently I converted one of my
> Struts
> 2 pages into Servlet + JSP solution and it turns out that Struts 2
> performance is much worse than Servlet + JSP. In Servlet + JSP solution,
> the
> server CPU is barely over 3-4% while with Struts 2, it's around 70% most
> of
> the time. The JSP page is around 300 lines of code. I don't have a chance
> to
> do any profiling to find out where is the bottleneck but I suspect it
> might
> be OGNL which hinders the performance. I think, we already have a pretty
> good feature set so we can start thinking about optimising Struts 2. That
> will probably speed up its adoption in the industry.
> 
> 
> 
> The other thing I want to comment on is the use of Dojo as Ajax theme. I
> don't have much experience with Dojo apart from a few hours playing around
> with it. However, even with the latest version (0.9), Dojo just seems to
> be
> to heavy weight for most purposes. I mean if you only want a bloody
> calendar
> in your webapp, you don't want to load up a 100kb of  javascript. Plus, it
> might be my experience only, Dojo seems to have the tendency to hang my
> browser everytime I open a Dojo-based app.
> 
> -- 
> Regards,
> 
> Cuong Hoang
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-performance-tf4053401.html#a11524619
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 performance

2007-07-12 Thread cilquirm

Frank, would you care to give the same tests a shot with  ognl 2.7 and
javassist in the mix.

Although none of this is purely scientific, at least evaluations on that
regard give us some level of subjective information.
 
The ognl 2.7 and javassist jar are available via the tapestry-4.2-libs
download :

http://tapestry.apache.org/download.html





Frank W. Zammetti wrote:
> 
> Dunno if this might help, but:
> 
> http://www.omnytex.com/struts_benchmarking.zip
> 
> In it you'll find two applications, one for S1 (1.3.8) and one for S2 
> (2.0.8)... they are both (I think!) pretty much equivalent, and about as 
> simplistic as you can get.  Also included is a JMeter test plan to run 
> against them (just disable one or the other thread group, wouldn't want 
> to test them both at the same time!).
> 
> Just ran a quick-and-dirty comparison of the two using the test plan... 
> I ran 100 users with no ramp-up... local Tomcat instance (6.0.13)... the 
> one difference is that the S1 version was compiled with JDK 1.4.2, and 
> the S2 version with 1.6.0, so there's at least one potentially big 
> variance right up front... here's what I saw:
> 
> S1 results:
> 4256 samples, 913 average, 108.6/sec throughput, 16.01 KB/sec
> 
> S2 results:
> 4165 samples, 1974 average, 50.0/sec throughput, 7.38 KB/sec
> 
> I'm not claiming this to be the perfect test, nor do I believe there's 
> not some flaws in there (benchmarking is always a tough thing to get 
> quite right, especially trying to do a comparison like this)... but, 
> unless someone can point out some obvious mistakes I made, the numbers 
> don't lie: S2 *looks*, *on the surface* at least, to be inherently twice 
> as slow as S1.
> 
> I'm not trying to make any sensational claims here, and again, I may 
> have totally blown it in the first place (I did throw this together in 
> about 30 minutes after all), but if we can use this as a basis going 
> forward, maybe build it up as a more expansive, realistic and solid 
> benchmarking suite, then it's all good in the end.
> 
> Anyway, it's there, if anyone's interested.
> 
> Frank
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM/Yahoo: fzammetti
> MSN: [EMAIL PROTECTED]
> Author of "Practical Ajax Projects With Java Technology"
>   (2006, Apress, ISBN 1-59059-695-1)
> and "JavaScript, DOM Scripting and Ajax Projects"
>   (2007, Apress, ISBN 1-59059-816-4)
> Java Web Parts - http://javawebparts.sourceforge.net
>   Supplying the wheel, so you don't have to reinvent it!
> 
> Ing. Andrea Vettori wrote:
>> 
>> Il giorno 12/lug/07, alle ore 16:31, Guillaume Carré ha scritto:
>> 
>>> 2007/7/12, Ing. Andrea Vettori <[EMAIL PROTECTED]>:
 Compared to nothing... they are pure numbers. They are simply just
 good enought (to me).

 If we don't have this in mind we should use assember for everything :)
>>>
>>> what I meant was: maybe it could be a good idea to redevelop your
>>> screens with, say struts 1 for example, and compare the results
>> 
>>  I can't do that... simply don't have the time... :)
>> 
>> 
 In the high load test, after 10 seconds you have about 90 users (the
 other 10 should have finished). Having a response time of 2,5 seconds
 for a db search and result display under such load seems very good to
 me.

 Don't you ?
>>>
>>> it depends :-)
>>>
>>> "2.5s" doesn't say much to me, I would need to know how much time is
>>> consumed in your DB requests, how much time is consumed in your
>>> service layer, etc etc.
>>>
>>> Is it 90 users really active at the same time, meaning using 90
>>> threads on the server?if it is, do you have at least 90 connections in
>>> your pool?
>>> or did you put think times in your tests?
>> 
>> 
>> 
>> No think time...
>> 
>> I have 250 threads but I have a limit of 50 connections on my pool. I'll 
>> try to raise
>> the number of maximum connection to see if the MP3 list test gets better.
>> 
>> However I think that struts alone is performing well for my app; don't 
>> know if it's because
>> i'm using only few OGNL expressions on my jsp pages.
>> 
>> -- 
>> Ing. Andrea Vettori
>> Consulente per l'Information Technology
>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
>> 
>> 
>> --No virus found in this incoming message.
>> Checked by AVG Free Edition.Version: 7.5.476 / Virus Database: 
>> 269.10.4/897 - Release Date: 7/11/2007 9:57 PM
>> 
>> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-performance-tf4053401.html#a11568260
Sent from the Struts - User mailing list archive at Nabble.com.


---

Re: Struts 2 performance

2007-07-12 Thread cilquirm

for my sake, i hope it's still 1.5.

i'm not allowed to go near 1.6 because of some obscure bug in some oracle
driver somewhere.



Ted Husted wrote:
> 
> Are we targeting 1.6 now, or is the S2 target platform still 1.5?
> 
> -T.
> 
> On 7/12/07, James Holmes <[EMAIL PROTECTED]> wrote:
>> Perfect! This is an excellent start.
>>
>> I think both should be compiled with 1.6.0. That will immediately remove
>> that
>> element of difference between the two.
>>
>> James
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-performance-tf4053401.html#a11568292
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: Configuring Struts with eclipse

2007-07-12 Thread cilquirm

It's relatively easy.

You want the WTP  ( unless you're using some customized version like
MyEclipse, at which point, I can't help ).

a) Create a Dynamic Web Project.
b) Set up your Server Runtime (1) (2)
c) Drop your jars into WebResources/WEB-INF/lib  (3)(4)
4) write up your struts.xml :



http://struts.apache.org/dtds/struts-2.0.dtd";>











5) set up your web.xml :


http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>


struts

org.apache.struts2.dispatcher.FilterDispatcher


actionPackages
com.thestreet.web.actions




struts
/*





6) happy coding.

hth,
-a

(1) if you're using Eclipse Europa 3.3, you can use the J2EE preview to run
an embedded version of jetty so you don't even need an external runtime.
(2) certain servers, like glassfish and geronimo, can actually be installed
directly from this setup screen.
(3) at the very least you'll need the struts2-core, ognl, commons-logging,
xwork, 
(4) fwiw, I like to use the codebehind plugin ( or at your leisure, use the
smarturls plugin )




umeshawasthi wrote:
> 
> HI All,
> Can any body tell me how can i configure Struts in Eclipse i am using
> Eclipse 3.2.2 .How can i start a struts project in the Eclipse.Any help
> will be much appriciated.
> 
> thanks
> --umesh :(
> 

-- 
View this message in context: 
http://www.nabble.com/Configuring-Struts-with-eclipse-tf4069766.html#a11568684
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 + Spring 2 + JPA + AJAX Tutorial

2007-07-17 Thread cilquirm

By the looks of it, your classpath is messed up.

Is the hibernate3 jar in the right place?

I can't think of any other reason it wouldn't be able to find
org.hibernate.MappingNotFoundException



LucaLuca wrote:
> 
> Hi,
> 
> I've tried to make some changes to make it work..But nothing!. These are
> my configuration files:
> 
> ---"ApplicationContext.xml":---
> 
> 
>xmlns="http://www.springframework.org/schema/beans";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:aop="http://www.springframework.org/schema/aop";
> xmlns:tx="http://www.springframework.org/schema/tx";
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
> http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";>
> 
> 
>  class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
> />  
>class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
>   
>   
>   
>  
>   
> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 
>  value="jdbc:mysql://localhost:3306/quickstart" />
> 
> 
> 
> 
> 
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
>
>   
>  class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> 
>
>   
> 
> 
> 
> 
>   
>  class="org.springframework.orm.jpa.JpaTransactionManager">
>  />
>   
> 
> 
>   
>   
>  class="quickstart.action.PersonAction">
> 
> 
> 
> 
> 
> ---"Web.xml"---
> 
> 
> http://java.sun.com/xml/ns/j2ee";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
> quickstart
> 
> struts2
> 
> org.apache.struts2.dispatcher.FilterDispatcher
> 
> 
> 
> 
> struts2
> /*
> 
> 
> 
> 
> org.springframework.web.context.ContextLoaderListener
> 
> 
> 
>  
> index.jsp
> 
>  
> 
> 
> 
> --"Struts.xml"--
> 
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd";>
> 
>
> 
> 
>  class="quickstart.action.PersonAction">
> pages/list.jsp
> pages/list.jsp
> 
> 
>  method="remove">
> pages/list.jsp
> pages/list.jsp
> 
> 
>  method="save">
> pages/list.jsp
> pages/list.jsp
> 
> 
> 
> 
> 
> --"Struts.properties"--
> 
> struts.objectFactory = org.apache.struts2.spring.StrutsSpringObjectFactory
> struts.devMode = true
> struts.enable.DynamicMethodInvocation = false
> struts.objectFactory.spring.autoWire = type
> 
> 
> ---This is my Stack error trace...:---
> 
> 
> 
> GRAVE: Context initialization failed
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'entityManagerFactory' defined in ServletContext resource
> [/WEB-INF/applicationContext.xml]: Invocation of init method failed;
> nested exception is java.lang.NoClassDefFoundError:
> org/hibernate/MappingNotFoundException
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1178)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:407)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:255)
> at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:252)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:247)
> at
> org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:257)
> at
> org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:121)
> at
> org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.(PersistenceExceptionTranslationInterceptor.java:77)
> at
> org.springframework.dao.annotation.Per

Re: Open Source Struts Dating Application

2007-07-18 Thread cilquirm


I think you have to 'know' somebody to get it incubated.  i.e.  Just because
you're offering, doesn't mean they'll bite.  (And I don't mean that in a bad
way, either.  )

Check out the incubation docs for more info :

http://incubator.apache.org/incubation/Incubation_Policy.html

Barring that, you're free to open it up to the world on sourceforge,
dev.java.net, or googlecode.

I do think that having an advanced application is a good real-world testbed
for a whole slew of things.

I'm assuming it's an S1 app?

-a




Strut Date wrote:
> 
> Hi
>
>   I have been writing a Struts based dating application for the last 2
> years, and would like to explore the possibility of contributing this to
> the Apache SW Foundation.  I wondered whether this would be possible, and
> if so, what would be involved / who I should contact.  
>
>   Functionality Includes
>
>   - Buddylists / Hotlists
>   - Date Search (Zip & City Based)
>   - Webmail
>   - Integration to Instant Messaging (Userplane)
>   - Photo Management 
>   - Profile Management
>   - Log4J Loging
>
>   There are many areas in which the application could be improved, and
> extended into a broader social space application.  Any comments would be
> appreciated. 
> 
>
> -
> Got a little couch potato? 
> Check out fun summer activities for kids.
> 

-- 
View this message in context: 
http://www.nabble.com/Open-Source-Struts-Dating-Application-tf4105619.html#a11678962
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: FieldExpressionValidator: How do I reference field names?

2007-07-18 Thread cilquirm

That's a mouthful.

OGNL does have an 'in' operator

customer.creditCards[0].type in [ 'AMERICAN_EXPRESS', 'VISA', 'DISCOVER' ,
'MASTERCARD']

note that you don't have to do toString() if type is already a string ;
ognl's equality operator ( == ) already uses equals.

If it's not of type String, you might try projection :

[ 'AMERICAN_EXPRESS', 'VISA', 'DISCOVER' , 'MASTERCARD'].{? #this.equals(
customer.creditCards[0].type ) }.size() > 0 
 



Musachy Barroso wrote:
> 
> Looks ok, here is one that I have:
> 
> 
> 
> 
> 'AMERICAN_EXPRESS'.equals(customer.creditCards
> [0].type.toString())
> || 'VISA'.equals(customer.creditCards[0].type.toString())
> || 'DISCOVER'.equals(customer.creditCards
> [0].type.toString())
> || 'MASTERCARD'.equals(customer.creditCards
> [0].type.toString())
> 
> Credit Card Type must be American Express, Visa,
> MasterCard, Discover
> 
> 
> 
> //is ther an "in" operator in OGNL?
> 
> musachy
> 
> On 7/18/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>>
>> That didn't work - how about this: http://rafb.net/p/cmnEKB18.html
>>
>>
>> mraible wrote:
>> >
>> > Looks like Nabble was escaping my HTML - let's try again with HTML
>> Format
>> > checked:
>> >
>> > 
>> > 
>> > true
>> > Reason is required.
>> > 
>> > 
>> >
>> > 
>> > 
>> > friendEmail
>> > reason.equals('friend') and friendEmail == null
>> > Please provide your friend's email
>> > 
>> >
>> > 
>> > 
>> > 
>> > reason.equals('friend') and friendEmail == null
>> > Please provide your friend's email
>> > 
>> > 
>> >
>> >
>> > Musachy Barroso wrote:
>> >>
>> >> I've read this like 10 times just to make sure I'm not missing
>> something,
>> >> but:
>> >>
>> >>  
>> >>friendEmail
>> >>reason.equals('friend') and friendEmail == null
>> >>Please provide your friend's email
>> >>
>> >>
>> >>
>> >> why is "friendEmail" in the expression?(should be "
>> >> reason.equals('friend')
>> >> and friendEmail == null" right?)
>> >>
>> >> musachy
>> >>
>> >> On 7/18/07, mraible <[EMAIL PROTECTED]> wrote:
>> >>>
>> >>>
>> >>> I'm trying to use a FieldExpressionValidator (or ExpressionValidator)
>> to
>> >>> compare fields. Unfortunately, it doesn't seem to be working. I have
>> a
>> >>> radio
>> >>> button (named "reason") and a text field named "friendEmail". If the
>> >>> selected radio has a reason of "friend", I want to require the text
>> >>> field.
>> >>> However, the expression "reason.equals('friend') and friendEmail ==
>> >>> null"
>> >>> doesn't seem to work. Is this expression syntax correct, or do I have
>> to
>> >>> do
>> >>> something additional to get a handle on the "reason" and
>> "friendEmail"
>> >>> values?
>> >>>
>> >>> 
>> >>> 
>> >>> true
>> >>> Reason is a required field.
>> >>> 
>> >>> 
>> >>>
>> >>> 
>> >>> friendEmail
>> >>> reason.equals('friend') and friendEmail == null
>> >>> Please provide your friend's email
>> >>> 
>> >>>
>> >>> I've also tried the following, but no dice:
>> >>>
>> >>> 
>> >>> 
>> >>> reason.equals('friend')
>> >>> Please provide your friend's email
>> >>> 
>> >>> 
>> >>>
>> >>> Thanks,
>> >>>
>> >>> Matt
>> >>> --
>> >>> View this message in context:
>> >>>
>> http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11673436
>> >>> Sent from the Struts - User mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>> -
>> >>> 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
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11677727
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> 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
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11679100
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: HashMap - from jsp to action

2007-08-09 Thread cilquirm

the way to construct a map in ognl is 

%{ key : value , key : vale } 



http://www.opensymphony.com/ognl/html/LanguageGuide/collectionConstruction.html#mapConstruction

hth,
-a



Hartrich, James CTR USTRANSCOM J6 wrote:
> 
> I'm iterating a collection (keys) from s:action to get corresponding
> hashmap (values) from aforementioned s:action then creating multiple
> s:select.
> 
>  
> 
> Does anyone know how to construct a hashmap with ognl on a jsp? What
> type is then needed on the action to populate the hashmap? 
> 
>  
> 
>  
> 
> James
> 
>  
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/S2%3A-HashMap---from-jsp-to-action-tf4238260.html#a12082014
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: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread cilquirm

In my experience, just having OSIV doesn't automatically imply that you
expect all your data to be retrieved ad-hoc. (maybe the users do :) 

  OSIV doesn't prevent the user from using eager fetching when necessary or
useful ( and my experience delays it until your application is working and
you're onto improving performance ).  There's no reason I still can't
Hibernate.initialize() or  fetch join when I want to bring down the number
of round-trips to the database.   OSIV does provide a big boost ( to me, at
least ) in being able to do rapid turn-around development.


Toni Lyytikäinen wrote:
> 
> Lazy initialization is to boost performance. The problem is that it
> doesn't
> apply to all cases. In cases where you have to iterate over a list of
> objects and those have lazy loading properties that you need, it will
> generate a lot of extra queries to to database. In those cases it's best
> to
> use eager loading to fetch the properties. However, if you eager load too
> many properties, the queries will become slow because of the joins. So
> it's
> all about finding a good balance that fits you database schema. In order
> to
> find the balance monitor the amount of queries your actions make, and the
> time it took to execute the queries. In some simple database schemas OSIV
> can be avoided but with complex schemas this isn't always the case.
> 
> On 8/22/07, hezjing <[EMAIL PROTECTED]> wrote:
>>
>> This is something new to me, I always thought that lazy initialization
>> is to boost performance. So we should really use eager fetching by
>> default and minimize the use of OSIV.
>>
>>
>> On 8/22/07, Toni Lyytikäinen <[EMAIL PROTECTED]> wrote:
>> > "And, is there a better alternative than using
>> > OpenSessionInViewInterceptor?"
>> >
>> > Yes. It's important to realise that while OpenSessionInView feels very
>> > handy, it is not a particularly nice design pattern, as it can stress
>> your
>> > database with lots of small queries. It's best to learn how to do eager
>> > fetching with Hibernate and use it for most cases and rely on OSIV only
>> in
>> > some special cases where eager fetching is not possible. This way it's
>> often
>> > possible to build entire web applications without resorting to use
>> OSIV.
>> >
>>
>>
>> --
>>
>> Hez
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Configuring-OpenSessionInViewInterceptor-as-S2%27s-interceptor-tf4310239.html#a12278172
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.0.9] Is there a better way to do this...

2007-09-06 Thread cilquirm


Al Sutton-4 wrote:
> 
> Hi Richard,
> 
> Thanks for the pointer.
> 
> I'm using 2 actions because my current belief is that using a single
> action
> would cause problems with result names because you can't define separate
> SUCCESS results for the form prep and the form submission if you only have
> one action (or have I misunderstood the docs?).
> 
> 

You can have a single action with multiple execution methods that return the
same result name to different result values.  i.e.

public class MyAction extends ActionSupport {

  public String prep() {
...
   return SUCCESS;

  public String submit() {
... 
return SUCCESS;
  }
}

could be defined as 


  
/my/dir/myjsp1.jsp
  
  
/my/dir/myjsp1.jsp
  




Al Sutton-4 wrote:
> 
> 
> Isn't using the Prepareable interface on the submission action
> inefficient?,
> I can see it's an option for the list population action, but wouldn't the
> database be queried unnecessarily when the form is submitted with no
> errors
> because the action class gets the list from the database in the prepare
> method?
> 
> Al.
> 
> 

I think what Richard is suggesting is something akin to this  :

public class AwesomeAction extends ActionSupport implements Preparable {
  
  List awesomeList;
  AwesomeService awesomeService;
 

  public void prepare() {
 
 awesomeList = awesomeService.getList();
  }
  
  public string prep() {
 return SUCCESS;
  }

  public String submit() {
 [ do checks ]
 if ( !everythignChecksOut )  return INPUT; 
 return SUCCESS;
  }
}

In such a scenario, yes, prepare would be called on the submission.   You
can work around it in this manner.

public class AwesomeAction extends ActionSupport implements Preparable {
  
  List awesomeList;
  AwesomeService awesomeService;
 

  public void preparePrep  /* how droll! */ () {  
 
 awesomeList = awesomeService.getList();
  }
  
  public string prep() {
 return SUCCESS;
  }

  public String submit() {
 [ do checks ]
 if ( !everythignChecksOut )  {
 preparePrep();
 return INPUT; 
 }
 return SUCCESS;
  }
}

HTH,
-a


Al Sutton-4 wrote:
> 
> 
> 
> -Original Message-
> From: Richard Sayre [mailto:[EMAIL PROTECTED] 
> Sent: 06 September 2007 13:33
> To: Struts Users Mailing List
> Subject: Re: [s2.0.9] Is there a better way to do this...
> 
> 
> I use the prepare method to populate my lists.  See the Prepareable
> interface.I also would put this in Action B.  Is there a specific
> reason why you are using 2 actions?
> 
> On 9/6/07, Al Sutton <[EMAIL PROTECTED]> wrote:
>> Here's a problem I've come across a couple of times and the solution I 
>> have feels clunky so I thought I'd throw it out to see if anyone has 
>> any better ideas;
>>
>> I have a form which has a s:select populated from a Map of objects 
>> which come from a database, at the moment I'm doing the following;
>>
>> 1) Action A gets the list from the database
>> 2) A .JSP displays the form with the s:select and submits to Action B
>> 3) Action B processes the form.
>>
>> This is looks neat until you look at the situation when an error 
>> occurs.
>>
>> In order to ensure that the s:select is correctly filled the error 
>> result has to send the browser back to Action A, which is being done 
>> as a redirect. The problem with this is that all actionMessages and 
>> actionErrors get lost during the redirect, and thus the user can't see 
>> what was wrong. To get around this I use the store interceptor, but 
>> this causes problems if validation is turned on (it will bounce the 
>> user to the error result of Action A if an errorMessage is present - 
>> see https://issues.apache.org/struts/browse/WW-1963 for the bug 
>> report).
>>
>> So I end up with the validation interceptor turned off and having to 
>> hand code some validation, and the store interceptor turned on for 
>> several actions.
>>
>> So has anyone found a better way of handling the "populate list -> 
>> show list
>> -> handle errors" situation?
>>
> 
> -
> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-s2.0.9--Is-there-a-better-way-to-do-this...-tf4391572.html#a12525108
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.0.9] Is there a better way to do this...

2007-09-06 Thread cilquirm



Al Sutton-4 wrote:
> 
> Ok, Looks like the first part is confusion in terminology. I took Action
> to
> mean an action as defined in struts.xml, but I now see Richard meant a
> single class used to declare two actions. 
> 
> Your solution to the second part doesn't seem right to me. My
> understanding
> of things is that if struts validation was enabled and it failed
> validating
> one of the form parameters the submit method would not get called and thus
> the list would not be re-populated before the user is sent back to the
> input
> page. So it isn't right for me because I'm looking for something which
> allows action message passing between actions and allows validation to be
> enabled.
> 
> Thanks for the suggestion though.
> 


you could work around that in this way, a little wonky, but still
sustainable:

public class AwesomeAction extends ActionSupport implements Preparable,
Validateable {
 
  List awesomeList;
  AwesomeService awesomeService;
 

  public void preparePrep  /* how droll! */ () {  
 
 awesomeList = awesomeService.getList();
  }

  public void validateSubmit() {
 if ( hasErrors() ) { 
  preparePrep();
 }
  }
 
  public string prep() {
 return SUCCESS;
  }

  public String submit() {
 [do eet];
  }
}

-- 
View this message in context: 
http://www.nabble.com/-s2.0.9--Is-there-a-better-way-to-do-this...-tf4391572.html#a12526913
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: Joining list with OGNL

2007-09-14 Thread cilquirm

I don't believe OGNL supports concatenation of lists, but such functionality
could be achieved using chained subexpressions :

( ticketStates.add(0,new MyObject(-1,"All")), ticketStates )

which would insert the new object into the head of the list, and then return
the ticketStates object as the return value.



Jan Röhrich wrote:
> 
> Hello,
> 
> I want to use the  tag rendering a dropdown list of objects:
> 
> 
> 
> 
> This works but now I need an additional option displayed which is not in 
> the "ticketstates" list. It should be a mapping of "-1" -> "all" which 
> semantically means "all options a once". 
> 
> Is there a way to add a list entry using ognl or something similar? I 
> don't want to add the special entry in my action because it is only 
> needed in the view.
> 
> Thanks in advance.
> 
> Jan
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Joining-list-with-OGNL-tf4441687.html#a12676466
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] Conditional Validation (test if field is present in JSP)

2007-09-17 Thread cilquirm

somewhat hackish, but you can accomplish this by using expressions :

#params['attrib'] != null ? attrib in ('a','list','of','values')

(this is just an example stating that you can check for the existence of the
variable in the parameter and then execute an expression like you normally
would )



mleneveut wrote:
> 
> Hi all,
> 
> We have an Action redirecting to several JSP, depending on the customer. 
> But the forms of these JSP are different : some fields are added/removed 
> in some JSP.
> 
> So the automatic validation fails for those fields not existing in some 
> JSP.
> 
> We bypass the problem by copying the Action method to others Actions 
> (exactly the same code...). We have now one Action for one JSP, so we 
> could have different validation XML file name. But it is not very nice...
> 
> Do we have another solution, like one Action, several JSP, one XML 
> validation file testing if the fields "exist" and if yes doing the field 
> validation ? Or setting a flag (hidden field) in the JSPs and doing 
> differents sets of validation depending of this flag ?
> 
> Thanks for your tips.
> 
> Regards,
> 
> Michaël
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Conditional-Validation-%28test-if-field-is-present-in-JSP%29-tf4465421.html#a12737286
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: Whats the harm in creating a Servlet Dispatcher?

2007-09-17 Thread cilquirm

I'm pretty sure that making FilterDispatcher a Filter was a design decision
so converting it to a servletdispatcher may not be as easy or as
straightforward as one might think.

If memory serves ( and these days, that's not guaranteed ), it actually used
to be a filter/servlet combination before it got rolled up in to a filter.

For example, it wraps the servletrequest so that the EL can have access to
the value stack.  Also, it allows for the static dispatch of the templating
themes.

Coder emptor, is all.

hth + gl, 
-a


Shepherd, Darren S -2 wrote:
> 
> All,
> 
>  
> 
> This is regarding Struts 2.0.
> 
>  
> 
> I've just ran into what I believe is a bug in WebSphere 6.0 and 6.1 where
> the filter chain does not get hit on certain RequestDispatcher includes. 
> So I have two options here:
> 
>  
> 
> 1.Get IBM to fix the bug
> 2.Rewrite the Filter Dispatcher as a Servlet
> 
>  
> 
> My experience is that if I engage IBM my bug will be fixed some time in
> 2008 (seriously).  I'm supposed to be in production before that.  So let
> me know if this is a terrible idea.  I'm going to take the filter
> dispatcher and turn it into a servlet.  We do not serve static files from
> struts.  If we do wish to server static files, I will write a filter
> specifically for that.
> 
>  
> 
> Darren
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Whats-the-harm-in-creating-a-Servlet-Dispatcher--tf401.html#a12737527
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] Conditional Validation (test if field is present in JSP)

2007-09-17 Thread cilquirm

You can manage conditionals by using expressions and fieldexpressions , so
your validation below would become :



 (#params['myInputFieldName'] neq null)  && ( myInputFieldName
neq null & myInputFieldName.trim().length()  gt 0 )  






mleneveut wrote:
> 
> Sorry I did'nt understand your answer.
> 
> I was talking about some  fileds in my JSP (present in some JPS, 
> not in others), and how to write my XML validator file, like :
> 
> 
> 
> true
>     
> 
> 
> ...
> 
> 
> 
> 
> 
> cilquirm <[EMAIL PROTECTED]> 
> 17/09/2007 16:50
> Veuillez répondre à
> "Struts Users Mailing List" 
> 
> 
> A
> user@struts.apache.org
> cc
> 
> Objet
> Re: [S2] Conditional Validation (test if field is present in JSP)
> 
> 
> 
> 
> 
> 
> 
> somewhat hackish, but you can accomplish this by using expressions :
> 
> #params['attrib'] != null ? attrib in ('a','list','of','values')
> 
> (this is just an example stating that you can check for the existence of 
> the
> variable in the parameter and then execute an expression like you normally
> would )
> 
> 
> 
> mleneveut wrote:
>> 
>> Hi all,
>> 
>> We have an Action redirecting to several JSP, depending on the customer. 
> 
>> But the forms of these JSP are different : some fields are added/removed 
> 
>> in some JSP.
>> 
>> So the automatic validation fails for those fields not existing in some 
>> JSP.
>> 
>> We bypass the problem by copying the Action method to others Actions 
>> (exactly the same code...). We have now one Action for one JSP, so we 
>> could have different validation XML file name. But it is not very 
> nice...
>> 
>> Do we have another solution, like one Action, several JSP, one XML 
>> validation file testing if the fields "exist" and if yes doing the field 
> 
>> validation ? Or setting a flag (hidden field) in the JSPs and doing 
>> differents sets of validation depending of this flag ?
>> 
>> Thanks for your tips.
>> 
>> Regards,
>> 
>> Michaël
>> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/-S2--Conditional-Validation-%28test-if-field-is-present-in-JSP%29-tf4465421.html#a12737286
> 
> 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/-S2--Conditional-Validation-%28test-if-field-is-present-in-JSP%29-tf4465421.html#a12738566
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 : Validation per Action method - ideas?

2007-09-18 Thread cilquirm

I'm not sure I follow how validation is more flexible when using annotations
vs. xml files.

Aliases are how you tell xwork that this method is the one to be executed,
so there's a 1-to-1 mapping between aliases and methods.

File based validation is, in a sense, more flexible, because you can define
multiple aliases against a single method and specify different rules for
each of those.

If you could provide more information regarding your situation, that would
be of great insight.

Thanks,
-a



David Harland-3 wrote:
> 
> Hi Ted,
> 
> It appears that if you use annotations you have more flexibilty than
> with using xml. Would it not be possible to add the abililty to specify
> validation files for each method without having to create aliases for
> every single method. We have actions with quite a high number of methods
> each wanting different validation. This can get messy. 
> 
> 
> Regards
> 
> David 
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
> Ted Husted
> Sent: 18 September 2007 11:12
> To: Struts Users Mailing List
> Subject: Re: S2 : Validation per Action method - ideas?
> 
>  * http://struts.apache.org/2.x/docs/validation.html
> 
> It's under "Defining Validation Rules" at 2. The term "alias" is used to
> refer to the action method.
> 
> So if there's an actions.Register.java class with "insert" and "update"
> action methods, then there might be XML docs like
> 
> /java/actions/Register-insert-validations.xml
> /java/actions/Register-update-validations.xml
> 
> One would only file for the insert method and the other only for the
> update method.
> 
> The framework makes the association automatically, based on the naming
> convention, so there's nothing else to configure.
> 
> In WebWork in Action, it's at page 353-354, under "Validation under
> different contexts".
> 
> HTH, Ted
> 
> 
> 
> On 9/18/07, David Harland <[EMAIL PROTECTED]> wrote:
>> Can someone please point me to the documentation that shows you how to
> 
>> configure validation per action method using the validation xml files?
>> Or is this not possible?
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of 
>> Ted Husted
>> Sent: 18 September 2007 10:27
>> To: Struts Users Mailing List
>> Cc: [EMAIL PROTECTED]
>> Subject: Re: S2 : Validation per Action method - ideas?
>>
>> I opened
>>
>>  * https://issues.apache.org/struts/browse/WW-2191
>>
>> for this, and noted the setting in the Validators documentation.
>>
>> Thanks for pointing this out, Veronica!
>>
>> -Ted.
>>
>> On 8/10/07, Veronica Iturrioz <[EMAIL PROTECTED]> wrote:
>> > You must to set the property validateAnnotatedMethodOnly=true, and 
>> > the
>> validation occurs only for the correct methods.
>> >
>> > 
>> > true
>> > input,back,cancel,browse
>> > 
>> >
>> > but this is ok for server validation, not for client validation.
>> > Anybody know how to resolve that for client validations?
>> >
>> >
>> > Veronica.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> - --
> ML {UFI}
> 
> __
> Ufi Limited 
> Registered in England No.  3980770 
> Registered Office:  Dearing House, 1 Young Street, Sheffield, S1 4UP 
> 
> learndirect Solutions Ltd 
> Registered in England No. 5081669 
> Registered Office:  Dearing House, 1 Young Street, Sheffield, S1 4UP 
> 
> UFI Charitable Trust 
> Registered in England No.  3658378 
> Registered Charity No.  1081028 
> Registered Office:  Dearing House, 1 Young Street, Sheffield, S1 4UP 
> 
> This email has been scanned by the MessageLabs Email Security System.
> 
> __
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670.html#a12758403
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: ParameterInterceptor

2007-09-20 Thread cilquirm


I'm not sure I follow this 100%.

Are you saying that a single null propery being passed into the setter of
your model caused a whole new model object to be created?


So you have : firstName, lastName, and address1 
address1 was read-only ( disabled or whatever you want to call it ).

your action is ( for example ) : 

public class MyAction extends ActionSupport implements ModelDriven {
 
  private User user = new User();
  public User getModel() {  return user ; }

}

then because address1 was null, a new user was created?

I'm partly confused because disabled properties shouldn't even be
transmitted by the browser ( though some ajax libraries are faulty when
'serializing' a form for use via XMLHttpRequest ).






stanlick wrote:
> 
> I had a strange experience last night!  My web page parms were being set
> onto my action's model until a null property was encountered.  It seems
> one
> of the web page fields was set to readonly and was not passed as a request
> parm.  The null property resulted in a new model object being constructed
> and things went down hill from there.  Has anyone experienced this one?
> 
> -- 
> Scott
> [EMAIL PROTECTED]
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ParameterInterceptor-tf4487083.html#a12801035
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 Action with two or more "process methods"

2007-09-21 Thread cilquirm

You can also map each method to a name in your struts.xml by using the method
attribute of the action tag.






Ganebnyi Genadii wrote:
> 
> Requesting action like /web-path/someAction!someMethod.action, calls
> SomeAction.doSomeMethod().
> 
> 2007/9/21, michetag <[EMAIL PROTECTED]>:
>>
>>
>> Hi all!!..
>> I'm new with the framework and we are trying to develope a proyect with
>> Struts 2.
>> In the Analysys of the proyect we are trying to understand if it's
>> possible
>> to call different "process methods" ( or execution method ) in the same
>> Action class.
>> It is so or always when we call an action class have to execute the same
>> and
>> unic process method? Somebody can help me?..
>>
>> Thanks so much and sorry for my english
>> --
>> View this message in context:
>> http://www.nabble.com/Struts-Action-with-two-or-more-%22process-methods%22-tf4492646.html#a12813067
>> 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-Action-with-two-or-more-%22process-methods%22-tf4492646.html#a12823236
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: Breadcrumbs

2007-09-25 Thread cilquirm


Nope, since IAs and sitemaps are very site specific.

Java does, tho. It's called java.util.Stack ( or at your leisure,
commons-collections has ArrayStack )

:-)

-a




stanlick wrote:
> 
> Can you tell me if Struts 2 has a facility for breadcrumbs?
> 
> On 9/25/07, Antonio Petrelli <[EMAIL PROTECTED]> wrote:
>>
>> 2007/9/24, stanlick <[EMAIL PROTECTED]>:
>> >
>> >
>> > I am writing a Breadcrumbs utility and have a question about how to
>> easily
>> > get the current request in a format that could be wrapped in an URL. 
>> Is
>> > there a quick way to do this given a TilesRequestContext reference?
>>
>>
>>
>> If it is a Tiles-related question, please post it at Tiles Users mailing
>> list:
>> http://tiles.apache.org/mail.html
>>
>> Antonio
>>
> 
> 
> 
> -- 
> Scott
> [EMAIL PROTECTED]
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Breadcrumbs-tf4511352.html#a12882714
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: Mapping multiple enums to a nested object

2007-09-25 Thread cilquirm

Are enums type-converted automatically now?

I recall early on I  had to specify
http://struts.apache.org/2.0.9/struts2-core/apidocs/com/opensymphony/xwork2/util/EnumTypeConverter.html

Have you tried specifying that?

with 

Element_selectedNutrients = com.opensymphony.xwork2.util.EnumTypeConverter




Guillaume Bilodeau wrote:
> 
> Looks like the JSP code doesn't show. Here it is:
> 
> 
> [s:form action="createSimpleFood.go" method="post"
> namespace="/nutrition"]
> [s:textfield key="food.name" name="model.name" /][br/]
> [s:select key="food.group" name="model.group"
> list="availableGroups" /]
> [s:checkboxlist key="food.nutrients"
> name="model.selectedNutrients"
> list="availableNutrients" /]
> [s:submit key="nutrition.foods.simpleFoods.create.submit" /]
> [/s:form]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Mapping-multiple-enums-to-a-nested-object-tf4505238.html#a12884986
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: Mapping multiple enums to a nested object

2007-09-25 Thread cilquirm

Indeed, the problem is that EnumTypeConverter, as provided by Struts2  only
works for single values.

Can you make selectedNutrients a List?

If so, you might be able to use the EnumTypeConverter from the showcase app,
or roll your own based off it, which isn't that hard at all.

org.apache.struts2.showcase.conversion.EnumTypeConverter

hth,
-a



Guillaume Bilodeau wrote:
> 
> Yes I tried that, with no success unfortunately.
> 
> Somehow we need to specify that:
> 1- selectedNutrients[] will need to be mapped to an array of Nutrients
> 2- each element of selectedNutrients[] must be mapped using
> EnumTypeConverter
> 
> 
> cilquirm wrote:
>> 
>> Are enums type-converted automatically now?
>> 
>> I recall early on I  had to specify
>> http://struts.apache.org/2.0.9/struts2-core/apidocs/com/opensymphony/xwork2/util/EnumTypeConverter.html
>> 
>> Have you tried specifying that?
>> 
>> with 
>> 
>> Element_selectedNutrients =
>> com.opensymphony.xwork2.util.EnumTypeConverter
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Mapping-multiple-enums-to-a-nested-object-tf4505238.html#a12885311
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: Mapping multiple enums to a nested object

2007-09-25 Thread cilquirm

Doesn't seem that way.
One converts a single string value to an enum, and the other converts a
String[] to a List

I just checked it over and it's not directly useable because it's a type
converter for a specific enum ( OperationsEnum ), but the principles apply.

The long and the short of is that you'll have to write your own type
converter, but checking out the example from showcase is a fairly good
starting point that should get you at least halfway.

hth,
-a


Guillaume Bilodeau wrote:
> 
> So you're saying that the showcase EnumTypeConverter isn't the same as the
> one provided in XWork2?
> 
> 
> cilquirm wrote:
>> 
>> Indeed, the problem is that EnumTypeConverter, as provided by Struts2 
>> only works for single values.
>> 
>> Can you make selectedNutrients a List?
>> 
>> If so, you might be able to use the EnumTypeConverter from the showcase
>> app, or roll your own based off it, which isn't that hard at all.
>> 
>> org.apache.struts2.showcase.conversion.EnumTypeConverter
>> 
>> hth,
>> -a
>> 
>> 
>> 
>> Guillaume Bilodeau wrote:
>>> 
>>> Yes I tried that, with no success unfortunately.
>>> 
>>> Somehow we need to specify that:
>>> 1- selectedNutrients[] will need to be mapped to an array of Nutrients
>>> 2- each element of selectedNutrients[] must be mapped using
>>> EnumTypeConverter
>>> 
>>> 
>>> cilquirm wrote:
>>>> 
>>>> Are enums type-converted automatically now?
>>>> 
>>>> I recall early on I  had to specify
>>>> http://struts.apache.org/2.0.9/struts2-core/apidocs/com/opensymphony/xwork2/util/EnumTypeConverter.html
>>>> 
>>>> Have you tried specifying that?
>>>> 
>>>> with 
>>>> 
>>>> Element_selectedNutrients =
>>>> com.opensymphony.xwork2.util.EnumTypeConverter
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Mapping-multiple-enums-to-a-nested-object-tf4505238.html#a12885920
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] How to separate Action from "FormBean"

2007-01-08 Thread cilquirm



Dariusz Wojtas wrote:
> 
> Want to have a bean separate from the action and just reference it?
> Define your bean (whatever you want) and just declare it as a variable
> on your action.
> Nothing more.
> Add getter and setter.
> 
> class MyAction ... {
>private MyBeanClass myBean;
> 
> }
> 
> in your JSP just prefix bean components with the bean name;
> 
>   
> 
> That's all :)
> 
> Dariusz Wojtas
> 
> 


One other thing that's nice about Struts2/WW is that you can utilize the
ModelDriven interface on your action.

So your action is 

public class MyAction implements ModelDriven {

  private MyBean myBean = new MyBean();

  public Object getModel() { return myBean; }

}

that way your form fields can still be referenced by 



Also very useful when moving your properties from the action into a
model/domain object/value object/etc... because your front-end code does not
hae to change.

-- 
View this message in context: 
http://www.nabble.com/-S2--How-to-separate-Action-from-%22FormBean%22-tf2936107.html#a8222113
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: Validation Annotations

2007-01-08 Thread cilquirm

According to http://struts.apache.org/2.x/docs/validation-annotation.html

you can specify annotations at the method level.



André Faria-3 wrote:
> 
> Hi People!!!
> 
> Is there a way to use Validation Annotations only for a method or always 
> for the action...
> 
> Example, if I have a action PersonAction with three methods:
> 
> public class PersonAction {
> public void execute(){}
> public void list(){}
> public void save(){}  
> }
> 
> But I have to validate the user input only in method save what could I do?
> 
> 
> Have a nice weekend,
> Thank's for help,
> André Faria
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Validation-Annotations-tf2930726.html#a819
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] possible NPE in Restful2?

2007-01-16 Thread cilquirm



Hi, I think I noticed an NPE in Restful2, which is set as my default action
mapper. I'd like to resolve it but I'm not sure my logic on the matter is
correct and hopefully someone on the list can set  me straight :

The error : 

java.lang.NullPointerException
org.apache.struts2.dispatcher.mapper.Restful2ActionMapper.getMapping(Restful2ActionMapper.java:97)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:393)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)


The offending code :

public ActionMapping getMapping(HttpServletRequest request,
ConfigurationManager configManager) {

ActionMapping mapping = super.getMapping(request, configManager);

String actionName = mapping.getName();


The logic :

Since restful2 is subclassed from DefaultActionMapper, the super call does
the work that the defaultactionmapper would do and then runs its own checks.

The problem happens when you use codebehind and restful2 ( as I am ), and a
mapping is not returned.  Then, the mapping is null, and getName() fails.

So the solution would be to check mapping for null before proceeding.


Again, I'm not sure of the intrinsic details of it, but I applied such a fix
locally and it seems to work smoothly ( though I don't have the plethora of
tests that maybe others have, but the surefire stuff runs ).


Please let me know if I am of the right mind, and I'll submit an issue and
patch.


Thanks,
-a

(oh and sorry for not posting in struts-dev. I don't belong to that list yet
and this was slightly faster.)



-- 
View this message in context: 
http://www.nabble.com/-S2--possible-NPE-in-Restful2--tf3022218.html#a8394594
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] how to make s:iterator work

2007-01-16 Thread cilquirm

I don't know particularly about the s:iterator, but since you said you're
using JSP, you can access the model via the jstl tags just as easily :


  ${book.author}



though, looking at your code again,  I suspect it's because your getter is
class private.

It would have to be public.

-a



walidito wrote:
> 
> Hi everybody.
> I have a problem with displaying a list of objects that I extract from a
> hibernate database. I' searching for the simpler and the better way to do
> it please.
> I have two issues :
> 
> I am not sure about how to send it to the jsp. For the moment I am trying
> this one from my action :
> 
> private List getListOfBooks() {
> ...  // get books from Data Access Object  classes
> }
> 
> public String execute() throws Exception {
> ...
>   booklist = getListOfBooks();
>   this.request.setAttribute("listOfBooks", booklist);
>   return SUCCESS;
>   }
> In my jsp, i don't know how to display it.
> I tried many solutions without success among them :
> 
> 
> 
> 
> which does not work.
> 
> Help please !!
> 

-- 
View this message in context: 
http://www.nabble.com/-s2--how-to-make-s%3Aiterator-work-tf3022827.html#a8396707
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] how to make s:iterator work

2007-01-16 Thread cilquirm


scratch my original comment ( though the part regarding using the jstl is
still valid. )

the problem for you is that since listOfBooks is not in the valuestack
directly, you would have to reference it via the request object, like so


...




walidito wrote:
> 
> Hi everybody.
> I have a problem with displaying a list of objects that I extract from a
> hibernate database. I' searching for the simpler and the better way to do
> it please.
> I have two issues :
> 
> I am not sure about how to send it to the jsp. For the moment I am trying
> this one from my action :
> 
> private List getListOfBooks() {
> ...  // get books from Data Access Object  classes
> }
> 
> public String execute() throws Exception {
> ...
>   booklist = getListOfBooks();
>   this.request.setAttribute("listOfBooks", booklist);
>   return SUCCESS;
>   }
> In my jsp, i don't know how to display it.
> I tried many solutions without success among them :
> 
> 
> 
> 
> which does not work.
> 
> Help please !!
> 

-- 
View this message in context: 
http://www.nabble.com/-s2--how-to-make-s%3Aiterator-work-tf3022827.html#a8396710
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] possible NPE in Restful2?

2007-01-16 Thread cilquirm


I've created 

https://issues.apache.org/struts/browse/WW-1648

and attached a patch.


cilquirm wrote:
> 
> 
> 
> Hi, I think I noticed an NPE in Restful2, which is set as my default
> action mapper. I'd like to resolve it but I'm not sure my logic on the
> matter is correct and hopefully someone on the list can set  me straight :
> 
> The error : 
> 
> java.lang.NullPointerException
> org.apache.struts2.dispatcher.mapper.Restful2ActionMapper.getMapping(Restful2ActionMapper.java:97)
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:393)
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
> com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
> 
> 
> The offending code :
> 
> public ActionMapping getMapping(HttpServletRequest request,
> ConfigurationManager configManager) {
> 
> ActionMapping mapping = super.getMapping(request, configManager);
> 
> String actionName = mapping.getName();
> 
> 
> The logic :
> 
> Since restful2 is subclassed from DefaultActionMapper, the super call does
> the work that the defaultactionmapper would do and then runs its own
> checks.
> 
> The problem happens when you use codebehind and restful2 ( as I am ), and
> a mapping is not returned.  Then, the mapping is null, and getName()
> fails.
> 
> So the solution would be to check mapping for null before proceeding.
> 
> 
> Again, I'm not sure of the intrinsic details of it, but I applied such a
> fix locally and it seems to work smoothly ( though I don't have the
> plethora of tests that maybe others have, but the surefire stuff runs ).
> 
> 
> Please let me know if I am of the right mind, and I'll submit an issue and
> patch.
> 
> 
> Thanks,
> -a
> 
> (oh and sorry for not posting in struts-dev. I don't belong to that list
> yet and this was slightly faster.)
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--possible-NPE-in-Restful2--tf3022218.html#a8400651
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] Prepable and Validate

2007-01-17 Thread cilquirm


I don't think this will work as you expect it to for 2 reasons :

1) prepare comes before validate ( at least in all the interceptor stacks
that i saw, obviously you're free to change the order )

2) validation, at least in my perusal of the source, doesn't short circuit
the interceptor stack

hth,
-a


André Faria-3 wrote:
> 
> All,
>   
> I have these methods in a Action:
>
> public action Person extends ActionSupport  implemens Preparable {
> public String input {...}
> public void prepareInput{..}
> public void validateSave(){
>addFieldError("person.name","Error");
> }
> public void save(){...};  
> public void prepare(){};
> }
>
> 
> Before the method input the method prepareInput is called by the 
> Interceptor, but the if I put an error in method validateSalve (that is 
> called by the interceptor too before the method save), the input result 
> will be called, but without call the method prepareInput... Is that
> correct?
> 
> Have a Nice Day,
> 
> Regards,
> */André Faria/*
> //
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Prepable-and-Validate-tf3027946.html#a8418853
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] String comparison with OGNL -- Learning OGNL by stabbing in the dark.

2007-01-23 Thread cilquirm


Just FYI,
I think this lesson was less about OGNL per se, and more about
Java,Servlets, and the Parameter map.

#parameters.addrType is of type String[], because that's how it's collated 
( since you can have multiple values to a single name.. )

hth,
-a



Wesley Wannemacher wrote:
> 
> Okay, I'm officially renaming this thread - 
> 
> Learning OGNL by stabbing in the dark.
> 
> This isn't meant to offend anyone trying to help me because I really
> appreciate it! It's just because, rather than read the docs, I decided to
> figure this out by brute force (as you'll see below).
> 
> I should have tried the obvious earlier, but it turns out the easiest
> correct syntax is this:
> 
> 
> 
> In case you're wondering about whatever else works, here is my final
> attempt: 
> 
> ---CODE---
>   
> Please verify the details of your  value="#parameters.addrType"/>
> address below -
>   
> 1 
> 2  
> 3  
> 4  value='%{#parameters.addrType.toString().equals("billing")}'/> 
> 5  value='%{#parameters.addrType.toString().trim().equals("billing")}'/> 
> 6  
> 7  value='#parameters.addrType.toString().equals("billing")'/>
> 8  value='#parameters.addrType.toString().trim().equals("billing")'/> 
> 9 
> 10  
> 11  
> 12  value="%{#parameters.addrType.toString().equals('billing')}"/> 
> 13  value="%{#parameters.addrType.toString().trim().equals('billing')}"/> 
> 14  
> 15  value="#parameters.addrType.toString().trim().equals('billing')"/>
> 16  value="#parameters.addrType.toString().equals('billing')"/>
> 17 
> 18  
> 19  
> 20  
> 21  value='%{#addrType.toString().trim().equals("billing")}'/> 
> 22  
> 23 
> 24  value='#addrType.toString().trim().equals("billing")'/>
> 
> 25 
> 26  
> 27  
> 28  
> 29  value="%{#addrType.toString().trim().equals('billing')}"/> 
> 30  
> 31  value="#addrType.toString().trim().equals('billing')"/>
> 32 
> 33 
> 34  
> 35  
> 36  
> 37  value='%{addrType.toString().trim().equals("billing")}'/> 
> 38  
> 39 
> 40  value='addrType.toString().trim().equals("billing")'/> 
> 41 
> 42  
> 43  
> 44  
> 45  value="%{addrType.toString().trim().equals('billing')}"/> 
> 46  
> 47  value="addrType.toString().trim().equals('billing')"/>
> 48 
> 49 
> 50 
> 
> ---OUTPUT---
>   
> Please verify the details of your billing address below -
>   
> 1 false
> 2 false 
> 3 false 
> 4 false 
> 5 false 
> 6 false 
> 7 false
> 8 false 
> 9 false
> 10 false 
> 11 false 
> 12 false 
> 13 false 
> 14 false 
> 15 false
> 16 false
> 17 false
> 18 false 
> 19 false 
> 20  
> 21  
> 22 false 
> 23 
> 24  
> 25 false
> 26 false 
> 27 false 
> 28  
> 29  
> 30 false 
> 31 
> 32 
> 33 true
> 34 true 
> 35 true 
> 36 true 
> 37 true 
> 38 true 
> 39 true
> 40 true 
> 41 true
> 42 true 
> 43 true 
> 44 true 
> 45 true 
> 46 true 
> 47 true
> 48 true
> 49 
> 50 false
> 
>> -Original Message-
>> From: Alexandre Mendonça Lima 
>> [mailto:[EMAIL PROTECTED] 
>> Sent: Tuesday, January 23, 2007 2:23 PM
>> To: Struts Users Mailing List
>> Subject: Re: [s2] String comparison with OGNL
>> 
>> I see something in the Guide page about this way:
>> 
>> 
>> Alexandre Lima
>> 
>> - Original Message - 
>> From: "Wesley Wannemacher" <[EMAIL PROTECTED]>
>> To: "Struts Users Mailing List" 
>> Sent: Tuesday, January 23, 2007 3:44 PM
>> Subject: RE: [s2] String comparison with OGNL
>> 
>> 
>> > Nope, same result... Here is the code and output -
>> >
>> > ---CODE
>> > 
>> > Please verify the details of your > > value="#parameters.addrType"/>
>> > address below -
>> > 
>> > 
>> >
>> > ---RESULT
>> > 
>> > Please verify the details of your billing address below -
>> > 
>> > false
>> >
>> >
>> > I'm not sure how much it matters, but I am working with a 
>> snapshot of 
>> > 2.0.2
>> > that I built a while back. If this is an issue, I can 
>> replace any jars to
>> > see if that fixes the problem.
>> >
>> > -Wes
>> >
>> >> -Original Message-
>> >> From: Dave Newton [mailto:[EMAIL PROTECTED]
>> >> Sent: Tuesday, January 23, 2007 1:36 PM
>> >> To: Struts Users Mailing List
>> >> Subject: RE: [s2] String comparison with OGNL
>> >>
>> >> From: Wesley Wannemacher [mailto:[EMAIL PROTECTED]
>> >> > 
>> >>
>> >> Does wrapping it with %{} do it?
>> >>
>> >> 
>> >>
>> >> I still get a little confused when dealing with the 
>> different markups.
>> >>
>> >> 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]
>> 
>> 
> 
>  
> 

-- 
View this message in context: 
http://www.nabble.com/RE%3A--s2--String-comparison-with-OGNLLearning-OGNL-by-stabbing-in-the-dark.-tf3077206.html#a8550782
Sent from the Struts - User mailing list archive at Nabble.com.


-

Re: how to use struts2 + spring + JPA

2007-01-29 Thread cilquirm

your persistence.xml must be in META-INF directory in the classpath ( so
basically, it needs to end up either in your jars in WEB-INF/lib or in your
WEB-INF/classes directory )




shahab wrote:
> 
> Hi:
> 
> I have persistence.xml under META-INF
> 
> (both WEB-INF and META-INF are under tomcat_home/webapps/ level
> 
> In fact, w/o this file, i get the same error also. 
> 
> Also, please note that, I couldnt find "struts2-Spring-plugin.jar"
> anywhere.
> 
> 
> thanx
> Shahab
> 
> 
> Musachy Barroso-2 wrote:
>> 
>> Is "persistence.xml" under WEB-INF? I was getting the same error when I 
>> tried to avoid using the dummy persistence.xml (there is got to be a way 
>> of configuring the persistent unit from Spring, but I didn't look into
>> it).
>> 
>> musachy
>> 
>> shahab wrote:
>>> Hi: 
>>>
>>> I am trying to use Struts 2, Spring and JPA. I have developed a simple
>>> application like the one mentioned in
>>> http://cwiki.apache.org/S2WIKI/struts-2-spring-jpa-ajax.html. 
>>>
>>> I am getting the following error - 
>>>
>>> SEVERE: Exception sending context initialized event to listener instance
>>> of
>>> class org.springframework.web.context.ContextLoa 
>>> derListener 
>>> org.springframework.beans.factory.BeanCreationException: Error creating
>>> bean
>>> with name 'entityManagerFactory' defined in Ser 
>>> vletContext resource [/WEB-INF/applicationContext.xml]: Invocation of
>>> init
>>> method failed; nested exception is java.lang.Ille 
>>> galStateException: No persistence units parsed from
>>> {classpath*:META-INF/persistence.xml} 
>>> Caused by: java.lang.IllegalStateException: No persistence units parsed
>>> from
>>> {classpath*:META-INF/persistence.xml} 
>>>
>>>
>>> My applicationContext.xml and persistence.xml is similar to what is
>>> there in
>>> the example. 
>>>
>>> My persistence.xml is the following - 
>>> http://java.sun.com/xml/ns/persistence";
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";
>>> version="1.0">
>>> 
>>> 
>>> 
>>>
>>>
>>>
>>> Any help will be greatly appreaciated. 
>>>
>>> thanx 
>>> Shahab
>>>   
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-use-struts2-%2B-spring-%2B-JPA-tf3138267.html#a8699909
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: Struts2: New life to IBM RAD?

2007-01-30 Thread cilquirm

>From my experience, it is possible to run Struts1 and Struts2 side by side
As far as I've seen and worked with, other than keeping the "org.apache"
start of the package name, the namespaces and class names are different.



Bruno Melloni-2 wrote:
> 
> 
> Are all the package.class names different between Struts 1.1 and 2.0.x?
> If they are, then code written to use 2.0.x would have no problems even
> if RAD forces its old Struts 1.1 JAR files into the project.  (I know
> that using Ant for the build would help us bypass this issue, but too
> many of our developers rely on the default IDE build, and changing those
> habits would be very difficult)
> 
> Is this wishful thinking?  Or is it time to look for a replacement IDE?
> 
> Bruno
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2%3A-New-life-to-IBM-RAD--tf3142638.html#a8718240
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: how to specify ActionMapper

2007-02-07 Thread cilquirm



The error seems self-explanatory.

By specifying the "queryReportBeanName" inside the  tag, you're
actually setting the value on the redirect-action object ( known also by
it's java name org.apache.struts2.dispatcher.ServletActionRedirectResult ).

if you want to set a static param on your own action ( also known as
com.xyz.customersolutions.ess.webapp.action.common.BaseAction ), then take
it out from under the  tag and put it in inside the  tag.

hth,
-a




Ravi Mangalagiri wrote:
> 
> I added the following key, value in my struts.properties
> 
> struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper
> 
> and my action is defined as follows:
> 
> 
> 
>  namespace="/queryReport">
> 
> 
> 
> 
>  
>runQueryReport
>/queryReport
>auditLogReport
>   
> 
> 
> 
> /pages/includes/query.jsp
> 
> 
> 
> 
> 
> 
> and it still refers to
> org.apache.struts2.dispatcher.ServletActionRedirectResult i
> 
> Follow is the error I am getting, am I missing something
> 
> Feb 7, 2007 8:50:42 AM
> com.opensymphony.xwork2.util.OgnlUtilinternalSetProperty
> WARNING: Caught OgnlException while setting property 'queryReportBeanName'
> on type 'org.apache.struts2.dispatcher.ServletActionRedirectResult'.
> ognl.NoSuchPropertyException:
> org.apache.struts2.dispatcher.ServletActionRedirectResult.queryReportBeanName
>  at
> ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:133)
>  at
> com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(
> OgnlValueStack.java:65)
>  at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1629)
>  at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
>  at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>  at ognl.SimpleNode.setValue(SimpleNode.java:246)
>  at ognl.Ognl.setValue(Ognl.java:476)
>  at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:184)
>  at
> com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java
> :358)
>  at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:74)
>  at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:47)
>  at com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java
> :211)
>  at com.opensymphony.xwork2.DefaultActionInvocation.createResult(
> DefaultActionInvocation.java:179)
>  at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(
> DefaultActionInvocation.java:303)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:218)
>  at
> com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(
> DefaultWorkflowInterceptor.java:177)
>  at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(
> MethodFilterInterceptor.java:86)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(
> ValidationInterceptor.java:115)
>  at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(
> MethodFilterInterceptor.java:86)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at
> com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept
> (ConversionErrorInterceptor.java:123)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(
> ParametersInterceptor.java:147)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at
> com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(
> StaticParametersInterceptor.java:105)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(
> CheckboxInterceptor.java:80)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(
> FileUploadInterceptor.java:204)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(
> ModelDrivenInterceptor.java:74)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at
> com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(
> ScopedModelDrivenInterceptor.java:120)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at
> org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(
> ProfilingActivationInterceptor.java:59)
>  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> DefaultActionInvocation.java:200)
>  at
> org.apache.struts2.interceptor.debuggin

Re: how to specify ActionMapper

2007-02-07 Thread cilquirm

My apologies. I read the message wrong.

Is the problem that the the value is not being set on the action being
redirected to?

Looking at the error message, and the source, it's just a warning. 
Processing continues as normal after that, so it should be setting the
values correctly.

I've not used 'redirect-action' with extra parameters like below, but I have
done so using 'redirect' ( and the former is extended from the latter ) with
success.

-a



Dave Newton-4 wrote:
> 
> --- cilquirm <[EMAIL PROTECTED]> wrote:
>> By specifying the "queryReportBeanName" inside the
>>  tag, you're actually setting the value on 
>> the redirect-action object [...]
>> if you want to set a static param on your own action
>> then take it out from under the  tag and
> put
>>  it in inside the  tag.
> 
> Just a clarification, that is direct contradiction to
> the docs at
> http://cwiki.apache.org/WW/redirect-action-result.html:
> 
>  extends="struts-default"
> namespace="/passingRequestParameters">
><-- Pass parameters (reportType, width and height)
> -->
>
>
>type="redirect-action">
>   name="actionName">generateReport
>  /genReport
>  pie
>  100
>  100
>   
>
> 
> 
> because you're passing parameters to the *result*
> action, NOT the action that is *generating* the
> result.
> 
> This issue is in JIRA at
> https://issues.apache.org/struts/browse/WW-1714
> 
> So either the docs are wrong, or there's a bug.
> 
> d.
> 
> 
> 
>  
> 
> Cheap talk?
> Check out Yahoo! Messenger's low PC-to-Phone call rates.
> http://voice.yahoo.com
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-specify-ActionMapper-tf3187257.html#a8849592
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] struts2 validation for only one method in action

2007-02-21 Thread cilquirm

I believe you can use validation annotation to specify validation routines at
the method level.




ros wrote:
> 
> Hi!
> 
> How to configure struts2 validation for only one method in action?
> 
> Thanks.
> 

-- 
View this message in context: 
http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a9083597
Sent from the Struts - User mailing list archive at Nabble.com.


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



s2: numbers being formatted during display in s:select tag

2007-02-22 Thread cilquirm

This is so odd, yet I'm surprised no one's come across this.

This is S2 built off the 2_0_X branch ( no modifications, straight clean
build ), running under Java 1.5  in both resin and tomcat.

Given a snippet like so :




the output of the id is a formatted string :


Please, Helpme 
Being, Earnest
...


(names have been changed to protect the innocent )

Anyone else come across this.

Is this a bug? Known workaround?

Thanks for any input,

aadi
-- 
View this message in context: 
http://www.nabble.com/s2%3A-numbers-being-formatted-during-display-in-s%3Aselect-tag-tf3275613.html#a9109511
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] JNLP with struts ?

2007-02-23 Thread cilquirm

in your resulting page
you can set

@page contentType = 'application/x-java-jnlp-file'

and return the body of your jnlp file ( possibly even read via c:import or
some such mechanism )





Maya menon wrote:
> 
> Have anyone used java web start[JNLP files] with struts ?
>
>   I have a project which uses struts. Now i have a Login.jsp, which calls
> Loginaction.java.
>
>   If user is a valid user, then I have to initiate a call to a "jnlp file"
> . Have anyone done this ?
>
>   basically, I want to install something in the client's machines if the
> user is a valid user of our application. The app uses Login.jsp and
> Loginaction.java now. 
>
>   Any suggestions/thoughts,
>
>   Maya
> 
>  
> -
> Be a PS3 game guru.
> Get your game face on with the latest PS3 news and previews at Yahoo!
> Games.
> 

-- 
View this message in context: 
http://www.nabble.com/JNLP-with-struts---tf3280718.html#a9127299
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 Action Classes (HELP!)

2007-02-27 Thread cilquirm


That example is using the null property handling feature of the XW
type-conversion system :

http://struts.apache.org/2.x/docs/type-conversion.html

Basically, when xw/ognl  sees ( evaluates )  person.firstName, it calls
getPerson() , which returns null.
XW goes to work and creates an empty Person object and places it on that
action.
and then sets firstname on that newly created person object.

(n.b. the exact ordering may be slightly off, it might set first name first
before setting person object, but the end result is the same, in this case )

I'm not sure how your spring configuration is set up, but that would be
helpful  to see.
Myself, I don't use the constructor injection mechanism, i use
autowire-by-type, so my Action doesn't have a specifically declared
constructor, just a 

setUserService(UserService us) { this.userService = us }

-a


Paul Saumets | Merge wrote:
> 
> Could we explain this good example then?
> 
> http://cwiki.apache.org/S2WIKI/struts-2-spring-2-jpa-ajax.html
> 
> Here we can see there is a form (index.jsp) calling the save() action on
> the PersonAction class.
> 
> The first call on the save action is the service.save(person).
> 
> Where does the Person person object inside PersonAction get set?
> Somehow the Person setters are being called and I'm not understanding how
> those setters are automatically called yet my LoginAction setters where
> userName and userPassword are passed from the form are not?!
> 
> Could anyone explain please? ;)
> 
> -Original Message-
> From: Gabe Hamilton [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 27, 2007 11:44 AM
> To: Struts Users Mailing List
> Subject: Re: Struts 2 Action Classes (HELP!)
> 
> I believe the Parameters Interceptor will call your setUserName() method. 
> I
> would check that that interceptor is in the stack used for LoginAction.
> 
> -Gabe
> 
> On 2/27/07, Paul Saumets | Merge <[EMAIL PROTECTED]> wrote:
>>
>> I'm having some difficulty passing along params from my action forms with
>> Struts 2. I have a basic jsp form declared as follows:
>>
>> > nomespace="/">
>> 
>> 
>> 
>> 
>>
>> executeLogin is correctly mapped to my LoginAction action class which
>> looks something like the following:
>>
>> public class LoginAction extends ActionSupport {
>>
>> private UserService service;
>> private String userName;
>> private String userPassword;
>>
>> // service injected via Spring
>>
>> public LoginAction(UserService service) {
>> this.service = service;
>> }
>>
>> public void setUserName(String userName) {
>> this.userName = userName;
>> }
>>
>> /* remaining setters & getters below */
>>
>> public String execute() {
>>
>> Boolean ret = service.validateUser(getUserName(),
>> getUserPassword());
>>
>> /// more follow up code here
>> }
>> }
>>
>>
>> My understanding of the Struts 2 framework is that when my action is
>> called the setters on the Action class will be called as well storing my
>> passed along form vars? Am I wrong on this? What exactly am I doing
>> wrong?
>> Should I implementing sessionAware and then having to access the request
>> object?
>>
>> From reading the Mailreader example I see setters in for username and
>> password in the MailreaderSupport base class so I don't see why the above
>> isn't working.
>>
>> Would be great to get some feedback!
>>
>> Regards,
>> Paul
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-Action-Classes-%28HELP%21%29-tf3301377.html#a9188636
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: Problems using spring plugin and struts 2.0.6

2007-02-27 Thread cilquirm

Technically, this isn't necessary when you have the struts-spring-plugin.jar
in your WEB-INF/lib
since it's already specified by the struts-plugin.xml file

I think, however, seeing a more complete stack trace for the CNFE would be
helpful since I have 2.0.6 with the spring plugin just fine.




Paul Saumets | Merge wrote:
> 
> Perhaps obvious question but,
> 
> Do you have
> 
> 
> 
> set inside your struts.xml?
> 
> -Original Message-
> From: João Vieira da Luz [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 27, 2007 12:42 PM
> To: user@struts.apache.org
> Subject: Problems using spring plugin and struts 2.0.6
> 
> We've upgraded to struts 2.0.6 and we can't make spring-plugin work.
> 
> The spring factory isn't being called and we are getting
> ClassNotFoundException for the beans that reference spring.
> 
> This is working with struts 2.0.1.
> 
> What changed?
> 
> Thanks a lot,
> 
>João
> 
> -
> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problems-using-spring-plugin-and-struts-2.0.6-tf3302939.html#a9188385
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] Problem with 2.0.6

2007-02-27 Thread cilquirm

I see errors like that on occasion ( mine is with the JSONResult type and the
location property ), but they've always been warnings.

Is yours logged at the ERROR level?



Piero Sartini-3 wrote:
> 
> upgraded to 2.0.6 - now the error below is thrown when accessing an Action 
> with validators.
> 
> dont know if it is important, but ajax-validation is enabled and the 
> annotation looks like this:
> 
> --- code ---
>@RequiredStringValidator(message = "Login is required", key 
> = "error.loginname.missing")
> public String getLogin() {
> return login;
> }
> --- code ---
> 
> 
> Exec[0]: validator.doPost()
> Caught OgnlException while setting property 'methodName' on 
> type
> 'com.opensymphony.xwork2.validator.validators.RequiredStringValidator'.
> ognl.NoSuchPropertyException: 
> com.opensymphony.xwork2.validator.validators.RequiredStringValidator.methodName
> at 
> ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
> at 
> com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlValueStack.java:68)
> at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
> at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
> at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
> at ognl.SimpleNode.setValue(SimpleNode.java:246)
> at ognl.Ognl.setValue(Ognl.java:476)
> at
> com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
> at 
> com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java:360)
> at 
> com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76)
> at 
> com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:103)
> at 
> com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:90)
> at 
> com.opensymphony.xwork2.ObjectFactory.buildValidator(ObjectFactory.java:234)
> at 
> com.opensymphony.xwork2.validator.ValidatorFactory.getValidator(ValidatorFactory.java:252)
> at 
> com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:79)
> at 
> com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:134)
> at 
> com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:109)
> at 
> com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:96)
> at 
> com.opensymphony.xwork2.validator.ValidationInterceptor.doBeforeInvocation(ValidationInterceptor.java:142)
> at 
> com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:148)
> at 
> org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
> at 
> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
> at 
> com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-2.0.6-tf3300246.html#a9188430
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] Problems using spring plugin and struts 2.0.6

2007-02-27 Thread cilquirm

I'm not sure type converters are instantiated via the ObjectFactory
mechanism, but you can just as easily say :

domain.security.PermissionType = presentation.converter.EnumTypeConverter

You will probably need to refactor some code if your EnumTypeConverter
expects to be in a Spring context.



João Vieira da Luz wrote:
> 
> Well we've made progresses. The problem is on registering converters
> on XWorkConverter.
> 
> We are trying to register converters using spring.
> 
> On application-context.xml we have this,
> 
>  class="presentation.converter.EnumTypeConverter" />
> 
> and on xwork-conversion.properties,
> 
> domain.security.PermissionType = enumTypeConverter
> 
> Probably is a problem from our xwork configuration, but we can't
> figure out what is wrong?
> 
> How can I tell xwork that it must use a "SpringClassLoader"?
> 
> Thanks again,
> Joao
> 
> PS: The stacktrace is pretty much what I've send you.
> 
> On 2/27/07, cilquirm <[EMAIL PROTECTED]> wrote:
>>
>> Technically, this isn't necessary when you have the
>> struts-spring-plugin.jar
>> in your WEB-INF/lib
>> since it's already specified by the struts-plugin.xml file
>>
>> I think, however, seeing a more complete stack trace for the CNFE would
>> be
>> helpful since I have 2.0.6 with the spring plugin just fine.
>>
>>
>>
>>
>> Paul Saumets | Merge wrote:
>> >
>> > Perhaps obvious question but,
>> >
>> > Do you have
>> >
>> > 
>> >
>> > set inside your struts.xml?
>> >
>> > -Original Message-
>> > From: João Vieira da Luz [mailto:[EMAIL PROTECTED]
>> > Sent: Tuesday, February 27, 2007 12:42 PM
>> > To: user@struts.apache.org
>> > Subject: Problems using spring plugin and struts 2.0.6
>> >
>> > We've upgraded to struts 2.0.6 and we can't make spring-plugin work.
>> >
>> > The spring factory isn't being called and we are getting
>> > ClassNotFoundException for the beans that reference spring.
>> >
>> > This is working with struts 2.0.1.
>> >
>> > What changed?
>> >
>> > Thanks a lot,
>> >
>> >João
>> >
>> > -
>> > 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]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Problems-using-spring-plugin-and-struts-2.0.6-tf3302939.html#a9188385
>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problems-using-spring-plugin-and-struts-2.0.6-tf3302939.html#a9190615
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] Problem with 2.0.6

2007-02-28 Thread cilquirm

I do.
It looks vicious, but is pretty harmless.
You could wipe it out of your logs by setting the class that throws it to
only log ERROR and greater.



Piero Sartini-3 wrote:
> 
> Am Dienstag, 27. Februar 2007 schrieb cilquirm:
>> I see errors like that on occasion ( mine is with the JSONResult type and
>> the location property ), but they've always been warnings.
>>
>> Is yours logged at the ERROR level?
> 
> they are logged at WARNING level. Should I just ignore them? I do not feel 
> good with this errors..
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-2.0.6-tf3300246.html#a9207784
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] TypeConverter

2007-02-28 Thread cilquirm

I do it like so :

Map contextMap = ActionContext.getContext().getContextMap();

ApplicationContext applicationContext = (ApplicationContext) ((Map)
contextMap

.get("application")).get(org.springframework.web.context.WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
);


This I discovered using a bit of trail and error.
I'm not sure if there's a better way to retrieve the servlet context from a
TypeConverter, but if there was,
you'd be able to use WebApplicationContextUtils, from the spring api.




João Vieira da Luz wrote:
> 
> Hi,
> 
> How can I access application context on a custom ognl.TypeConverter?
> 
> Thanks,
> João
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/TypeConverter-tf3308136.html#a9208773
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] forward to another action

2007-03-01 Thread cilquirm

why can't you add parameters in chain?

In your action, can't you :

 1)  implement ParameterAware
 2) set a parameter value in the map that's passed in
 3) chain to your action
 4) have the value be set in your chained action, via the params interceptor

-a



Laurie Harper wrote:
> 
> Mike Baroukh wrote:
>> 
>> I can't figure how to do this.
>> Can somebody help me 
>> 
>> I wan't to forward an action to another with something like
>> requestDispatcher("/action.do?param1=value1").forward(req, res);
>> 
>> - I can't use redirect because I wan't to use the same request scope.
>> - I can't use chain because chain doesn't allow to add parameters.
>> - I can't use dispatcher because *.do is mapped to a filter and not a 
>> servlet. The application server doesn't find servlet to forward to 
>> (Result in file not found ...)
>> - I wan't to call again interceptor stack
>> 
>> So, please, how do you resolve this case ???
>> Why having deleted the ServletAction that was in WW 
> 
> So you're using Struts2? Why not just configure the target action in 
> your action mapping as normal? Roughly,
> 
>
>  /action.do?param1=value1
>  ...
>
> 
> If 'value1' isn't static, you can use the ${expr} form to resolve it 
> against the value stack.
> 
> L.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/forward-to-another-action-tf3326999.html#a9259840
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] How to pass param to actions from Struts.xml

2007-03-14 Thread cilquirm

Create a setter with the same name as your param.

ex :

for :
This value


in MyAction :

public class MyAction implements Action {

  private String myValue;

  public void setMyValue( String value) { this.myValue = value; }

}


Type conversion's done on this param value just like any other parameter.

hth,
-a




Harring Figueiredo wrote:
> 
>  Folks,
> 
>  Is there a way to pass parameter to an Action using the struts.xml config
> file.
> 
> 1 ) I see that the  has a param attribute. How can I access its
> value from within the action?
> 
> My action already implements the ParameterAwre interface. However, I am
> unable to see the value on the Map provided by the setParameter() IoC
> call.
> 
> 2) Is this the same functionality as the the Struts ActionMapping?
> 
> Thanks in advance
> 
> Harring Figueiredo
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-s2--How-to-pass-param-to-actions-from-Struts.xml-tf3403074.html#a9478391
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] Newbie: Sharing a POJO between two or more actions

2007-03-14 Thread cilquirm


If your actions occur in sequence, ( 

 i.e. submit to an action -> display action

), 
 it's possible to use action chaining to  share objects.

http://struts.apache.org/2.x/docs/action-chaining.html



Roger Varley wrote:
> 
> Hi
> 
> I need to share an object between two actions. As I'm familiar with
> servlet programming I reached for the SessionAware interface and share
> the object that way. And it works. However. the Javadoc for
> SessionAware discourages the use of this interface as it ties the
> actions to a servlet environment. What is the recommended Struts 2 way
> of doing this?
> 
> Regards
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/%7BS2--Newbie%3A-Sharing-a-POJO-between-two-or-more-actions-tf3401421.html#a9478515
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: Validation on java.util.List

2007-03-14 Thread cilquirm


I don't know if this helps, but when I validate a list or array , i use
OGNL's selection/projection facility :

i.e. :

customers.{ ? #this.age gt 0  and #this.username neq null }.size()  eq
customers.size

creates a list of all customers whose age is greater than zero and who have
a username and checks that it is the same as the incoming array ( i.e.
everyone has a username and an age ) 

For the second part,

in your Object's  -conversion.xml  file
declare the type information of the element, like so :

Element_customers = my.Customer

more info here :

http://struts.apache.org/2.x/docs/type-conversion.html



Alex Wibowo wrote:
> 
> Hi all...
> 
> I am using Struts 2.0. Has anyone ever done validation on individual item
> in
> java.util.List before?
> 
> Say, I have a property
>   List customers
> in my Action, and Customer is defined as:
> 
> public class Customer{
>  private String username;// must not be empty
>  private int  age;// must be > 0
> }
> 
> In the JSP I have the following:
> 
> 
> 
> 
> 
> 
> 
> 
> How can I enforce using struts validation (preferrably through annotation)
> so that:
> - both username and age are compulsory
> - age must be an integer
> 
> 
> Secondly, since "age" is of type "int".. when user enter characters
> (numbers) in the textfield, they get converted to 0 (somehow).
> How can I prevent this?
> 
> 
> 
> Thanks in advance!
> 
> 
> 
> -- 
> Best regards,
> 
> 
> WiB
> ---
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Validation-on-java.util.List-tf3398904.html#a9478828
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: OSS tool to diagram struts-config.xml ?

2007-03-16 Thread cilquirm


There are a number of tools in the Eclipse space that can do this ( i.e.
they run as Eclipse plugins/features and using the underlying GEF framework
).

One that I can think of off the top of my head is StrutsIDE :
http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=StrutsIDE 

Exadel Studio also has one. They're not OSS yet, but having been bought by
Red Hat, they will be in short order.


Peter L. Berghold wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hi folks,
> 
> Anyone out there know of a tool that is Open Source that will create a
> diagram of actions and forwards from a struts-config.xml file?
> 
> 
> - --
> 
> Peter L. Berghold [EMAIL PROTECTED]
> "Those who fail to learn from history are condemned to repeat it."
> AIM: redcowdawgYahoo IM: blue_cowdawg  ICQ: 11455958
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.2.6 (GNU/Linux)
> Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org
> 
> iD8DBQFF+qZ2UM9/01RIhaARAkGpAKCT8B0yLtZs3m8kXWYaizCvma5RDwCgmC0z
> 0JOdoom27ASEZNcNkOtW6sQ=
> =IDp8
> -END PGP SIGNATURE-
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
View this message in context: 
http://www.nabble.com/OSS-tool-to-diagram-struts-config.xml---tf3414744.html#a9516649
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: Handling login for struts 2.0

2007-03-28 Thread cilquirm

I think the answer is a 2 part solution, but you're on the right track.

1) Create the interceptor that returns Action.LOGIN ( or whatever it is when
the user isn't authenticated ).

2) set up your login page in your global results type. See this page for
more information :
http://struts.apache.org/2.x/docs/result-configuration.html

That should really be all that needs be done.


Ståle Undheim wrote:
> 
> I am currently using Struts 2.0 using guice for dependency injection.
> I have a goal to have a minimum amount of xml in my project.
> 
> I want to handle all login in 1 place. So if a user isn't
> authenticated, he will be sent to the login page.
> 
> I first tried this with a base action class that I extended, in the
> base class I defined @Result for Action.LOGIN, while the subclasses
> would define @Result for Action.SUCCESS. This didn't seem to work as
> only the @Result annotation on the subclass was found by struts.
> 
> Then I tried to create an interceptor, but it seems that the only
> thing I can do here is to change the result String, not actually
> affect which page the user gets sent to.
> 
> Currently it seems to me that I have to define both Action.LOGIN and
> Action.SUCCESS @Result annotations for all Actions I define. This is
> clearly not according to the DRY principles, and not what I want.
> 
> I also now have to set @Package on all my actions, so they are in the
> package I have defined my interceptor.
> 
> What I really want, is to not have anything in my Actions that
> indicate that they require authentication (all of the do), or just a
> marker interface/annotation to enable authentication.
> 
> How can I achieve this? Is Action chaining something I should look at?
> I don't really know anything about it except that it exists. And is it
> something that can be configured from my guice module loading, or does
> it require definitions in struts.xml?
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Handling-login-for-struts-2.0-tf3480451.html#a9718422
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: IDE for struts-enabled web application

2007-04-02 Thread cilquirm


Dave Newton-4 wrote:
> 
> 
> Spend the $50; good grief.
> 
> 

Having been down this road,  I would venture with the "Don't bother." side
of the argument


In my opinion, while the price is fantastic, you're generally stuck with
versions that lag behind their completely free implementations ( i.e. the
hibernate console from the jboss ide and their wsdl support ), or don't work
as well as alternative plugins/features ( say, for example, the data access
tools ).

My advice is to get Eclipse from one of the Callisto distribution sites, and
configure it yourself using the Update Site.  

The Eclipse WTP is, for the most part, really well done and supports
everything you need for S2 development out of the box. 

However, this is one of those things where your knowledge, expertise, and
familiarity with Eclipse play a big role.  

I think, however, this is a great opportunity for someone to become much
more familiar with the Eclipse ecosystem, and learn to pick and choose the
tools that work closer to the way you want.


Dave Newton-4 wrote:
> 
> AFAIK nothing really supports S2 yet, although I don't
> know what the state of WW support was in any of the
> IDEs.
> 
> d.
> 

So true.   WW never had any good tools ( to my recollection ) either.

But, because S2 relies a lot less on the "heavy-OO" conventions that make up
S1, pretty much any IDE is suitable for S2 development.

Here, because we're using ClasspathConfiguration, Codebehind, and
Annotations, there's only been a tiny amount of locations where we have had
to go to the configuration files to make the magic happen.





 

-- 
View this message in context: 
http://www.nabble.com/IDE-for-struts-enabled-web-application-tf3493204.html#a9798158
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 URL mapping

2007-04-05 Thread cilquirm

You actually can do that with the default mapper, using wildcarding.

Here's an example of what we do :


{1}


The only trick is that you have to remember to suffix your url appropriately
when calling so that S2's dispatchfilter is able to run and pick up on the
url mapping.

i.e. ( our struts.action.extension is 'page' ) :

http://mysite.com/view/23.page

calls the execute method of the ViewAction and sets 23 to the ID.

Multiple mappings are allowed as well :


{1}
{2}


to execute :

http://mysite.com/view/movies/16.page

Of course, this implies that for every distinct format of urls that you may
have, you need a mapping set up.  If you have a lot of variety, this could
be problematic.

Otherwise, like Dave mentioned, you can look into using RestfulActionMapper.

I haven't really used Restful (more experience with Restful2) much, but it
seems that it imposes a constraint on you of having your urls of the fashion
:

http://mysite.com/myaction/paramName/paramValue 
 or
http://mysite.com/myaction/myid  ( shortcut ).

If you only have one parameter, or if you don't mind your urls in that
format, it could work for you.

One final comment.  I'm not sure how the default setup is anymore, but my
configuration has 'struts.enable.SlashesInActionNames' to be 'true'.  If you
have trouble with the above ( assuming you try it ), you might want to check
to see if that config param is the same.

hth,
-a


Dave Newton-4 wrote:
> 
> --- meeboo <[EMAIL PROTECTED]> wrote:
>> Is it possible to snap up URL parameters via
>> wildcards in Struts.xml and then pass them on as 
>> request parameters to an action? 
> 
> You may be able to use the RestfulActionMapper to do
> this; I don't know if you can do that with the default
> mapper.
> 
> http://struts.apache.org/2.x/docs/restfulactionmapper.html
> 
> d.
> 
> 
> 
>  
> 
> The fish are biting. 
> Get more visitors on your site using Yahoo! Search Marketing.
> http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-URL-mapping-tf3531174.html#a9859852
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 URL mapping

2007-04-05 Thread cilquirm

You actually can do that with the default mapper, using wildcarding.

Here's an example of what we do :


{1}


The only trick is that you have to remember to suffix your url appropriately
when calling so that S2's dispatchfilter is able to run and pick up on the
url mapping.

i.e. ( our struts.action.extension is 'page' ) :

http://mysite.com/view/23.page

calls the execute method of the ViewAction and sets 23 to the ID.

Multiple mappings are allowed as well :


{1}
{2}


to execute :

http://mysite.com/view/movies/16.page

Of course, this implies that for every distinct format of urls that you may
have, you need a mapping set up.  If you have a lot of variety, this could
be problematic.

Otherwise, like Dave mentioned, you can look into using RestfulActionMapper.

I haven't really used Restful (more experience with Restful2) much, but it
seems that it imposes a constraint on you of having your urls of the fashion
:

http://mysite.com/myaction/paramName/paramValue 
 or
http://mysite.com/myaction/myid  ( shortcut ).

If you only have one parameter, or if you don't mind your urls in that
format, it could work for you.

One final comment.  I'm not sure how the default setup is anymore, but my
configuration has 'struts.enable.SlashesInActionNames' to be 'true'.  If you
have trouble with the above ( assuming you try it ), you might want to check
to see if that config param is the same.

hth,
-a


Dave Newton-4 wrote:
> 
> --- meeboo <[EMAIL PROTECTED]> wrote:
>> Is it possible to snap up URL parameters via
>> wildcards in Struts.xml and then pass them on as 
>> request parameters to an action? 
> 
> You may be able to use the RestfulActionMapper to do
> this; I don't know if you can do that with the default
> mapper.
> 
> http://struts.apache.org/2.x/docs/restfulactionmapper.html
> 
> d.
> 
> 
> 
>  
> 
> The fish are biting. 
> Get more visitors on your site using Yahoo! Search Marketing.
> http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-URL-mapping-tf3531174.html#a9859853
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 URL mapping

2007-04-05 Thread cilquirm

You actually can do that with the default mapper, using wildcarding.

Here's an example of what we do :


{1}


The only trick is that you have to remember to suffix your url appropriately
when calling so that S2's dispatchfilter is able to run and pick up on the
url mapping.

i.e. ( our struts.action.extension is 'page' ) :

http://mysite.com/view/23.page

calls the execute method of the ViewAction and sets 23 to the ID.

Multiple mappings are allowed as well :


{1}
{2}


to execute :

http://mysite.com/view/movies/16.page

Of course, this implies that for every distinct format of urls that you may
have, you need a mapping set up.  If you have a lot of variety, this could
be problematic.

Otherwise, like Dave mentioned, you can look into using RestfulActionMapper.

I haven't really used Restful (more experience with Restful2) much, but it
seems that it imposes a constraint on you of having your urls of the fashion
:

http://mysite.com/myaction/paramName/paramValue 
 or
http://mysite.com/myaction/myid  ( shortcut ).

If you only have one parameter, or if you don't mind your urls in that
format, it could work for you.

One final comment.  I'm not sure how the default setup is anymore, but my
configuration has 'struts.enable.SlashesInActionNames' to be 'true'.  If you
have trouble with the above ( assuming you try it ), you might want to check
to see if that config param is the same.

hth,
-a


Dave Newton-4 wrote:
> 
> --- meeboo <[EMAIL PROTECTED]> wrote:
>> Is it possible to snap up URL parameters via
>> wildcards in Struts.xml and then pass them on as 
>> request parameters to an action? 
> 
> You may be able to use the RestfulActionMapper to do
> this; I don't know if you can do that with the default
> mapper.
> 
> http://struts.apache.org/2.x/docs/restfulactionmapper.html
> 
> d.
> 
> 
> 
>  
> 
> The fish are biting. 
> Get more visitors on your site using Yahoo! Search Marketing.
> http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-URL-mapping-tf3531174.html#a9859854
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: How to get a attribute value of map value?

2007-04-05 Thread cilquirm


The second way, %{test['AnyString'].att} or even, explicitly,
%{test['AnyString'].getAtt()} should both work.

I know it might sound dumb, but is there a value to att? ( using that class
as an example, there's no way to set it :-)

-a


Felipe Rodrigues wrote:
> 
> Hi guys,
> 
> I have this case now, and I'm not getting take the value of a map value
> attribute.
> Let me explain better. I have a class:
> 
> class Mov{   private String att;   public String getAtt(){  return att; }
> }
> 
> and I put it inside a java.util.Map, like
> 
> Map test = new HashMap();
> test.put("AnyString", new Mov( ) );
> 
> So I'm trying to get the value of att from the map, using OGNL.
> %{test['AnyString']} prints the mov.toString( ), 
> %{test['AnyString'].att} prints nothing and finally
> %{test['AnyString']}.att prints it as literal.
> 
> Using EL I would do that, ${test['AnyString'].att}, how could I do the
> same thing using OGNL?
> 
> Thanks in advance,
> 
> Felipe
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-get-a-attribute-value-of-map-value--tf3532725.html#a9860232
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: request.getParameterValues OGNL ?

2007-04-05 Thread cilquirm

Hi,

Does 


...


not work for you?



Will Berger wrote:
> 
> How does one in struts 2 process a list of req parameters using ognl?  
>
> In jsp, this gets the job done.
> <%
>  String emailList[] = request.getParameterValues("email"));
>  for (int i=0;i {
>  out.println(emailList[i]);
> }
> %>  
> What is the equivalent with the  
> Any help much appreciated.  If someone could point me at some
> documentation I would gladdly
> not ask this basic questions. 
> 
> Will
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/request.getParameterValues-OGNL---tf3528203.html#a9860691
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] Adding Calendar function to a form.

2007-04-10 Thread cilquirm

Struts 2 tags support pretty much all the attributes that their html
counterparts do.
I haven't used NewCal ( seen it, but not used it )

but you can try something like this :


javascript:NewCal('myfield','ddmmm',true,24)  images/cal.gif  


Skip Hollowell wrote:
> 
> I tried the s:datetimepicker to work on things, but since I am not using 
> AJAX, I believe that is a dead end, no?  There'd be no point in bringing 
> in the ajax theme if I wasn't using AJAX.
> 
> So how do I incorporate a standard js calendar routine into a field on 
> my form?
> 
> What I want to add:
>  javascript:NewCal('demo1','ddmmm',true,24)  images/cal.gif  
> 
> Where I want to add it:
> 
> 
> I am just missing the concept here on how to plug custom code into the 
> s: tags.  I am trying very hard not to hack this thing to bits with 
> tricks and cheats.
> 
> Skip Hollowell
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Adding-Calendar-function-to-a-form.-tf3555209.html#a9929125
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: Can we *please* havea seperate Struts *2* - User list?

2007-04-11 Thread cilquirm


Just FYI, Nabble does provide RSS feeds on a per-list/forum level.

I Live-bookmark http://www.nabble.com/Struts---User-f206.html




Frank W. Zammetti wrote:
> 
> I think the thought behind not splitting the lists to this point is that 
> Apache experience has been that it tends to divide a community rather 
> than direct traffic in a more granular way.  The idea is that a Struts 
> user is a Struts user regardless of version, and those that may not be 
> using S2 today (yours truly included for the most part) may well be 
> using it tomorrow... a person can get a leg-up just by keeping an eye on 
> the S2 posts (I know that's true for me).  One could always subscribe to 
> multiple lists of course, but in terms of community, a single united 
> list theoretically at least yields more synergy.  This is my 
> interpretation of things I've seen stated in the past (I happen to agree 
> with it too :) ).  Maybe the thinking is different now by those who are 
> in a position to change things, I don't know.
> 
> As for a forum, I seem to remember Apache infrastructure not supporting 
> it, and I also seem to remember something about Apache projects not 
> (directly at least) using outside resources... others more knowledgeable 
> than I would have to answer this though... I can't off the top of my 
> head think of any other Apache project that has a forum that is 
> officially linked to the project.  As a personal opinion, I'm not sure I 
> see the benefit of a forum vs. a mailing list, they seem pretty well 
> even to me, maybe a slight edge to the mailing list since it goes to my 
> mail client... I could see a good argument though for a forum that 
> supplies an RSS feed too.
> 
> Frank
> 
> Antony Stubbs wrote:
>> Well it might have made sense if struts 2 issues were somehow applicable
>> to
>> struts 1, but they're mostly not. 
>> 
>> For Struts 2 to be adopted, it needs to be clearly separated from struts
>> 1,
>> as is the code base. This includes having clearly separate support to
>> make
>> it as easy as possible to find help. It's not like it's we want a struts
>> 1.5
>> list. 2 is very different from 1. 
>> 
>> What's the mentality for keeping them jumbled together?
>> 
>> I suppose you don't see a separate mailing list for every major tapestry
>> release, but this is a case of adopting the best process that fit's the
>> situation, and in this situation the lists should be seperate IMO.
>> 
>> 
>> Dave Newton-4 wrote:
>>> --- Antony Stubbs <[EMAIL PROTECTED]> wrote:
 This list seems to be quite busy, and I think
 everyone would benefit hugely from separating out
>>> the
 two frameworks for obvious reasons. Actually I'm
 surprised this hasn't been done already.
>>> It's been brought up (even by me) in the past; I still
>>> agree and would vote for separation if it was votable.
>>>
>>> d.
>>>
>>>
>>>
>>>  
>>> 
>>> Finding fabulous fares is fun.  
>>> Let Yahoo! FareChase search your favorite travel sites to find flight
>>> and
>>> hotel bargains.
>>> http://farechase.yahoo.com/promo-generic-14795097
>>>
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>> 
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM/Yahoo: fzammetti
> MSN: [EMAIL PROTECTED]
> Author of "Practical Ajax Projects With Java Technology"
>   (2006, Apress, ISBN 1-59059-695-1)
> Java Web Parts - http://javawebparts.sourceforge.net
>   Supplying the wheel, so you don't have to reinvent it!
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can-we-*please*-havea-seperate-Struts-*2*---User-list--tf3556523.html#a9941601
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.action.extension question

2007-04-11 Thread cilquirm

I don't believe this can be cleanly handled with just the web 2.4 spec and
struts2.

Some container, like Resin, allow for url-patterns to be regexes, which
would help in this scenario.



meeboo wrote:
> 
> The problem is that I have a lot of URL:s which look like /user/username,
> movie/movieTitle or account/create - and I don't want to forward or
> redirect for each URL since this will slow down my application. Is there a
> way to exclude .css extensions maybe?
> 
> 
> joey-30 wrote:
>> 
>> keep struts.action.extension default.and create a filter to make sure
>> it's before the struts filter.like this:
>> 
>> yourfilter
>> movie/*
>> 
>> 
>> struts2
>> /*
>> 
>> u can foward or redirect to the url movie.action?movieTitle=* or
>> something
>> else in your
>> filter.
>> 
>> regards
>> joey
>> On 4/11/07, meeboo <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>> No takers on this?
>>>
>>>
>>> meeboo wrote:
>>> >
>>> > Hey all
>>> >
>>> > I have a mapping pattern which looks like this
>>> >
>>> > >> class="com.bubbleclip.web.struts.action.PlayMovie
>>> ">
>>> > {1}
>>> > /movie.jsp
>>> > 
>>> >
>>> > The wildcard is for backwards compability since our original
>>> JSP/Servlet
>>> > web-layer mapped movie titles like
>>> > http:localhost:8080/movie/movieTitle
>>> >
>>> > This works fine if I set struts.action.extension to "", this way I
>>> > preserve compatibility since the movie title is the actual action
>>> name.
>>> > The problem is that S2 will also interpret everything else as being
>>> > actions - even CSS names making the pages not render correctly. Is
>>> there
>>> a
>>> > way around this?
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/struts.action.extension-question-tf3548145.html#a9934814
>>> 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.action.extension-question-tf3548145.html#a9941787
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: returns an String[] when is checked!

2007-04-11 Thread cilquirm


Try declaring a boolean setter in your Action with the checkbox name.

i.e.  

setCheckboxName( boolean val ) { this.checkboxName = val ; } 

and using that instead.

I'm not sure why you're trying to get the value from the
ActionContext.getParameters().  That will return the raw, globbed values of
the parameters, and they by nature are multi-valued, so a String[] is
expected. 
( it's possible for a query string to be someParam=a&someParam=b ).








Felipe Rodrigues wrote:
> 
> Hi guys,
> 
> I'm using ActionContext.getContext().getParameters().get("checkboxName");
> to get a value from a checkbox in my jsp.
> The problem here is, when its value is false, works fine, I got an String.
> But when my checkbox is checked and I call this same method, I got a
> String[] and as you know, if I cast from String[] to String I got an cast
> exception.
> Does somebody knows why I got this behavior?
> 
> Thanks,
> 
> Felipe
> 

-- 
View this message in context: 
http://www.nabble.com/%3Cs%3Acheckbox%3E-returns-an-String---when-is-checked%21-tf3559152.html#a9943331
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] Adding Calendar function to a form.

2007-04-11 Thread cilquirm

it is possible, if you extend and modify whatever theme you're using.

Then you can put that code wherever you want it to show up right inside the
freemarker template that renders it.
http://struts.apache.org/2.x/docs/extending-themes.html

hth,
-a


Skip Hollowell wrote:
> 
> Trying again, due to bad formatting on Nabble...
> I saw cilquirms reply, but I don't think I phrased my problems 
> correctly.  I understand that the tag libraries are very accomodating, 
> but I am at a loss as to how to insert this code.  This little calendar 
> image and the associated href for clickability would need to go 
> somewhere inside the generated code that the tag outputs.  Is that even 
> possible?  I want to have the little calendar icon be next to the field 
> input, so user's can use it instead of typing in a date by hand. 
> 
> Hopefully that is a bit more clear on my issues.
> 
> Any ideas?
> 
> ---
> 
> I tried the s:datetimepicker to work on things, but since I am not using 
> AJAX, I believe that is a dead end, no?  There'd be no point in bringing 
> in the ajax theme if I wasn't using AJAX.
> 
> So how do I incorporate a standard js calendar routine into a field on 
> my form?
> 
> What I want to add is this calendar clickable icon that brings up a date 
> picker:
> 
>  javascript:NewCal('demo1','ddmmm',true,24)  images/cal.gif  
> 
> 
> Where I want to add it is next to my input box on my form for the 
> datePaid field:
> 
> 
> I am just missing the concept here on how to plug custom code into the 
> s: tags.  I am trying very hard not to hack this thing to bits with 
> tricks and cheats.
> 
> Skip Hollowell
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Adding-Calendar-function-to-a-form.-tf3555209.html#a9946512
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.action.extension question

2007-04-11 Thread cilquirm


I believe I didn't follow the original issue, then.

I thought that struts2 was swallowing the requests for the css files because
they fit the pattern specified by the filter.
I can't see how making them absolute urls would be any different for the
filter, because when the request is made by the browser, it all looks the
same to the filter.


meeboo wrote:
> 
> Unfortunately I'm running Tomcat. I did come up with a pretty clean
> solution though, what I do is that I link to the CSS /JS/Image files via
> an absolute URL, so instead of "public/css/design.css" I use
> "http://mydomain.com/public/css/design.css"; - good enough for me at the
> moment.
> 
> 
> cilquirm wrote:
>> 
>> I don't believe this can be cleanly handled with just the web 2.4 spec
>> and struts2.
>> 
>> Some container, like Resin, allow for url-patterns to be regexes, which
>> would help in this scenario.
>> 
>> 
>> 
>> meeboo wrote:
>>> 
>>> The problem is that I have a lot of URL:s which look like
>>> /user/username, movie/movieTitle or account/create - and I don't want to
>>> forward or redirect for each URL since this will slow down my
>>> application. Is there a way to exclude .css extensions maybe?
>>> 
>>> 
>>> joey-30 wrote:
>>>> 
>>>> keep struts.action.extension default.and create a filter to make sure
>>>> it's before the struts filter.like this:
>>>> 
>>>> yourfilter
>>>> movie/*
>>>> 
>>>> 
>>>> struts2
>>>> /*
>>>> 
>>>> u can foward or redirect to the url movie.action?movieTitle=* or
>>>> something
>>>> else in your
>>>> filter.
>>>> 
>>>> regards
>>>> joey
>>>> On 4/11/07, meeboo <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>>
>>>>> No takers on this?
>>>>>
>>>>>
>>>>> meeboo wrote:
>>>>> >
>>>>> > Hey all
>>>>> >
>>>>> > I have a mapping pattern which looks like this
>>>>> >
>>>>> > >>>> class="com.bubbleclip.web.struts.action.PlayMovie
>>>>> ">
>>>>> > {1}
>>>>> > /movie.jsp
>>>>> > 
>>>>> >
>>>>> > The wildcard is for backwards compability since our original
>>>>> JSP/Servlet
>>>>> > web-layer mapped movie titles like
>>>>> > http:localhost:8080/movie/movieTitle
>>>>> >
>>>>> > This works fine if I set struts.action.extension to "", this way I
>>>>> > preserve compatibility since the movie title is the actual action
>>>>> name.
>>>>> > The problem is that S2 will also interpret everything else as being
>>>>> > actions - even CSS names making the pages not render correctly. Is
>>>>> there
>>>>> a
>>>>> > way around this?
>>>>> >
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/struts.action.extension-question-tf3548145.html#a9934814
>>>>> 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.action.extension-question-tf3548145.html#a9946608
Sent from the Struts - User mailing list archive at Nabble.com.


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