Changing Result Class at Runtime

2009-06-25 Thread Dan Slack
Hi,

 

So, first off, I'm doing some unit testing with Struts2.  So far, using
different solutions provided from other sites, I've been able to run a unit
test on an Action.  However, I had to tell Struts2 to NOT execute the
result.  This is fine when I'm testing that my Action is a-ok, however, I
would like to execute the result to verify that I have no major errors in my
view.  Specifically, for my actions that use Velocity as their view
technology, I'd like to execute them.

 

The problem is that I'm running these tests outside of a container.  This
means that the location of my template files are different than what the
struts configuration is expecting (/WebContent/WEB-INF/templates/hello.vm
instead of /WEB-INF/templates/hello.vm).  So, my first thought is, write my
own class that extends from VelocityResult and override the getTemplate
method to tweak the location, and then call the super.getTemplate(.).

 

Well, I very quickly realized that I had no real way of easily overriding
the velocity result mapping (at least, its not as apparent as the
VelocityManager override).  I contemplated creating my own mapping file (ala
struts-default.xl) just for testing, but, then realized that this wouldn't
work as my actual Struts mappings all extend from struts-default.

 

Does anybody know how to do this?

 

Thanks,

Dan Slack



RE: Prevent Word formatting

2009-06-25 Thread Dan Slack
If you want to allow pasting, but just strip out the word formatting, well,
that can be a pain, and the easiest solution is to use javascript.

I've used a library called CleanPaste
(http://antscode.blogspot.com/2009/05/strip-formatting-on-paste-using-yui.ht
ml), however, this is tied to the YUI Rich Text Editor.  I'd imagine there
are other "clean pastes" out there for non-YUI users..

If you want to disable pasting entirely, you can do some javascript keycode
checking for ctrl-v (although this is NOT fullproof).

Dan Slack

-Original Message-
From: Jim Collings [mailto:jlistn...@gmail.com] 
Sent: Thursday, June 25, 2009 2:34 PM
To: Struts Users Mailing List
Subject: Prevent Word formatting

I don't want users pasting in formatting from Word into my Struts II
text area. How can I prevent this?


Jim C.

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


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



Struts 2.1.6 TLD file

2009-07-30 Thread Dan Slack
Hi,

 

Our J2EE server (Sybase EAServer 6.1) has been complaining about my struts 2
application when I deploy it.  After some digging, it turns out that the
"tlibversion" in the Struts2 tld file is "invalid".  This seemed to happen
when I changed my project to Servlet 2.5.  

 

The Struts 2 tlibversion is 2.2.3, and I know that the 'tlibversion' can be
a dewey-decimal type, but from my memories of libraries, I don't remember it
being allowed to have 2 decimal points.  Does anybody know if this is a
failing of my server, or is this something that is a failing of Struts2?

 

In the mean time, I actually, at runtime, open up the Struts 2 Jar, and
modify the tld to "fix" it when deploying to that server.

 

Thanks

Dan Slack



RE: Struts 2.1.6 TLD file

2009-07-30 Thread Dan Slack
Ok, so, it's obviously an issue with my servers validation of tlibversion.

I'll guess I'll have to stick with my hack until a new version of the server
is tested.

Thanks,
Dan

-Original Message-
From: Musachy Barroso [mailto:musa...@gmail.com] 
Sent: Thursday, July 30, 2009 3:12 PM
To: Struts Users Mailing List
Subject: Re: Struts 2.1.6 TLD file

agr, actually I missread the regex, I read 0..3 as applied to [0..9].
So the version in the tld is ok.

musachy

On Thu, Jul 30, 2009 at 1:09 PM, Musachy Barroso wrote:
> Yes, the version is wrong in struts, according to the JSP Spec:
>
> 
> Describes the JSP version (number) this taglibrary requires in order to
function
> (dewey decimal)
> The default is 1.1
> #PCDATA ::= [0-9]*{ “.”[0-9] }0..3
>
> //I will fix it in trunk
> musachy
>
> On Thu, Jul 30, 2009 at 12:50 PM, Dan Slack wrote:
>> Hi,
>>
>>
>>
>> Our J2EE server (Sybase EAServer 6.1) has been complaining about my
struts 2
>> application when I deploy it.  After some digging, it turns out that the
>> "tlibversion" in the Struts2 tld file is "invalid".  This seemed to
happen
>> when I changed my project to Servlet 2.5.
>>
>>
>>
>> The Struts 2 tlibversion is 2.2.3, and I know that the 'tlibversion' can
be
>> a dewey-decimal type, but from my memories of libraries, I don't remember
it
>> being allowed to have 2 decimal points.  Does anybody know if this is a
>> failing of my server, or is this something that is a failing of Struts2?
>>
>>
>>
>> In the mean time, I actually, at runtime, open up the Struts 2 Jar, and
>> modify the tld to "fix" it when deploying to that server.
>>
>>
>>
>> Thanks
>>
>> Dan Slack
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



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

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



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



Struts 2 Velocity Text tag

2009-08-21 Thread Dan Slack
Hi,

 

I'm at a little bit of a loss here.  I am attempting to use the #stext()
user directive provide by Struts 2 to output I18N messages.  However, I need
to pass in additional arguments.  In tag libs, all I'd have to do is:

 



Param 1



 

However, in Velocity, the stext component is inline, so, I can't nest the
param directives.  I thought that I could perhaps pass in the "values"
property directly like:

#stext('name=sample' 'values={"Param 1"}')

 

But, after trying this (and other iterations), I stepped through the source
and saw that it wasn't working because there is no setter for values, and
the values property itself isn't publicly accessible.  Has anybody found a
way of pulling this off?  I'm looking at possibly writing my own stext user
directive to handle this, as this is a pretty common use case.

 

Thanks,

Dan Slack



Sitemesh 2.4 and Struts 2.0.14

2009-03-18 Thread Dan Slack
Hi,

 

First, I apologize if this has already been mentioned, but I recently
attempted to upgrade to Sitemesh 2.4 to bad results.  I guess in Sitemesh
2.4, the "PageFilter" was deprecated, and all code has been removed.  This
means that "applyDecorators" method is not being called anymore, which means
that the method in VelocityPageFilter never gets called for Velocity files
(and Freemarker templates I'd assume).  So, I had to revert back to Sitemesh
2.3.

 

 I did a brief search, but, didn't see anything (I also looked briefly into
Struts 2.1.x plugin, and saw that it was also assuming that the PageFilter
is calling "applyDecorators"). Is anybody aware of any efforts to update the
Sitemesh plugin for 2.4.x?

 

Thanks,

 

Dan Slack
Langui Systems Inc.