Julio Camarero 14 Years Ago Great summary Amos, this is very helpful! Please sign in to reply. Reply as... Cancel
Bavithra Rajendran 14 Years Ago Sir, Thanks for this helpful feature Please sign in to reply. Reply as... Cancel
Gwenaël Gourevich 14 Years Ago That is very useful ... thank you! Please sign in to reply. Reply as... Cancel
Joao Sequeira 14 Years Ago Very nice article I was trying to use your example but the class "UserLocalServiceWrapper" or "UserWrapper" are not on the liferay distribution (5.2.3), only on SVN, is it possible to use this with the official distribution?Best Regards,Joao Sequeira Please sign in to reply. Reply as... Cancel Amos Fong Joao Sequeira 14 Years Ago Hi Joao,Sorry I didn't specify versions. Number 1 is only available in 6.0, 5.2 EE SP 2, 5.1 EE SP 5 or later. Please sign in to reply. Reply as... Cancel
Amos Fong Joao Sequeira 14 Years Ago Hi Joao,Sorry I didn't specify versions. Number 1 is only available in 6.0, 5.2 EE SP 2, 5.1 EE SP 5 or later. Please sign in to reply. Reply as... Cancel
Anand Barhate 14 Years Ago Hi Amos,Thanks for the article I have couple of questions. I am using 5.2.2 in the first half it says about using plugin for extending the user attributes. When I added that in hooks I am getting error about service tags. Secondly in later part it talks about changing struts xml. Does it need to be done in plugin/hooks?Please let me know.Thanks Please sign in to reply. Reply as... Cancel Amos Fong Anand Barhate 14 Years Ago Hi Anand,Making changes to struts-config.xml has to be done in ext environment. Please sign in to reply. Reply as... Cancel Deepak Kenchamba Amos Fong 13 Years Ago Hi Team, You need to edit the "struts-config-ext.xml" file to point to your custom Action class.Assuming Liferay is deployed in "D:\liferay-portal-6.0.5" folder. A blank "struts-config-ext.xml" can be found atD:\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\ folder <action path="/login/create_account" type="ae.rak.hook.portlet.login.action.MyCreateAccountAction"> <forward name="portlet.login.create_account" path="portlet.login.create_account" /> </action> Next add the custom action class into the classes folder of the portal.D:\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\classesIt is easy to compile your custom Action java file.1. Install Liferay IDE2. Create a new 'Liferay Hook Plug-in Project'3. Create your custom Action java file & compile The IDE provides all help in compiling your .java file to a .class file Please sign in to reply. Reply as... Cancel Henrique Fernandes Deepak Kenchamba 13 Years Ago Hi Deepak,Is there any way of doing this using the deploy process of a Hook Plug-in? Please sign in to reply. Reply as... Cancel Luis RodrÃguez Fernández Henrique Fernandes 13 Years Ago Hi Henrique, I have tried overriding the action class with a hook plugin, but it seems to be problems with the classloader: http://www.liferay.com/community/forums/-/message_boards/message/7817764#_19_message_7817764I am afraid that the EXT approach is going to be the best solution...Hope it helps, Luis Please sign in to reply. Reply as... Cancel
Amos Fong Anand Barhate 14 Years Ago Hi Anand,Making changes to struts-config.xml has to be done in ext environment. Please sign in to reply. Reply as... Cancel Deepak Kenchamba Amos Fong 13 Years Ago Hi Team, You need to edit the "struts-config-ext.xml" file to point to your custom Action class.Assuming Liferay is deployed in "D:\liferay-portal-6.0.5" folder. A blank "struts-config-ext.xml" can be found atD:\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\ folder <action path="/login/create_account" type="ae.rak.hook.portlet.login.action.MyCreateAccountAction"> <forward name="portlet.login.create_account" path="portlet.login.create_account" /> </action> Next add the custom action class into the classes folder of the portal.D:\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\classesIt is easy to compile your custom Action java file.1. Install Liferay IDE2. Create a new 'Liferay Hook Plug-in Project'3. Create your custom Action java file & compile The IDE provides all help in compiling your .java file to a .class file Please sign in to reply. Reply as... Cancel Henrique Fernandes Deepak Kenchamba 13 Years Ago Hi Deepak,Is there any way of doing this using the deploy process of a Hook Plug-in? Please sign in to reply. Reply as... Cancel Luis RodrÃguez Fernández Henrique Fernandes 13 Years Ago Hi Henrique, I have tried overriding the action class with a hook plugin, but it seems to be problems with the classloader: http://www.liferay.com/community/forums/-/message_boards/message/7817764#_19_message_7817764I am afraid that the EXT approach is going to be the best solution...Hope it helps, Luis Please sign in to reply. Reply as... Cancel
Deepak Kenchamba Amos Fong 13 Years Ago Hi Team, You need to edit the "struts-config-ext.xml" file to point to your custom Action class.Assuming Liferay is deployed in "D:\liferay-portal-6.0.5" folder. A blank "struts-config-ext.xml" can be found atD:\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\ folder <action path="/login/create_account" type="ae.rak.hook.portlet.login.action.MyCreateAccountAction"> <forward name="portlet.login.create_account" path="portlet.login.create_account" /> </action> Next add the custom action class into the classes folder of the portal.D:\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\classesIt is easy to compile your custom Action java file.1. Install Liferay IDE2. Create a new 'Liferay Hook Plug-in Project'3. Create your custom Action java file & compile The IDE provides all help in compiling your .java file to a .class file Please sign in to reply. Reply as... Cancel Henrique Fernandes Deepak Kenchamba 13 Years Ago Hi Deepak,Is there any way of doing this using the deploy process of a Hook Plug-in? Please sign in to reply. Reply as... Cancel Luis RodrÃguez Fernández Henrique Fernandes 13 Years Ago Hi Henrique, I have tried overriding the action class with a hook plugin, but it seems to be problems with the classloader: http://www.liferay.com/community/forums/-/message_boards/message/7817764#_19_message_7817764I am afraid that the EXT approach is going to be the best solution...Hope it helps, Luis Please sign in to reply. Reply as... Cancel
Henrique Fernandes Deepak Kenchamba 13 Years Ago Hi Deepak,Is there any way of doing this using the deploy process of a Hook Plug-in? Please sign in to reply. Reply as... Cancel Luis RodrÃguez Fernández Henrique Fernandes 13 Years Ago Hi Henrique, I have tried overriding the action class with a hook plugin, but it seems to be problems with the classloader: http://www.liferay.com/community/forums/-/message_boards/message/7817764#_19_message_7817764I am afraid that the EXT approach is going to be the best solution...Hope it helps, Luis Please sign in to reply. Reply as... Cancel
Luis RodrÃguez Fernández Henrique Fernandes 13 Years Ago Hi Henrique, I have tried overriding the action class with a hook plugin, but it seems to be problems with the classloader: http://www.liferay.com/community/forums/-/message_boards/message/7817764#_19_message_7817764I am afraid that the EXT approach is going to be the best solution...Hope it helps, Luis Please sign in to reply. Reply as... Cancel
Peter Pastrnak 13 Years Ago Nice article, thank you.I would like to ask you, how is possible to use the extended User object (TestUserImpl) from the test-hook example in a JSP code - f.e. in the portlet/blogs/view.jsp.It seems the JSP compiler does not see the class, so I cannot import it:<%@ page import="com.liferay.testhook.hook.model.impl.TestUserImpl" %>Only a type can be imported. com.liferay.testhook.hook.model.impl.TestUserImpl resolves to a packageIs there an easy way, how to do it?Thanks. Please sign in to reply. Reply as... Cancel
Alessandro Cosenza 13 Years Ago Helloif I want to override the AssetEntryLocalServiceImpl.updateEntry method in a hook, what I have to do?Extending AssetEntryLocalServiceWrapper seems to be very tricky, because I have to substitute all the *persistence variables with corresponding *LocalServiceUtil class. And it still doesn't work, because how can I replace assetEntryPersistence.setAssetCategories? Does anyone help me? Please sign in to reply. Reply as... Cancel Brian Chan Alessandro Cosenza 13 Years Ago See svn://svn.liferay.com/repos/public/plugins/trunkThere's one called /hooks/sample-wrapper-hookWe'll be releasing that soon. Please sign in to reply. Reply as... Cancel
Brian Chan Alessandro Cosenza 13 Years Ago See svn://svn.liferay.com/repos/public/plugins/trunkThere's one called /hooks/sample-wrapper-hookWe'll be releasing that soon. Please sign in to reply. Reply as... Cancel
Fernando O 13 Years Ago Hi!I'm triying to override a method in com.liferay.portal.service.LayoutLocalService.I use this code in liferay-hook.xml:<service><service-type>com.liferay.portal.service.LayoutLocalService</service-type><service-impl>com.prueba.portal.service.MyLayoutLocalService</service-impl></service>and override the method in this class (MyLayoutLocalService) (it extends LayoutLocalServiceWrapper).But when I deploy the hook and use the method, it doesn't use the new method and stills using the old one.How can I made this work? Where could I find lifeary-hook_6_0_0.dtd?Kind regards! and thank you for the blog entry! Please sign in to reply. Reply as... Cancel Fernando O Fernando O 13 Years Ago Finally I found the problem, there were some code that was executed before tue function I wanted to override, once I remove this wrong code everithing works as expected. Please sign in to reply. Reply as... Cancel
Fernando O Fernando O 13 Years Ago Finally I found the problem, there were some code that was executed before tue function I wanted to override, once I remove this wrong code everithing works as expected. Please sign in to reply. Reply as... Cancel
Prasanna Kumar 13 Years Ago Hi All,I need some solution on user management module.When we create new user in liferay it will go to user_ table in lportal database. But our requirement is we want to store the userdetails to be stored in our database as well.I mean.. When we create new user, details should be stored in both the database (user_ table in lportal database and user table in our database).Can anybody suggest where to write the code to do above task?we are working in ext environment...Thanks in advance.... Please sign in to reply. Reply as... Cancel Amos Fong Prasanna Kumar 13 Years Ago Hi Prasana,There a couple ways to do this, the best way I can think of is to create a model listener for add user and update user that will update your own database. Please sign in to reply. Reply as... Cancel Jakub Liska Amos Fong 13 Years Ago Hi Amos,regarding the hint about overriding classes listed in liferay-hook.dtd, I suppose we can't change for example " login.events.post=com.liferay.portal.events.LoginPostAction " to " login.events.post=com.liferay.portal.events.MyOwnLoginPostAction "in other words, we can override the properties, but the new classes that we need to use instead, like MyOwnLoginPostAction, must be added via ext, right? Overriding portal-impl or portal-service classes, can be done only via ext, except of the custom services that can be overridden by hook. Please sign in to reply. Reply as... Cancel Jakub Liska Jakub Liska 13 Years Ago I got it, we can do it. It's like a list of classes that can be overridden no matter if they are portal-impl. It's good to know, thank you Amos Please sign in to reply. Reply as... Cancel
Amos Fong Prasanna Kumar 13 Years Ago Hi Prasana,There a couple ways to do this, the best way I can think of is to create a model listener for add user and update user that will update your own database. Please sign in to reply. Reply as... Cancel Jakub Liska Amos Fong 13 Years Ago Hi Amos,regarding the hint about overriding classes listed in liferay-hook.dtd, I suppose we can't change for example " login.events.post=com.liferay.portal.events.LoginPostAction " to " login.events.post=com.liferay.portal.events.MyOwnLoginPostAction "in other words, we can override the properties, but the new classes that we need to use instead, like MyOwnLoginPostAction, must be added via ext, right? Overriding portal-impl or portal-service classes, can be done only via ext, except of the custom services that can be overridden by hook. Please sign in to reply. Reply as... Cancel Jakub Liska Jakub Liska 13 Years Ago I got it, we can do it. It's like a list of classes that can be overridden no matter if they are portal-impl. It's good to know, thank you Amos Please sign in to reply. Reply as... Cancel
Jakub Liska Amos Fong 13 Years Ago Hi Amos,regarding the hint about overriding classes listed in liferay-hook.dtd, I suppose we can't change for example " login.events.post=com.liferay.portal.events.LoginPostAction " to " login.events.post=com.liferay.portal.events.MyOwnLoginPostAction "in other words, we can override the properties, but the new classes that we need to use instead, like MyOwnLoginPostAction, must be added via ext, right? Overriding portal-impl or portal-service classes, can be done only via ext, except of the custom services that can be overridden by hook. Please sign in to reply. Reply as... Cancel Jakub Liska Jakub Liska 13 Years Ago I got it, we can do it. It's like a list of classes that can be overridden no matter if they are portal-impl. It's good to know, thank you Amos Please sign in to reply. Reply as... Cancel
Jakub Liska Jakub Liska 13 Years Ago I got it, we can do it. It's like a list of classes that can be overridden no matter if they are portal-impl. It's good to know, thank you Amos Please sign in to reply. Reply as... Cancel
Prasanna Kumar 13 Years Ago Amos Fong, Thanks for your reply...I am very new to liferay Can you explain in detail? Please sign in to reply. Reply as... Cancel Amos Fong Prasanna Kumar 13 Years Ago There is a short tutorial in this wiki:http://www.liferay.com/community/wiki/-/wiki/Main/Portal+Hook+PluginsAnd there is a sample test hook here that has an example of a model listener:http://svn.liferay.com/repos/public/plugins/trunk/portlets/test-hook-portlet/user: guest, no password Please sign in to reply. Reply as... Cancel
Amos Fong Prasanna Kumar 13 Years Ago There is a short tutorial in this wiki:http://www.liferay.com/community/wiki/-/wiki/Main/Portal+Hook+PluginsAnd there is a sample test hook here that has an example of a model listener:http://svn.liferay.com/repos/public/plugins/trunk/portlets/test-hook-portlet/user: guest, no password Please sign in to reply. Reply as... Cancel
Prasanna Kumar 13 Years Ago Thanks Amos...We are using openSSO ... we need to sync openSSO data with liferay data. Can you suggest some solution? Please sign in to reply. Reply as... Cancel
prakash harigopal 13 Years Ago Hi Amos,Can you give me some instructions to implement the custom services(which connects to a different database) in liferay action classes. Plz let me know the way to handle creating services through service builder and Spring and Hibernate configurations in the plugin hook.thanksprakash Please sign in to reply. Reply as... Cancel
Sandeep Nair 13 Years Ago In sample wrapper user of type SampleUserImpl is returned. How can it be accessed from other class?? Please sign in to reply. Reply as... Cancel Brahim TARNAOUI Sandeep Nair 13 Years Ago Hello,i use a hook to extend a jsp page and i will use in my jsp a code like this <%@page import="my.packahe.my.classes"%>where can'i put my jar file? Please sign in to reply. Reply as... Cancel
Brahim TARNAOUI Sandeep Nair 13 Years Ago Hello,i use a hook to extend a jsp page and i will use in my jsp a code like this <%@page import="my.packahe.my.classes"%>where can'i put my jar file? Please sign in to reply. Reply as... Cancel
Peter Davison 13 Years Ago Hi.Does anyone know if it is possible to override a workflow handler via the hook mechanism, or does that need to be done via ext?Thanks,Pete Please sign in to reply. Reply as... Cancel prakash harigopal Peter Davison 13 Years Ago Hi Peter,If i listen correctly , you want to override the default workflow thats available in liferay. You can override that by selecting the workflow from controlpanel and paste the XML document thats available in Kaleo-web\web-inf\src\meta-inf\definitions\single-approver.xml. Liferay by default provided single approver workflow , you can override how ever you want by adding multiple tasks and transitions.And you can add a new workflow using controlpanel also , just go to workflow and click on add and upload the xml document to that ....thanksPrakash. Please sign in to reply. Reply as... Cancel Peter Davison prakash harigopal 13 Years Ago Thanks for your reply. Yeah, I've created my own workflow which is essentially the single approver workflow with an additional step added when the workflow is approved. I want to send an email notification out to all interested users that a new piece of content is available in the portal. In this case it happens to be a new document library document.I want to include in the email a link to the new document. I'm struggling trying to build that URL given the data that is available in the velocity context that is available at the point that the email is generated.I'd like to override the code that creates the starts the workflow so that the URL to the document (as well as some other data like the list of roles that have access to the folder in which the document lives) is pre-populated in the workflow context. The code I'd like to override is the DLFileEntryWorkflowHandler. This seemed like a good place to build the URL to the newly uploaded document given that the DLFileEntry is passed into the startWorkflowInstance method. The default behaviour of this method (inherited from BaseWorkflowHandler) is to ignore the the model object passed in. I'd like to override that method to do something useful like build the URL to the document and stick it in the workflowContext. I'm attempting to do this via the ext method of overriding but if it is at all possible to do this via a hook I would prefer that approach.Pete Please sign in to reply. Reply as... Cancel
prakash harigopal Peter Davison 13 Years Ago Hi Peter,If i listen correctly , you want to override the default workflow thats available in liferay. You can override that by selecting the workflow from controlpanel and paste the XML document thats available in Kaleo-web\web-inf\src\meta-inf\definitions\single-approver.xml. Liferay by default provided single approver workflow , you can override how ever you want by adding multiple tasks and transitions.And you can add a new workflow using controlpanel also , just go to workflow and click on add and upload the xml document to that ....thanksPrakash. Please sign in to reply. Reply as... Cancel Peter Davison prakash harigopal 13 Years Ago Thanks for your reply. Yeah, I've created my own workflow which is essentially the single approver workflow with an additional step added when the workflow is approved. I want to send an email notification out to all interested users that a new piece of content is available in the portal. In this case it happens to be a new document library document.I want to include in the email a link to the new document. I'm struggling trying to build that URL given the data that is available in the velocity context that is available at the point that the email is generated.I'd like to override the code that creates the starts the workflow so that the URL to the document (as well as some other data like the list of roles that have access to the folder in which the document lives) is pre-populated in the workflow context. The code I'd like to override is the DLFileEntryWorkflowHandler. This seemed like a good place to build the URL to the newly uploaded document given that the DLFileEntry is passed into the startWorkflowInstance method. The default behaviour of this method (inherited from BaseWorkflowHandler) is to ignore the the model object passed in. I'd like to override that method to do something useful like build the URL to the document and stick it in the workflowContext. I'm attempting to do this via the ext method of overriding but if it is at all possible to do this via a hook I would prefer that approach.Pete Please sign in to reply. Reply as... Cancel
Peter Davison prakash harigopal 13 Years Ago Thanks for your reply. Yeah, I've created my own workflow which is essentially the single approver workflow with an additional step added when the workflow is approved. I want to send an email notification out to all interested users that a new piece of content is available in the portal. In this case it happens to be a new document library document.I want to include in the email a link to the new document. I'm struggling trying to build that URL given the data that is available in the velocity context that is available at the point that the email is generated.I'd like to override the code that creates the starts the workflow so that the URL to the document (as well as some other data like the list of roles that have access to the folder in which the document lives) is pre-populated in the workflow context. The code I'd like to override is the DLFileEntryWorkflowHandler. This seemed like a good place to build the URL to the newly uploaded document given that the DLFileEntry is passed into the startWorkflowInstance method. The default behaviour of this method (inherited from BaseWorkflowHandler) is to ignore the the model object passed in. I'd like to override that method to do something useful like build the URL to the document and stick it in the workflowContext. I'm attempting to do this via the ext method of overriding but if it is at all possible to do this via a hook I would prefer that approach.Pete Please sign in to reply. Reply as... Cancel
Luis RodrÃguez Fernández 13 Years Ago Thanks Amos, great post, really useful!!!1. Do you need to override any *Action.java classes? For doing this couldn't you create a hook pluging?Thanks in advance, Luis Please sign in to reply. Reply as... Cancel
Nguyen Trung Kien 13 Years Ago Hi AmosIf I define new method in TestUserLocalServiceImpl, can I use it in other portlet made by Liferay Plugin SDK?Can I use hook plugin to define new method in userService?Thanks. Please sign in to reply. Reply as... Cancel Amos Fong Nguyen Trung Kien 13 Years Ago No you cannot define a new method using a hook because it doesn't override the Util class, only the Impl class. You should use ext to define a new method in a Liferay Service. But it actually might be better to create your own service/class so there's better separation between your code and Liferay's. Please sign in to reply. Reply as... Cancel
Amos Fong Nguyen Trung Kien 13 Years Ago No you cannot define a new method using a hook because it doesn't override the Util class, only the Impl class. You should use ext to define a new method in a Liferay Service. But it actually might be better to create your own service/class so there's better separation between your code and Liferay's. Please sign in to reply. Reply as... Cancel
(You) 12 Years Ago [...] Shahin Ali: Can i change the sorting order of message thread posts in the message boards to 'last posted first' present order is first posted first using liferay 6 EE Thanks. Try a hook on the... [...] Read More Please sign in to reply. Reply as... Cancel Jakub Liska 12 Years Ago I'm wondering what is the best way to implement custom Store. I'd need an alternative to JcrStore. I'm not using JackRabbit but ModeShape. And I'm wondering if I should use Hook or Ext. Please sign in to reply. Reply as... Cancel Jakub Liska Jakub Liska 12 Years Ago I implemented it with Ext, no other means possible I think... Please sign in to reply. Reply as... Cancel Amos Fong Jakub Liska 12 Years Ago @Jakub, do you mean another Document Library store using this property, (dl.store.impl)? I know it used to be possible and I think it should still be. Did you try specifying that property in your hook's portal.properties and making your store extend BaseStore? Please sign in to reply. Reply as... Cancel
Jakub Liska 12 Years Ago I'm wondering what is the best way to implement custom Store. I'd need an alternative to JcrStore. I'm not using JackRabbit but ModeShape. And I'm wondering if I should use Hook or Ext. Please sign in to reply. Reply as... Cancel Jakub Liska Jakub Liska 12 Years Ago I implemented it with Ext, no other means possible I think... Please sign in to reply. Reply as... Cancel Amos Fong Jakub Liska 12 Years Ago @Jakub, do you mean another Document Library store using this property, (dl.store.impl)? I know it used to be possible and I think it should still be. Did you try specifying that property in your hook's portal.properties and making your store extend BaseStore? Please sign in to reply. Reply as... Cancel
Jakub Liska Jakub Liska 12 Years Ago I implemented it with Ext, no other means possible I think... Please sign in to reply. Reply as... Cancel Amos Fong Jakub Liska 12 Years Ago @Jakub, do you mean another Document Library store using this property, (dl.store.impl)? I know it used to be possible and I think it should still be. Did you try specifying that property in your hook's portal.properties and making your store extend BaseStore? Please sign in to reply. Reply as... Cancel
Amos Fong Jakub Liska 12 Years Ago @Jakub, do you mean another Document Library store using this property, (dl.store.impl)? I know it used to be possible and I think it should still be. Did you try specifying that property in your hook's portal.properties and making your store extend BaseStore? Please sign in to reply. Reply as... Cancel
Rajesh Chaurasia 12 Years Ago I want to extend the EditPagesAction class of Lifreay I want to add a tab in look and feel section of edit_pages_look_and_feel.jsp.I want to know how I Can use hook here .public class NPPEditPagesAction extends EditPagesAction { public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { System.out.println("Inside processAction...createTheme()"); String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try { if (cmd.equals("createtheme")) { createTheme(actionRequest); } super.processAction(mapping, form, portletConfig, actionRequest,actionResponse); } catch (Exception e) { } } public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { return super.render(mapping, form, portletConfig, renderRequest, renderResponse); //return mapping.findForward(getForward(renderRequest, "portlet.communities.edit_pages")); } @SuppressWarnings("static-access") public static void createTheme(ActionRequest actionRequest) { System.out.println("Inside createTheme..."); ThemeUtil themeUtil = new ThemeUtil(); final String themeZipFilePath = ThemeUtil.SAMPLE_THEMES_PATH; final String themeConfigFilePath = ThemeUtil.THEMES_CONFIG_PATH; try{ //To Modify liferay-look-and-feel.xml themeUtil.getXMLDetails(themeConfigFilePath); //To Extract the sample themes zip folder to tomcat location themeUtil.extractFolder(themeZipFilePath); } catch (Exception ex) { ex.printStackTrace(); } }<custom-jsp-dir>/WEB-INF</custom-jsp-dir> <struts-action> <struts-action-path>/layout_management/edit_pages</struts-action-path> <struts-action-impl>com.liferay.portlet.communities.action.NPPEditPagesAction</struts-action-impl> </struts-action>I am unable to execute my java code.please let me know where I am going wrong Please sign in to reply. Reply as... Cancel Amos Fong Rajesh Chaurasia 12 Years Ago Hi Rajesh,You cannot override struts action in a hook. You'll need to use the ext-plugin/environment to do that. Please sign in to reply. Reply as... Cancel Brian Chan Amos Fong 12 Years Ago No, you can now.See http://www.liferay.com/web/mika.koivisto/blog/-/blogs/overriding-and-adding-struts-actions-from-hook-plugins Please sign in to reply. Reply as... Cancel
Amos Fong Rajesh Chaurasia 12 Years Ago Hi Rajesh,You cannot override struts action in a hook. You'll need to use the ext-plugin/environment to do that. Please sign in to reply. Reply as... Cancel Brian Chan Amos Fong 12 Years Ago No, you can now.See http://www.liferay.com/web/mika.koivisto/blog/-/blogs/overriding-and-adding-struts-actions-from-hook-plugins Please sign in to reply. Reply as... Cancel
Brian Chan Amos Fong 12 Years Ago No, you can now.See http://www.liferay.com/web/mika.koivisto/blog/-/blogs/overriding-and-adding-struts-actions-from-hook-plugins Please sign in to reply. Reply as... Cancel
(You) 12 Years Ago [...] The below blog may help on how to extend a services via hook. http://www.liferay.com/web/amos.fong/blog/-/blogs/minimizing-the-ext-environment Mark as an Answer [...] Read More Please sign in to reply. Reply as... Cancel
Suraj Bihari 12 Years Ago Thanks Amos! Please sign in to reply. Reply as... Cancel Abu Muhammad Suraj Bihari 12 Years Ago Hi Amos, how to make user can post comment ? In my liferay, error "Blogs in temporarily unavailable" when submit comment. Please sign in to reply. Reply as... Cancel Carlo G. Abu Muhammad 12 Years Ago In your code you write:throw new RequiredFieldException("favoriteColor", "favoriteColorLabel"); // v6.0/EE specific code Is there a suitable exception in the Community Edition (6.1) ? Please sign in to reply. Reply as... Cancel Amos Fong Carlo G. 12 Years Ago I believe since writing the post it has been added to CE so it should be in 6.1. Please sign in to reply. Reply as... Cancel
Abu Muhammad Suraj Bihari 12 Years Ago Hi Amos, how to make user can post comment ? In my liferay, error "Blogs in temporarily unavailable" when submit comment. Please sign in to reply. Reply as... Cancel Carlo G. Abu Muhammad 12 Years Ago In your code you write:throw new RequiredFieldException("favoriteColor", "favoriteColorLabel"); // v6.0/EE specific code Is there a suitable exception in the Community Edition (6.1) ? Please sign in to reply. Reply as... Cancel Amos Fong Carlo G. 12 Years Ago I believe since writing the post it has been added to CE so it should be in 6.1. Please sign in to reply. Reply as... Cancel
Carlo G. Abu Muhammad 12 Years Ago In your code you write:throw new RequiredFieldException("favoriteColor", "favoriteColorLabel"); // v6.0/EE specific code Is there a suitable exception in the Community Edition (6.1) ? Please sign in to reply. Reply as... Cancel Amos Fong Carlo G. 12 Years Ago I believe since writing the post it has been added to CE so it should be in 6.1. Please sign in to reply. Reply as... Cancel
Amos Fong Carlo G. 12 Years Ago I believe since writing the post it has been added to CE so it should be in 6.1. Please sign in to reply. Reply as... Cancel
(You) 11 Years Ago [...] This article will share two cool features - Hooks and Plugins Ext - in Liferay portal 6. Speciall thanks to Amos Fong, so that we could minimize the ext environment by using hooks. A lot of thanks to... [...] Read More Please sign in to reply. Reply as... Cancel
Elijah Mangason 11 Years Ago Hello Liferay Community,I am very new to Liferay, and am trying to program a Hook using 6.1 that will override CreateAccountAction as shown in this post. Is it possible??? If not, in what type of Liferay project would one include the code shown in this post (i.e. ext, new portlet, etc.)Thanks in advance for your response. I'm really stuck!E. Please sign in to reply. Reply as... Cancel Amos Fong Elijah Mangason 11 Years Ago - Edited @ElijahYes, you can override CreateAccountAction in hook now, not by methods in this post, but see this post:http://www.liferay.com/web/mika.koivisto/blog/-/blogs/overriding-and-adding-struts-actions-from-hook-plugins Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago Hello Amos,Thank you for your response.I've read link on overriding struts actions several times. It is mentioned in the link that only two interfaces can be overridden: BaseStrutsPortletAction and BaseStrutsAction. Neither of these allows for directly extending CreateAccountAction, which is in portal-impl.jar. I need to validate existing users on login by simply comparing their input with what is already in the database. I would like to extend and override CreateAccountAction.java to do this, as you have shown above in THIS post. To implement as above, where would I place the code, in a hook, ext? Your help would be greatly appreciated.E. Please sign in to reply. Reply as... Cancel Amos Fong Elijah Mangason 11 Years Ago Following this post, you would use ext plugin and edit struts-action-ext.xml to point to your own implementation. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago Thanks, Amos, for your response. I may have to do my implementation as an ext plugin rather than a hook. I'm wondering, however, how what you have shown in this post minimizes the ext environment if it needs to be implemented as an ext anyway. Could you please clarify? Please sign in to reply. Reply as... Cancel Amos Fong Elijah Mangason 11 Years Ago It may not be obvious that it is possible to extend struts action classes through struts-config-ext.xml rather than having override the entire class which is more work and less maintainable. So this was just a tip for those who weren't already aware of it. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago It wasn't obvious to me, but I am new to Liferay, so that may be the reason why.Is there a tutorial or working example I could reference on how to extend or access methods within a struts action class such as CreateAccountAction without overriding the entire class? I've reference the post from Mika Koivisto (http://www.liferay.com/web/mika.koivisto/blog/-/blogs/7132115) several times.... what am I missing? Please sign in to reply. Reply as... Cancel
Amos Fong Elijah Mangason 11 Years Ago - Edited @ElijahYes, you can override CreateAccountAction in hook now, not by methods in this post, but see this post:http://www.liferay.com/web/mika.koivisto/blog/-/blogs/overriding-and-adding-struts-actions-from-hook-plugins Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago Hello Amos,Thank you for your response.I've read link on overriding struts actions several times. It is mentioned in the link that only two interfaces can be overridden: BaseStrutsPortletAction and BaseStrutsAction. Neither of these allows for directly extending CreateAccountAction, which is in portal-impl.jar. I need to validate existing users on login by simply comparing their input with what is already in the database. I would like to extend and override CreateAccountAction.java to do this, as you have shown above in THIS post. To implement as above, where would I place the code, in a hook, ext? Your help would be greatly appreciated.E. Please sign in to reply. Reply as... Cancel Amos Fong Elijah Mangason 11 Years Ago Following this post, you would use ext plugin and edit struts-action-ext.xml to point to your own implementation. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago Thanks, Amos, for your response. I may have to do my implementation as an ext plugin rather than a hook. I'm wondering, however, how what you have shown in this post minimizes the ext environment if it needs to be implemented as an ext anyway. Could you please clarify? Please sign in to reply. Reply as... Cancel Amos Fong Elijah Mangason 11 Years Ago It may not be obvious that it is possible to extend struts action classes through struts-config-ext.xml rather than having override the entire class which is more work and less maintainable. So this was just a tip for those who weren't already aware of it. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago It wasn't obvious to me, but I am new to Liferay, so that may be the reason why.Is there a tutorial or working example I could reference on how to extend or access methods within a struts action class such as CreateAccountAction without overriding the entire class? I've reference the post from Mika Koivisto (http://www.liferay.com/web/mika.koivisto/blog/-/blogs/7132115) several times.... what am I missing? Please sign in to reply. Reply as... Cancel
Elijah Mangason Amos Fong 11 Years Ago Hello Amos,Thank you for your response.I've read link on overriding struts actions several times. It is mentioned in the link that only two interfaces can be overridden: BaseStrutsPortletAction and BaseStrutsAction. Neither of these allows for directly extending CreateAccountAction, which is in portal-impl.jar. I need to validate existing users on login by simply comparing their input with what is already in the database. I would like to extend and override CreateAccountAction.java to do this, as you have shown above in THIS post. To implement as above, where would I place the code, in a hook, ext? Your help would be greatly appreciated.E. Please sign in to reply. Reply as... Cancel Amos Fong Elijah Mangason 11 Years Ago Following this post, you would use ext plugin and edit struts-action-ext.xml to point to your own implementation. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago Thanks, Amos, for your response. I may have to do my implementation as an ext plugin rather than a hook. I'm wondering, however, how what you have shown in this post minimizes the ext environment if it needs to be implemented as an ext anyway. Could you please clarify? Please sign in to reply. Reply as... Cancel Amos Fong Elijah Mangason 11 Years Ago It may not be obvious that it is possible to extend struts action classes through struts-config-ext.xml rather than having override the entire class which is more work and less maintainable. So this was just a tip for those who weren't already aware of it. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago It wasn't obvious to me, but I am new to Liferay, so that may be the reason why.Is there a tutorial or working example I could reference on how to extend or access methods within a struts action class such as CreateAccountAction without overriding the entire class? I've reference the post from Mika Koivisto (http://www.liferay.com/web/mika.koivisto/blog/-/blogs/7132115) several times.... what am I missing? Please sign in to reply. Reply as... Cancel
Amos Fong Elijah Mangason 11 Years Ago Following this post, you would use ext plugin and edit struts-action-ext.xml to point to your own implementation. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago Thanks, Amos, for your response. I may have to do my implementation as an ext plugin rather than a hook. I'm wondering, however, how what you have shown in this post minimizes the ext environment if it needs to be implemented as an ext anyway. Could you please clarify? Please sign in to reply. Reply as... Cancel Amos Fong Elijah Mangason 11 Years Ago It may not be obvious that it is possible to extend struts action classes through struts-config-ext.xml rather than having override the entire class which is more work and less maintainable. So this was just a tip for those who weren't already aware of it. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago It wasn't obvious to me, but I am new to Liferay, so that may be the reason why.Is there a tutorial or working example I could reference on how to extend or access methods within a struts action class such as CreateAccountAction without overriding the entire class? I've reference the post from Mika Koivisto (http://www.liferay.com/web/mika.koivisto/blog/-/blogs/7132115) several times.... what am I missing? Please sign in to reply. Reply as... Cancel
Elijah Mangason Amos Fong 11 Years Ago Thanks, Amos, for your response. I may have to do my implementation as an ext plugin rather than a hook. I'm wondering, however, how what you have shown in this post minimizes the ext environment if it needs to be implemented as an ext anyway. Could you please clarify? Please sign in to reply. Reply as... Cancel Amos Fong Elijah Mangason 11 Years Ago It may not be obvious that it is possible to extend struts action classes through struts-config-ext.xml rather than having override the entire class which is more work and less maintainable. So this was just a tip for those who weren't already aware of it. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago It wasn't obvious to me, but I am new to Liferay, so that may be the reason why.Is there a tutorial or working example I could reference on how to extend or access methods within a struts action class such as CreateAccountAction without overriding the entire class? I've reference the post from Mika Koivisto (http://www.liferay.com/web/mika.koivisto/blog/-/blogs/7132115) several times.... what am I missing? Please sign in to reply. Reply as... Cancel
Amos Fong Elijah Mangason 11 Years Ago It may not be obvious that it is possible to extend struts action classes through struts-config-ext.xml rather than having override the entire class which is more work and less maintainable. So this was just a tip for those who weren't already aware of it. Please sign in to reply. Reply as... Cancel Elijah Mangason Amos Fong 11 Years Ago It wasn't obvious to me, but I am new to Liferay, so that may be the reason why.Is there a tutorial or working example I could reference on how to extend or access methods within a struts action class such as CreateAccountAction without overriding the entire class? I've reference the post from Mika Koivisto (http://www.liferay.com/web/mika.koivisto/blog/-/blogs/7132115) several times.... what am I missing? Please sign in to reply. Reply as... Cancel
Elijah Mangason Amos Fong 11 Years Ago It wasn't obvious to me, but I am new to Liferay, so that may be the reason why.Is there a tutorial or working example I could reference on how to extend or access methods within a struts action class such as CreateAccountAction without overriding the entire class? I've reference the post from Mika Koivisto (http://www.liferay.com/web/mika.koivisto/blog/-/blogs/7132115) several times.... what am I missing? Please sign in to reply. Reply as... Cancel