this is my code.
see that really i can shoot a new method or property to another class on another PC.
this is really fun i can access my code on the customer system. and even i can change the code i did ?
this is really funi
file name: maplet.tld
Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> <taglib> <tlibversion>1.0</tlibversion> <jspversion>1.1</jspversion> <shortname>maplet</shortname> <tag> <name>Service</name> <tagclass>org.j2os.shine.maplet.tag.Service</tagclass> <bodycontent>JSP</bodycontent> <attribute> <name>name</name> </attribute> </tag> <tag> <name>SecureService</name> <tagclass>org.j2os.shine.maplet.tag.SecureService</tagclass> <bodycontent>JSP</bodycontent> <attribute> <name>name</name> </attribute> </tag> <tag> <name>ErrorService</name> <tagclass>org.j2os.shine.maplet.tag.ErrorService</tagclass> <bodycontent>JSP</bodycontent> </tag> </taglib>
server side code
file name : Server.java
Code:1. package ServerSide; 2. 3. public class Server 4. { 5. //the definition of method lay here 6. public void PrintName(String Name) 7. { 8. System.out.print("Dear user Your name is "+Name); 9. System.out.print("<br>"); 10. } 11. public int Plus(int val1,int val2) 12. { 13. int res = val1 + val2 ; 14. System.out.print(val1+" + "+val2+" is equal "+res+""); 15. System.out.print("<br>"); 16. return res; 17. } 18. private void private_Method() 19. { 20. System.out.print("Peivate Method is invoked"); 21. System.out.print("<br>"); 22. } 23. }
Client side code
file name : Client.java
Code:1. package ClientSide; 2. import ServerSide.Server; 3. import org.j2sos.shine.jshooter.*; 4. import java.util.ArrayList; 5. public class Client 6. { 7. //call the method from server side 8. //1- get method type 9. //2- invoke a method 10. //3- newInstat 11. //4- get fild type 12. public static void main(String arg[])throws Exception 13. { 14. ServerApplication Client_Obj = new Application().receive("Rokhsana","CommunityName"); 15. Client_Obj.newInstance("ServerSide.Server"); 16. ArrayList method_array = Client_Obj.getMethodsNames(); 17. int i = 0; 18. while(method_array.size()!=i) 19. { 20. System.out.println(method_array.get(i)); 21. i ++; 22. } 23. } 24. }
engine code on the server
file name : Core.java
Code:1. package Engin; 2. import org.j2sos.shine.jshooter.Application; 3. 4. public class Core 5. { 6. //distribute server class for client 7. public static void main(String arg[])throws Exception 8. { 9. Application distrubuted_Obj = new Application(); 10. distrubuted_Obj.distribute(1099,"CommunityName"); 11. System.out.print("~~~~~~~~~~Core isrunning~~~~~~~~~~~~~~"); 12. } 13. }




Reply With Quote



Bookmarks