Re: Questions about migrating to Struts 7.0
Lukasz Lenart <[email protected]> Wed, 12 Mar 2025 06:53:03 +0100
| Newsgroups | gmane.comp.jakarta.struts.user |
|---|---|
| Message-ID | <CAMopvkOvhCmeqReDYw1RAaEUJVWaq+MOaPxT1D0Oayr+qjcuhw@mail.gmail.com> |
wt., 11 mar 2025 o 16:09 Nate Kerkhofs <[email protected]> napisał(a): > One thing I'm wondering about is the StrutsParameter annotation that now needs to be added to all getters and setters that need to be accessed from the OGNL context. We have a number of Actions where we have getters and setters for POJO objects, and sometimes those POJOs have getters and setters for nested POJO objects as well, and sometimes this goes on for quite a number of levels. Do all these getters and setters on POJO objects need that annotation as well? Or is there a way we can just annotate the Action level getters and setters and it will handle all levels, even if it is a recursive situation where the number of levels is not known at compile time? You just need one @StrutsParametere annotation with "depth" attribute set to a proper value or Integer.MAX_VALUE for a given setter (once defined for setter, there is no need to define another for getter) https://github.com/apache/struts-examples/blob/main/type-conversion/src/main/java/org/apache/struts/example/ThemeAction.java#L47-L57 > Another question I have: do s:url tags automatically handle the namespace resolution changes? Or will we need to add an explicit namespace to all our s:url tags? I'm not even sure what's meant with a namespace in this context. Is this related to the Request Context (the first part of the url after the domain)? Or is this something different? In Struts you can define packages in different namespaces, this is something different the Request Context, basically all the actions from a given package are available in a given namespace (do not treat namespace as folder, just a named space, eg. /admin/users or /public/orders) https://struts.apache.org/core-developers/namespace-configuration And by default <s:url/> tag uses the current namespace where you use it, yet you can define the "namespace" attribute if you want to create a link to action in another namespace. https://struts.apache.org/tag-developers/url-tag Cheers Łukasz