掲示板
Include JSP file in theme
I need to create a scriplet inside a JSP file in order to make a call to a variable so i can use it in my theme. As far as i know you can't just add a jsp file inside a theme so i found this solution :
1. Create the jsp file in my theme docroot
2. Include the jsp file to themeServletContext with $theme.include($themeServletContext, "path to my JSP")
Im just a little bit lost when it comes to how to use the scriplet in order to give it style or a certain Layout. Im sorry if the fact that im saying "how to use the scriplet" makes not sense at all (i guess it will be a JAVA object or variable) but im pretty new when it comes to velocity / development issues.
I have been working on another way to do it with velocity that i found but to be honest i don't know how to make it work:
#set ($friendlyurl = "/123456")
#set ($groupLocalService = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))
#set ($group = $groupLocalService.getFriendlyURLGroup(long, String)($company_id, $friendlyurl))
Will really appreciate if someone can help / explain this to me.
Thanks.
1. Create the jsp file in my theme docroot
2. Include the jsp file to themeServletContext with $theme.include($themeServletContext, "path to my JSP")
Im just a little bit lost when it comes to how to use the scriplet in order to give it style or a certain Layout. Im sorry if the fact that im saying "how to use the scriplet" makes not sense at all (i guess it will be a JAVA object or variable) but im pretty new when it comes to velocity / development issues.
I have been working on another way to do it with velocity that i found but to be honest i don't know how to make it work:
#set ($friendlyurl = "/123456")
#set ($groupLocalService = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))
#set ($group = $groupLocalService.getFriendlyURLGroup(long, String)($company_id, $friendlyurl))
Will really appreciate if someone can help / explain this to me.
Thanks.
9年前 に Aditya Bhardwaj によって更新されました。
RE: Include JSP file in theme
Junior Member 投稿: 78 参加年月日: 15/01/08 最新の投稿
Hi Low,
you have 3 types of framework to create theme :-
1)Freemaker (By Default)
2)Velocity
3)Jsp
Mostly we use velocity if you use velocity then it is better to use velocity variables. Just invest some time on velocity variables and use velocity variables
you have 3 types of framework to create theme :-
1)Freemaker (By Default)
2)Velocity
3)Jsp
Mostly we use velocity if you use velocity then it is better to use velocity variables. Just invest some time on velocity variables and use velocity variables
9年前 に Olaf Kock によって更新されました。
RE: Include JSP file in theme
Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
Your question would be easier to answer if you asked what you want to achieve, not how you want to achieve it. I'm almost sure that the solution will be easy, but I have no clue what you're planning to do.
Please state: Do you want to link to a certain page? Do you want to show certain data from the portal? user information? Will it be a simple value or a more complex display? Available for everyone or just some people? ... (please describe your underlying problem, rather than answering these questions - they're probably not matching your problem, naturally, as I don't understand it yet)
Please state: Do you want to link to a certain page? Do you want to show certain data from the portal? user information? Will it be a simple value or a more complex display? Available for everyone or just some people? ... (please describe your underlying problem, rather than answering these questions - they're probably not matching your problem, naturally, as I don't understand it yet)
9年前 に Low Trux によって更新されました。
RE: Include JSP file in theme
Junior Member 投稿: 64 参加年月日: 14/11/06 最新の投稿Olaf Kock:
Your question would be easier to answer if you asked what you want to achieve, not how you want to achieve it. I'm almost sure that the solution will be easy, but I have no clue what you're planning to do.
Please state: Do you want to link to a certain page? Do you want to show certain data from the portal? user information? Will it be a simple value or a more complex display? Available for everyone or just some people? ... (please describe your underlying problem, rather than answering these questions - they're probably not matching your problem, naturally, as I don't understand it yet)
Sorry if i was not clear enough Olaf i guess i was pretty vague for sure, What i need to do is to show this java object in my theme to give it a certain layout and style, it is a value (and i repeat im not a java developer and im starting with velocity so im sure i can be pretty messy on how i formulate my question). The developer team have send me the java code on how to get the object but im not really sure how to work with it in order to show it on my theme:
import cat.aoc.eacatpl.portal.factory.*;
import cat.aoc.eacatpl.portal.model.*;
UsuEnsDAO usuEnsDAO = new UsuEnsDAOImpl();
Ens ens = usuEnsDAO.getEns(String sessionId, String idEns);
ens.getEnsNomLlarg();
Really hope i was a little bit more clear this time and thanks a lot for your reply.
9年前 に Dipti Atkotiya によって更新されました。
RE: Include JSP file in theme
New Member 投稿: 10 参加年月日: 15/01/09 最新の投稿
Hi Low,
Try following code to get java object in your theme using velocity
In 1st and 2nd line ,write code to get value of sessionId and idEns from request or session after "=" and on 3rd line pass service class name including package in find service method.
#set ($sessionId = "")
#set ($idEns = "")
#set ($usuEnsDAO = $serviceLocator.findService("UsuEnsDAO"))
#set ($ens = $usuEnsDAO.getEns($sessionId, $idEns))
#set ($ensNomLlarg = $ens.getEnsNomLlarg())
Try following code to get java object in your theme using velocity
In 1st and 2nd line ,write code to get value of sessionId and idEns from request or session after "=" and on 3rd line pass service class name including package in find service method.
#set ($sessionId = "")
#set ($idEns = "")
#set ($usuEnsDAO = $serviceLocator.findService("UsuEnsDAO"))
#set ($ens = $usuEnsDAO.getEns($sessionId, $idEns))
#set ($ensNomLlarg = $ens.getEnsNomLlarg())
9年前 に Low Trux によって更新されました。
RE: Include JSP file in theme
Junior Member 投稿: 64 参加年月日: 14/11/06 最新の投稿Dipti Atkotiya:
Hi Low,
Try following code to get java object in your theme using velocity
In 1st and 2nd line ,write code to get value of sessionId and idEns from request or session after "=" and on 3rd line pass service class name including package in find service method.
#set ($sessionId = "")
#set ($idEns = "")
#set ($usuEnsDAO = $serviceLocator.findService("UsuEnsDAO"))
#set ($ens = $usuEnsDAO.getEns($sessionId, $idEns))
#set ($ensNomLlarg = $ens.getEnsNomLlarg())
I will try it Dipti, many thanks !
9年前 に Low Trux によって更新されました。
RE: Include JSP file in theme
Junior Member 投稿: 64 参加年月日: 14/11/06 最新の投稿
It worked Dipti thanks a lot !