facebook

Setter not found (take 2) [Closed]

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

    (take 2 since there already was one…)
    This is an extract from a JSP:

    
    <jsp:useBean id="contactBean" scope="session" class="system.common.Contact"/>
    <jsp:useBean id="userBean" scope="session" class="system.security.User"/>
    <jsp:setProperty name="userBean" property="id" value="<%= contactBean.getId() %>"/>
    

    ME insists that the last tag (setProperty) is wrong:

    no setter found: system.security.User.setId()

    Viewed as an observation ME is 100% right! There is no setter with that signature!!! No need to shout that out as I already knew. 😆
    Anyhow, viewed as an error-message ME is 100% wrong: the class User has a method with this signature: setId(int). This is the setter ME should look for! The parameter value is of course the input to the setter method.

    It seems to me that ME sometimes fail to recognize setProperty-tags with either an option for value or param. It’s quite annoying to get red-marked errors on code that is correct!

    And Yes! The code compiles and behaves correctly with Tomcat even though ME says it’s wrong… . 8)

    Regards
    Kjell-Einar

    #207914 Reply

    Riyad Kalla
    Member

    kjellein,
    I think something else is going wrong here, I just tried to duplicate what you found, and was unable to do it. Please post your system information (and software versions) for us to help you figure out what is going wrong. I’m using Eclipse 2.1.3 and MyEclipse 2.8 Beta 1 on Windows XP.

    Below is my test code.

    User.java (in “com.test” package)

    
    package com.test;
    
    public class User
    {
        private int id = -1;
        private String name = null;
        
        public int getId()
        {
            return id;
        }
    
        public String getName()
        {
            return name;
        }
    
        public void setId(int i)
        {
            id = i;
        }
    
        public void setName(String string)
        {
            name = string;
        }
    }
    

    MyJsp.jsp (In webroot)

    
    <%@ page language="java"%>
    
    <%
        Integer value = new Integer(15);
    %>
    
    <html>
      <head>
        <title>MyJsp.jsp</title>
      </head>
      <body>
          <jsp:useBean id="userBean" scope="session" class="com.test.User" />
          <jsp:setProperty name="userBean" property="id" value="<%= value.intValue() %>" />
      </body>
    </html>
    

    No compile errors or warnings.

    #207939 Reply

    Hi.
    – System Setup ——————————-
    Operating System and version: SuSe Linux 9.0
    Eclipse version: 2.1.3
    Eclipse build id: 200403101828
    MyEclipse version: 2.7.1
    Eclipse JDK version: j2sdk1.4.2_04
    Application Server JDK version: Tomcat 5
    – Message Body ——————————-

    The strange thing is that the same type of statement is accepted in other JSPs that I have…
    I also ran into the same problem with another JSP where I used this tag:

    <jsp:setProperty name="userBean" property="role" param="selRole" />

    Anyway, that errormessage disappeared after a while for unknown reasons.

    Regards
    Kjell-Einar

    #207940 Reply

    Riyad Kalla
    Member

    Anyway, that errormessage disappeared after a while for unknown reasons.

    Hmm… strange. If you are able to create a test case that can reproduce this reliably, please let us know.

    Glad you are up and running now.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Setter not found (take 2) [Closed]

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