- This topic has 5 replies, 3 voices, and was last updated 21 years, 1 month ago by
penquinone.
-
AuthorPosts
-
penquinoneMemberGreetings.
I am new to MyEclipse, and I was going through the tutorial for generating struts Actions, etc.
Everything worked fine until I got to try to run the first login JSP file, and it wouldn’t run because the taglib inclusion put in by when the JSP file was generated had a URI that pointed to the Jakarta site! It looks like this:
<%@ taglib url=”http://jakarta.apache.org/struts/tags-bean” prefix=”bean”%>
It normally wouldn’t be too bad, but my laptop doesn’t always have a connection and it makes it difficult to debug locally.
Actually, come to think of it, since these files are locally available (via the WEB-INF directory) I modified my web.xml to add these files.
Shouldn’t MyEclipse a) update my web.xml and put these files in there for me, and b) by default reference these via the web.xml mapped URI and NOT some random URL that might change, etc?
Am I missing something here. Seems like there should be some setting to force it to use the application’s mapped TLD settings and not go looking to Jakarta.
By the way, I’ll include my system profile info, but as my laptop right now is not connected and I’m entering this from my desktop, it’ll have to do.
– System Setup ——————————-
Operating System and version: Win 2000/xp
Eclipse version: 2.1.2
Eclipse build id: 200311030802
Fresh Eclipse install (y/n): y
If not, was it upgraded to its current version using the update manager?
Other installed external plugins:
Number of plugins in the <eclipse>/plugins directory that begin with org.eclipse.pde.*:
MyEclipse version: 2.6.2
Eclipse JDK version: 1.4.2
Application Server JDK version: 1.4.2
Are there any exceptions in the Eclipse log file? Tons. None that are meaningful– Message Body ——————————-
Riyad KallaMemberI think you have a very valid point. Right now the way the JSP templates work is there isn’t much (if any) translation going on when they are generated, so instead of having these hard coded paths, we could introduce some processing (like you said). I’ll kick this suggestion back and see what the others think.
Thanks!
support-michaelKeymasterSeveral thoughts:
1) I believe you may be encountering an early XML validation problem where it would attempt to load remote DTDs. The latest ME release uses cached DTD. Please upgrade to the latest MyEclipse version, 2.7.1.
2)
<%@ taglib url=”http://jakarta.apache.org/struts/tags-bean” prefix=”bean”%>
It normally wouldn’t be too bad, but my laptop doesn’t always have a connection and it makes it difficult to debug locally.
There seems to be misunderstanding of the function of the “uri” attribute of a taglib directive. It is a unique handle for mapping a tag prefix to a physical TLD. The ME Struts demo and wizards take advantage of implicit taglib mapping introduced in JSP 1.2 spec., see section 7.3.4 of the spec or http://jakarta.apache.org/struts/userGuide/configuration.html#dd_config_taglib_23 Implicit TLD mapping allows you to enter a context relative path to TLD file, e.g., /WEB-INF/bean.tld, or a value that matches the <uri> element of a TLD file, e.g., http://jakarta.apache.org/struts/tags-bean. Therefore the URI is never used for network access.
3) The current Struts wizards include hardcoded taglib directives based on most common used prefixes. I have entered an enhancement request to incorporate web.xml taglib info and implicitly mapped taglibs.
Thanks for your feedback.
penquinoneMemberThere seems to be misunderstanding of the function of the “uri” attribute of a taglib directive. It is a unique handle for mapping a tag prefix to a physical TLD. The ME Struts demo and wizards take advantage of implicit taglib mapping introduced in JSP 1.2 spec., see section 7.3.4 of the spec or http://jakarta.apache.org/struts/userGuide/configuration.html#dd_config_taglib_23 Implicit TLD mapping allows you to enter a context relative path to TLD file, e.g., /WEB-INF/bean.tld, or a value that matches the <uri> element of a TLD file, e.g., http://jakarta.apache.org/struts/tags-bean. Therefore the URI is never used for network access.
Ok. I’m a tad confused. It seems to me that the URI mapping included in the JSP is purely to find the TLD mapping file. You can either include it in your web.xml or directly in the file itself. My problem is that it used a full path by default, and the JSP wouldn’t compile because it couldn’t find the TLD- as far as I understand because it was looking for a network path, right? I guess where I’m confused is: if there’s no network access and my JSP points to a network path to get the TLD, how is the JSP resolving the TLD?
3) The current Struts wizards include hardcoded taglib directives based on most common used prefixes. I have entered an enhancement request to incorporate web.xml taglib info and implicitly mapped taglibs.
Just to be clear then, there is no way already to make this work now, it’ll have to be an enhancement in a future version.
Sorry to be so slow. 🙄
support-michaelKeymasterI reviewed your ME version info and ME2.6.2 is pretty old. The current version is ME 2.7.1. I recommend you upgrade to it since there have been many enhancements and bug fixes since your version. Following are a few more thoughts on this subject.
My problem is that it used a full path by default, and the JSP wouldn’t compile because it couldn’t find the TLD- as far as I understand because it was looking for a network path, right? I guess where I’m confused is: if there’s no network access and my JSP points to a network path to get the TLD, how is the JSP resolving the TLD?
Correct there is no network access performed since the TLDs must be in your project (JSP spec dictates this). In all cases the MyEcipse JSP editor implements the TLD resource-path strategy define in the spec for JSP containers. So if you’re wonder how the full URI comes into play just open the *.tld files under your WEB-INF folder until you find the tld file that contains a <uri> attribute with the same value.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> <taglib> <tlibversion>1.0</tlibversion> <jspversion>1.1</jspversion> <shortname>bean</shortname> <uri>http://jakarta.apache.org/struts/tags-bean</uri> ...
Our JSP editor parses every TLD and jar file in your project searching for such info when code completing and validating your JSPs. The multiple ways of resolving taglib directives is just 1 of many complex operations that our JSP editor must perform dynamically.
Just to be clear then, there is no way already to make this work now, it’ll have to be an enhancement in a future version.
If you have the referenced TLD under the <web-root>/WEB-INF directory then the MyEclipse JSP code completion and validation will detect and use it. I believe upgrading to ME 2.7.1 will resolve any problems you’re experiencing.
The demo http://www.myeclipseide.com/ContentExpress-display-ceid-16.html walks through creation, deployment, and testing of a simple Struts/JSP web project. You should not experience any problems with it.
penquinoneMemberOK Thanks so much Michael!
Just FYI- I tried updating first, but until I found the post about getting the updates correctly (there was some setting for the Install/Update in Eclipse that I had to change) I wasn’t seeing any updates for MyEclipse. I am currently downloading the latest version.
Thanks again!
Cory
-
AuthorPosts