Grails rest-api PageRenderer groovyPageRenderer bean not present - grails

I want generate a html inside a controller or service but the bean "PageRenderer groovyPageRenderer" has not present in the application context.
I think the problem is the profile rest-api, do you know how initialize the bean?
Do you have some idea?
Thanks
Mauro

Resolved.
You need to add this dependency
implementation "org.grails.plugins:gsp"
Thanks

Related

Grails 2.4.4 - how to redirect from Groovy class (non controller)

I'm trying to use redirect() method from a Groovy class method which is not resolving in this class, getting Error groovy.lang.MissingMethodException: No signature of method
How I can redirect the control from a groovy class method to controller-> action inside a project?
not even response object is getting resolved to use response.sendRedirect()
Any help would be appreciated, thanks in advance!
I don't know is this good way use, but you use following to redirect to controoler action from your groovy class method
def yourMethod(){
new YourController().redirect(action:"YourControllerActionName")
}
Please note that i tested it with grails 3, so please let me is it really worked for you.
Hope this will helps you

How to pass bean from action class to other jsp page?

It is very simple to do in servlet using request.setAttribute(). But how to do this in Struts2?
How to use that bean in other jsp page?
Please give example code.
As #AndreaLigios mentions in the comments, you'll want to generate getters and setters in your action classes.
In your JSP files, you'll be able to get them by using the <s:property> tag.

Set a custom ELContext in JSF

this question is related to a previous answer to a similar problem, which would fit my requirements.
Programmatically register taglib reference
I understand the solution, but I'm not able to figure out how to register my custom ELContext (or FunctionMapper) to the current FacesContext (or ELContext) without a specific implementation (MyFaces, mojarra etc.). The goal is to use some functions in the *.xhtml source. I DON'T want to use a taglib because some dynamic stuff should be handled by my own function mapper.
So how do I register a FunctionMapper or decorate the current ELContext with my own implementation?
Cheers,
Markus
Register it in faces-config.xml as
<application>
<el-resolver>com.example.YourELResolver<el-resolver>
</application>

How to remove controller from grails programmatically?

Im having some conflicts with the Searchable plugin.
I have a filter which fetches the controller in question in the before phase. It fetches the requested controller by finding the first controller that has the same name as controllerName which is a property available in grails filters.
however, my problem is that the Searchable plugin has its own SearchableController, and i myself have made my own version of the SearchableController. The effect of this is that i have two classes with the same name that would match controllerName in my find logic.
controller = grailsApplication.controllerClasses.find { c ->
c.logicalPropertyName == controllerName
}
Can i somehow remove the SearchableController that comes with the plugin? What are my options?
Maybe this could help you:
http://grails.org/Searchable+Plugin+-+SearchableController+and+view
I found an existing post on this topic:
Disable grails Searchable plugin default search page?
I worked around the issue by renaming my SearchableController class to SearchController. Don't like workarounds tho...

How to I make castle windsor automatically register controllers that don't have any dependencies?

I know I can specify it in the configuration XML, but I'd like to not have to do so for every controller. For example: I have a controller without any dependencies being injected, but I'd rather not type out the XML component section in the config file or register it programmatically. Any ideas, suggestions, examples? Thanks for all the help!
This will automatically register all the controllers from the assembly of DependencyInjectionContainer class. No matter controllers have dependencies or not.
Register(
AllTypes.Of<IController>()
.FromAssembly(typeof(DependencyInjectionContainer).Assembly)
.Configure(c => c.LifeStyle.Transient)
);

Resources