Hey,
I need to use a Java Object with in ColdFusion
application program.I am doing this by using cfobject
tag.I can access properties of Java class and also the
methods which are either taking any argument or
returning any value but I am not able to access a
method whose return type is void.It gives following
error though there r no overloaded methods in my
class:
------------------------------------------------------
The selected method f1 was not found.  
Either there are no methods with the specified method
name and argument types, or the method f1 is
overloaded with arguments types that ColdFusion can't
decipher reliably. If this is a Java object and you
verified that the method exists, you may need to use
the javacast function to reduce ambiguity.  
------------------------------------------------------

My java class file is as folows:
------------------------------------------------------
public class Employee {

public String FirstName;
public String LastName;
private float Salary;
private int   JobGrade;

/* public Employee() {
  FirstName ="";
  LastName ="";
  Salary   = 0.0f;
  JobGrade = 0;
}

public Employee(String First, String Last) {
  FirstName = First;
  LastName = Last;
  Salary   = 0.0f;
  JobGrade = 0;
}  */

public Employee(String First, String Last, float
salary, int grade) {
  FirstName = First;
  LastName = Last;
  Salary   = salary;
  JobGrade = grade;
}
public void f1()
{
System.out.println("Test");   
}
public void SetSalary(float Dollars) {
   Salary = Dollars;
}

public float GetSalary() {
  return Salary;
}

/*public void SetJobGrade(int grade) {
  JobGrade = grade;
}*/

public void SetJobGrade(String Grade) {
  if (Grade.equals("CEO")) {
    JobGrade = 3;
  }
  else if (Grade.equals("MANAGER")) {
    JobGrade = 2;
  }
  else if (Grade.equals("DEVELOPER")) {
    JobGrade = 1;
  }
}

public int GetJobGrade() {
  return JobGrade;
}

}


----------------------------------------------------

And I am accessing this class with in ColdFusion as
follows:
------------------------------------------------------

<html>
<body>
<cfobject type="java" action="" class="Employee"
name="emp">
<cfset emp.init("chanchal","malik",2556.70,1)>
<cfoutput>
#emp.f1()#
</cfoutput>
</body>
</html>

------------------------------------------------------

Plese help me and let me know where I am wrong.

Thanks,
chanchal   
     
  



__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to