Fórumok
JSP hooks issue in Eclipse IDE
Biresh Choudhury, módosítva 12 év-val korábban
JSP hooks issue in Eclipse IDE
Junior Member Bejegyzések: 29 Csatlakozás dátuma: 2010.12.08. Legújabb bejegyzések
Hi,
I am using Liferay6 with Eclipse IDE for my development environment. Have issue related to Hooks development for JSP.
My aim is to edit the shopping portlet. Have followed the below steps and still facing some problem.
1) Created a hooks project in liferay.
2) Added the line "<custom-jsp-dir>/custom_jsps</custom-jsp-dir>" inside liferay-hook.jsp
3) Copied the file name "edit_category.jsp" from liferay's root folder into META-INF/custom_jsps/html/portlet/shopping.(As it's the original path of the file inside Liferay root)
Now the problem I am facing is related to some error like variables used in the jsp are not being resolved to its type since it's not able to recognize the file init.jsp from the path <%@ include file="/html/portlet/shopping/init.jsp" %>.
My doubt is do I need to include all the files for the concerned portlet inorder to override a single file or am I missing out on some important steps like configuring something else.
Regards,
Biresh Choudhury
I am using Liferay6 with Eclipse IDE for my development environment. Have issue related to Hooks development for JSP.
My aim is to edit the shopping portlet. Have followed the below steps and still facing some problem.
1) Created a hooks project in liferay.
2) Added the line "<custom-jsp-dir>/custom_jsps</custom-jsp-dir>" inside liferay-hook.jsp
3) Copied the file name "edit_category.jsp" from liferay's root folder into META-INF/custom_jsps/html/portlet/shopping.(As it's the original path of the file inside Liferay root)
Now the problem I am facing is related to some error like variables used in the jsp are not being resolved to its type since it's not able to recognize the file init.jsp from the path <%@ include file="/html/portlet/shopping/init.jsp" %>.
My doubt is do I need to include all the files for the concerned portlet inorder to override a single file or am I missing out on some important steps like configuring something else.
Regards,
Biresh Choudhury
David H Nebinger, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Hi, Biresh, I'm sure you'll hear from the Liferay IDE guy (he's really great about monitoring and responding to IDE issues), but I can confirm that this is sometimes an issue. For the most part I end up ignoring these kinds of errors since I know the code is working in the canned Liferay, it should work deployed w/o mods. Then I just take extra care during editing to make sure I don't introduce errors on my own.
It's definitely a pain, and there's probably a better way to get around this, I just haven't tried to track it down yet
It's definitely a pain, and there's probably a better way to get around this, I just haven't tried to track it down yet
![emoticon](@theme_images_path@/emoticons/smile.gif)
Dave Weitzel, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Regular Member Bejegyzések: 208 Csatlakozás dátuma: 2009.11.18. Legújabb bejegyzések
no you don't need to include th e"included" pages such as init.jsp unless you are likely to be adding common classes in your mods on more than one page in that portlet (ecommerce in this case).
when it gets deployed the new jsp actually gets put into the live webapps/ROOT/docroot/html/portlet/ecommerce with the old file getting renamed with a .portlet.jsp so all the other files are still there in their same related places - such as init.jsp.
If there are other errors in your jsp they will become apparent in the console log if your test server is running from eclipse as well.
Dave
when it gets deployed the new jsp actually gets put into the live webapps/ROOT/docroot/html/portlet/ecommerce with the old file getting renamed with a .portlet.jsp so all the other files are still there in their same related places - such as init.jsp.
If there are other errors in your jsp they will become apparent in the console log if your test server is running from eclipse as well.
Dave
Gregory Amerson, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Liferay Legend Bejegyzések: 1123 Csatlakozás dátuma: 2010.02.16. Legújabb bejegyzések
Thanks David and Dave for responding, I really appreciate you guys jumping in to help other IDE users.
As they said you can safely ignore the errors in the JSP. They are showing up because the Eclipse JSP validator does not know how to find the required contextual JSP files to make that particular JSP build without errors. I have an enhancement ticket for modifying the Eclipse JSP model to fix this situation but I have not implemented it yet because I believe the performance/memory trade off is not worth developer's time.
The quick solution is to modify the JSP validator's exclusion filters to tell it not to validate any custom_jsp files. I'll post back to this forum with a link to a page that describes the process of how to do that, but I need to create that page first
.
As they said you can safely ignore the errors in the JSP. They are showing up because the Eclipse JSP validator does not know how to find the required contextual JSP files to make that particular JSP build without errors. I have an enhancement ticket for modifying the Eclipse JSP model to fix this situation but I have not implemented it yet because I believe the performance/memory trade off is not worth developer's time.
The quick solution is to modify the JSP validator's exclusion filters to tell it not to validate any custom_jsp files. I'll post back to this forum with a link to a page that describes the process of how to do that, but I need to create that page first
![emoticon](@theme_images_path@/emoticons/happy.gif)
Biresh Choudhury, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Junior Member Bejegyzések: 29 Csatlakozás dátuma: 2010.12.08. Legújabb bejegyzések
Thanks David, Dave and Gregory for response.
Will try and implement the alternate solution mentioned above.
Regards,
Biresh
Will try and implement the alternate solution mentioned above.
Regards,
Biresh
Gregory Amerson, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Liferay Legend Bejegyzések: 1123 Csatlakozás dátuma: 2010.02.16. Legújabb bejegyzések
Here is the new section on the Liferay IDE wiki where I posted the how-to for disabling the JSP syntax validation for just specifically the custom_jsps folder.
http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+IDE+Developing+Liferay+Hooks
http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+IDE+Developing+Liferay+Hooks
Biresh Choudhury, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Junior Member Bejegyzések: 29 Csatlakozás dátuma: 2010.12.08. Legújabb bejegyzések
Thanks Gregory for the solution.
I followed steps mentioned in that link as below:
* Right click the hook project, go to Properties
* Select Validation page
* Check the box "Enable project specific settings"
* In the row "JSP Syntax Validator" click the "..." button
* In the dialog click the "Add exclude group" button
* Select the "Exclude group" node and click the "Add Rule..." button
* Select the filter type, "Folder or File name"
* Click Browse for folder and select the folder that stores the custom jsps
* Click Finish, then OK, then OK
* Right click the custom_jsps folder and select "Validate"
But still facing the error as of now:
"Fragment "/html/portlet/shopping/init.jsp" was not found at expected path {Project Name}/docroot/html/portlet/shopping/init.jsp".
It has been turn around for removing almost 90% of the errors coming earlier but this is one issue I am not able to resolve since there is a include statement as <%@ include file="/html/portlet/shopping/init.jsp" %> inside the file name edit_category.jsp which is causing the problem.
Regards,
Biresh
I followed steps mentioned in that link as below:
* Right click the hook project, go to Properties
* Select Validation page
* Check the box "Enable project specific settings"
* In the row "JSP Syntax Validator" click the "..." button
* In the dialog click the "Add exclude group" button
* Select the "Exclude group" node and click the "Add Rule..." button
* Select the filter type, "Folder or File name"
* Click Browse for folder and select the folder that stores the custom jsps
* Click Finish, then OK, then OK
* Right click the custom_jsps folder and select "Validate"
But still facing the error as of now:
"Fragment "/html/portlet/shopping/init.jsp" was not found at expected path {Project Name}/docroot/html/portlet/shopping/init.jsp".
It has been turn around for removing almost 90% of the errors coming earlier but this is one issue I am not able to resolve since there is a include statement as <%@ include file="/html/portlet/shopping/init.jsp" %> inside the file name edit_category.jsp which is causing the problem.
Regards,
Biresh
Biresh Choudhury, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Junior Member Bejegyzések: 29 Csatlakozás dátuma: 2010.12.08. Legújabb bejegyzések
It's working now.
Was trying to select the folder path instead of the file to be excluded.
Regards,
Biresh
Was trying to select the folder path instead of the file to be excluded.
Regards,
Biresh
Gregory Amerson, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Liferay Legend Bejegyzések: 1123 Csatlakozás dátuma: 2010.02.16. Legújabb bejegyzések
Glad you got it working. In the latest version of the IDE (1.3.1) there is a option on the wizard for custom_jsps in hooks that will disable jsp validation for the entire custom_jsps folder. So hopefully in the future for new hook projects that customize JSPs you wont have to worry about re-setting that preference.
David H Nebinger, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
You know, we only do this as a shortcut to remove invalid errors from the JSPs, but I figure most of us would rather have the ability to define an alternate home for the JSPs. So I can say "Hey, treat everything in this custom_jsp folder as though the actual root was $CATALINA_HOME/webapps/ROOT/html" or some such thing.
Obviously we don't want false errors showing up in Eclipse, but what we'd really like is to be able to verify the JSPs so we catch actual errors...
Obviously we don't want false errors showing up in Eclipse, but what we'd really like is to be able to verify the JSPs so we catch actual errors...
Gregory Amerson, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Liferay Legend Bejegyzések: 1123 Csatlakozás dátuma: 2010.02.16. Legújabb bejegyzések
Your exactly right David, actually have the JSP fully realized would be Ideal. I've done some research and there is a way to configure an Eclipse project so that it will "understand" more of the hook JSPs context. But this comes with a tremendous performance penalty. Basically you have to compile nearly every one of the portal JSPs just to full "validate" or "realize" the single hook JSP. Fully compiling the portal JSP source takes a very, very long time, especially if its the first time. Not only time but gobbs of memory. I'm pretty convinced that even if we could get this working right, most users would disable it because of the performance penalty.
I'll keep looking and investigating ways to make this work but for now I recommend full disabling of validation.
I'll keep looking and investigating ways to make this work but for now I recommend full disabling of validation.
David H Nebinger, módosítva 12 év-val korábban
RE: JSP hooks issue in Eclipse IDE
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
I don't know about totally disabling; I'd probably only enable when I was going to be making significant changes to the JSP where I didn't want to just trust that me or one of my developers just did it all right...
Łukasz Pogorzelski, módosítva 11 év-val korábban
RE: JSP hooks issue in Eclipse IDE
New Member Bejegyzések: 6 Csatlakozás dátuma: 2012.04.12. Legújabb bejegyzések
I know that last answer was almost a year ago, but maybe my solution will help someone.
I realized that in following way:
1. I copied jsp which I would like to edit to my hook.
2. If that jsp include another jsp which I wanted to edit, then in the first one I changed include tag URI from context-relative path (starts with /) to page relative path.
3. If my hooked file includes jsp that I don't want to edit, then I simply copy it to folder structure, which is identical to liferay.
4. Additionally I created web.xml and configured required taglibs. Conteiner ignores the same taglibs.
Advantages:
- full JSP validation,
- edited and not edited JSP files are isolated (different folders).
Drawbacks:
- because additional files (not edited) were copied to the hook, these files will not be updated if Liferay Team change them,
- similar to the above, copied taglibs can become obsolete.
In the future may be considered to change build process to exclude folders with additional (not edited) jsps and taglibs.
I realized that in following way:
1. I copied jsp which I would like to edit to my hook.
2. If that jsp include another jsp which I wanted to edit, then in the first one I changed include tag URI from context-relative path (starts with /) to page relative path.
3. If my hooked file includes jsp that I don't want to edit, then I simply copy it to folder structure, which is identical to liferay.
4. Additionally I created web.xml and configured required taglibs. Conteiner ignores the same taglibs.
Advantages:
- full JSP validation,
- edited and not edited JSP files are isolated (different folders).
Drawbacks:
- because additional files (not edited) were copied to the hook, these files will not be updated if Liferay Team change them,
- similar to the above, copied taglibs can become obsolete.
In the future may be considered to change build process to exclude folders with additional (not edited) jsps and taglibs.