facebook

JSP Validation Question

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #278625 Reply

    csargent
    Participant

    Hi — I am evaluating MyEclipse and have a question about JSP Validation.

    I have created an Enterprise Application project with a dependent Web and EJB projects. Everything is working fine with the exception of the JSP Validation.

    I have all the default validations enabled for my JSPs but it seems that the validations are not catching compile errors. For example — a page with a scriptlet that won’t compile passes all the validations.

    I suspect since I am new to MyEclipse I just have something misconfigured. Can someone please set me straight?

    Thanks in Advance!

    Chris

    #278658 Reply

    Loyal Water
    Member

    What is the validation that is not being caught ?

    #278678 Reply

    csargent
    Participant

    As I say I am new to MyEclipse so I am not sure the name of the validator that is supposed to catch scriptlet compile errors, but it doesn’t seem to be catching any.

    For instance, if I add this

    <%foo.ThisIsAnObviousError();%>

    to my JSP I get no errors. Is it possible this is just a warning? This seems unlikely, but my project DOES have a bunch of warning messages and I am only seeing the first 100.

    Thanks for your help!

    Chris

    #278679 Reply

    csargent
    Participant

    Another thing that leads me to think I have something misonfigured — the code completion feature is not working at all. Neither is the tag completion. FYI I am using Version:
    6.0.1 GA
    Build id: 6.0.1-GA-200710

    Thanks

    #278755 Reply

    csargent
    Participant

    Bump — anyone have imput on this issue? It’s the only show-stopper I’ve encoutered so far.

    #278757 Reply

    csargent
    Participant

    I think I have solved my problem. I created a new empty Web Project, added a JSP and voila, both the validation and the code completion worked fine. I started looking at the differences and found the one that made the code completion and validation start working in my project:

    It was the fact that I had no source folders on my build path — the only “source” in my web project is my jsps. All my other source is in dependent projects. Anyway — I added a dummy source folder to the project and now validation and code completion work just fine.

    Not sure if you consider this a bug or not — certainly the workaround is simple enough. Thanks for your help.

    Chris

    #278782 Reply

    Loyal Water
    Member

    Chris,
    Sorry for the delay. Im glad you got it to work and thank you for posting your findings. Ill take a look at this issue and let the dev team know about this.

    #278797 Reply

    csargent
    Participant

    Thanks

    Actually (sorry to be a pain) I have encountered a couple more small problems now that I have validation working — both related to custom tags and scriptlets.

    The first problem I have seen posted here before, but the posts were old and contained no definitive resolutions that I could see. The problem is with code like this:

    <logic:iterate name="buildingMaintenanceRateSet"  id="bmr" type="BuildingMaintenanceRate">
       maintItemYear1RateArray["<%=bmr.getTypeId()%>"] = "<%=decimalFormat.format(bmr.getYear1Rate())%>";   
    </logic:iterate>

    This code generates a compile error saying that the symbol bmr can’t be resolved (in the scriptlet). At least one of the posts I saw about this problem indicated that in some cases this code validated properly — what’s the latest on this? I realize that support for any random tag library could be difficult — but given you have explicit support for Struts, it seems like this code should validate properly.

    My second problem is with code that looks like this:

    <nested:text size="7" maxlength="15" property="year1ChangeString" styleClass="FormFieldNumeric" value="0" onblur="<%=onblur%>" onfocus="this.select(); setCurrent(this)"  tabindex="<%=10+(i*7)%>" styleId="<%=id%>"/>

    This code passes ME validations OK but when I run it (in JBoss 4.2.2 btw) I get the following JSP compile error:

    An error occurred at line: 886 in the jsp file: /Budget/ListBAVLineItems.jsp
    The method setTabindex(String) in the type BaseHandlerTag is not applicable for the arguments (int)

    The problem is that the scriptlet <%=10+(i*7)%> returns an int, but the setTabindex() method of the custom tag takes a String. I know that some other application servers (Oracle OC4J for example) handle the implicit cast to a String, so I’m not sure why this is even a problem at all — but since it is, I’d like it to be flagged as such in ME. I was looking at some other Eclipse distros and in at least one (I think the JBoss IDE) the error was caught in validation. Is there a way to get ME to catch this error? (Alternatively — if you have a suggestion for getting JBoss/Tomcat to handle the cast implicitly like OC4J that would be even better!).

    Sorry for the long post — and thanks again for your help.

    Chris

    #278806 Reply

    Loyal Water
    Member

    At least one of the posts I saw about this problem indicated that in some cases this code validated properly — what’s the latest on this?

    Can you post a like to the thread that you were referring to.

    I’ll check the 2nd bit that you have reported and get back to you.

    #278807 Reply

    csargent
    Participant

    Thanks for the reply — look forward to hearing what you find re: the second problem.

    Can you post a like to the thread that you were referring to.

    Here is the link to the post I was talking about:

    https://www.genuitec.com/forums/topic/jsps-with-struts-tags-and-ids-show-validation-errors/&highlight=logic+iterate+scriptlet

    Thanks

    Chris

    #278867 Reply

    Loyal Water
    Member

    I’ll check the 2nd bit that you have reported and get back to you.

    Chris, can you send me a sample project which will help me reproduce this issue. I’ll file this as a bug for my dev team.

    As for the first issue, we will look into it … but it’s a limitation of knowing that the taglib defines a new variable named “bmr”. We have already added support for something like this recently with the JSF dataTable tag.

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: JSP Validation Question

You must be logged in to post in the forum log in