facebook

JSP Tag Validation: unable to find setter method for attrib

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #233276 Reply

    Paul Stanton
    Member

    eclipse Version: 3.1.0
    Build id: I20050627-1435
    MyEclipse: 4.0m2

    I’ve never been happy with the jsp validation/compilation in myeclipse but assumed it would get better with time. imho it is getting worse. below are a couple of problems which are currently annoying me.

    1. I get a validation error when i use my tag pageLink saying “Unable to find setter method for attribute: page”. The setter method exists, and is in the tld.

    java:

    public void setPage(Object page)
    {
        this.page = (SitePage) page;
    }

    tld:

    <attribute>
        <name>page</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>

    jsp:

    <shop:pageLink page="<%= request.getAttribute("currentPage") %>"><bean:write name="currentPage" property="name"/></shop:pageLink>

    2. I was also getting this error on another tag where the setter method for an attribute was inherited from super class. that doesn’t seem to happen any more although the code didn’t change.

    3. I also DO NOT get an error for the following:

    <%= pageCo ntext.getAttribute("product") %>

    which is an obvious syntax error.

    4. jsp:

    <!--shop:pageLink page="<%= request.getAttribute("shopCategory") %>"><bean:write name="shopCategory" property="name"/></shop:pageLink-->

    for this i get the error: ‘The end tag “</shop:pageLink-” is unbalanced’

    5. typing half of a class name and hitting ctrl+space (auto complete) spits the fully qualified class name out (including package) instead of adding an import declaration and spitting out just the class name. also, (especially with method names) there is a tendency to overwrite existing code following the carat when using auto complete.

    #233278 Reply

    Riyad Kalla
    Member

    <shop:pageLink page=”<%= request.getAttribute(“currentPage”) %>”><bean:write name=”currentPage” property=”name”/></shop:pageLink>

    Try using single quotes around the “currentPage” instead of double quotes. Part of the JSP spec is actually related to proper quoting and you cannot have double inside of double quotes as you have here. I wonder if the “cannot find” error is just a red herring.

    2. I was also getting this error on another tag where the setter method for an attribute was inherited from super class. that doesn’t seem to happen any more although the code didn’t change.

    Almost every single base tag in JSF and JSTL are inherited, so if our editor was choking on this I believe it would be a big show stopper for us.

    <%= pageCo ntext.getAttribute(“product”) %>

    If you open a command line window (Start > Run > Cmd) and type “javac” do you get a “Command not found” error, or does it dump out the javac command line arguments? The JSP validator needs javac in your system path to run properly.

    <!–shop:pageLink page=”<%= request.getAttribute(“shopCategory”) %>”><bean:write name=”shopCategory” property=”name”/></shop:pageLink–>

    Again, check if it’s the embedded double quoting issue here.

    5. typing half of a class name and hitting ctrl+space (auto complete) spits the fully qualified class name out (including package) instead of adding an import declaration and spitting out just the class name. also, (especially with method names) there is a tendency to overwrite existing code following the carat when using auto complete.

    This was a bug with 3.8.0 that was fixed in 3.8.1, simply put it absolutely should not be doing this for you. Can you right click on your JSP file, go to “Open With” and make sure “MyEclipse JSP Editor” is what is selected as the default? (has a black ball next to it).

    Also please go to Help > About > Feature Details, and I’d like to know the version given from provider “Genuitec, LLC” for the feature “MyEclipse Web Development Feature”, honestly something doesn’t sound right here because you are just encountering too many problomatic issues all at one time and the bad autocomplete is very suspect to me.

    #233279 Reply

    Paul Stanton
    Member

    @support-rkalla wrote:

    Try using single quotes around the “currentPage” instead of double quotes.

    tried .. same error
    @support-rkalla wrote:

    Almost every single base tag in JSF and JSTL are inherited, so if our editor was choking on this I believe it would be a big show stopper for us.

    ok, lucky that stopped happening then eh? 😉

    @support-rkalla wrote:

    If you open a command line window (Start > Run > Cmd) and type “javac” do you get a “Command not found” error, or does it dump out the javac command line arguments? The JSP validator needs javac in your system path to run properly.

    added [jdk_dir]/bin to path, javac is now found at command line. shouldn’t myeclipse warn me if it can’t find javac? syntax errors are caught now, however the tld errors mentioned seem to take presedence so the compile errors are not visible untill the tld errors are fixed .. thats not good.

    @support-rkalla wrote:

    Again, check if it’s the embedded double quoting issue here.

    again, no.

    @support-rkalla wrote:

    This was a bug with 3.8.0 that was fixed in 3.8.1, simply put it absolutely should not be doing this for you. Can you right click on your JSP file, go to “Open With” and make sure “MyEclipse JSP Editor” is what is selected as the default? (has a black ball next to it).

    MyEclipse JSP Editor

    Also please go to Help > About > Feature Details, and I’d like to know the version given from provider “Genuitec, LLC” for the feature “MyEclipse Web Development Feature”, honestly something doesn’t sound right here because you are just encountering too many problomatic issues all at one time and the bad autocomplete is very suspect to me.

    MyEclipse Web Development Tooling
    Version: 3.9.210
    Build id: 20050627-4.0-Milestone-2

    #233280 Reply

    Paul Stanton
    Member

    fyi i still get the “Unable to find setter method for attribute: page” error if the parameter i pass in is a predefined variable or even a string literal. so both

    <shop:pageLink page="<%= var %>">a</shop:pageLink>

    and

    <shop:pageLink page="string">a</shop:pageLink>

    break.

    #233281 Reply

    Paul Stanton
    Member

    btw, resin 2 gives me errors if i use <%= request.getAttribute(‘xyz’) %>: invalid character, so that is not an option.

    #233283 Reply

    Riyad Kalla
    Member

    Is there anyway you can send me this sample project? I want to figure out what is going on here, this is getting my blood boiling…

    #233284 Reply

    Paul Stanton
    Member

    tried to emmulate quickly in a separate project with no luck (although it’s never that simple is it?)

    one obvious difference is this: in the problem project, my java source is stored under WebRoot/WEB-INF/src

    possible cause?

    #233309 Reply

    Riyad Kalla
    Member

    my java source is stored under WebRoot/WEB-INF/src

    possible cause?

    Let’s test it real quick:

    1) Create a new web project
    2) Take your old project and copy/paste all of it’s contents from the original into the new one. Now drag and dropt he /src dir to the root of the project, edit your project properties to reassign the src dir.

    Are teh tags working now? I’ll admit that having the /src dir under WEB-INF wasn’t an intended setup in our environment, our recommended setup is here:
    http://www.myeclipseide.com/FAQ+index-myfaq-yes-id_cat-30.html#111

    Although I know that /src under WEB-INF is a preferred Maven approach IIRC?

    #233340 Reply

    Paul Stanton
    Member

    @support-rkalla wrote:

    I’ll admit that having the /src dir under WEB-INF wasn’t an intended setup … Although I know that /src under WEB-INF is a preferred Maven approach IIRC?

    in this case i cannot choose the project setup and prefer the recommended, however the web-inf/src setup is common and myeclipse should handle it.

    i’m testing now, will let you know.

    #233341 Reply

    Paul Stanton
    Member

    Ok, i’ve tested and no longer think the source path is a factor.
    I created new project with normal layout, copied the code from the other project etc: no errors.
    I then used Navigator to move the src folder to WebRoot/WEB-INF, edited .classpath to match: no errors.

    very confused now.

    #233342 Reply

    Paul Stanton
    Member

    ARGH!!! The error has dissapeared! I did nothing to fix it!
    all i can think is closing, re-opening the project, refresh .. all things i have done before.
    :S

    #233348 Reply

    Riyad Kalla
    Member

    I have already gone through 3 test projects and will continue to dig to see if I can uncovery something, let me know if you find anything more.

    In the mean time are you able to work without problems?

    #233350 Reply

    Paul Stanton
    Member

    to answer your question: yes, i can complete my work.

    so appart from the ghost bugs which are no longer haunting me, these are still issues:
    @pstanton wrote:

    3. I also DO NOT get an error for the following:

    <%= pageCo ntext.getAttribute("product") %>

    which is an obvious syntax error.

    4. jsp:

    <!--shop:pageLink page="<%= request.getAttribute("shopCategory") %>"><bean:write name="shopCategory" property="name"/></shop:pageLink-->

    for this i get the error: ‘The end tag “</shop:pageLink-” is unbalanced’

    5. typing half of a class name and hitting ctrl+space (auto complete) spits the fully qualified class name out (including package) instead of adding an import declaration and spitting out just the class name. also, (especially with method names) there is a tendency to overwrite existing code following the carat when using auto complete.

    note: i understand that 3 is better described as this: tld errors take presedence over compile errors (ie, the compile error will show if there are no tld errors).

    #233373 Reply

    Scott Anderson
    Participant

    <!–shop:pageLink page=”<%= request.getAttribute(“shopCategory”) %>”><bean:write name=”shopCategory” property=”name”/></shop:pageLink–>

    This is a violation of the nesting of quotes as described in the spec. Try this:

    
    <!--shop:pageLink page='<%= request.getAttribute("shopCategory") %>'><bean:write name="shopCategory" property="name"/></shop:pageLink-->
    
    #233375 Reply

    Riyad Kalla
    Member

    3. I also DO NOT get an error for the following:
    Code:
    <%= pageCo ntext.getAttribute(“product”) %>
    which is an obvious syntax error.

    Yes it is, and it is marked as such:

    4. jsp:
    Code:
    <!–shop:pageLink page=”<%= request.getAttribute(“shopCategory”) %>”><bean:write name=”shopCategory” property=”name”/></shop:pageLink–>
    for this i get the error: ‘The end tag “</shop:pageLink-” is unbalanced’

    This is invalid, taglibs are not like normal HTML tags, you can’t just make the semblance of HTML comments in the beginning and of a taglib call and have it ignored. You are using client side comments here to try and hide this taglib call which is processed by the *compiler*, you have to use server side comments:
    <%–
    %>

    5. typing half of a class name and hitting ctrl+space (auto complete) spits the fully qualified class name out (including package) instead of adding an import declaration and spitting out just the class name. also, (especially with method names) there is a tendency to overwrite existing code following the carat when using auto complete.

    This was a bug that snuck into one of our builds, it has been fixed and should be in Milestone 3.

Viewing 15 posts - 1 through 15 (of 21 total)
Reply To: JSP Tag Validation: unable to find setter method for attrib

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