grails 3.04
generate-all mydomain
index.gsp
what is "f:table"?
I can't find it in grails 3.04 document.
I can't find it in https://github.com/grails-fields-plugin/grails-fields.
What is this magic? How can I get to learn it?
I'm sorry, I don't have the ability to write English.
Translation support:http://fanyi.youdao.com/
The tag f:table you are referring to comes from the fields plug-in, as you correctly noticed. It is used to render some (or all) properties of a list of beans (Domain Classes for example) as a table.
You pointed to the documentation of the fields plugin for Grails 2.x. The fields plug-in has been forked to make a version for Grails 3.x. Have a look here for the documentation: http://grails3-plugins.github.io/fields/snapshot/ref/Tags/table.html
Related
We are trying to move our existing grails 2.5 application to newer versions of grails. For that adopting strategy to first upgrade to grails 3.3.11 (latest in 3.x releases) and then move to grails 4.
For one of the feature from grails 2.5.6 application, I found that there is nothing documented anywhere or may be I've missed that part on the document! It is about Plugin descriptor's doWithWebDescriptor. With this closure we can able to update web.xml dynamically based on some rules.
After upgrading to grails 3, I found that doWithWebDescriptor is not working. It is not initializing task which it supposed to (as far as grails 2.5 concerned). Later I found that there is nothing documented after grails 3.0 documentation.
If doWithWebDescriptor is removed then what is the best suitable replacement with grails 3 or latest grails 4 edition? If it still working fine and there is some configuration related changes required with grails 3 then kindly point me to that part.
Update:
Reason why we need doWithWebDescriptor is that, we are trying to add servlet based on the plugin. Actually we have several plugins for different modules in the application. Not all plugins included in the project. Based on modules selected we are adding plugin to the application. So if a plugin is included then we need to add servlet and a filter to web.xml.
Thank you.
Reason why we need doWithWebDescriptor is that, we are trying to add
servlet based on the plugin.
You can add a servlet by registering a ServletRegistrationBean in the application context. You can do that in the plugin's doWithSpring method or in the app's resources.groovy. Example:
Closure doWithSpring() {{->
myServlet(ServletRegistrationBean, new MyServlet(), "/myServlet/*") {
loadOnStartup = 2
}
}}
We have documented this in the 18.5 Hooking into Runtime Configuration section at http://docs.grails.org/3.3.11/guide/plugins.html#hookingIntoRuntimeConfiguration.
I want to migrate an application from grails 2.4.4 to grails 3.3.9.
As the structure of the conf directory in grails 2.x is completely different from 3.x, there is no config.groovy in 3.x anymore. In config.groovy of 2.x I used to define lists of constants for my select boxes like:
metals=['au','ag','pl']
and I accessed them via
static List getMetals() {
grails.util.Holders.config.metals
}
in my groovy code.
What is the corresponding way in 3.x?
I would start by checking out the upgrade guides:
http://docs.grails.org/latest/guide/upgrading.html
http://docs.grails.org/3.2.0/guide/upgrading.html#upgrading2x
config.groovy, by default becomes application.yml, but you can convert that to application.groovy, and there is a script in the external config plugin that will help with that:
http://plugins.grails.org/plugin/grails/external-config
In general it is conserdered back practice to use the holders, it would be better to use either an injected bean/service
GrailsApplication grailsApplication
grailsApplication.config.etc
Or wire in a bean using resources. The only reason to use holders is in another object that is outside of grails, that for some reason, you can't wire up as a bean. In that cases there is now a Holders class, that you can get the config from. Here's some other ways to get at the config from an OCI blog:
http://grailsblog.objectcomputing.com/posts/2016/08/31/retrieving-config-values.html
At the moment, we have multiple grails applications built on grails 2.5.0
Our Model is in a grails plugin (2.5.0), published to a local maven repository. So far everything works great.
Now we want to create a new application with Grails 3, which relies on some of the basic Domains located in a grails2 plugin (User, Group, etc).
What would be the best way, to share those ? I dont want to maintain two code-bases for our model, one for v2 and one for v3 ...
The only thing which came into my mind is, building everything in plain groovy Classes / Interfaces, and then extending / implementing the Model in both grails2 and grails3 plugins
core-model (contains Interfaces, abstract classes)
grails-model-v2
grails-model-v3
You're on the right track. The domain classes will probably work unchanged, but the problem is the grails plugin projects are incompatible. So you can use a plain groovy project to house your domains and then have each plugin depend on the domain project. The tricky part is telling grails that those plain groovy classes are domains. In grails 3 you can probably just apply the groovy traits that grails automatic applies to domains using doWithSpring(). I think grails 2 uses metaClass to accomplish the same thing, so the approach might be similar.
I'm trying to add these single signout filters to my Grails 2.3.6 app. According to the Grails docs on Filters it seems like you can only add new (custom) filters to Grails apps, whereas these are existing filters imported from another project/JAR.
I scanned my project for the existence of a web.xml and didn't find anything.
How can I add the specific filters in the above link to my Grails app?
The easiest way is to run "grails install-templates" and edit the resulting src/templates/war/web.xml file.
You can use WebXmlConfig plugin which provides a DSL approach to add/modify contents to web.xml.
Struts2 Scope Plugin is no longer compatible with the latest version of Struts2-core (e.g. 2.3.15). What is the successor of the Struts2 Scope Plugin? Struts2 Conversation Scope Plugin? What is the migration effort? Experience?
Yes, It is the Struts2 Conversation Plugin. There is nothing such as a migration plan.
Best strategy is to identify annotations from the old scope plugin. Then replace the them one-by-one with the new annotations. E.g. Find #In/#Out annotations and replace them with #ConversationField (of course, where appropriate)
Follow the Quick-Intro here: http://code.google.com/p/struts2-conversation/
First I tried to update the scope plugin itself. This is pretty straight forward (change dependency, add a version to the maven compiler, replace findAnnotatedMethods by getAnnotatedMethods and fix the tests) and seems to work fine.
Nevertheless I decided to remove the plugin completely and use a simple SessionAware actions.