- This topic has 33 replies, 6 voices, and was last updated 18 years, 6 months ago by Riyad Kalla.
-
AuthorPosts
-
cri_tsgMemberI’m using MyEclipse version 4.1.1.
I created a new WebProject and I was able to get the editor to recognize tags in JSPs. However, to get it to work, I had to put the jsp folder at the same level as WEB-INF. We usually put the jsp folder under WEB-INF to prevent directory browsing (we also use struts to forward to jsps).
So in my “real” project, I moved my jsp folder up one level to the same as WEB-INF. That didn’t work. I also verified that standard.jar and jstl.jar are in the build path. I also copied them to WEB-INF\lib. I also verified that all tld files are in WEB-INF. None of that helped.
I’m wondering if there is something else that the JSP editor is looking for. In a previous posting, you said :
put those JARs into your WEB-INF/lib directory, remove the library and then just mount them from the WEB-INF/lib dir, then close all your editors and rebuild the project, and reopen the file
I’m not sure I follow. How should I “remove the library” and how do I “mount them”?
I would prefer not to use the milestone builds yet (especially since it depends upon non-production eclipse 3.2).
Thanks.
Morgan
Riyad KallaMemberMorgan,
It could be as simple as you using incorrect @taglib entries, read this tip first, if it doesn’t help, give me your jsp @taglib headers and any web.xml taglib entries you have:
http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-10906.html
cri_tsgMemberThat’s a really good posting. But I have been following that convention. Here is a set of sample @taglib entries from one JSP of mine:
<%@ taglib uri="/tags/struts-bean" prefix="bean" %> <%@ taglib uri="/tags/struts-html" prefix="html" %> <%@ taglib uri="/tags/struts-logic" prefix="logic" %> <%@ taglib uri="/tags/c" prefix="c" %>
And the corresponding web.xml is:
<taglib> <taglib-uri>/tags/struts-bean</taglib-uri> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-html</taglib-uri> <taglib-location>/WEB-INF/struts-html.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-logic</taglib-uri> <taglib-location>/WEB-INF/struts-logic.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/c</taglib-uri> <taglib-location>/WEB-INF/c.tld</taglib-location> </taglib>
And just to be sure, I confirmed that all tld files exist in the project’s WEB-INF directory, and the containing folder is listed on the Java Build Path – Source tab.
Thanks for taking a look at this!
Riyad KallaMemberSo far so good, ok is this a web project or a Java project? Right click on it and go to properties, do you see a MyEclipse-Web preference panel? If so, what values are in the two text fields?
If not, you need to right click on your project, go to MyEclipse then “Add Web Capabilities” to allow MyEclipse to understand this project as a web project.
cri_tsgMemberIt’s a java project. I tried to add webproject capabilities, but it doesn’t like my directory structure. I have /src/main/webapp/WEB-INF – and I tried to make that the web root directory, but the wizard complains that “Web-root folder can not reside under a Java source folder.”
So I tried using /src/main as the web-root, and the wizard accepts that, but it created its own /src/main/WEB-INF directory instead of using my /src/main/webapp/WEB-INF. Anyway, after I copied the tlds to the new WEB-INF the JSP editor recognized the taglibs.
I had avoided using the WebProject feature because that directory structure doesn’t work with my project. I’m using Maven2 which defines/expects a different structure.
If there is a way to add WebProject capabilities while pointing to my directory, that would help a lot!
Since the jars are apparently not needed for the JSP editor, I think the only real problem is that the JSP editor expects the WEB-INF dir to be in a specific location. Make that configurable and I’d be set!
Riyad KallaMemberI have /src/main/webapp/WEB-INF – and I tried to make that the web root directory, but the wizard complains that “Web-root folder can not reside under a Java source folder.”
Your webroot dir would actually be “/src/main/webapp”, but yes, you cannot have your webroot inside of a source dir. Are you actually setting /src/main as a source dir? Why?
So I tried using /src/main as the web-root, and the wizard accepts that, but it created its own /src/main/WEB-INF directory instead of using my /src/main/webapp/WEB-INF. Anyway, after I copied the tlds to the new WEB-INF the JSP editor recognized the taglibs.
Don’t do that, only because it will just confuse you. You set the webroot to a dir that it isn’t support to be, then munged around MyEclipse by copying the TLDs into the right location. I would back out all those changes. It’s sort of like trying to save gas by welding the doors on your car shut.
Since the jars are apparently not needed for the JSP editor, I think the only real problem is that the JSP editor expects the WEB-INF dir to be in a specific location. Make that configurable and I’d be set!
You are right, it expects the WEB-INF dir to be inside of the WebRoot dir, have a look here at one of the most supported project layouts: http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-11099.html
The WebRoot dir is what get’s deployed. Give me some indication of what your project layout is, and which dir contains what stuff and I think we can figure something out.
Mickey BartonParticipantI downloaded 5.0Milestone 1 and eclipse 3.2RC7 and am still getting the error of unknown tag for the tlds that I reference that are not local. Any Idea?
Mickey BartonParticipantPS I am using Maven 2.0.4 and the latest eclipse Maven2 plugin from codehaus v 0.0.9
Riyad KallaMembermlbartonsr,
Start giving us information to work with. Is this a web project? If you open the project and go to MyEclipse-Web, what are the two values you have filled out in the text fields? What do your taglib entries look like? Do you have any taglib entries in your web.xml file? If so, what?
Mickey BartonParticipantThis is a web project.
I am using the maven2 directory structure for web apps. My web-root folder is /src/main/webapp. My context path is /STAR.
An example of taglibs in my web.xml is:
<jsp-config>
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/tags/struts-bean.tld</taglib-location>
</taglib>
</jsp-config>
In my jsp page I have:
<%@ taglib uri=”/tags/struts-bean” prefix=”bean” %>
<%@ taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c” %>I can reference the bean tld fine but when I have a reference to the jstl core tag is displays an unknown tag marker when I am looking at the file in the editor. I do not see anything in the list of the problems tab. I have the filter set to any resource in the same project and all types selected.
Riyad KallaMemberOk everything looks good, you likely just have your URI wrong. If you are using JSTL 1.0 it should be: http://java.sun.com/jstl/core but in 1.1 they changed it to what you have no.
You can be sure by expanding “standard.jar” inyour path, going into META-INF and opening the c.tld file, look around the 5th tag for something that says “<uri></uri>”, the values between it is the default URI you want to use.
Mickey BartonParticipantI did like you suggested and found that I have the uri that they specified. Any other ideas?
Riyad KallaMemberSounds like a bug, see if you can create a little test project with all the necesary files, export it to a zip and email it to me: support@genuitec.com ATTN Riyad with a link to this thread so I know why I’m getting it. I’ll test it on this end.
cri_tsgMemberHere is my project structure:
\project_root ¦ ¦ pom.xml ¦ +---src +---main ¦ ¦ ¦ +---java ¦ ¦ +---com...(presentation packages go here) ¦ ¦ ¦ +---resources ¦ ¦ ApplicationResources.properties ¦ ¦ log4j.properties ¦ ¦ ¦ +---webapp ¦ +---css ¦ ¦ global.css ¦ ¦ ¦ +---images ¦ ¦ ¦ +---scripts ¦ ¦ global.js ¦ ¦ ¦ +---WEB-INF ¦ ¦ applicationContext.xml ¦ ¦ c.tld ¦ ¦ fmt.tld ¦ ¦ struts-bean.tld ¦ ¦ struts-config.xml ¦ ¦ web.xml ¦ ¦ x.tld ¦ ¦ [...] ¦ ¦ ¦ +---jsp ¦ index.jsp ¦ +---test +---java
There is no \lib directory under WEB-INF since I’m using Maven2. It generated the original eclipse project files with paths to the local repository jars as needed.
As you suggested, I read the link http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-11099.html for the recommended project layout. In fact, the layout is quite similar to what I have. The two main differences are (1)I have my JSPs under WEB-INF/jsp, and (2) the inclusion of the WEB-INF/lib in the WebProject.
Riyad KallaMembermrachell,
This structure looks workable. Have you tried adding web capabilities with the following settings:
1) /src/main/java is a Source folder (Project Properties > Java Build Path > Source (tab))
2) /src/main/resources is a Source folder (same as #1, it will get “built” into the root of WEB-INF/classes)
3) /src/main/webapp is your WebRoot directoryMyEclipse might freak out that you don’t have a lib dir, if your deployments fail, try and create an empty one. Also, if autocomplete for taglibs is not working and it doesn’t understand them AND You are adding your JARs to your build path via a Library this is the problem. This was fixed in MyEclipse 5.0Milestone1 however, so if you had time to test Eclipse 3.2M7 and MyEclipse 5.0M1 in a new install, new directories with a new workspace (import your project) you might find that setup more agreeable for you. The peformance is already increased.
-
AuthorPosts