- This topic has 7 replies, 3 voices, and was last updated 7 years, 11 months ago by support-swapna.
-
AuthorPosts
-
greybeardParticipantTypical is:
var doorHeightMax = <c:out value=”${cabinetDoorPricing.doorsHeightMaxMin.maxValue}”/>;
gives error: “Unexpected Token”
AND more is:
var isUBO = <c:choose><c:when test=”${orderForm.chosenProduct.pricePlan.isUnderBenchOven eq true}”>true</c:when><c:otherwise>false</c:otherwise></c:choose>;
gives error: “expected end of statement or expression”due to these & other errors the whole page is littered with supposed errors. How do I suppress these errors to make it “ignore” (even make them “warning”)
thanks & regards
support-swapnaModeratorgreybeard,
The problems reported are from JavaScript parser. Any html code is transparent to the JavaScript compiler because the output is determined only at server runtime. So all the HTML content is replaced by spaces.Also mixing and matching JSTL and JavaScript is not recommended.
Providing proper validation for such syntax is virtually impossible unless you run the code, so when we detect it, we can just downgrade syntax errors to warnings.The problems on the code should be reported as warnings and not errors.
To avoid these validation issues, you should use EL expressions ${..} directly within the JavaScript code .Example : var doorHeightMax = ${cabinetDoorPricing.doorsHeightMaxMin.maxValue};
Alternatively, I see that if there is atleast one valid EL expression in the <script> section, then all the related problems are shown as warnings, otherwise they are shown as errors.
Can you please replace one of the variable declarations with EL expression and check if the problems are showing up as warnings? I will file a bug with the dev team to investigate about the problems being shown as errors.
Sorry for inconvenience caused. Please let us know how it works for you.
–Swapna
MyEclipse Support
greybeardParticipantThank you for your response. I note that there are more issues when the JSTL/JS mixed in a jsp. Another issue is js comments viz:
//<%– if okToUse then put the altered drawer to it’s requested height –%>
if(okToUse == true) {
…..
The open brace is marked as an error thus stuffing up all subsequent braces.I use the above js/jsp comment form so that the comment is NOT seen at run time.
These have never been an issue prior to 2016 version
support-swapnaModeratorgreybeard,
Apologies for delayed response. The difference between MyEclipse 2016 and previous versions is that we have moved to JSJet in MyEclipse 2016 for JavaScript.
The error on the JS comment might be a bug in our editor and I have filed it with the dev team for further investigation.
As suggested in my previous response, can you please clarify whether adding a valid EL expression to the script section changes the error markers into warnings?
Apologies for inconvenience caused.
–Swapna
MyEclipse Support
support-piotrParticipantGreybeard,
I cannot reproduce your issue with JSP-style comments (attached is a screenshot of a sample I used to reproduce the issue). Could you please provide the actual code before and after to reproduce the issue? A screenshot would also be handy. Thanks!
Piotr Tomiak
Attachments:
You must be logged in to view attached files.
greybeardParticipantHERE is before & after shots of jsp file (I have added my comments for clarity):
Also another issue within js functions:
if(xxxx < min || xxxx > max){ etc causes error marker at the “greater than” operator.
to get rid of error I used
if(xxxx < min || xxxx >= max + 1){ etc no error using “greater than or equal to” operator
“less than” does not cause an error to be shownAttachments:
You must be logged in to view attached files.
support-piotrParticipantGreybeard,
I’ve reproduced both reported issues with provided examples. Thank you very much for your reports! The first issue was happening, because we were indeed not properly handling JSP comments, the other due to incorrect regexp, which was replacing everything between < and > with spaces. Both fixes will be included in the next MyEclipse release – 2017 CI 1, which is due this or next week. Let me know if you see any other issues!
Best regards,
Piotr Tomiak
support-swapnaModeratorGreybeard,
MyEclipse 2017 CI 1 is out and it has the fixes for the issues you reported. Please download the MyEclipse 2017 CI 1 installer from here : https://www.genuitec.com/products/myeclipse/download/
You can install MyEclipse 2017 CI 1 to a different location alongside your existing MyEclipse 2016 installation and use your current license. Please give it a try and let us know how it works for you.
–Swapna
MyEclipse Support -
AuthorPosts