Author Login
Post Reply
user Digest 16 Apr 2008 22:39:07 -0000 Issue 7983
Topics (messages 185500 through 185516):
Text formatting
185500 by: Hartrich, James CTR USTRANSCOM J6
185503 by: Dave Newton
185508 by: Adam Gordon
185510 by: Dave Newton
185511 by: Dave Newton
datetimepicker on 2.1.1-SNAPSHOT
185501 by: Décio Heinzelmann Luckow
185505 by: Dave Newton
Re: Validation of Struts XML files
185502 by: Dave Newton
185507 by: Adam Gordon
Re: Struts2 Portlet with custom interceptors
185504 by: Nils-Helge Garli Hegvik
185513 by: Parker Grimes
185515 by: Nils-Helge Garli Hegvik
185516 by: Parker Grimes
ParameterAware Arrays
185506 by: Dustin S.
Eclipse plugins to verify xml/jsp at compile time?
185509 by: Michael Gagnon
Overriding subset of interceptor params
185512 by: Jon Wilmoth
Re: Is it possible to make a pop up window using Struts?
185514 by: Randy Burgess
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_185500.ezm (zipped)Struts2.0.9
Has anyone successfully formatted a number 5557777 into 555-7777.
MyAction.properties: format.telephone={0,number,###-####}
My.jsp: <s:action name="myaction"/>
<s:text name="format.telephone">
<s:param name="value" value="myTeleValue"/>
</s:text>
The only output rendered to the jsp page after numerous attempts is the
string "format.telephone".
Thanks
James

Attachment:
smime.p7s (zipped)
Attachment:
user_185503.ezm (zipped)--- "Hartrich, James CTR USTRANSCOM J6" wrote:
> Has anyone successfully formatted a number 5557777 into 555-7777.
>
> MyAction.properties: format.telephone={0,number,###-####}
>
> My.jsp: <s:action name="myaction"/>
> <s:text name="format.telephone">
> <s:param name="value" value="myTeleValue"/>
> </s:text>
>
> The only output rendered to the jsp page after numerous attempts is the
> string "format.telephone".
I'm not aware that you can format numbers like that. AFAIK the number
formatting follows the decimal formatting Java rules [1] where things like
the "-" character refer to the default negative number prefix.
Phone numbers aren't numbers (add two together?!), they're strings. Or should
be; if they're not you may want to reconsider.
Dave
[1] http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html

Attachment:
user_185508.ezm (zipped)James-
I'm sure this was totally unintentional and you did it to simply get the
email address of the mailing list, but thread hijacking is generally
frowned upon in support mailing lists.
--adam
Hartrich, James CTR USTRANSCOM J6 wrote:
> Struts2.0.9
> Has anyone successfully formatted a number 5557777 into 555-7777.
>
>
> MyAction.properties: format.telephone={0,number,###-####}
>
> My.jsp: <s:action name="myaction"/>
> <s:text name="format.telephone">
> <s:param name="value" value="myTeleValue"/>
> </s:text>
>
> The only output rendered to the jsp page after numerous attempts is the
> string "format.telephone".
>
> Thanks
> James
>

Attachment:
user_185510.ezm (zipped)--- Adam Gordon <adam.gordon@(protected):
> I'm sure this was totally unintentional and you did it to simply get the
> email address of the mailing list, but thread hijacking is generally
> frowned upon in support mailing lists.
He started the thread, and it's about formatting (via the <s:text...> tag).
Dave
> Hartrich, James CTR USTRANSCOM J6 wrote:
> > Struts2.0.9
> > Has anyone successfully formatted a number 5557777 into 555-7777.
> >
> >
> > MyAction.properties: format.telephone={0,number,###-####}
> >
> > My.jsp: <s:action name="myaction"/>
> > <s:text name="format.telephone">
> > <s:param name="value" value="myTeleValue"/>
> > </s:text>
> >
> > The only output rendered to the jsp page after numerous attempts is the
> > string "format.telephone".
> >
> > Thanks
> > James
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_185511.ezm (zipped)--- Dave Newton <newton.dave@(protected):
> --- Adam Gordon <adam.gordon@(protected):
> > I'm sure this was totally unintentional and you did it to simply get the
> > email address of the mailing list, but thread hijacking is generally
> > frowned upon in support mailing lists.
>
> He started the thread, and it's about formatting (via the <s:text...> tag).
Just realized I viewed this in a non-threaded view and I didn't check the
headers, so it might have been hijacked; sorry.
Dave

Attachment:
user_185501.ezm (zipped)Hi all,
I was testing an master-detail screen with <s:datetimepicker>
When I update the struts version to 2.1.1 a give this message:
java.lang.NoClassDefFoundError:
org/apache/struts2/views/jsp/ui/DateTimePickerTag
at org.apache.jsp.cre_jsp._jspx_meth_s_005fdatetimepicker_005f0(*
cre_jsp.java:466*)
at org.apache.jsp.cre_jsp._jspx_meth_s_005fiterator_005f0(*cre_jsp.java:329*
)
at org.apache.jsp.cre_jsp._jspx_meth_s_005fform_005f0(*cre_jsp.java:206*)
at org.apache.jsp.cre_jsp._jspService(*cre_jsp.java:105*)
at
org.apache.jasper.runtime.HttpJspBase.service(*HttpJspBase.java:70*)
I search this class tag at package struts2-core and don´t find it.
The ajax tags was moved to another package or plugin?
Is there an release notes to 2.1.1?

Attachment:
user_185505.ezm (zipped)--- D�cio Heinzelmann Luckow <decioluckow@(protected):
> The ajax tags was moved to another package or plugin?
Plugin.
> Is there an release notes to 2.1.1?
http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html
http://struts.apache.org/2.0.11.1/docs/version-notes-210.html
http://struts.apache.org/2.0.11.1/docs/version-notes-211.html
Dave

Attachment:
user_185502.ezm (zipped)Does it work if you use the DTD it says to use?
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
Dave
--- Adam Gordon <adam.gordon@(protected):
> Last night, our company had a maintenance window whereby Internet access
> was shut off from our office to the outside world. During that time I
> was doing development and attempted to start up our web app in a
> development environment.
>
> I've not seen this error in almost 2 years but it's apparently back:
>
> [
org.apache.struts.action.ActionServlet] [handleConfigException] Parsing
> error processing resource path /WEB-INF/struts-optout.xml
>
java.net.UnknownHostException: jakarta.apache.org
> at
java.net.PlainSocketImpl.connect (
PlainSocketImpl.java:177)
> at
java.net.Socket.connect (
Socket.java:520)
> at
java.net.Socket.connect (
Socket.java:470)
> at
sun.net.NetworkClient.doConnect (
NetworkClient.java:157)
> ...*snip*...
>
> I remember this well. The problem is that struts-optout.xml has the
> DOCTYPE of:
>
> <!DOCTYPE struts-config PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
> "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
>
> But, the struts-config_1_3.dtd is not in the struts.jar file (we're
> using Struts 1.2.9) so, apparently in order to validate that the XML
> file is well-formed at webapp start up time, Tomcat feels the need to go
> out and retrieve this DTD - only it can't because Internet access was
> down. The problem is greatly exacerbated by the fact that Tomcat stops
> processing the loading of struts modules when this one fails essentially
> rendering the web app useless.
>
> I seem to recall playing with turning validation of XML files off, but
> that not being a sufficient solution so I tried adding the DTD into the
> struts JAR file in the same location as the other DTDs:
> org/apache/struts/resources/struts-config_1_x.dtd (where x=0,1,2) but
> that didn't work.
>
> We need to be able to find a solution to where we can host the DTDs
> locally and do not have to rely on a 3rd party server being up in order
> to deploy our web application. I seem to recall this being an issue
> with the W3C (especally w.r.t. [X]HTML validation in that it results in
> a ton of unnecessary network calls to retrieve DTDs for validation
> rather than web servers hosting the DTDs locally.
>
> I'm sure I'm not the only one to have seen this so any help to resolve
> this would be greatly appreciated. Thanks.
>
> -- adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_185507.ezm (zipped)Well, the DTD files are identical, only the URLs are different so I
don't expect the outcome to be any different....
And it turns out it's not. Changing the URL does not prevent Tomcat
from going out and trying to retrieve the DTD even though I've added it
to the JAR file.
Any other ideas?
--adam
Dave Newton wrote:
> Does it work if you use the DTD it says to use?
>
> <!DOCTYPE struts-config PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
> "http://struts.apache.org/dtds/struts-config_1_3.dtd">
>
> Dave
>
> --- Adam Gordon <adam.gordon@(protected):
>
>
>> Last night, our company had a maintenance window whereby Internet access
>> was shut off from our office to the outside world. During that time I
>> was doing development and attempted to start up our web app in a
>> development environment.
>>
>> I've not seen this error in almost 2 years but it's apparently back:
>>
>> [
org.apache.struts.action.ActionServlet] [handleConfigException] Parsing
>> error processing resource path /WEB-INF/struts-optout.xml
>>
java.net.UnknownHostException: jakarta.apache.org
>> at
java.net.PlainSocketImpl.connect (
PlainSocketImpl.java:177)
>> at
java.net.Socket.connect (
Socket.java:520)
>> at
java.net.Socket.connect (
Socket.java:470)
>> at
sun.net.NetworkClient.doConnect (
NetworkClient.java:157)
>> ...*snip*...
>>
>> I remember this well. The problem is that struts-optout.xml has the
>> DOCTYPE of:
>>
>> <!DOCTYPE struts-config PUBLIC
>> "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
>> "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
>>
>> But, the struts-config_1_3.dtd is not in the struts.jar file (we're
>> using Struts 1.2.9) so, apparently in order to validate that the XML
>> file is well-formed at webapp start up time, Tomcat feels the need to go
>> out and retrieve this DTD - only it can't because Internet access was
>> down. The problem is greatly exacerbated by the fact that Tomcat stops
>> processing the loading of struts modules when this one fails essentially
>> rendering the web app useless.
>>
>> I seem to recall playing with turning validation of XML files off, but
>> that not being a sufficient solution so I tried adding the DTD into the
>> struts JAR file in the same location as the other DTDs:
>> org/apache/struts/resources/struts-config_1_x.dtd (where x=0,1,2) but
>> that didn't work.
>>
>> We need to be able to find a solution to where we can host the DTDs
>> locally and do not have to rely on a 3rd party server being up in order
>> to deploy our web application. I seem to recall this being an issue
>> with the W3C (especally w.r.t. [X]HTML validation in that it results in
>> a ton of unnecessary network calls to retrieve DTDs for validation
>> rather than web servers hosting the DTDs locally.
>>
>> I'm sure I'm not the only one to have seen this so any help to resolve
>> this would be greatly appreciated. Thanks.
>>
>> -- adam
>>
>> ---------------------------------------------------------------------
>> 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_185504.ezm (zipped)
Attachment:
user_185513.ezm (zipped)My interceptor is being called, but it appears that
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor is still
being called before my interceptor, despite having my interceptor declared
first in the stack. As you can tell my interceptor is handed the "error"
result rather than catching the exception.
The only way I was able to get it to work is by changing the 'exception'
interceptor definition in struts-default.xml to point to my class. As a side
note, is there a way to override struts-default.xml? I tried setting the
property
struts.configuration.files=my-struts-default.xml,struts-plugin.xml,struts.xml
and overriding the 'exception' interceptor in my-struts-default.xml, but the
struts-default.xml was still being loaded. So I ended up checking out the
struts2 source, editing struts-default.xml and packaging it myself, which is
kind of a pain.
I have have tried both Struts 2.0.11 and 2.1.1 <http://2.1.1./>, also tried
it as a regular app and a portlet app and I get the same behavior.
Thanks,
Parker
On Wed, Apr 16, 2008 at 11:12 AM, Nils-Helge Garli Hegvik <nilsga@(protected)>
wrote:
> I did some testing locally, and it looks to me like exceptions should
> be propagated properly. Are you sure that the exception is not handled
> somewhere else? From your logs, it appears that "error" is returned
> somewhere along the chain.
>
> Nils-H
>
> On Wed, Apr 16, 2008 at 12:46 AM, Parker Grimes <pgrimes@(protected):
> > I am trying to implement a custom exception mapping interceptor to be
> used
> > in my struts2 portlet. I implemented my own ExceptionMappingInterceptor
> > class that is similar to
> >
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor, the
> only
> > difference is that I send an email with the exception report to the
> > application administrators. I have used this same interceptor
> successfully
> > in a regular struts2 application.
> >
> > The problem I am having is that it appears that the action is being
> called
> > and the exception caught by some other class before it gets to my
> > interceptor even though my interceptor is declared first in my stack.
> Since
> > my custom interceptor is first in my stack shouldn't it be the first
> thing
> > to catch an exception begin thrown from my action?
> >
> > *My interceptor looks like this in struts.xml:*
> > <interceptors>
> > <interceptor name="customException"
> > class="edu.suu.struts2.interceptor.ExceptionMappingInterceptor"/>
> > <interceptor-stack name="myStack">
> > <interceptor-ref name="customException"/>
> > <interceptor-ref name="portletDefaultStack"/>
> > </interceptor-stack>
> > </interceptors>
> > <default-interceptor-ref name="myStack"/>
> >
> > *
> > Here is my debug logging:*
> > DEBUG [
com.opensymphony.xwork2.DefaultActionInvocation] - Executing
> action
> > method = optIn
> > DEBUG [edu.suu.googleapps.portlet.OptInAction] - optIn()
> > ---exception is thrown here---
> > DEBUG [
org.apache.struts2.portlet.result.PortletResult] - Executing
> result
> > in Event phase
> > DEBUG [
org.apache.struts2.portlet.result.PortletResult] - Setting event
> > render parameter: /WEB-INF/jsp/error.jsp
> > DEBUG [edu.suu.struts2.interceptor.ExceptionMappingInterceptor] -
> result =
> > error
> > DEBUG [edu.suu.struts2.interceptor.ExceptionMappingInterceptor] - No
> > exceptions caught
> > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> Leaving
> > processAction
> > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> Entering
> > render
> > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> > serviceAction
> > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> Creating
> > action proxy for name = renderDirect, namespace =
> > DEBUG [
com.opensymphony.xwork2.DefaultActionProxy] - Creating an
> > DefaultActionProxy for namespace and action name renderDirect
> > DEBUG [
org.apache.struts2.portlet.interceptor.PortletStateInterceptor]
> -
> > Restoring value stack from event phase
> > DEBUG [
org.apache.struts2.portlet.interceptor.PortletStateInterceptor]
> -
> > Restored stack
> > DEBUG [
com.opensymphony.xwork2.interceptor.I18nInterceptor] - intercept
> > '/renderDirect' {
> > DEBUG [
com.opensymphony.xwork2.interceptor.I18nInterceptor] -
> > requested_locale=null
> > *
> > The interceptor looks like this:*
> > public String intercept(ActionInvocation invocation) throws Exception {
> > HttpServletRequest request = ServletActionContext.getRequest();
> > String result = null;
> > try {
> > logger.debug("Invoking action, looking for exceptions.");
> > result = invocation.invoke();
> > logger.debug("result = " + result);
> > logger.debug("No exceptions caught");
> > } catch (Exception ex) {
> > logger.debug("Exceptions caught");
> > ex.printStackTrace();
> > ......
> > }
> > return result;
> > }
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_185515.ezm (zipped)The default ExceptionMappingInterceptor is "closer" to the error (as
it is configured by default), so it will intercept it first (on the
way out... [1]). If you already have configured exception mappings for
that interceptor, it will never reach your interceptor. It might be
better for you to replace the the interceptor in the stack, as you
have already tried. You can set up your own default stack in your
application struts.xml file. It's a bit of duplication, but there's no
need to edit the framework supplied configuration files.
[1] - http://struts.apache.org/2.x/docs/interceptors.html#Interceptors-OrderofInterceptorExecution
Nils-H
On Wed, Apr 16, 2008 at 9:46 PM, Parker Grimes <pgrimes@(protected):
> My interceptor is being called, but it appears that
>
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor is still
> being called before my interceptor, despite having my interceptor declared
> first in the stack. As you can tell my interceptor is handed the "error"
> result rather than catching the exception.
>
> The only way I was able to get it to work is by changing the 'exception'
> interceptor definition in struts-default.xml to point to my class. As a side
> note, is there a way to override struts-default.xml? I tried setting the
> property
> struts.configuration.files=my-struts-default.xml,struts-plugin.xml,struts.xml
> and overriding the 'exception' interceptor in my-struts-default.xml, but the
> struts-default.xml was still being loaded. So I ended up checking out the
> struts2 source, editing struts-default.xml and packaging it myself, which is
> kind of a pain.
>
> I have have tried both Struts 2.0.11 and 2.1.1 <http://2.1.1./>, also tried
> it as a regular app and a portlet app and I get the same behavior.
>
> Thanks,
> Parker
>
> On Wed, Apr 16, 2008 at 11:12 AM, Nils-Helge Garli Hegvik <nilsga@(protected)>
> wrote:
>
>
>
> > I did some testing locally, and it looks to me like exceptions should
> > be propagated properly. Are you sure that the exception is not handled
> > somewhere else? From your logs, it appears that "error" is returned
> > somewhere along the chain.
> >
> > Nils-H
> >
> > On Wed, Apr 16, 2008 at 12:46 AM, Parker Grimes <pgrimes@(protected):
> > > I am trying to implement a custom exception mapping interceptor to be
> > used
> > > in my struts2 portlet. I implemented my own ExceptionMappingInterceptor
> > > class that is similar to
> > >
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor, the
> > only
> > > difference is that I send an email with the exception report to the
> > > application administrators. I have used this same interceptor
> > successfully
> > > in a regular struts2 application.
> > >
> > > The problem I am having is that it appears that the action is being
> > called
> > > and the exception caught by some other class before it gets to my
> > > interceptor even though my interceptor is declared first in my stack.
> > Since
> > > my custom interceptor is first in my stack shouldn't it be the first
> > thing
> > > to catch an exception begin thrown from my action?
> > >
> > > *My interceptor looks like this in struts.xml:*
> > > <interceptors>
> > > <interceptor name="customException"
> > > class="edu.suu.struts2.interceptor.ExceptionMappingInterceptor"/>
> > > <interceptor-stack name="myStack">
> > > <interceptor-ref name="customException"/>
> > > <interceptor-ref name="portletDefaultStack"/>
> > > </interceptor-stack>
> > > </interceptors>
> > > <default-interceptor-ref name="myStack"/>
> > >
> > > *
> > > Here is my debug logging:*
> > > DEBUG [
com.opensymphony.xwork2.DefaultActionInvocation] - Executing
> > action
> > > method = optIn
> > > DEBUG [edu.suu.googleapps.portlet.OptInAction] - optIn()
> > > ---exception is thrown here---
> > > DEBUG [
org.apache.struts2.portlet.result.PortletResult] - Executing
> > result
> > > in Event phase
> > > DEBUG [
org.apache.struts2.portlet.result.PortletResult] - Setting event
> > > render parameter: /WEB-INF/jsp/error.jsp
> > > DEBUG [edu.suu.struts2.interceptor.ExceptionMappingInterceptor] -
> > result =
> > > error
> > > DEBUG [edu.suu.struts2.interceptor.ExceptionMappingInterceptor] - No
> > > exceptions caught
> > > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> > Leaving
> > > processAction
> > > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> > Entering
> > > render
> > > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> > > serviceAction
> > > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> > Creating
> > > action proxy for name = renderDirect, namespace =
> > > DEBUG [
com.opensymphony.xwork2.DefaultActionProxy] - Creating an
> > > DefaultActionProxy for namespace and action name renderDirect
> > > DEBUG [
org.apache.struts2.portlet.interceptor.PortletStateInterceptor]
> > -
> > > Restoring value stack from event phase
> > > DEBUG [
org.apache.struts2.portlet.interceptor.PortletStateInterceptor]
> > -
> > > Restored stack
> > > DEBUG [
com.opensymphony.xwork2.interceptor.I18nInterceptor] - intercept
> > > '/renderDirect' {
> > > DEBUG [
com.opensymphony.xwork2.interceptor.I18nInterceptor] -
> > > requested_locale=null
> > > *
> > > The interceptor looks like this:*
> > > public String intercept(ActionInvocation invocation) throws Exception {
> > > HttpServletRequest request = ServletActionContext.getRequest();
> > > String result = null;
> > > try {
> > > logger.debug("Invoking action, looking for exceptions.");
> > > result = invocation.invoke();
> > > logger.debug("result = " + result);
> > > logger.debug("No exceptions caught");
> > > } catch (Exception ex) {
> > > logger.debug("Exceptions caught");
> > > ex.printStackTrace();
> > > ......
> > > }
> > > return result;
> > > }
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>

Attachment:
user_185516.ezm (zipped)Thanks for your help I had an "ah ha" moment. I know I read that the stack
gets passed through twice, once down the stack and then back up but I had
forgotten that. That was my problem. The exception was being thrown on the
way back up the stack and being caught by the default
ExceptionMappingInterceptor since it was lower in the stack.
I did as you suggested and defined my own default stack, replacing the
exception interceptor with mine. Works great now.
Thanks again for the help.
Parker
On Wed, Apr 16, 2008 at 3:59 PM, Nils-Helge Garli Hegvik <nilsga@(protected)>
wrote:
> The default ExceptionMappingInterceptor is "closer" to the error (as
> it is configured by default), so it will intercept it first (on the
> way out... [1]). If you already have configured exception mappings for
> that interceptor, it will never reach your interceptor. It might be
> better for you to replace the the interceptor in the stack, as you
> have already tried. You can set up your own default stack in your
> application struts.xml file. It's a bit of duplication, but there's no
> need to edit the framework supplied configuration files.
>
> [1] -
> http://struts.apache.org/2.x/docs/interceptors.html#Interceptors-OrderofInterceptorExecution
>
> Nils-H
>
> On Wed, Apr 16, 2008 at 9:46 PM, Parker Grimes <pgrimes@(protected):
> > My interceptor is being called, but it appears that
> >
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor is
> still
> > being called before my interceptor, despite having my interceptor
> declared
> > first in the stack. As you can tell my interceptor is handed the
> "error"
> > result rather than catching the exception.
> >
> > The only way I was able to get it to work is by changing the
> 'exception'
> > interceptor definition in struts-default.xml to point to my class. As a
> side
> > note, is there a way to override struts-default.xml? I tried setting
> the
> > property
> >
> struts.configuration.files=my-struts-default.xml,struts-plugin.xml,struts.xml
> > and overriding the 'exception' interceptor in my-struts-default.xml,
> but the
> > struts-default.xml was still being loaded. So I ended up checking out
> the
> > struts2 source, editing struts-default.xml and packaging it myself,
> which is
> > kind of a pain.
> >
> > I have have tried both Struts 2.0.11 and 2.1.1 <http://2.1.1./>, also
> tried
> > it as a regular app and a portlet app and I get the same behavior.
> >
> > Thanks,
> > Parker
> >
> > On Wed, Apr 16, 2008 at 11:12 AM, Nils-Helge Garli Hegvik <
> nilsga@(protected)>
> > wrote:
> >
> >
> >
> > > I did some testing locally, and it looks to me like exceptions should
> > > be propagated properly. Are you sure that the exception is not
> handled
> > > somewhere else? From your logs, it appears that "error" is returned
> > > somewhere along the chain.
> > >
> > > Nils-H
> > >
> > > On Wed, Apr 16, 2008 at 12:46 AM, Parker Grimes <pgrimes@(protected)>
> wrote:
> > > > I am trying to implement a custom exception mapping interceptor to
> be
> > > used
> > > > in my struts2 portlet. I implemented my own
> ExceptionMappingInterceptor
> > > > class that is similar to
> > > >
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor,
> the
> > > only
> > > > difference is that I send an email with the exception report to
> the
> > > > application administrators. I have used this same interceptor
> > > successfully
> > > > in a regular struts2 application.
> > > >
> > > > The problem I am having is that it appears that the action is
> being
> > > called
> > > > and the exception caught by some other class before it gets to my
> > > > interceptor even though my interceptor is declared first in my
> stack.
> > > Since
> > > > my custom interceptor is first in my stack shouldn't it be the
> first
> > > thing
> > > > to catch an exception begin thrown from my action?
> > > >
> > > > *My interceptor looks like this in struts.xml:*
> > > > <interceptors>
> > > > <interceptor name="customException"
> > > > class="edu.suu.struts2.interceptor.ExceptionMappingInterceptor"/>
> > > > <interceptor-stack name="myStack">
> > > > <interceptor-ref name="customException"/>
> > > > <interceptor-ref name="portletDefaultStack"/>
> > > > </interceptor-stack>
> > > > </interceptors>
> > > > <default-interceptor-ref name="myStack"/>
> > > >
> > > > *
> > > > Here is my debug logging:*
> > > > DEBUG [
com.opensymphony.xwork2.DefaultActionInvocation] -
> Executing
> > > action
> > > > method = optIn
> > > > DEBUG [edu.suu.googleapps.portlet.OptInAction] - optIn()
> > > > ---exception is thrown here---
> > > > DEBUG [
org.apache.struts2.portlet.result.PortletResult] -
> Executing
> > > result
> > > > in Event phase
> > > > DEBUG [
org.apache.struts2.portlet.result.PortletResult] - Setting
> event
> > > > render parameter: /WEB-INF/jsp/error.jsp
> > > > DEBUG [edu.suu.struts2.interceptor.ExceptionMappingInterceptor] -
> > > result =
> > > > error
> > > > DEBUG [edu.suu.struts2.interceptor.ExceptionMappingInterceptor] -
> No
> > > > exceptions caught
> > > > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> > > Leaving
> > > > processAction
> > > > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> > > Entering
> > > > render
> > > > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> > > > serviceAction
> > > > DEBUG [
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher] -
> > > Creating
> > > > action proxy for name = renderDirect, namespace =
> > > > DEBUG [
com.opensymphony.xwork2.DefaultActionProxy] - Creating an
> > > > DefaultActionProxy for namespace and action name renderDirect
> > > > DEBUG
> [
org.apache.struts2.portlet.interceptor.PortletStateInterceptor]
> > > -
> > > > Restoring value stack from event phase
> > > > DEBUG
> [
org.apache.struts2.portlet.interceptor.PortletStateInterceptor]
> > > -
> > > > Restored stack
> > > > DEBUG [
com.opensymphony.xwork2.interceptor.I18nInterceptor] -
> intercept
> > > > '/renderDirect' {
> > > > DEBUG [
com.opensymphony.xwork2.interceptor.I18nInterceptor] -
> > > > requested_locale=null
> > > > *
> > > > The interceptor looks like this:*
> > > > public String intercept(ActionInvocation invocation) throws
> Exception {
> > > > HttpServletRequest request =
> ServletActionContext.getRequest();
> > > > String result = null;
> > > > try {
> > > > logger.debug("Invoking action, looking for
> exceptions.");
> > > > result = invocation.invoke();
> > > > logger.debug("result = " + result);
> > > > logger.debug("No exceptions caught");
> > > > } catch (Exception ex) {
> > > > logger.debug("Exceptions caught");
> > > > ex.printStackTrace();
> > > > ......
> > > > }
> > > > return result;
> > > > }
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > 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_185506.ezm (zipped)I noticed the the map for setParameters is <String, String[]>. If I
intend to always only use [0], is there any easy way to accomplish
this without having to do [0] everytime I get() a parameter from the
map? I noticed there is SingleValueMap in webwork for this purpose.
Does something exist like this in Struts 2 or possibly is there any
easier way to get params from a url (page?parm1=value1¶m2=value2)
that I am not seeing?

Attachment:
user_185509.ezm (zipped)Is there any plugin support for eclipse that can help validate struts2
configuration?
So if I have a struts.xml mapping like:
<action name="LoginUser" class="userAccounts.action.LoginUserAction">
...
Then some build-time plugin might check and see the
userAccounts.action.LoginUserAction class does not exist
Or perhaps a struts tag in a JSP might look like:
<s:form namespace="/userAccounts" action="RegisterUser" method="post" >
...
And some build-time check might notice that "RegisterUser" has no mapping in
the "userAccounts" package of the struts.xml
Currently my only method of finding these errors (which are CAPABLE of being
detected at compile time) is to start Tomcat. If it starts up successfully
then my struts.xml is okay. Then the only way to verify jsp
s:form,s:action,s:url,etc. tags is to browse the page and look for Tocmat
output. This makes it easy to successfully compile a project, pass all unit
tests, but check in broken code to source control.

Attachment:
user_185512.ezm (zipped)I'm trying to override one of three interceptor parameters in an action specific config using method #2 described in
http://struts.apache.org/2.0.11.1/docs/interceptors.html#Interceptors-InterceptorParameterOverriding. Unfortunately the other two parameters that I'm not overriding are not being taken from the default stack definition and are ending up as null on the interceptor. Before I open a Jira bug (or enhancement request), I thought I'd make sure a) this isn't user error b) the expected behavior is "my" expected behavior (i.e. bug vs. enhancement). Below is a sample action config showing what I'm attempting...
<package name="packageA"...>
<interceptors>
<interceptor name="myInterceptor" class="..."/>
<interceptor-stack name="myStack">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="myInterceptor">
<param name="paramA">defaultValueA</param>
<param name="paramB">defaultValueB</param>
<param name="paramC">defaultValueC</param>
</interceptor-ref>
</interceptor-stack>
</package>
With the following action config, the "myInterceptor" interceptor's paramA & paramB are null and not "defaultValueA" and "defaultValueB" as expected/desired.
<package name="packageB" extends="packageA"...>
<action name="myAction" class="myActionClass">
<interceptor-ref name="myStack">
<param name="myInterceptor.paramC">actionSpecificValue</param>
</interceptor-ref>
</action>
</package>
Thanks,
Jon

Attachment:
user_185514.ezm (zipped)You can pass a query string to the popup window. Here is an example.
<a
href="javascript:popup('printOrder.do?orderNumber=${order.workOrderNumber}',
600, 600, true);">
And then in the popup window to get the orderNumber param passed in above:
<c:if test="${not empty param.orderNumber}">
Reference Number: ${param.orderNumber}
</c:if>
You might want to change the href to # and put the window.open code in the
onclick event but other than that this will work fine. In this case order
Is a request attribute for this action.
Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications
> From: ryan webb <webb.ryan1@(protected)>
> Reply-To: Struts Users Mailing List <user@(protected)>
> Date: Wed, 16 Apr 2008 16:40:25 +0800
> To: Struts Users Mailing List <user@(protected)>
> Subject: Re: Is it possible to make a pop up window using Struts?
>
> Antonio,
>
>> 1) What Struts? Struts 1.2.9 (Netbeans bundle)
>> 2) You can still do it in Javascript. I see.. I just want to know if you do
> it with struts.
>
> I am having trouble with it..I created a pop up window using javascript and
> i cant pass query string on new window.
> when i clicked a <html:link> I pass a paramId and paramProperty and I cant
> make it appear to new window.
>
> I have an action class that has *request.setAttribute("username",
> request.getParameter("username"));*
> on the new window I have *<%= out.println(request.getAttribute("username"))
> %>* but this only displays the word NULL
>
> I am new to struts..
>
> Ryan
>
> On Wed, Apr 16, 2008 at 4:22 PM, Antonio Petrelli <
> antonio.petrelli@(protected):
>
>> 2008/4/16, ryan webb <webb.ryan1@(protected)>:
>>> Is it possible to make a window pop up using struts?
>>> usually this can be done in Javascript..
>>
>> 1) What Struts?
>> 2) You can still do it in Javascript
>>
>> Antonio
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
This email and any attachments ("Message") may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.
This email and any attachments ("Message") may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.