Foros de discusión

Is possible to use a JSP from .jar in ConfigurationAction Render() ?

thumbnail
yaragad from Spain, modificado hace 12 años.

Is possible to use a JSP from .jar in ConfigurationAction Render() ?

Junior Member Mensajes: 52 Fecha de incorporación: 15/03/11 Mensajes recientes
Im using an Implementation of ConfigurationAction class.
The render method returns the jsp path to be displayed, it works fine, just returning the path "web-inf/jsp/myfile.jsp"

But... is there any way to get that jsp from a .jar file?
thumbnail
Tomas Polesovsky, modificado hace 12 años.

RE: Is possible to use a JSP from .jar in ConfigurationAction Render() ?

Liferay Master Mensajes: 676 Fecha de incorporación: 13/02/09 Mensajes recientes
AFAIK in current JEE implementation not. I heard that JEE 7 could support it.
thumbnail
yaragad from Spain, modificado hace 12 años.

RE: Is possible to use a JSP from .jar in ConfigurationAction Render() ?

Junior Member Mensajes: 52 Fecha de incorporación: 15/03/11 Mensajes recientes
Is there any other possibility? (ie: using an additional library)
thumbnail
Tomas Polesovsky, modificado hace 12 años.

RE: Is possible to use a JSP from .jar in ConfigurationAction Render() ?

Liferay Master Mensajes: 676 Fecha de incorporación: 13/02/09 Mensajes recientes
I don't know any library that could do it - I think it depends on every servlet container implementation how it compiles JSPs into servlets and call them.

There could be way to compile your JSPs into servlets during compile time and register them in web.xml (with mapping for the jsp file location). Servlets could be in JAR, but web.xml has to be in your WAR file. But I'm not 100% sure it will work.

-- tom
thumbnail
yaragad from Spain, modificado hace 12 años.

RE: Is possible to use a JSP from .jar in ConfigurationAction Render() ?

Junior Member Mensajes: 52 Fecha de incorporación: 15/03/11 Mensajes recientes
Ok, thanks... Maybe there is a simpler solution...

The library (and JSP) will be the same for all portlets () containing
<configuration-action-class>package.ConfigurationActionImpl</configuration-action-class>
in the liferay-portlet.xml.

So... is there a simple way to add the .jar and the .jsp in liferay directory, so I can access throw the portlets?

I mean, add the 2 files somewhere inside liferay-portal-6.0.6 folder and access them from my custom portlets.
- to access the .JAR trough the <configuration-action-class>
- to return the .JSP path in the ConfigurationAction Render method.
thumbnail
Tomas Polesovsky, modificado hace 12 años.

RE: Is possible to use a JSP from .jar in ConfigurationAction Render() ?

Liferay Master Mensajes: 676 Fecha de incorporación: 13/02/09 Mensajes recientes
yaragad,

I hope I understand.

You want to share your configuration among many portlets. And those portlets are in different WAR files, right?

I think the most clear and simple solution is to change your portlet's architecture / build process. I.e:
1, move all your portlets into one WAR file so that they could share the JSP in your WEB-INF/jsp directory and ConfigurationActionImpl.
2, or create separate project with your JSP and ConfigurationActionImpl and during build process pack them into all your portlets.

When your WAR files are deployed they all have different servlet context and therefore it's not easy (if even possible) to access JSP that is located somewhere outside. The only way I see could be to use combination of ConfigurationActionImpl+Servlet in JAR file that you put into tomcat/lib/ext dir. Then you only need to register servlet in your web.xml. I hope struts can also redirect to servlet mapping emoticon

-- tom
kevin qian, modificado hace 11 años.

RE: Is possible to use a JSP from .jar in ConfigurationAction Render() ?

New Member Mensaje: 1 Fecha de incorporación: 19/11/12 Mensajes recientes
Hello, Tomas,

do u know how to get PortletPreferences in render() method?
thumbnail
Tomáš Polešovský, modificado hace 11 años.

RE: Is possible to use a JSP from .jar in ConfigurationAction Render() ?

Liferay Master Mensajes: 676 Fecha de incorporación: 13/02/09 Mensajes recientes
Hello Kevin,

please create a new thread next time, you'll have better chance to get the answer faster.

You can get PortletPreferences from any portlet request object: PortletRequest.getPreferences().

In render() method that means renderRequest.getPreferences().

HTH.

-- tom +