H
hozen
Unregistered / Unconfirmed
GUEST, unregistred user!
I have written a game called Fazuul which was shown in the book masteringEJB. And I met a problem .
After I added the code
--------------------
public Component attachTo(Component other) throws RemoteException,ComponentException;
public String getName() throws RemoteException;
--------------------
in remote file Component.java, I added following code
--------------------
public Component attachTo(Component other) throws RemoteException,ComponentException{
Properties props=sessionContext.getEnvironment();
String matchString=(String)props.get(ENV_MATCHES);
Enumeration matches=new StringTokenizer(matchString,",");
while(matches.hasMoreElements()){
String equationString=(String)matches.nextElement();
Enumeration equation=new StringTokenizer(equationString,"+=");
String nameA=(String)equation.nextElement();
String nameB=(String)equation.nextElement();
String result=(String)equation.nextElement();
}
}
--------------------
in Bean file ComponentBean.java. And I tried to add the code
--------------------
other.getName();
--------------------
in the "while(){}" in above codes. But it cannot find the method called getName(). All what I can use is "this.getName()", so I cannot make a comparision between "this.getName()" with "other.getName()".
How to resolve this problem?
Hope for your answers.
Thank you!
After I added the code
--------------------
public Component attachTo(Component other) throws RemoteException,ComponentException;
public String getName() throws RemoteException;
--------------------
in remote file Component.java, I added following code
--------------------
public Component attachTo(Component other) throws RemoteException,ComponentException{
Properties props=sessionContext.getEnvironment();
String matchString=(String)props.get(ENV_MATCHES);
Enumeration matches=new StringTokenizer(matchString,",");
while(matches.hasMoreElements()){
String equationString=(String)matches.nextElement();
Enumeration equation=new StringTokenizer(equationString,"+=");
String nameA=(String)equation.nextElement();
String nameB=(String)equation.nextElement();
String result=(String)equation.nextElement();
}
}
--------------------
in Bean file ComponentBean.java. And I tried to add the code
--------------------
other.getName();
--------------------
in the "while(){}" in above codes. But it cannot find the method called getName(). All what I can use is "this.getName()", so I cannot make a comparision between "this.getName()" with "other.getName()".
How to resolve this problem?
Hope for your answers.
Thank you!