Maplet (Web, MVC Framework)
What is Maplet?
Maplet is a framework for implementing web based program, which is compatible with MVC architecture. This framework is very easy and helpful for developers and analyzers to do their jobs better than before, let’s begin with a simple example.
First example
First you have to download shine library from one of these web sites: www.j2os.org Shine-Enterprise-Java-Pattern | Download Shine-Enterprise-Java-Pattern software for free at SourceForge.net
(file) maplet.tld
///////////////////
<?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>
////////////////////////
public void addEmail() throws Exception {
boolean a=db.executeSQLQuery("insert into email_table (name,email) values ('"+name+"','"+email+"')");
forward_page="../service/EmailServiceResponses.jsp";
if (a) {
forward_tag = "add_success";
} else {
forward_tag = "add_error";
}
}
public void searchEmail() throws Exception {
ResultSet r = db.getSQLQueryContent("select email from email_table where name like '"+name+"'");
while (r.next()) {
email= r.getString("email");
}
addURL("email",email);
forward_page="../service/EmailServiceResponses.jsp";
if (!(email.equals(""))) {
forward_tag = "search_success";
} else {
forward_tag = "search_error";
}
}
public void addPhoneNumber() throws Exception {
boolean a=db.executeSQLQuery("insert into phon_table (name,phone) values ('"+name+"','"+ph_num+"')");
forward_page="../service/PhoneServiceResponses.jsp";
if (a) {
forward_tag = "add_success";
} else {
forward_tag = "add_error";
}
}
public void searchPhoneNumber() throws Exception {
ResultSet r = db.getSQLQueryContent("select phone from phone_table where name like '"+name+"'");
JShooter (Reflect in Network Framework)
What is JShooter?
JShooter is a framework for distributing application programs on the network. Certainly, you have used RMI, Corba and JMS. Each of aforementioned technologies has its own special problems and at the same time enjoys extraordinary advantages. However, you must be careful about the expenses caused by these technologies. In most cases RMI, Corba and JMS increase the productions’ costs unbelievably. However in other cases they confuse programmers. Years ago, Reflect Oriented Programming was the focus of attention within professional programmers, then Aspect Oriented Programming came into the programming world but instead of reducing the programmer’s task, it causes the professional programmers and even the amateur ones to be confused in many cases. One of the most important capabilities of JShooter is that it makes the “Reflect Oriented Programming” easier to use.
server side code
file name : Server.java
==================================
package ServerSide;
public class Server
{
//the definition of method lay here
public void PrintName(String Name)
{
System.out.print("Dear user Your name is "+Name);
System.out.print("<br>");
}
public int Plus(int val1,int val2)
{
int res = val1 + val2 ;
System.out.print(val1+" + "+val2+" is equal "+res+"");
System.out.print("<br>");
return res;
}
private void private_Method()
{
System.out.print("Peivate Method is invoked");
System.out.print("<br>");
}
}
==================================
Client side code
file name : Client.java
==================================
package ClientSide;
import ServerSide.Server;
import org.j2sos.shine.jshooter.*;
import java.util.ArrayList;
public class Client
{
//call the method from server side
//1- get method type
//2- invoke a method
//3- newInstat
//4- get fild type
public static void main(String arg[])throws Exception
{
ServerApplication Client_Obj = new Application().receive("Rokhsana","CommunityName");
Client_Obj.newInstance("ServerSide.Server");
ArrayList method_array = Client_Obj.getMethodsNames();
int i = 0;
while(method_array.size()!=i)
{
System.out.println(method_array.get(i));
i ++;
}
}
}
==================================
engine code on the server
file name : Core.java
==================================
package Engin;
import org.j2sos.shine.jshooter.Application;
public class Core
{
//distribute server class for client
public static void main(String arg[])throws Exception
{
Application distrubuted_Obj = new Application();
distrubuted_Obj.distribute(1099,"CommunityName");
System.out.print("~~~~~~~~~~Core isrunning~~~~~~~~~~~~~~");
}
}
==================================