struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burton Rhodes <burtonrho...@gmail.com>
Subject Re: How to reference a struts constant from within struts.xml?
Date Fri, 10 Apr 2020 13:51:06 GMT
Done.  The JIRA ticket is located here:
https://issues.apache.org/jira/browse/WW-5066

On Fri, Apr 10, 2020 at 12:45 AM Lukasz Lenart <lukaszlenart@apache.org>
wrote:

> czw., 9 kwi 2020 o 16:58 Burton Rhodes <burtonrhodes@gmail.com>
> napisał(a):
> >
> > Is it possible to reference a Struts constant from within the same file?
> > In other words, I would like to define a constant inside my struts.xml
> file
> > and then reference that constant further down in the file.
> >
> > For example:
> >
> > [struts.xml]
> > <struts>
> >
> >     <!-- My Constants -->
> >     <constant name="afs.maxFileSize" value="20971520"/>     <!-- Max size
> > for individual files (20 MB) -->
> >
> >     <package>
> >         <action name="XactionActivityGeneric_update"
> > class="com.afs.web.struts.action.xaction.XactionActivityGenericAction"
> > method="update">
> >             <interceptor-ref name="myParamsPrepareParamsStack">
> >                 <!-- REFERENCE MY CONSTANT HERE -->
> >                 <param
> > name="fileUpload.maximumSize">${afs.maxFileSize}</param>
>
> This rather won't work directly, as ${...} is executed in context of
> an action, which means the "afs.maxFileSize" must be action's
> property. Anyway this looks like an interesting idea, would you mind
> registering a ticket in JIRA with this proposal?
>
> ... but you can use @Inject("afs.maxFileSize") in your action (you can
> use either constructor or field injection) and then reference it via a
> getter from the action, eg.: getMaxFileSize -> ${maxFileSize}
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message