- This topic has 18 replies, 4 voices, and was last updated 20 years, 11 months ago by michael_talavera.
-
AuthorPosts
-
michael_talaveraMemberI’m running MyEclipse Service Release 2.7 RC2 which I just upgraded today from RC1 running on Windows XP Pro using Eclipse 2.1.2. In both versions, myself and the other programmer evaluating this software are having trouble with the code completion behaviour for JSP pages. It seems to be sometimes working, sometimes not. Does it depend on what type of project that the files are set up as when you create the new project in your workspace? The new projects were created and use existing content directories for our existing web application. I have yet to figure out why some files work and some do not. Any ideas or is more information needed?
No OperationMembersome info:
– JSP files MUST be inside web root
– if there are errors in the JSP file, completion MAY failcould you post an example where it does not work?
NOP
michael_talaveraMemberThe JSP files are located under C:\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\cmps with all the project subfolders under this directory structure. I should add that this project is linked to Visual Source Safe, I’m not sure if that has anything to do with it or not.
The code completion will not work at all in the file, even the simplest one like the following:
<html>
<HEAD>
<%
import java.io.*;
import java.sql.*;
%>
</head>
<body>
<% String newString;%>This is a test.
<%= newString%>
</body>
</html>None of the JSP code will trigger the auto complete boxes.
Riyad KallaMemberMichael,
Can you try the following to see if the code completion works.Use the following skeleton:
<html> <body> <% String meowMix = "I want liver, I want chicken..."; %> All cats sing: | </body> </html>
Note the | character, that marks where I want you to try these different things:
1. Hit CTRL-SPACE where the | is in the below code after typing it out, does it work? (note: no space and incomplete tag)
<%=|
2. Hit CTRL-SPACE where the | is in the below code after typing it out, does it work? (note: no space and complete tag)
<%=|%>
3. Hit CTRL-SPACE where the | is in the below code after typing it out, does it work? (note: space and incomplete tag)
<%= |
4. Hit CTRL-SPACE where the | is in the below code after typing it out, does it work? (note: space and complete tag)
<%= |%>
5. Hit CTRL-SPACE where the | is in the below code after typing it out, does it work? (note: new incomplete scriplet, use variable)
<%|
6. Hit CTRL-SPACE where the | is in the below code after typing it out, does it work? (note: new complete scriplet, use variable)
<%|%>
These might seem strange requests, but previous there was an issue with the JSP autocomplete where it only worked in <%=%> sections of code when there were no spaces, and only in scriplets when they were complete. I’m wondering if the bug is (a) still there or (b) turned into a new kind of bug.
No OperationMember<%
import java.io.*;
import java.sql.*;
%>Ouch!!! This is a BIG error, use
<%@ page import="java.sql.*" %>
<% String newString;%>
and here: this variable MUST be initialized!
hope this helps you out.
NOP
Riyad KallaMemberMichael,
Please do NOP’s suggestions first before answering my longer questions.Thanks NOP
michael_talaveraMemberI have noticed something that may be the cause, but I don’t know why. Below is code that will work to invoke the code completion:
<%@ page language=”java” import=”javax.naming.*,java.util.*,java.sql.*,java.io.*” %>
<html>
<HEAD>
<title>This is a test!</title>
</HEAD>
<BODY>
This is a test
<br>
<% String strTest1; %>Here is a further test.
<% strTest1.trim() %>
</body>
</html>If I add an include statement such as <%@ include file=”/cmps/pageParts/constants.jsp” %>, then the code completion will stop working. Any ideas of why?
Riyad KallaMembermichael,
try to change this line:<% String strTest1; %>
to this line:
<% String strTest1 = "hello there!"; %>
and see if code completion down on the line where you do the trim works.
No OperationMemberIf I add an include statement such as <%@ include file=”/cmps/pageParts/constants.jsp” %>, then the code completion will stop working. Any ideas of why?
there might be an error in coude included file. BTW use the suffix jsf or jspf for include files.
NOP
michael_talaveraMember@nop wrote:
If I add an include statement such as <%@ include file=”/cmps/pageParts/constants.jsp” %>, then the code completion will stop working. Any ideas of why?
there might be an error in coude included file. BTW use the suffix jsf or jspf for include files.
NOP
Thank you nop for your suggestion, and I think you have the solution, and error in the include files!
What I have done is taken the same code I submitted in my posting today and added a new INCLUDE file, a file ending in jsf with only the words “This is from the include file NewTest!”, nothing else in the code at all. The INCLUDE tag is <%@ include file=”/download/NewTest.jsf” %>, and the code completion works just fine. If I change the tag to have the file end in jsp instead of jsf, which would be an error since no such file exists, the code completion stops working due to the error.
I’m running this web application through Tomcat 5.0.16 on my local machine and everything works just fine with all the include statements, meaning Tomcat is giving me no indication that anything is wrong in any of the files that are being included. Is there some way to catch such problems? For example, in what I stated above of changing the file extention to a file that does not exits, there are no errors in MyEclipse to say that there is a problem at all. Is there some error checking that I do not have enabled somewhere?
BTW, can you tell me why the INCLUDE files should end in jsf or jspf?
Riyad KallaMemberjsp = java server page
jspf = java server page fragment (intended for us via include statements)As far as tomcat not giving you any errors, I’m betting that its allowing things it shouldn’t. Can you post the contents of “constants.jsp” or is that private?
Also, you can always copy-paste the contents of the include into a JSP file and see if myeclipse complains about it and won’t compile it.
michael_talaveraMemberUnfortunatly, those contents point to our production database and hold all the constants for our entire application, so I’m not able to post it here. I’ll go look though that code and all pages being included to see if I can spot what the problem is.
Can you tell me about the syntax checking that is done in MyEclipse? I know there is extensive syntax checking when working on a java file, but I’m not noticing the same type of checking for jsp. It seems that the MyEclipse editor is recognizing the fact that the file doesn’t exist in the INCLUDE statement since the code completion stops functioning, but I’m not getting any indication in the Task View that there are any problems like I would with a java file.
Scott AndersonParticipantMichael,
Can you tell me about the syntax checking that is done in MyEclipse?
First, you need to be sure you have JSP compilation turned on under the JSP editor preferences (Window > Preferences > MyEclipse > Editors > JSP). Then, each time you save a JSP file a full compilation will be performed and the file will be marked with errors, similarly to the way the Java editor does.
No OperationMemberFor example, in what I stated above of changing the file extention to a file that does not exits, there are no errors in MyEclipse to say that there is a problem at all.
Then the JSP compilationis turned off.
Note that also “perform build automatically on resource modification” must be turned on, to get an update on file saves.NOP
michael_talaveraMemberWhen I go to Window > Preferences > MyEclipse > Editors > JSP/HTML Editor, on the General tab, I do have the radio button for JSP Compiler Build Behavior selected on Compile JSP’s. Also, in Window > Preferences > Workbench, I have both “Perform build automatically on resource modification” and “Show Tasks view when build has errors or warnings” enabled. What type of errors will be checked for? I put in some errors such as not ending statements with ; and not putting the file attribute in the INCLUDE tag. I know the MyEclipse editor is recognizing the errors because the code completion will no longer function, but when I save, there is no entries in the Task view. When I run the application, Tomcat will give me a “Include directive: Mandatory attribute file missing” error, but nothing from the editor when I save. Any further ideas?
-
AuthorPosts