Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 5 Apr 2008 05:56:51 -0000 Issue 7965

user-digest-help

2008-04-05


Author LoginPost Reply

user Digest 5 Apr 2008 05:56:51 -0000 Issue 7965

Topics (messages 185064 through 185087):

Re: [OT] What do you code today?
 185064 by: Martin Gainty
 185068 by: David Durham, Jr.
 185069 by: Chris Pratt
 185080 by: Frank W. Zammetti

Re: rrrrr...why my field returns null????
 185065 by: xianwinwin

Re: Connecting s:autocompleter and s:div
 185066 by: manishbel
 185067 by: Musachy Barroso

Re: Struts 2 exception problem
 185070 by: jimski
 185079 by: jimski
 185081 by: jimski

Struts2 tags behaviour customizable? isXyz() instead of getXyz()
 185071 by: akash agrawal
 185072 by: Musachy Barroso
 185073 by: akash agrawal
 185074 by: Musachy Barroso
 185075 by: akash agrawal
 185076 by: David Durham, Jr.
 185077 by: akash agrawal
 185078 by: David Durham, Jr.
 185082 by: Laurie Harper

Re: <s:radio> issue
 185083 by: Laurie Harper

Re: any struts 2 unit testers out there?
 185084 by: Laurie Harper

Re: Freemarker (old version that struts2 uses) disappearing pages
 185085 by: Laurie Harper
 185087 by: Dustin S.

Re: [S2] Struts with Web Services
 185086 by: Wes Wannemacher

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------

Attachment: user_185064.ezm (zipped)
Could you suggest a pattern which would most closely match the requirements
for the typical workflow application?

When I think of workflow I think of a uber-dispatcher who assigns work based
on
a)capabilities of the resource
b)availability of the resource
c)priority of product/service
Any thoughts/ideas to implement a viable Architecture would be greatly
appreciated

Thanks
Martin
----- Original Message -----
From: "Ted Husted" <husted@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Friday, April 04, 2008 6:14 AM
Subject: [OT] What do you code today?


> While outward facing web application get the most publicity, I know
> that most of us are heads-down on internally-facing applications
> designed for fellow employees to use over the corporate intranet.
>
> I'm trying to put together a list of the typical types of applications
> that enterprise developer write in real life. For example, my last
> project involved a system to track drafting, granting, monitoring, and
> enforcing water permits administered by a government agency. We would
> create an initial record for a permit, and then add child records to
> track progress through the workflow, and also update the master record
> along the way. For management, a key item here is a tracking report,
> which we exported to Word (using a third-party tool) for better
> formatting. For engineers, a key item was a flexible search system to
> quickly find a master or child record. Other interesting features are
> workflows where one task leads to another. When we completed one task
> (child record), the next is often implied, and so we had a workflow
> that would default the next task to work on when a current task was
> closed. Another interesting requirement was that sometimes master
> items were merged under another uber-master-item, becoming, in effect,
> child items themselves. In most cases, the application simply exposed
> business models that we designed into the database, so the application
> has little business logic of its own. Most of the workflows were
> designed to find, list, edit, or view one database entity or the
> other.
>
> So, if anyone else is up for sharing, I'd be interested in hearing
> what sort of things other people are doing these days. (If your not
> comfortable posting the list, feel free to mail me direct.)
>
> -Ted.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_185068.ezm (zipped)
On Fri, Apr 4, 2008 at 6:14 AM, Ted Husted <husted@(protected):
> So, if anyone else is up for sharing, I'd be interested in hearing
> what sort of things other people are doing these days. (If your not
> comfortable posting the list, feel free to mail me direct.)

I'm working with python and plone these days, and I'm completely out
of my element. It's kind of refreshing.

I wrote a little Plone product (really just modified some examples and
asked a lot of questions in irc :)) which facilitates integrating
external applications within a Plone site. Check it out here:

http://plone.org/products/contentcaller

You can use it to include a JSP or servlet or whathaveyou in a Plone
page. There's also support for GWT. I'm just getting started with
that, but it's kind of interesting. A bit tangential, but Plone has
workflows as well, only they're visibility centric.

I also wrote a java library that can be used to automagically create
Java Beans from an excel file or csv. You can see that here:

 http://code.google.com/p/beanfiles/

My employer graciously allowed me to opensource the beanfiles tool.
Maybe someone here will find it useful. If not, doesn't bother me at
all. :)

--Dave

Attachment: user_185069.ezm (zipped)
I'm still working on externally facing applications. The company has
a few different types of user that it supports (Members who receive
services, Providers who provide the services, Brokers who sell the
service, and Clients that pay for their members to receive services).
Each of these audiences has their own web site to support their needs.
Up to about 4 months ago, each of these sites was written in it's
own, home-grown framework which effectively prevented developers from
one team helping out any of the other teams.

So, recently I had the opportunity to try out a few different
technology stacks to try and pick one for the company. I started with
Struts 1 and we wrote a successful externally facing application that
was well received and most of the people that are maintaining it
haven't had any problems.

Next I wrote a Struts 1/Tiles 1 application that had a strict
internationalization requirement (since it had to support multiple
languages from day 1). That also went very well and has been an easy
maintainence platform.

After that I wrote my first Struts 2 app (with Spring and Acegi
security). I fell in love with the new controller, but I'm still a
bit disappointed in the view. Struts 2 definitely has a steeper
learning curve for our junior programmers since it's a bigger
departure from what they're used to, but it's worth the climb. And
while I think Acegi probably has a place in a packaged application
where you're not sure what form the authentication database will take,
it was waaayyy overkill and waaayyy, waaayyy to complex for what we
needed. To this day I'm still the only one that can do maintainence
on that part of the site.

So then the powers-that-be sent down a decree that, since they
consider us an IBM shop and HAL has said that JSF is the way of the
future, that we would have to use JSF (even after all the discovery
that had been done in-house). So we embarked on a two month fiasco to
try and convert our current Struts 1 like, MVC applications, that have
requirements like sending out formatted e-mails and generating PDF's
on the fly, to JSF which was a dismal failure.

Fast forward to 4 months ago when we started the actual rewrite of the
first audience web site using Struts 2, Spring, and Tiles 2. We
removed Acegi from the mix and wrote a very flexible (if I do say so
myself) authentication/authorization system that is currently backed
by both LDAP and ActiveDirectory (something we could never get working
in Acegi). We have about 1 month left and we'll be "shipping" the
first of the new, unified, web sites. Then it's on to the next
audience.
(*Chris*)

Attachment: user_185080.ezm (zipped)
Ted Husted wrote:
> I'm trying to put together a list of the typical types of applications
> that enterprise developer write in real life.

My current main project, which has been my main project for about two
years now, is an application that seeks to unite all the back-office
applications in our organization into one consolidated offering. Right
now we have image viewing capability with workflow integration, new
account creation and maintenance, account inquiry for call center
personnel and account transfer creation/tracking/processing. We're a
few weeks away from rolling correspondence creation under the common
application. There are at least four separate projects going on that
are new pieces that "snap" into this main application.

We offer a host of management reporting capabilities, real-time
dashboarding of statistics and metrics for managers, multi-level
security backed by a highly robust LDAP-based security infrastructure,
and a host of web services for various clients. But all of this is
under a common umbrella application... each piece is a separate bit of
functionality (as evidence by the fact that some clients want part A and
nothing else and we're able to provide that with the flip of a switch),
and yet all the pieces are integrated (not just "at the glass" either,
we're talking the ability for one component to use the data from another
seamlessly) but at the same time they are developed independently and
are, with few exceptions, highly isolated in terms of packaging and
development cycles.

This is a highly complex undertaking that is pushing the limits of RIA
development as most people know it today. It's using virtually every
cool buzzword out there today in some form or other :) I have no qualms
about putting it up against any other web-based application out there in
terms of complexity and in terms of how close it actually comes to
looking, feeling and functioning like a fat-client app. It's extremely
flexible, powerful and pretty elegant architecturally (that's not to say
it's perfect: when you do something this large and complex you're bound
to learn some things through the process, and we certainly have, but it
says a lot about how good the underling architecture is that we've been
able to extend it and frankly correct things along the way without
killing ourselves, our budget or our timelines).

This is a back-office application primarily, but as I mentioned, parts
of it are used by various remote clients (the application and the web
services, which are two separate offerings) as well as more
front-office-type concerns (and all three groups are getting expanded
functionality little by little... this is without question the
fastest-growing application we have as most new development is targeted
to be a part of it).

> So, if anyone else is up for sharing, I'd be interested in hearing
> what sort of things other people are doing these days. (If your not
> comfortable posting the list, feel free to mail me direct.)

Over the past 10 years, here's a rundown of some of the other
applications I've developed:

* An application for creating, tracking and reconciling transfers of
assets between accounts (this capability has been rolled into the
previously mentioned application). This is also very definitely an RIA
and for a long time was the model for more advanced web UI applications
throughout the company.

* An application for maintaining insurance accounts. This was a very
interesting project because it was the first large web-based application
that used data (and processing) on the mainframe. It was also notable
because we didn't have an app server at the time, just a web server with
some now-defunct IBM technology allowing us to talk to the mainframe.
This application was actually developed around 1999, but it's in many
ways *the* model for an RIA: with no app server, the *entire*
application lived on the client... the calls to the mainframe were
essentially service calls that always returned nothing but data that the
client then did something with. Ironically, this is largely the model
we're using for the first app I mentioned at the start, except now we're
doing it with DWR and a far fancier UI.

* An application for processing of complex corporate actions (stock
splits, things like that). This was one of the more logic-heavy
applications because of the nature of the processing involved, and we
essentially custom-developed a very capable rules engine for it. This
was another RIA for sure, but it was a little server-heavy for my tastes
(didn't use AJAX per se, but pulled a lot of the same sort of partial
page refresh tricks).

* An application for processing of incoming payments. This was an
interesting project because it started out as a Visual Foxpro-based
Windows app and we pretty much ported the whole thing to the web in
terms of look and feel... I remember many comments by long-time users
that they couldn't tell the difference unless we told them (we simply
updated the icon on their desktop to point to a URL rather than an
executable).

All of those were internal-facing applications, some with client-facing
applications. A few of the external-facing applications I've done:

* An application for viewing of canceled checks online by shareholders.
This was again developed in the 90's, but it actually did what we'd
all probably now call COMET (you could actually sit and watch a queue
waiting for your check to show up in real-time).

* Created a portal (before there was such a term!) for our shareholders
so they could monitor their holding, get messages from us, etc., all
completely definable by them in terms of layout and content.

* Created an HTML-based facility for folks to securely download
generated investment reports as they saw fit. I frankly don't even
remember a whole lot about this except that it had some requirements
that couldn't be achieved with kind of "basic" technologies, it required
some pretty fancy coding to make work as specified (it hasn't been live
for a couple of years, hence I've cleared out that portion of my brain
to make room for more useful knowledge!)

Err, actually, I think that's it! Most of my work has been
internal-facing. Oh, I actually consulted on an interface for CheckFree
at one point too :)

I'm leaving out all the Windows-only products I developed since I assume
they aren't terribly relevant to anyone on a Struts list :) None of
that is more recent than about 1997 anyway.

> -Ted.

Frank

--
Frank W. Zammetti
Author of "Practical DWR 2 Projects"
 and "JavaScript, DOM Scripting and Ajax Projects"
 and "Practical Ajax Projects With Java Technology"
 for info: apress.com/book/search?searchterm=zammetti&act=search
Java Web Parts - javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!
My "only partially serious" blog: zammetti.com/blog

Attachment: user_185065.ezm (zipped)

I checked it on both IE7 and FireFox - no error on the js and the value is
NULL

any idea?!?!




Laurie Harper wrote:
>
> If it works without theme set to ajax, it's probably a client-side
> issue. What browser are you using? Are there any Javascript errors
> reported?
>
> L.
>
> xianwinwin wrote:
>> thank you Laurie for your reply.
>>
>> I made a type - its str not the Note. so the str is null :-(
>>
>> when I remove the theme="ajax" it works fine. BUT I need it there (the
>> idea
>> that the form will disappear once the action is completed).
>>
>> how do I get the value of the str? rrrrrr :-(
>> I've been trying different variation - nothing!
>>
>> thanks for any pointer!
>>
>>
>>
>> Laurie Harper wrote:
>>> Your action doesn't have a bean of name/type Note, it only has a single
>>> String property 'str'. Did you mean this property is not being set? From
>>> the code you've included, it should be set from the textfield so you
>>> must have something configured wrong. What does your action mapping look
>>> like? Are you using the default interceptor stack or have you specified
>>> a different one?
>>>
>>> L.
>>>
>>> xianwinwin wrote:
>>>> Can anyone advise why my bean is null.
>>>>
>>>> I have the following jsp page:
>>>>
>>>> <html>
>>>> <head>
>>>>   <s:head theme="ajax"/>
>>>> </head>
>>>> <body>
>>>>  
>>>> <s:form    
>>>>    theme="ajax"
>>>>    id="myForm"
>>>>    cssStyle="font-size :  8pt; font-family: verdana"
>>>>    action="notes_insert"
>>>>    method="post" >
>>>>
>>>>  <s:textarea rows="5" cols="60" name="str" label="Add Note"
>>>> required="true"/>
>>>>
>>>>  
>>>>  <s:submit align="center" targets="myForm" theme="ajax"/>  
>>>>  
>>>> </s:form>
>>>>
>>>> when the user cllicks submit - the action 'insert' kicksin but the bean
>>>> (Note) is null (yes, i have getter and setter)
>>>>
>>>>
>>>>
>>>>
>>>> //action
>>>> @Validation
>>>> public class NoteAction extends BaseSupport implements Serializable
>>>> {    
>>>>  private String str;
>>>>  
>>>>  
>>>>  @SkipValidation
>>>>  public String insert()
>>>>  {      
>>>>    System.out.println("the value is "+ str);
>>>>  }
>>>>
>>>>
>>>>  public String getStr()
>>>>  {
>>>>    return str;
>>>>  }
>>>>
>>>>  public void setStr(String str)
>>>>  {
>>>>    this.str = str;
>>>>  }
>>>> }
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_185066.ezm (zipped)

Thanks for the response Musachy,

The problem still persists. i went ahead and tried to follow one of the
examples on struts showcase " A div
that will listen to events to refresh and start/stop autoupdate". the
result was the same.

I also tried by copying the whole example into my application. the page
continues to refresh over and over. and i see multiple sections being added
and eventually the browser hangs.

I am not sure what's going on as i am not very well versed with struts 2 or
Ajax.

Any ideas?

Thanks
Manish.


Musachy Barroso wrote:
>
> The problem is that the notify topics are published multiple times
> (before request, after request and on error). A parameter is passed to
> the topic listener indicating when the topic is fired. Search the
> archives for examples (dojo.event.topic.subscribe), also look at the
> ajax examples on showcase.
>
> musachy
>
> On Thu, Apr 3, 2008 at 1:00 PM, manishbel <manishbel@(protected):
>>
>> Hello There,
>>
>> I am new to struts and have a requirement where i have to connect the
>> autocompleter with the div e.g. when autocompleter's value changes i
>> need
>> to refresh the contents of the div. i have written the following code to
>> achieve that.
>>
>> The Div Code
>> --------------
>> <s:div cssClass="formcontainer" href="%{EmailDistributionList_Load}"
>> theme="ajax" listenTopics="distributionListNameChange" autoStart="false"
>> formId="EmailDistributionList" >
>>
>> The AutoCompleter Code
>> -------------------------
>> <s:autocompleter name="emailDistributionList.distributionListName"
>> keyName="emailDistributionList.id"
>>                 list="emailDistributionLists" listKey="id"
>>                 listValue="distributionListName"
>> searchType="substring"
>> notifyTopics="distributionListNameChange" theme="ajax" />
>>
>> When the jsp loads it tries to refresh the page over and over submitting
>> the
>> request to EmailDistributionList_Load action.
>>
>> Any pointers would be greatly appreciated.
>>
>> Thanks
>> Manish
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Connecting-s%3Aautocompleter-and-s%3Adiv-tp16467820p16467820.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_185067.ezm (zipped)
Could you post a minimal example of your jsp?

musachy

On Fri, Apr 4, 2008 at 11:06 AM, manishbel <manishbel@(protected):
>
> Thanks for the response Musachy,
>
> The problem still persists. i went ahead and tried to follow one of the
> examples on struts showcase " A div
> that will listen to events to refresh and start/stop autoupdate". the
> result was the same.
>
> I also tried by copying the whole example into my application. the page
> continues to refresh over and over. and i see multiple sections being added
> and eventually the browser hangs.
>
> I am not sure what's going on as i am not very well versed with struts 2 or
> Ajax.
>
> Any ideas?
>
> Thanks
> Manish.
>
>
>
>
> Musachy Barroso wrote:
> >
> > The problem is that the notify topics are published multiple times
> > (before request, after request and on error). A parameter is passed to
> > the topic listener indicating when the topic is fired. Search the
> > archives for examples (dojo.event.topic.subscribe), also look at the
> > ajax examples on showcase.
> >
> > musachy
> >
> > On Thu, Apr 3, 2008 at 1:00 PM, manishbel <manishbel@(protected):
> >>
> >> Hello There,
> >>
> >> I am new to struts and have a requirement where i have to connect the
> >> autocompleter with the div e.g. when autocompleter's value changes i
> >> need
> >> to refresh the contents of the div. i have written the following code to
> >> achieve that.
> >>
> >> The Div Code
> >> --------------
> >> <s:div cssClass="formcontainer" href="%{EmailDistributionList_Load}"
> >> theme="ajax" listenTopics="distributionListNameChange" autoStart="false"
> >> formId="EmailDistributionList" >
> >>
> >> The AutoCompleter Code
> >> -------------------------
> >> <s:autocompleter name="emailDistributionList.distributionListName"
> >> keyName="emailDistributionList.id"
> >>                 list="emailDistributionLists" listKey="id"
> >>                 listValue="distributionListName"
> >> searchType="substring"
> >> notifyTopics="distributionListNameChange" theme="ajax" />
> >>
> >> When the jsp loads it tries to refresh the page over and over submitting
> >> the
> >> request to EmailDistributionList_Load action.
> >>
> >> Any pointers would be greatly appreciated.
> >>
> >> Thanks
> >> Manish
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Connecting-s%3Aautocompleter-and-s%3Adiv-tp16467820p16467820.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> For additional commands, e-mail: user-help@(protected)
> >>
> >>
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Connecting-s%3Aautocompleter-and-s%3Adiv-tp16467820p16491866.html
>
>
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



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

Attachment: user_185070.ezm (zipped)

Hi Oguzhan-

We've run into the *exact* same problem. Our interceptor is returning
"error" but that return value is not respected when the result is rendered.
It makes me wonder what the value of returning the invocation result is in
the first place...

Just stepping through the code and browsing the invocation context shows
that the resultCode is set to error just after our interceptor is invoked.
However, when I evaluated the resultCode handed to a PreResultListener I
found it had been set back to success.

I'm a little unsure at this point how to use the PreResultListener to solve
the problem.

I've tried adding it in catch block for the hibernate exception as an
Anonymous Inner Class:


    invocation.addPreResultListener(new PreResultListener() {
        public void beforeResult(ActionInvocation invocation, String
resultCode) {

             
ActionContext.getContext().getActionInvocation().setResultCode("error");
        }
     });

But the beforeResult method is never called even though I can see the object
getting created. I created a separate interceptor to initialize the
listener and that does work but I'm now stuck on finding a method to signal
that listener to set the result code to error appropriately. It seems that
pushing something onto the value stack in my hibernate interceptor is not
useful since the value I put there is being popped off by someone else.

Have you managed to make any progress on this?








oguzhan tortop wrote:
>
> Of course it has a global result :) it returns "error" too but i think
> struts 2 working mech. makes this impossible to do after
> invocation.invoke() method only the result of the action works... :) i
> think this is not a common situation
>
> Dave Newton-4 wrote:
>>
>> --- oguzhan tortop <oguzhantt@(protected):
>>> ... but how can i implement a PreResultListener.
>>
>> I don't think it'll help anyway; sorry.
>>
>> (Boy, I wish I had my regular machine right now :/
>>
>> How is an Action.ERROR normally handled with the stack
>> you have defined? Is there a global result?
>>
>> d.
>>
>>
>>
>>
>>
>> ____________________________________________________________________________________
>> Need Mail bonding?
>> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
>> http://answers.yahoo.com/dir/?link=list&sid=396546091
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_185079.ezm (zipped)

Hi Oguzhan-

We've run into the *exact* same problem. Our interceptor is returning
"error" but that return value is not respected when the result is rendered.
It makes me wonder what the value of returning the invocation result is in
the first place...

Just stepping through the code and browsing the invocation context shows
that the resultCode is set to error just after our interceptor is invoked.
However, when I evaluated the resultCode handed to a PreResultListener I
found it had been set back to success.

I'm a little unsure at this point how to use the PreResultListener to solve
the problem.

I've tried adding it in catch block for the hibernate exception as an
Anonymous Inner Class:


    invocation.addPreResultListener(new PreResultListener() {
        public void beforeResult(ActionInvocation invocation, String
resultCode) {

             
ActionContext.getContext().getActionInvocation().setResultCode("error");
        }
     });

But the beforeResult method is never called even though I can see the object
getting created. I created a separate interceptor to initialize the
listener and that does work but I'm now stuck on finding a method to signal
that listener to set the result code to error appropriately. It seems that
pushing something onto the value stack in my hibernate interceptor is not
useful since the value I put there is being popped off by someone else. I
find the same thing happens when I try adding values to the request
attribute map from an interceptor. At this point I'm using the session and
managing removal of the signal in the PreResultListener. It's not an
approach I like but it works.



oguzhan tortop wrote:
>
> Of course it has a global result :) it returns "error" too but i think
> struts 2 working mech. makes this impossible to do after
> invocation.invoke() method only the result of the action works... :) i
> think this is not a common situation
>
> Dave Newton-4 wrote:
>>
>> --- oguzhan tortop <oguzhantt@(protected):
>>> ... but how can i implement a PreResultListener.
>>
>> I don't think it'll help anyway; sorry.
>>
>> (Boy, I wish I had my regular machine right now :/
>>
>> How is an Action.ERROR normally handled with the stack
>> you have defined? Is there a global result?
>>
>> d.
>>
>>
>>
>>
>>
>> ____________________________________________________________________________________
>> Need Mail bonding?
>> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
>> http://answers.yahoo.com/dir/?link=list&sid=396546091
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_185081.ezm (zipped)
Hi Oguzhan-

We've run into the *exact* same problem. Our interceptor is returning
"error" but that return value is not respected when the result is
rendered. It makes me wonder what the value of returning the invocation
result is in the first place...

Just stepping through the code and browsing the invocation context shows
that the resultCode is set to error just after our interceptor is
invoked. However, when I evaluated the resultCode handed to a
PreResultListener I found it had been set back to success.

I'm a little unsure at this point how to use the PreResultListener to
solve the problem.

I've tried adding it in catch block for the hibernate exception as an
Anonymous Inner Class:


    invocation.addPreResultListener(new PreResultListener() {
        public void beforeResult(ActionInvocation invocation,
String resultCode) {

             
ActionContext.getContext().getActionInvocation().setResultCode("error");
        }
     });

But the beforeResult method is never called even though I can see the
object getting created. I created a separate interceptor to initialize
the listener and that does work but I'm now stuck on finding a method to
signal that listener to set the result code to error appropriately. It
seems that pushing something onto the value stack in my hibernate
interceptor is not useful since the value I put there is being popped
off by someone else. I find the same thing happens when I try adding
values to the request attribute map from an interceptor. At this point
I'm using the session and managing removal of the signal in the
PreResultListener. It's not an approach I like but it works.



Of course it has a global result :) it returns "error" too but i think
struts 2 working mech. makes this impossible to do after
invocation.invoke() method only the result of the action works... :) i
think this is not a common situation

  Dave Newton-4 wrote:
  --- oguzhan tortop <oguzhantt@(protected):
  > ... but how can i implement a PreResultListener.

  I don't think it'll help anyway; sorry.

  (Boy, I wish I had my regular machine right now :/



Attachment: user_185071.ezm (zipped)
Hi,

Struts 2 tags have value attribute where name of property is used to read the value from the bean. If the property is lets say xyz, tag looks for getXyz(). Is this possible to customize that so that instead of getXyz(), it looks for isXyz()? My boolean property has accessors which starts with isXyz() instead of getXyz().

Thx

-Akash



   ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

Attachment: user_185072.ezm (zipped)
Struts 2(OGNL technically speaking) will call getX() or isX() if one
of them exist, when "y.x" is evaluated.

musachy

On Fri, Apr 4, 2008 at 1:37 PM, akash agrawal <akash_agrawal@(protected):
> Hi,
>
> Struts 2 tags have value attribute where name of property is used to read the value from the bean. If the property is lets say xyz, tag looks for getXyz(). Is this possible to customize that so that instead of getXyz(), it looks for isXyz()? My boolean property has accessors which starts with isXyz() instead of getXyz().
>
> Thx
>
> -Akash
>
>
>
>
>     ____________________________________________________________________________________
> You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
> http://tc.deals.yahoo.com/tc/blockbuster/text5.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



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

Attachment: user_185073.ezm (zipped)
Here is my JSP snippet. isXyz() does not work for me. What am I doing incorrectly?

<s:set name="myBean" value="myBeanObject"></s:set>

<s:checkbox name="xyz" label="xyzLabel" value="%{#myBean.xyz}" required="true" tooltip="xyzTooltip"/>

Thx.


--- On Fri, 4/4/08, Musachy Barroso <musachy@(protected):

> From: Musachy Barroso <musachy@(protected)>
> Subject: Re: Struts2 tags behaviour customizable? isXyz() instead of getXyz()
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Friday, April 4, 2008, 10:47 AM
> Struts 2(OGNL technically speaking) will call getX() or
> isX() if one
> of them exist, when "y.x" is evaluated.
>
> musachy
>
> On Fri, Apr 4, 2008 at 1:37 PM, akash agrawal
> <akash_agrawal@(protected):
> > Hi,
> >
> > Struts 2 tags have value attribute where name of
> property is used to read the value from the bean. If the
> property is lets say xyz, tag looks for getXyz(). Is this
> possible to customize that so that instead of getXyz(), it
> looks for isXyz()? My boolean property has accessors which
> starts with isXyz() instead of getXyz().
> >
> > Thx
> >
> > -Akash
> >
> >
> >
> >
> >    
> ____________________________________________________________________________________
> > You rock. That's why Blockbuster's offering
> you one month of Blockbuster Total Access, No Cost.
> > http://tc.deals.yahoo.com/tc/blockbuster/text5.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> > For additional commands, e-mail:
> user-help@(protected)
> >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?"
> Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)


   ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

Attachment: user_185074.ezm (zipped)
Are you sure that "myBean" is not null?

musachy

On Fri, Apr 4, 2008 at 2:05 PM, akash agrawal <akash_agrawal@(protected):
> Here is my JSP snippet. isXyz() does not work for me. What am I doing incorrectly?
>
> <s:set name="myBean" value="myBeanObject"></s:set>
>
> <s:checkbox name="xyz" label="xyzLabel" value="%{#myBean.xyz}" required="true" tooltip="xyzTooltip"/>
>
> Thx.
>
>
> --- On Fri, 4/4/08, Musachy Barroso <musachy@(protected):
>
> > From: Musachy Barroso <musachy@(protected)>
> > Subject: Re: Struts2 tags behaviour customizable? isXyz() instead of getXyz()
> > To: "Struts Users Mailing List" <user@(protected)>
> > Date: Friday, April 4, 2008, 10:47 AM
>
>
> > Struts 2(OGNL technically speaking) will call getX() or
> > isX() if one
> > of them exist, when "y.x" is evaluated.
> >
> > musachy
> >
> > On Fri, Apr 4, 2008 at 1:37 PM, akash agrawal
> > <akash_agrawal@(protected):
> > > Hi,
> > >
> > > Struts 2 tags have value attribute where name of
> > property is used to read the value from the bean. If the
> > property is lets say xyz, tag looks for getXyz(). Is this
> > possible to customize that so that instead of getXyz(), it
> > looks for isXyz()? My boolean property has accessors which
> > starts with isXyz() instead of getXyz().
> > >
> > > Thx
> > >
> > > -Akash
> > >
> > >
> > >
> > >
> > >
> > ____________________________________________________________________________________
> > > You rock. That's why Blockbuster's offering
> > you one month of Blockbuster Total Access, No Cost.
> > > http://tc.deals.yahoo.com/tc/blockbuster/text5.com
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > user-unsubscribe@(protected)
> > > For additional commands, e-mail:
> > user-help@(protected)
> > >
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?"
> > Pink Floyd
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail:
> > user-help@(protected)
>
>
>     ____________________________________________________________________________________
> You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
> http://tc.deals.yahoo.com/tc/blockbuster/text5.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



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

Attachment: user_185075.ezm (zipped)
myBean is not null, There are other field which are not boolean and I do get them fine.

Thx

--- On Fri, 4/4/08, Musachy Barroso <musachy@(protected):

> From: Musachy Barroso <musachy@(protected)>
> Subject: Re: Struts2 tags behaviour customizable? isXyz() instead of getXyz()
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Friday, April 4, 2008, 11:09 AM
> Are you sure that "myBean" is not null?
>
> musachy
>
> On Fri, Apr 4, 2008 at 2:05 PM, akash agrawal
> <akash_agrawal@(protected):
> > Here is my JSP snippet. isXyz() does not work for me.
> What am I doing incorrectly?
> >
> > <s:set name="myBean"
> value="myBeanObject"></s:set>
> >
> > <s:checkbox name="xyz"
> label="xyzLabel" value="%{#myBean.xyz}"
> required="true"
> tooltip="xyzTooltip"/>
> >
> > Thx.
> >
> >
> > --- On Fri, 4/4/08, Musachy Barroso
> <musachy@(protected):
> >
> > > From: Musachy Barroso <musachy@(protected)>
> > > Subject: Re: Struts2 tags behaviour
> customizable? isXyz() instead of getXyz()
> > > To: "Struts Users Mailing List"
> <user@(protected)>
> > > Date: Friday, April 4, 2008, 10:47 AM
> >
> >
> > > Struts 2(OGNL technically speaking) will call
> getX() or
> > > isX() if one
> > > of them exist, when "y.x" is
> evaluated.
> > >
> > > musachy
> > >
> > > On Fri, Apr 4, 2008 at 1:37 PM, akash agrawal
> > > <akash_agrawal@(protected):
> > > > Hi,
> > > >
> > > > Struts 2 tags have value attribute where
> name of
> > > property is used to read the value from the
> bean. If the
> > > property is lets say xyz, tag looks for
> getXyz(). Is this
> > > possible to customize that so that instead of
> getXyz(), it
> > > looks for isXyz()? My boolean property has
> accessors which
> > > starts with isXyz() instead of getXyz().
> > > >
> > > > Thx
> > > >
> > > > -Akash
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> ____________________________________________________________________________________
> > > > You rock. That's why Blockbuster's
> offering
> > > you one month of Blockbuster Total Access, No
> Cost.
> > > >
> http://tc.deals.yahoo.com/tc/blockbuster/text5.com
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > user-unsubscribe@(protected)
> > > > For additional commands, e-mail:
> > > user-help@(protected)
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > "Hey you! Would you help me to carry the
> stone?"
> > > Pink Floyd
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> > > For additional commands, e-mail:
> > > user-help@(protected)
> >
> >
> >    
> ____________________________________________________________________________________
> > You rock. That's why Blockbuster's offering
> you one month of Blockbuster Total Access, No Cost.
> > http://tc.deals.yahoo.com/tc/blockbuster/text5.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> > For additional commands, e-mail:
> user-help@(protected)
> >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?"
> Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)


   ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

Attachment: user_185076.ezm (zipped)
On Fri, Apr 4, 2008 at 1:17 PM, akash agrawal <akash_agrawal@(protected):
> myBean is not null, There are other field which are not boolean and I do get them fine.

Is it boolean, or Boolean? I've seen situations where I was hoping
isX would return a reference to a Boolean (when reference with
JavaBean dot notation), but I had to implement a getX instead. Just 2
cents.

-Dave

Attachment: user_185077.ezm (zipped)
David,

It is a Boolean property but I still think it should work no matter whether it is boolean or Boolean. APIs I am using are not mine so I can't change the bean, but there are workaround I can put in although they aren't pretty. I was hoping something can be done on the framework (Struts2) side.

Thx.
-Akash


--- On Fri, 4/4/08, David Durham, Jr. <david.durham.jr@(protected):

> From: David Durham, Jr. <david.durham.jr@(protected)>
> Subject: Re: Struts2 tags behaviour customizable? isXyz() instead of getXyz()
> To: "Struts Users Mailing List" <user@(protected)
> Date: Friday, April 4, 2008, 11:33 AM
> On Fri, Apr 4, 2008 at 1:17 PM, akash agrawal
> <akash_agrawal@(protected):
> > myBean is not null, There are other field which are
> not boolean and I do get them fine.
>
> Is it boolean, or Boolean? I've seen situations where
> I was hoping
> isX would return a reference to a Boolean (when reference
> with
> JavaBean dot notation), but I had to implement a getX
> instead. Just 2
> cents.
>
> -Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)


   ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

Attachment: user_185078.ezm (zipped)
On Fri, Apr 4, 2008 at 1:39 PM, akash agrawal <akash_agrawal@(protected):
> It is a Boolean property but I still think it should work no matter whether it is boolean or Boolean. APIs I am using are not mine so I can't change the bean, but there are workaround I can put in although they aren't pretty. I was hoping something can be done on the framework (Struts2) side.

Ask not what the framework can do for you, but what you can do for the
framework ...  it's Friday. Seriously though, if you need to provide
a getMyBoolean, and you can't modify the original class, you can just
provide a wrapper to translate getMyBoolean to isMyBoolean. If it's a
public class as I think the JavaBean spec requires it to be, you can
just extend it, otherwise you need a delegator for not just this
property but all the others. Anyway, it's not really clear that this
is what you need anyway, so this is just more speculation.


--Dave

Attachment: user_185082.ezm (zipped)
David Durham, Jr. wrote:
> On Fri, Apr 4, 2008 at 1:39 PM, akash agrawal <akash_agrawal@(protected):
>> It is a Boolean property but I still think it should work no matter whether it is boolean or Boolean. APIs I am using are not mine so I can't change the bean, but there are workaround I can put in although they aren't pretty. I was hoping something can be done on the framework (Struts2) side.
>
> Ask not what the framework can do for you, but what you can do for the
> framework ...  it's Friday. Seriously though, if you need to provide
> a getMyBoolean, and you can't modify the original class, you can just
> provide a wrapper to translate getMyBoolean to isMyBoolean. If it's a
> public class as I think the JavaBean spec requires it to be, you can
> just extend it, otherwise you need a delegator for not just this
> property but all the others. Anyway, it's not really clear that this
> is what you need anyway, so this is just more speculation.

The JavaBean specification only talks about boolean properties; it
doesn't mention Boolean (section 8.3.2). But rather than messing with an
'adapter' sub-class, I would consider either (a) creating a BeanInfo
class or (b) simply living with it and just being explicit in OGNL
expressions like so:

<s:checkbox name="xyz" label="xyzLabel" value="%{#myBean.isXyz()}"
required="true" tooltip="xyzTooltip"/>

i.e. use method-call rather than simple property syntax.

L.


Attachment: user_185083.ezm (zipped)
Niral Trivedi wrote:
> Hi Dave,
>
> Thanks for the reply. I've actually tried with #keepRemoveRadio as well but
> got same result. In fact, I got it working by putting "john" or "doe" as
> below for <s:param> property:
>
> <s:param name="*Keep*" value="%{'john}"/>

That makes sense, since value="john" will try to evaluate 'john' as an
expression (i.e. will look for it on the value stack) whereas
value="%{'john'}" (or simply value="'john'") evaluates to a literal
string. This is described in the Tag Syntax guide linked at the top of
all the tag documentation pages:

http://struts.apache.org/2.0.11/docs/tag-syntax.html

[Hmm; that said, I just noticed that the 2.0.11 docs for s:param claim
that the value attribute is *not* evaluated, which is inconsistent with
what you're seeing; it could be that the documentation is in need of
updating for that tag.]

> Moving ahead, now stuck with a different issue. Actually, I want to create
> name of the param dynamically by concatenating two strings. One is already a
> struts2 <s:set> property and other is a static value. For example, I want to
> do something like this:
>
> Line 1: <s:set name="prop1" value="%{someActionProp}"/>
>
> <s:bean name="java.util.HashMap" id="keepRemoveRadioMap">
> *       <s:param name="%{prop1}Keep" value="%{prop1}john"/>
>       <s:param name="Remove" value="%{prop1}doe"/>
> * </s:bean>
>
> But I could not get the lines in bold working. Do you have any idea how to
> concatenate two strings and assing it to a third variable? I tried
> <s:append> but that doesn't work either. Using that I can only iterate and
> print the values but cant assign to third variable.

Try <s:param name="%{prop1+'Keep'}" value="%{prop1+'john'}"/> instead
(untested).

L.

> Thanks
>
> On Thu, Apr 3, 2008 at 8:40 AM, Dave Newton <newton.dave@(protected):
>> --- Niral Trivedi <niral22@(protected):
>>> I am using Struts 2.0.11 on RAD7, Webspher 6.1, JDK 1.5.
>> Hey, me too. My sympathies.
>>
>>> I am trying to create radio buttons using a dynamic Map as below:
>>>
>>> <s:bean name="java.util.HashMap" id="keepRemoveRadioMap">
>>>      <s:param name="Keep" value="john"/>
>>>      <s:param name="Remove" value="doe"/>
>>> </s:bean>
>>>
>>> <td width="20%" style="background-color:#fffade; vertical-align:center">
>>>      <s:radio name="keepRemove" list="keepRemoveRadioMap" onclick=
>>> "changeKeep1()" theme="simple"/>
>>> </td>
>>>
>>> But when I try to load the page, it is giving Freemaker Template
>> exception
>>> as below(I haven't pasted entire stack trace for readability) :
>> What happens if you use list="#keepRemoveRadioMap"?
>>
>> While I've never used the <s:bean...> tag, normally when you create an
>> object
>> in the OGNL context like that you need to refer to it with a leading "#"
>> meaning that it's a named object, not a property of an object on the value
>> stack.
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>


Attachment: user_185084.ezm (zipped)
As Ian says, the mock objects supplied by XWork may make this all a lot
easier, but in any case all this is predicated on the fact that you're
using ActionSupport's implementation of TextProvider which doesn't make
provision for mocking at test time. I think it would make a great deal
of sense to improve that (open an enhancement request in Jira), but in
the mean time, there's nothing preventing you from providing a getText()
implementation that's more conducive to testing.

I feel your pain on this one, and the right solution is to fix the
framework (patches always welcome ;-), but it shouldn't be that hard to
get around.

L.

paulbrickell wrote:
> Actually thats an interesting post. To my mind it doesn't demonstrate a
> solution. It demonstrates the problem.
>
> Here is why I think this.
>
> Struts 2 is just frankly brilliant for people doing test first development.
> The classes you create really are POJOs. There are no dependencies on any
> framework in my action classes. For example parameters are parsed well away
> from my action and the values are set using simple properties, things like
> sessions are simply maps. It is a truly new world for those of who have
> suffered the horror of mocking http requests, responses, context and the
> like.
>
> But this simple scenario brings all that pain flooding back. I add a line in
> my action like this...
>
> String yadaYada = getText("some.doodad");
>
> And my lovely world comes unraveled real quick. Now I need mock objects up
> the ying-yang.
>
> I started using the tutorial from the link posted (I am an Arsenal fan btw,
> so got two for the price of one, thanks), but it still doesn't provide a
> simple solution to the problem. To get this to work I have to build not just
> the application context but a mass of supporting objects to get a web
> application framework up and running before I can test my simple POJO.
>
> I am not going to give up just yet, but I think I am still going to have to
> look for another way.
>
> Cheers,
> Paul B.
>
>
>
>
>
> Relph,Brian wrote:
>>
>> I recommend creating an action context. Here is the basic guide I
>> followed to do so:
>>
>> http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/
>>
>> If you are not using spring or the struts2 spring plugin, you can cut out
>> all the code around the applicationContext.
>>
>>
>> -----Original Message-----
>> From: paulbrickell [mailto:paul.brickell@(protected)]
>> Sent: Thursday, April 03, 2008 11:44 AM
>> To: user@(protected)
>> Subject: Re: any struts 2 unit testers out there?
>>
>>
>> I am trying to deal with the same issue. Did you get any resolution?
>>
>> Following on from the reply asking for a stack trace, here is what I am
>> getting...
>>
>>
>> java.lang.NullPointerException
>>  at
>> com.opensymphony.xwork2.util.LocalizedTextUtil.findText (LocalizedTextUtil.java:299)
>>  at
>> com.opensymphony.xwork2.TextProviderSupport.getText (TextProviderSupport.java:172)
>>  at
>> com.opensymphony.xwork2.TextProviderSupport.getText (TextProviderSupport.java:87)
>>  at com.opensymphony.xwork2.ActionSupport.getText (ActionSupport.java:80)
>>      <SNIP>
>>  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:585)
>>  at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
>>  at
>> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
>>  at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
>>  at
>> org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
>>  at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
>>  at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
>>  at
>> org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
>>  at
>> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
>>  at
>> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
>>  at
>> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
>>  at
>> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
>>  at
>> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
>>  at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
>>  at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>  at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:460)
>>  at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:673)
>>  at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java:386)
>>  at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:196)
>>
>>
>> It is caused by ActionContext.getContext() returning null. Quite obviously
>> I do not have an action context during my unit testing.
>>
>> Now I can certainly use the ActionContext.setContext() in my tests setup
>> method to push one into thread local storage and that works OK. It isn't
>> ideal though because ActionContext is a concrete class and so my choices
>> then become a bit limited.
>>
>> I could create an instance but when I try this I find I have to create a
>> rather large object model to make it actually work. To the point where I
>> despair and give up.
>>
>> Alternatively I could use a mock library (like easy mock). But I am not
>> inclined to include a mocking library that requires byte code rewriting
>> (not even for testing).
>>
>> What I really want to do is inject a text provider into the ActionSupport
>> class. At the top of the ActionSupport class is this...
>>
>> private final transient TextProvider textProvider = new
>> TextProviderFactory().createInstance(getClass(), this);
>>
>> Damn its final and so I cannot inject my own text provider.
>>
>> BUT it uses a factory, thats good. I know I will have a look at the
>> factory I bet I can monkey with that and inject a mock. Nope. It's all
>> instance based. No way I can get in there. And thats that. Now what do I
>> do?
>>
>> I can see two (half) workable solutions.
>>
>> One is to override the the getText method in the action class when I
>> instantiate it during testing. So I end up doing this in all my action
>> unit tests...
>>
>>      Action action = new MyAction()
>>      {
>>         @Override
>>         public String getText(String textName)
>>         {
>>           return "mocked";
>>         }
>>      };
>>
>> It works, but its cheese.
>>
>> Or two I can add a level of indirection in my action class, like so...
>>
>>
>>   String text =
>> MyTextProviderFactory.getInstance(class.name).getText("some.property");
>>
>> Then I can use a delegate to the real text provider during live code and a
>> mock of my own text provider during testing. The question here is, Why for
>> the love of Pete, why?
>>
>> So in conclusion there are at least four options for testing Action
>> classes that use get text.
>>
>> 1. Build an action context by hand. (Too hard) 2. Use a class rewriting
>> mocking library. (Not on my watch) 3. Mock the get text method. (Cheese)
>> 4. Add another level of indirection. (Man thats just annoying)
>>
>> Comments?
>>
>> BTW If you got this far, thanks for taking the time.
>> Paul B.
>>
>>
>>
>>
>> Session Mwamufiya wrote:
>>> Hi All,
>>>
>>> Would someone let me know whether it's possible to tweak something so
>>> that JUnit test code can run on an action method that calls the
>>> ActionSupport method getText() to fetch string resources from a
>>> package.properties file.
>>> As it stands, I keep getting a null exception when getText() is called
>>> during the unit test.
>>>
>>> Thanks,
>>> Session
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>>
>> --
>> View this message in context:
>> http://www.nabble.com/any-struts-2-unit-testers-out-there--tp13437046p16467812.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>> ----------------------------------------------------------------------
>> CONFIDENTIALITY NOTICE This message and any included attachments are from
>> Cerner Corporation and are intended only for the addressee. The
>> information contained in this message is confidential and may constitute
>> inside or non-public information under international, federal, or state
>> securities laws. Unauthorized forwarding, printing, copying, distribution,
>> or use of such information is strictly prohibited and may be unlawful. If
>> you are not the addressee, please promptly delete this message and notify
>> the sender of the delivery error by e-mail or you may call Cerner's
>> corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>


Attachment: user_185085.ezm (zipped)
Jonny Cavell wrote:
> I use Maven, and if you look at struts 2.0.11.1's dependencies
> (http://www.mvnrepository.com/artifact/org.apache.struts/struts2-core/2.0.11.1)
> you'll see that it's Freemarker version 2.3.8 it depends on. I can't

2.0.11.1 != 2.1.1 :-)

> override this in Maven, even if I attempt to exclude it and force the latest
> version of Freemarker:
>
> .....
>    <dependency>
>      <groupId>org.apache.struts</groupId>
>      <artifactId>struts2-core</artifactId>
>      <version>2.0.11</version>
>      <exclusions>
>        <exclusion>
>          <groupId>org.freemarker</groupId>
>          <artifactId>freemarker</artifactId>
>        </exclusion>
>      </exclusions>
>    </dependency>
>    <dependency>
>      <groupId>org.freemarker</groupId>
>      <artifactId>freemarker</artifactId>
>      <version>2.3.12</version>
>    </dependency>

That ought to work, assuming those two stanzas are in their respective
correct places within the pom. Check 'mvn X' output to make sure your
excludes are correct with respect to the dependency graph.

L.

>
> Cheers
>
> Jonny
>
>
> Jeromy Evans - Blue Sky Minds wrote:
>> Jonny Cavell wrote:
>>> I have a problem that seems to occur periodically.
>>>
>>> My freemarker templates, served by struts2, stop appearing - I get a
>>> blank
>>> page. There are no useful messages in the logs, other than saying that it
>>> couldn't find the template (which it could find previously).
>>>
>>> First question - does anybody know what this problem might be?
>>>
>>>  
>> No, other than a classpath/deployment problem.
>>> I would like to upgrade to the latest version of Freemarker. However,
>>> Struts2 in its wisdom has locked me down to version 2.3.8, and this was
>>> released way back in 2006. Are there any plans to resolve this issue?
>>>
>>>  
>> The 2.1.1 version of Struts uses FreeMarker 2.3.11  You may be able to
>> replace the 2.3.8 jar with the 2.3.11 jar without problems.
>>
>> I doubt the problem is with FreeMarker. It's more likely to be the
>> FreeMarkerManager included with Struts 2 that's responsible for
>> searching for templates in the classpath.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>


Attachment: user_185087.ezm (zipped)
The Maven dependency plugin may be useful to you as well.
http://maven.apache.org/plugins/maven-dependency-plugin/index.html ,
specifically the dependency:tree goal.

On Fri, Apr 4, 2008 at 3:27 PM, Laurie Harper <laurie@(protected):

> Jonny Cavell wrote:
>
> > I use Maven, and if you look at struts 2.0.11.1's dependencies
> > (
> > http://www.mvnrepository.com/artifact/org.apache.struts/struts2-core/2.0.11.1
> > )
> > you'll see that it's Freemarker version 2.3.8 it depends on. I can't
> >
>
> 2.0.11.1 != 2.1.1 :-)
>
> override this in Maven, even if I attempt to exclude it and force the
> > latest
> > version of Freemarker:
> >
> > .....
> >           <dependency>
> >                <groupId>org.apache.struts</groupId>
> >                <artifactId>struts2-core</artifactId>
> >                <version>2.0.11</version>
> >                <exclusions>
> >                     <exclusion>
> >                           <groupId>org.freemarker</groupId>
> >
> > <artifactId>freemarker</artifactId>
> >                     </exclusion>
> >                </exclusions>
> >           </dependency>
> >           <dependency>
> >                <groupId>org.freemarker</groupId>
> >                <artifactId>freemarker</artifactId>
> >                <version>2.3.12</version>
> >           </dependency>
> >
>
> That ought to work, assuming those two stanzas are in their respective
> correct places within the pom. Check 'mvn X' output to make sure your
> excludes are correct with respect to the dependency graph.
>
>
> L.
>
>
> > Cheers
> >
> > Jonny
> >
> >
> > Jeromy Evans - Blue Sky Minds wrote:
> >
> > > Jonny Cavell wrote:
> > >
> > > > I have a problem that seems to occur periodically.
> > > >
> > > > My freemarker templates, served by struts2, stop appearing - I get a
> > > > blank
> > > > page. There are no useful messages in the logs, other than saying
> > > > that it
> > > > couldn't find the template (which it could find previously).
> > > >
> > > > First question - does anybody know what this problem might be?
> > > >
> > > >
> > > >
> > > No, other than a classpath/deployment problem.
> > >
> > > > I would like to upgrade to the latest version of Freemarker.
> > > > However,
> > > > Struts2 in its wisdom has locked me down to version 2.3.8, and this
> > > > was
> > > > released way back in 2006. Are there any plans to resolve this
> > > > issue?
> > > >
> > > >
> > > The 2.1.1 version of Struts uses FreeMarker 2.3.11  You may be able
> > > to replace the 2.3.8 jar with the 2.3.11 jar without problems.
> > >
> > > I doubt the problem is with FreeMarker. It's more likely to be the
> > > FreeMarkerManager included with Struts 2 that's responsible for searching
> > > for templates in the classpath.
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_185086.ezm (zipped)
Production integration experience? No...

I evaluated it and did a quick proof-of-concept on a project once. We
ended up sticking with the in-house option, which wasn't bad, but it was
an apache mod, so we periodically looked for alternatives because we
were always tied to mod_jk or mod_proxy because the
authentication/authorization service was tied to httpd.

The nice thing about CAS was that it can be integrated in more than just
Java web-apps. You can also integrate with acegi rather easily. It's
worth checking out if you have a suite of web-apps that you would like
to create a single-sign-on that is somewhat reusable.

-Wes

On Fri, 2008-04-04 at 08:56 +0200, Lukasz Lenart wrote:
> > http://www.ja-sig.org/products/cas/
> >
> > -Wes
>
> Do you have some experience with that? It looks quite interesting ;-)
>
>
> Regards

©2008 gg3721.com - Jax Systems, LLC, U.S.A.