Author Login
Post Reply
user Digest 12 Aug 2008 23:32:08 -0000 Issue 8191
Topics (messages 189963 through 189988):
Re: Regarding tiles error
189963 by: Lukasz Lenart
189965 by: sam thothi
Re: URL mapping in Struts 2
189964 by: Dave Newton
chain interceptor
189966 by: Brad A Cupit
exception unregistering portlet @undeploying the webapp, configuration manager -> null
189967 by: Torsten Krah
(Struts 2) Problem with uploading of file or validation
189968 by: Ylva Degerfeldt
189969 by: Jim Kiley
189970 by: Ylva Degerfeldt
Changing the way Context Root and Namespaces are rendered in URLS.
189971 by: Pandolf
189972 by: Al Sutton
Re: tabbed panels with Struts 2.1.2
189973 by: Owen Berry
189975 by: Musachy Barroso
[S2] equivalent to S1's <html:base/>
189974 by: Pierre Thibaudeau
189976 by: Musachy Barroso
189979 by: Pierre Thibaudeau
189984 by: Musachy Barroso
189985 by: Pierre Thibaudeau
Best practice for passing success/error message to another dispatch (struts2)?
189977 by: Jeremy Conner
189978 by: Martin Gainty
189980 by: Pierre Thibaudeau
189981 by: Jeremy Conner
189986 by: Jeremy Conner
189988 by: Martin Gainty
DOJO Dialog Problem? Please help me
189982 by: prashanth2
Re: [S2] Is there a modal dialog component in the current impl?
189983 by: prashanth2
Re: Get path to the webapp
189987 by: Paul Benedict
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_189963.ezm (zipped)> com.ibm.ws.jsp.JspCoreException: JSPG0218E: Error failed to locate
> setter method for attribute locale in tag class
>
org.apache.struts.taglib.html.HtmlTagThere is no local attribute, you should use lang attribute.
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_189965.ezm (zipped)Thanks Lukasz for your help, It's working now. I don't know Rad 7.5 behaves
indifferently.
On 8/12/08, Lukasz Lenart <lukasz.lenart@(protected):
>
> > com.ibm.ws.jsp.JspCoreException: JSPG0218E: Error failed to locate
> > setter method for attribute locale in tag class
> >
org.apache.struts.taglib.html.HtmlTag>
> There is no local attribute, you should use lang attribute.
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_189964.ezm (zipped)--- On Tue, 8/12/08, XML User <patelsameerm@(protected):
> Can you explain me with the code or some hint, how can i do that.?
Do what, use the REST plugin in Struts 2.1? It's helpful to include at least a little message context.
http://struts.apache.org/2.x/docs/rest-plugin.html
Dave

Attachment:
user_189966.ezm (zipped)I have a question about the placement of the chain interceptor in the
defaultStack.
Take the following situation:
* preferredUserId is a form field submitted by the user. It is the user
id
they want (if that user id is not already taken)
* Action1 has a setPreferredUserId() method but if the user id is
taken, a new id is generated for them and returned in the
getPreferredUserId() method
* Action1's result is a chain to Action2, which also has a
setPreferredUserId() method
Action2.setPreferredUserId() will be called twice, once by the chain
interceptor and once by the params interceptor, but since the chain
interceptor is setup to run earlier in the stack than the params
interceptor, Action2 will have preferredUserId from the request, not the
value output from Action1.
Ok, I know this example is contrived, and I don't actually have code in
an app which uses this. I also know the benefits of Redirect After POST
vs action chaining and I agree that it's very odd for Action2 to have a
setter that also matches a request parameter.
However, it seems unusual for the params interceptor to 'take
precedence' (because it happens later in defaultStack). It seems that
you'd always want the value from Action1 rather than what's in the
request.
My question is: is there some reason why 'chain' appears where it does
in defaultStack? I'd like to move it later in the stack, after the
params interceptor, but is there a good reason not to do that?
Brad Cupit
Louisiana State University - UIS

Attachment:
user_189967.ezm (zipped)
Attachment:
smime.p7s (zipped)
Attachment:
user_189968.ezm (zipped)Hi,
I'm trying to upload a file (and some text values) from a
multipart/form-data form. I'm also trying to use the validation
framework (I have created a -validation.xml file) but when the action
is receiving the values I get this exception:
Caused by:
java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.<init>(File.java:363)
at
com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators (
ValidatorFactory.java:323)...
I'm not sure if this is a validation error or a file uploading error.
But I can tell you this:
My action that is called by the multipart form (NameAndCvAction) has
get and set methods for some text values from the form, for the file
(like ...setCvFile(File cvFile) ) and for the filename. I've tried
stepping through these methods and I found that the file is received
in the setCvFile method, like a File object, the way it should..
The filename is correctly instantiated too..
After that I receive the value of a text field, called firstName (not
empty) which works..
Then I receive the last value, lastName (which in my test case is
empty) and that seems to work.
But then my HibernateSessionRequestFilter (meant to close the
Hibernate session for every request) is called and does the closing of
the Hibernate session.
After that I get the error.
I also have a validate() method in my action but I don't seem to get that far.
This is not a Hibernate issue or is it?
Is there anyone who can give me a hint at what this error is about?
I'd be very grateful!
/Ylva

Attachment:
user_189969.ezm (zipped)The javadoc for
java.io.File mentions a constructor that accepts a URI as
its parameter. It has the following note:
uri - An absolute, hierarchical URI with a scheme equal to "file", a
non-empty path component, and undefined authority, query, and fragment
components
So:
* Does the URI's path have any spaces in it?
* Is the URI's path empty?
jk
On Tue, Aug 12, 2008 at 12:41 PM, Ylva Degerfeldt <ylva.degerfeldt@(protected)
> wrote:
> Hi,
>
> I'm trying to upload a file (and some text values) from a
> multipart/form-data form. I'm also trying to use the validation
> framework (I have created a -validation.xml file) but when the action
> is receiving the values I get this exception:
>
> Caused by:
java.lang.IllegalArgumentException: URI is not hierarchical
> at java.io.File.<init>(File.java:363)
> at
>
com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators (
ValidatorFactory.java:323)...
>
> I'm not sure if this is a validation error or a file uploading error.
> But I can tell you this:
> My action that is called by the multipart form (NameAndCvAction) has
> get and set methods for some text values from the form, for the file
> (like ...setCvFile(File cvFile) ) and for the filename. I've tried
> stepping through these methods and I found that the file is received
> in the setCvFile method, like a File object, the way it should..
> The filename is correctly instantiated too..
> After that I receive the value of a text field, called firstName (not
> empty) which works..
> Then I receive the last value, lastName (which in my test case is
> empty) and that seems to work.
> But then my HibernateSessionRequestFilter (meant to close the
> Hibernate session for every request) is called and does the closing of
> the Hibernate session.
> After that I get the error.
>
> I also have a validate() method in my action but I don't seem to get that
> far.
>
> This is not a Hibernate issue or is it?
>
> Is there anyone who can give me a hint at what this error is about?
> I'd be very grateful!
>
> /Ylva
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com

Attachment:
user_189970.ezm (zipped)I'm not sure how to check that but I don't think the URI has any
spaces and it can't be empty. After all, the file Was saved to the
action without problems (at least the setFile method was executed and
others after that).
And this can't be about that specific file, since I've used that file
in testing earlier when I was using Struts 1 and then the uploading of
the file worked. It can't be that Struts 2 is worse than Struts 1 at
file uploading, can it?
What other reasons could there be for this error?
/Ylva
On Tue, Aug 12, 2008 at 6:49 PM, Jim Kiley <jhkiley@(protected):
> The javadoc for
java.io.File mentions a constructor that accepts a URI as
> its parameter. It has the following note:
>
> uri - An absolute, hierarchical URI with a scheme equal to "file", a
> non-empty path component, and undefined authority, query, and fragment
> components
>
> So:
> * Does the URI's path have any spaces in it?
> * Is the URI's path empty?
>
> jk
>
> On Tue, Aug 12, 2008 at 12:41 PM, Ylva Degerfeldt <ylva.degerfeldt@(protected)
>> wrote:
>
>> Hi,
>>
>> I'm trying to upload a file (and some text values) from a
>> multipart/form-data form. I'm also trying to use the validation
>> framework (I have created a -validation.xml file) but when the action
>> is receiving the values I get this exception:
>>
>> Caused by:
java.lang.IllegalArgumentException: URI is not hierarchical
>> at java.io.File.<init>(File.java:363)
>> at
>>
com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators (
ValidatorFactory.java:323)...
>>
>> I'm not sure if this is a validation error or a file uploading error.
>> But I can tell you this:
>> My action that is called by the multipart form (NameAndCvAction) has
>> get and set methods for some text values from the form, for the file
>> (like ...setCvFile(File cvFile) ) and for the filename. I've tried
>> stepping through these methods and I found that the file is received
>> in the setCvFile method, like a File object, the way it should..
>> The filename is correctly instantiated too..
>> After that I receive the value of a text field, called firstName (not
>> empty) which works..
>> Then I receive the last value, lastName (which in my test case is
>> empty) and that seems to work.
>> But then my HibernateSessionRequestFilter (meant to close the
>> Hibernate session for every request) is called and does the closing of
>> the Hibernate session.
>> After that I get the error.
>>
>> I also have a validate() method in my action but I don't seem to get that
>> far.
>>
>> This is not a Hibernate issue or is it?
>>
>> Is there anyone who can give me a hint at what this error is about?
>> I'd be very grateful!
>>
>> /Ylva
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
> --
> Jim Kiley
> Technical Consultant | Summa
> [p] 412.258.3346 [m] 412.445.1729
> http://www.summa-tech.com
>

Attachment:
user_189971.ezm (zipped)
Hi everyone,
I'm using Struts 2 to author Facebook applications and I have a bit of a
problem. When using the struts "form" or "URL" tags, struts 2 of course
wants to render URLs as follows:
/<context root>/<namespace>/<action>
Because I'm running applications through Facebook, the urls must be in the
following format:
/<my facebook app name>/<action>
Is there any way, perhaps in struts.xml, to change the way URLs are rendered
by struts?
Really what I need is to drop the context root and include my facebook app
name.
The only solution I've come up with is to set the context root of my web app
to be "/" and then put all actions for my facebook app in a namespace called
"<my app name>". Unfortunately this clutters my namespace hierarchy and so
I'm hoping there may be a better solution?
Any thoughts?
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_189972.ezm (zipped)What you're talking about is an application server issue. An easy
solution would be to name your war files/contexts to be your app name
and then use a namespace of "".
Al.
Pandolf wrote:
> Hi everyone,
>
> I'm using Struts 2 to author Facebook applications and I have a bit of a
> problem. When using the struts "form" or "URL" tags, struts 2 of course
> wants to render URLs as follows:
>
> /<context root>/<namespace>/<action>
>
> Because I'm running applications through Facebook, the urls must be in the
> following format:
>
> /<my facebook app name>/<action>
>
> Is there any way, perhaps in struts.xml, to change the way URLs are rendered
> by struts?
>
> Really what I need is to drop the context root and include my facebook app
> name.
>
> The only solution I've come up with is to set the context root of my web app
> to be "/" and then put all actions for my facebook app in a namespace called
> "<my app name>". Unfortunately this clutters my namespace hierarchy and so
> I'm hoping there may be a better solution?
>
> Any thoughts?
>

Attachment:
user_189973.ezm (zipped)I don't think so - I get the collision messages, but everything still
works fine for me.
On Tue, Aug 12, 2008 at 10:06 AM, André Cedik | GDG
<a.cedik@(protected):
> Ok, I'm not planning on messing with the Struts code.
> I'll leave that to the ones that know the framework
> better than I do. Unfortunately I do have a negative
> effect since the Tabs are not responding to any clicks.
> Thought it had something to do with the id collision.
>
>
>
> Owen Berry wrote:
>>
>> There's nothing much you can do about this collision message, unless
>> you want to "fix" the Struts code, but the good news is that it
>> doesn't seem to have any negative effects. The reason for the message
>> is that the tabs are parsed twice by Dojo.
>>
>> Owen
>>
>> On Tue, Aug 12, 2008 at 5:43 AM, André Cedik | GDG
>> <a.cedik@(protected):
>>
>>>
>>> Hi everyone,
>>>
>>> has anyone tried using tabbed panels with Struts 2.1.2?
>>> http://struts.apache.org/2.1.2/docs/tabbedpanel.html
>>>
>>> When I'm testing the example on the Struts website I always
>>> receive errors from the debugger the there's a collision on
>>> the widgets' id even when I'm not specifying one.
>>>
>>> ---------------------------------------------------------------------
>>> 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)
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_189975.ezm (zipped)yes, you can safely disregard those collision id errors, they have
been around for a long time.
musachy
On Tue, Aug 12, 2008 at 2:24 PM, Owen Berry <owen.berry@(protected):
> I don't think so - I get the collision messages, but everything still
> works fine for me.
>
> On Tue, Aug 12, 2008 at 10:06 AM, André Cedik | GDG
> <a.cedik@(protected):
>> Ok, I'm not planning on messing with the Struts code.
>> I'll leave that to the ones that know the framework
>> better than I do. Unfortunately I do have a negative
>> effect since the Tabs are not responding to any clicks.
>> Thought it had something to do with the id collision.
>>
>>
>>
>> Owen Berry wrote:
>>>
>>> There's nothing much you can do about this collision message, unless
>>> you want to "fix" the Struts code, but the good news is that it
>>> doesn't seem to have any negative effects. The reason for the message
>>> is that the tabs are parsed twice by Dojo.
>>>
>>> Owen
>>>
>>> On Tue, Aug 12, 2008 at 5:43 AM, André Cedik | GDG
>>> <a.cedik@(protected):
>>>
>>>>
>>>> Hi everyone,
>>>>
>>>> has anyone tried using tabbed panels with Struts 2.1.2?
>>>> http://struts.apache.org/2.1.2/docs/tabbedpanel.html
>>>>
>>>> When I'm testing the example on the Struts website I always
>>>> receive errors from the debugger the there's a collision on
>>>> the widgets' id even when I'm not specifying one.
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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)
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_189974.ezm (zipped)Any suggestion as to an S2 equivalent to S1's <html:base/>?
<base href="<s:url value="%{somethingOrOther}"/>" />
???
What do you guys do?
The same question was asked a number of months ago:
http://www.nabble.com/%3Chtml%3Abase%3E-equivalent-in-S2-to9547065.html
http://www.nabble.com/-s2--Is-there-a-tag-similar-to-%3Chtml%3Abase-%3E-in-s1-to10983577.html

Attachment:
user_189976.ezm (zipped)yes, that would work, or a lil bit more readable:
<s:url id="baseUrl "value="%{somethingOrOther}"/>
<base href="${baseUrl}" />
musachy
On Tue, Aug 12, 2008 at 2:44 PM, Pierre Thibaudeau
<pierre.thibaudeau@(protected):
> Any suggestion as to an S2 equivalent to S1's <html:base/>?
>
> <base href="<s:url value="%{somethingOrOther}"/>" />
> ???
>
> What do you guys do?
>
> The same question was asked a number of months ago:
> http://www.nabble.com/%3Chtml%3Abase%3E-equivalent-in-S2-to9547065.html
> http://www.nabble.com/-s2--Is-there-a-tag-similar-to-%3Chtml%3Abase-%3E-in-s1-to10983577.html
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_189979.ezm (zipped)The essence of my question rested specifically on the:
%{somethingOrOther}...
On one system where I run my application, the base path is
http://www.website.com/
On the other, it is http://localhost:8080/myapp/
<html:base/> took care of that seamlessly. I suppose I could use one given
action as base reference: <s:url action="home" />,
but that particular example would force me to rewrite all the relative
references (because the home action's base path is one hierarchical degree
removed from the current base path). which is a potential solution, since
that would be done once and for all (even though it would be tedious to have
to do it).
Before I embark on this, though, I would love to get people's advice on the
wisest standard for a base path. In particular, something which would be
robust with respect to deployment on several Tomcat setups that have
different path configurations.
2008/8/12 Musachy Barroso <musachy@(protected)>
> yes, that would work, or a lil bit more readable:
>
> <s:url id="baseUrl "value="%{somethingOrOther}"/>
> <base href="${baseUrl}" />
>

Attachment:
user_189984.ezm (zipped)You shouldn't need to use <base> at all. Just use the "url" tag to
build urls to any resource/urls you need, and it will take care of
adding the context to the url for you.
musachy
On 8/12/08, Pierre Thibaudeau <pierre.thibaudeau@(protected):
> The essence of my question rested specifically on the:
> %{somethingOrOther}...
>
> On one system where I run my application, the base path is
> http://www.website.com/
> On the other, it is http://localhost:8080/myapp/
>
> <html:base/> took care of that seamlessly. I suppose I could use one given
> action as base reference: <s:url action="home" />,
> but that particular example would force me to rewrite all the relative
> references (because the home action's base path is one hierarchical degree
> removed from the current base path). which is a potential solution, since
> that would be done once and for all (even though it would be tedious to have
> to do it).
>
> Before I embark on this, though, I would love to get people's advice on the
> wisest standard for a base path. In particular, something which would be
> robust with respect to deployment on several Tomcat setups that have
> different path configurations.
>
> 2008/8/12 Musachy Barroso <musachy@(protected)>
>
>> yes, that would work, or a lil bit more readable:
>>
>> <s:url id="baseUrl "value="%{somethingOrOther}"/>
>> <base href="${baseUrl}" />
>>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_189985.ezm (zipped)2008/8/12 Musachy Barroso <musachy@(protected)>
> You shouldn't need to use <base> at all. Just use the "url" tag to
> build urls to any resource/urls you need, and it will take care of
> adding the context to the url for you.
>
Good point!
(That said, the only place where I ever use non-<s:url>-based URLs are with
very occasional <img>s or <link href=""/>s or <meta>s. It always felt like
overkill to use struts tags for such purposes...)

Attachment:
user_189977.ezm (zipped)I have an action with two dispatch methods.
I have a single JSP that renders a list and also have an import file field.
On import failure, I want to populate the list with an error message.
THE PROBLEM:
It looks like validation for the list() method is wiping the errors from the import() method.
Example struts.xml:
<action name="*Role" class="RoleAction" method="list">
<result name="input">/list.page</result>
<result name="success">/list.page</result>
</action>
<action name="importRole" class="RoleAction" method="import">
<result name="input" type="chain">listRole</result>
<result name="success" type="chain">listRole</result>
</action>
Example pseudo code:
public String list() {
// sql lookup, populate list
return "success";
}
public String import() {
// do import
If (fail) {
addActionError(errorMessage);
}
return "success";
}

Attachment:
user_189978.ezm (zipped)
your action execute method can return "error" result which maps to error page e.g.
<result name="error">/error.jsp</result>
where error looks like
<html>
<body>
<b>YOU have an error !</b>
</body>
</html>
better to create a div tag and write a meaningful error to response which displays response in div tag ...
http://cwiki.apache.org/WW/ajax-recipes.html
Anyone else?
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
> From: jconner@(protected)
> To: user@(protected)
> Date: Tue, 12 Aug 2008 15:05:42 -0400
> Subject: Best practice for passing success/error message to another dispatch (struts2)?
>
> I have an action with two dispatch methods.
> I have a single JSP that renders a list and also have an import file field.
> On import failure, I want to populate the list with an error message.
>
> THE PROBLEM:
> It looks like validation for the list() method is wiping the errors from the import() method.
>
> Example struts.xml:
> <action name="*Role" class="RoleAction" method="list">
> <result name="input">/list.page</result>
> <result name="success">/list.page</result>
> </action>
>
> <action name="importRole" class="RoleAction" method="import">
> <result name="input" type="chain">listRole</result>
> <result name="success" type="chain">listRole</result>
> </action>
>
> Example pseudo code:
> public String list() {
> // sql lookup, populate list
> return "success";
> }
>
> public String import() {
> // do import
> If (fail) {
> addActionError(errorMessage);
> }
> return "success";
> }
>
>
>
_________________________________________________________________
Got Game? Win Prizes in the Windows Live Hotmail Mobile Summer Games Trivia Contest
http://www.gowindowslive.com/summergames?ocid=TXT_TAGHM

Attachment:
user_189980.ezm (zipped)This may be completely incidental to your problem, but, it seems to me that,
if your actions are listed in that order, the first one will catch the
occurrences of the second one. ("importRole" is a particular case of
"*Role".) Shouldn't they be listed in the reverse order?
> > Example struts.xml:
> > <action name="*Role" class="RoleAction" method="list">
> > <result name="input">/list.page</result>
> > <result name="success">/list.page</result>
> > </action>
> >
> > <action name="importRole" class="RoleAction" method="import">
> > <result name="input" type="chain">listRole</result>
> > <result name="success" type="chain">listRole</result>
> > </action>
>

Attachment:
user_189981.ezm (zipped)Thanks for the feedback Martin.
This is a really generic issue to me.
I have a list. From the list you can do operations. When you complete the operation you want to go back to the list.
Success or error, you want to go the list with a message from the first dispatch.
Another example would be having a [delete] link on each row of the list.
You click [delete], it fails because the page was stale, so delegate to the list() dispatch with the error message from delete().
I am asking for a best practice because I can make this work in several ways, none of which seem clean.
This seems like the default behavior of any list page to me. I am hoping there is a prescribed flow to follow.
There are a couple options that I can think of:
1) go to error.jsp
This is really not desired.
Going to a default error page (or even a custom one) is breaking the workflow of the user.
They see the error and next need to click back to the list so they can try again.
2) call list() as the return import().
This works fine, but now there is hard coded "chaining" logic.
3) pass my own parameter in the result action tag in struts.xml.
Ex. <param name="myErrorMessage">${myErrorMessage}</param>
This is not desired either. It basically means I am replacing the existing error framework.
All my JSPs would need to look for myErrorMessage instead of using the built in tags.
-----Original Message-----
From: Martin Gainty [mailto:mgainty@(protected)]
Sent: Tuesday, August 12, 2008 2:20 PM
To: Struts Users Mailing List
Subject: RE: Best practice for passing success/error message to another dispatch (struts2)?
your action execute method can return "error" result which maps to error page e.g.
<result name="error">/error.jsp</result>
where error looks like
<html>
<body>
<b>YOU have an error !</b>
</body>
</html>
better to create a div tag and write a meaningful error to response which displays response in div tag ...
http://cwiki.apache.org/WW/ajax-recipes.html
Anyone else?
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
> From: jconner@(protected)
> To: user@(protected)
> Date: Tue, 12 Aug 2008 15:05:42 -0400
> Subject: Best practice for passing success/error message to another dispatch (struts2)?
>
> I have an action with two dispatch methods.
> I have a single JSP that renders a list and also have an import file field.
> On import failure, I want to populate the list with an error message.
>
> THE PROBLEM:
> It looks like validation for the list() method is wiping the errors from the import() method.
>
> Example struts.xml:
> <action name="*Role" class="RoleAction" method="list">
> <result name="input">/list.page</result>
> <result name="success">/list.page</result>
> </action>
>
> <action name="importRole" class="RoleAction" method="import">
> <result name="input" type="chain">listRole</result>
> <result name="success" type="chain">listRole</result>
> </action>
>
> Example pseudo code:
> public String list() {
> // sql lookup, populate list
> return "success";
> }
>
> public String import() {
> // do import
> If (fail) {
> addActionError(errorMessage);
> }
> return "success";
> }
>
>
>
_________________________________________________________________
Got Game? Win Prizes in the Windows Live Hotmail Mobile Summer Games Trivia Contest
http://www.gowindowslive.com/summergames?ocid=TXT_TAGHM

Attachment:
user_189986.ezm (zipped)Good catch Pierre. It appeared to be working as is, but for cleanliness, I swapped them.
Unfortunately that's not the problem.
I did find one other error in my struts.xml though.
I was missing the chain interceptor in my stack.
Ex.
<interceptor-stack name="interceptorStack">
<interceptor-ref name="validationWorkflowStack" />
<interceptor-ref name="chain"/>
Another important thing was to put "chain" after "validationWorkflowStack".
If "chain" is first, it will copy actionErrors to the chained action, then the validation on the list() method will fail.
That gives you the right error message, but also bypasses running list()...
Anyway, this appears to be working now.
(I suspect that if validation on list() really does fail it will not make it to "chain". So this is still not a "perfect" solution.)
-----Original Message-----
From: Pierre Thibaudeau [mailto:pierre.thibaudeau@(protected)]
Sent: Tuesday, August 12, 2008 2:44 PM
To: Struts Users Mailing List
Subject: Re: Best practice for passing success/error message to another dispatch (struts2)?
This may be completely incidental to your problem, but, it seems to me that,
if your actions are listed in that order, the first one will catch the
occurrences of the second one. ("importRole" is a particular case of
"*Role".) Shouldn't they be listed in the reverse order?
> > Example struts.xml:
> > <action name="*Role" class="RoleAction" method="list">
> > <result name="input">/list.page</result>
> > <result name="success">/list.page</result>
> > </action>
> >
> > <action name="importRole" class="RoleAction" method="import">
> > <result name="input" type="chain">listRole</result>
> > <result name="success" type="chain">listRole</result>
> > </action>
>

Attachment:
user_189988.ezm (zipped)
yes the validator will short-circuit when the validator's short-circuit="true" e.g.
<validators>
<!-- Field Validators for email field -->
<field name="email">
<field-validator type="required" short-circuit="true">
http://struts.apache.org/2.x/docs/validation.html#Validation-ShortCircuitingValidator
HTH
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
> From: jconner@(protected)
> To: user@(protected)
> Date: Tue, 12 Aug 2008 18:56:23 -0400
> Subject: RE: Best practice for passing success/error message to another dispatch (struts2)?
>
> Good catch Pierre. It appeared to be working as is, but for cleanliness, I swapped them.
> Unfortunately that's not the problem.
>
> I did find one other error in my struts.xml though.
> I was missing the chain interceptor in my stack.
> Ex.
> <interceptor-stack name="interceptorStack">
> <interceptor-ref name="validationWorkflowStack" />
> <interceptor-ref name="chain"/>
>
> Another important thing was to put "chain" after "validationWorkflowStack".
> If "chain" is first, it will copy actionErrors to the chained action, then the validation on the list() method will fail.
> That gives you the right error message, but also bypasses running list()...
>
> Anyway, this appears to be working now.
> (I suspect that if validation on list() really does fail it will not make it to "chain". So this is still not a "perfect" solution.)
>
> -----Original Message-----
> From: Pierre Thibaudeau [mailto:pierre.thibaudeau@(protected)]
> Sent: Tuesday, August 12, 2008 2:44 PM
> To: Struts Users Mailing List
> Subject: Re: Best practice for passing success/error message to another dispatch (struts2)?
>
> This may be completely incidental to your problem, but, it seems to me that,
> if your actions are listed in that order, the first one will catch the
> occurrences of the second one. ("importRole" is a particular case of
> "*Role".) Shouldn't they be listed in the reverse order?
>
>
> > > Example struts.xml:
> > > <action name="*Role" class="RoleAction" method="list">
> > > <result name="input">/list.page</result>
> > > <result name="success">/list.page</result>
> > > </action>
> > >
> > > <action name="importRole" class="RoleAction" method="import">
> > > <result name="input" type="chain">listRole</result>
> > > <result name="success" type="chain">listRole</result>
> > > </action>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
_________________________________________________________________
Get Windows Live and get whatever you need, wherever you are. Start here.
http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home_082008

Attachment:
user_189982.ezm (zipped)
Hi,
I am using s2 2.0.11 version, I am able to display the dojo dialog, but the
contents that supposed to appear on the dialog are appearing on the jsp that
iam calling from. I tried many possible ways but endup writing this question
here.
Well I have one more question, instead of displaying a div tag in the dojo
dialog, is there a way to call the server and pass some variables, and based
on the variables i would like to display some content on the dialog in a new
jsp.
Please find the attached output, you can find "name-text box", that actually
should appear on the Dialog.And also please help me in passing some
variables to the dialog, so that i can display a new jsp based on the server
response. http://www.nabble.com/file/p18951580/Doj-Dialog.JPG Doj-Dialog.JPG
Here is my jsp as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@(protected)"%>
<html>
<head>
<title>Dojo: Hello World!</title>
<script type="text/javascript" src="<s:url
value='/js/thickBox/jquery.js'/>"></script>
<script type="text/javascript" src="<s:url
value='/js/thickBox/thickbox-compressed.js'/>"></script>
<link href="<s:url value='/theme/main.css'/>" rel="stylesheet"
type="text/css"/>
<link rel="stylesheet" href="<s:url value='/theme/thickbox.css'/>"
type="text/css" media="screen" />
<link
href="<s:url value='/js/dojo-1.1.1/dijit/themes/tundra/tundra.css'/>"
rel="stylesheet" type="text/css" />
<link href="<s:url value='/js/dojo-1.1.1/dojo/resources/dojo.css'/>"
rel="stylesheet" type="text/css" />
<!-- SECTION 1 -->
<script type="text/javascript" src="js/dojo-1.1.1/dojo/dojo.js"
djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
// Load Dojo's code relating to the Button widget
dojo.require("dojo.parser");
dojo.require("dijit.form.Button");
dojo.require("dijit.Dialog");
dojo.require("dijit.form.TextBox");
</script>
</head>
<body class="tundra">
<s:form action="detailedInfo" method="post">
<s:actionerror/>
<s:fielderror/>
<button dojoType="dijit.form.Button"
onclick="dijit.byId('dialog1').show()">Show Dialog</button>
<div dojoType="dijit.Dialog" id="dialog1" title="First Dialog"
onfocus="console.log('user focus handler')"
onblur="console.log('user blur handler')"
execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0],
true));">
<table>
<tr>
<td><label for="name">Name: </label></td>
<td><input dojoType=dijit.form.TextBox type="text" name="name"
id="name"></td>
</tr>
</table>
</div>
</s:form>
</body>
</html>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_189983.ezm (zipped)
Could u help me, in creating a dojo dialog.
and I would like pass some variables so that, i can submit to server and
response jsp needed to be shown on the dialog.
Is it possible to do that way?
Dariusz Wojtas wrote:
>
> Hi,
>
> Is there a component in the current code to show a modal dialog or
> 'Accordion' (as shown on the DojoTooklit website)?
> If not - I could try to help in this area.
>
> Dariusz Wojtas
>
> ---------------------------------------------------------------------
> 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_189987.ezm (zipped)Vasyl,
The attempt is very iffy. Some things you need to know:
1) No Servlet API provides the path to your files.
2) If running in a WAR file that is never expanded, there will be no
such file directory that will exist.
3) You can use the classloader of the web context to get the root of
your web application, but that assumes #2 is false. You must be on a
file system for it to work.
Paul
On Tue, Aug 12, 2008 at 8:04 AM, Vasyl Skrypij <vasyl.skrypij@(protected):
>
> Hi all
>
> I have Struts 2.0.9
>
> I need to get the path to the directory in which my web application is
> situated during interceptor's asking. How can I do this been using
> ActionInvocation class object which passes into intercept method, or maybe i
> should try some other way?
>
> --
> View this message in context: http://www.nabble.com/Get-path-to-the-webapp-tp18943905p18943905.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)
>
>