General discussion

Locked

What is Shine Enterprise Java Pattern ?

By john.stalin.java ·
how know what is Shine Enterprise Java Pattern and its benefits ?
any tutorial or e-book will be very useful too.
don't miss sample code

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

shine enterprise pattern

by mcgrow In reply to What is Shine Enterprise ...

The Java Web Model Service architecture is based on MVC.It improves all disadvantages ,and add some adavantages points to it.As Struts comes to help us to implement our project based on MVC , we need maplet to implement JWMS architecture.These maplets are based on those old Servlets ,with some new featurs.
Purpose of JWMS architecture is that, to have a JSP page for every job of your actors in UML diagrams. And those all actions start from a request JSP page ,and continue with one or more maplets ,and then finish with a response JSP page (for all possibles response ) through a flow just like your UML diagrams.


Now there isn't any need to make a JSP page for every possible response (for example a proper response for empty fields and an other proper respose for errors ...) like before.Instead, the all things you need is that to create a response jsp page and tag it.A tag for success message a tag for error and so on.
As you see , every thing is very simple.Also, you can be a project manager too !!!
An other ability of maplet is that ,you don't need to carry parameters with yourself by using session or application.Maplet gets all parameters from the first page and cross it to an other maplet or JSP.For reaching these parameters you just need to define a public String variable as the same name of parameter in first JSP page.The content of this variable is the same as user inputted parameter(with out doing any job!).
We are not magicians , we just know how to work with URL !!!
If you want to send any parameter to next maplet ,add it to URL as the same !!!
For more information and knowing how to work with AddURL(),forward(),... read the complete document from below link :

https://www.ibm.com/developerworks/mydeveloperworks/groups/service/html/communityview?communityUuid=4d8031a4-58d3-4270-a160-6795db7b6bb5

Collapse -

What are the chances...

by CharlieSpencer In reply to shine enterprise pattern

that two 'IT Department Managers' both in 'tehran' (with lower-case 't'), both interested in the same software, would join on the same day?

For messages that originated in Iran, there's a lot of pork in them.

Collapse -

i hava a maplet for patern

by j2os In reply to What is Shine Enterprise ...

(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>
////////////////////////


request page
(file) AddEmail.jsp
////////////////////////
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>untitled</title>
</head>
<body>
<DIV align="center">
<P> </P>
<P>
<STRONG><FONT size="5">Add a new Email to my email list</FONT></STRONG>
</P>
<P> </P>
<P> </P>
<form action="../../servlet/Model.Controller" method="get">
<DIV align="left">
<P>Name:  
<input type="text" name="name"/>
</P>
<P>Email:  
<input type="text" name="email"/></P>
<P>
<input type="submit" value="Submit"/>
<input type="reset" value="Reset"/>
</P>
</DIV>
</form>
</DIV>
</body>
</html>
///////////////////


request page
(file) SearchEmail.jsp
/////////////////////////
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>untitled</title>
</head>
<body>
<P> </P>
<P align="center">
<STRONG><FONT size="5">Search an email in my list</FONT></STRONG>
</P>
<P> </P>
<form action="../../servlet/Model.Controller" method="get">
<P>Name:  
<input type="text" name="name"/>
</P>
<P>
<input type="submit" value="Submit"/>
<input type="reset" value="Reset"/>
</P>
</form>
</body>
</html>
/////////////////////////

request page
(file) AddPhoneNumber.jsp
////////////////////////////
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>untitled</title>
</head>
<body>
<DIV align="center">
<P> </P>
<P>
<STRONG><FONT size="5">Add a new phone to my phone book</FONT></STRONG>
</P>
<P> </P>
<P> </P>
<form action="../../servlet/Model.Controller" method="get">
<DIV align="left">
<P>Name:  
<input type="text" name="name"/>
</P>
<P>phone num:  
<input type="text" name="ph_num"/></P>
<P>
<input type="submit" value="Submit"/>
<input type="reset" value="Reset"/>
</P>
</DIV>
</form>
</DIV>
</body>
</html>
////////////////////

request page
(file) SearchPhoneNumber.jsp
////////////////////////////
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>untitled</title>
</head>
<body>
<P> </P>
<P align="center">
<STRONG><FONT size="5">Search a phone number in my phone book</FONT></STRONG>
</P>
<P> </P>
<form action="../../servlet/Model.Controller" method="get">
<P>Name:  
<input type="text" name="name"/>
</P>
<P>
<input type="submit" value="Submit"/>
<input type="reset" value="Reset"/>
</P>
</form>
</body>
</html>
////////////////
response page
(file) EmailServiceResponses.jsp
//////////////////////////////////////
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/WEB-INF/maplet.tld" prefix="maplet"%>
<maplet:Service name="add_success">Your email address had entered successfully.<br/>name:<br/><%=request.getParameter("name")%><br/>email:<br/><%=request.getParameter("email")%> </maplet:Service>
<maplet:Service name="search_success"><%=request.getParameter("name")%>'s email : <%=request.getParameter("email")%></maplet:Service>
<maplet:Service name="add_error">your email address failed! there was a problem!</maplet:Service>
<maplet:Service name="search_error">you had entered a wrong value!</maplet:Service>
<maplet:ErrorService>No Access!</maplet:ErrorService>
///////////////////////////////////////////////////////////


response page
(file) PhoneServiceResponses.jsp
/////////////////////////////////////
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/WEB-INF/maplet.tld" prefix="maplet"%>
<maplet:Service name="add_success">Your phone number had entered successfully.<br/>name:<br/><%=request.getParameter("name")%><br/>phone:<br/><%=request.getParameter("ph_num")%> </maplet:Service>
<maplet:Service name="search_success"><%=request.getParameter("name")%>'s phone : <%=request.getParameter("ph_num")%></maplet:Service>
<maplet:Service name="add_error">your number failed! there was a problem!</maplet:Service>
<maplet:Service name="search_error">you had entered a wrong value!</maplet:Service>
<maplet:ErrorService>No Access!</maplet:ErrorService>
///////////////////////////////////


engine page (maplet)
(file) Controller.java
/////////////////////////////////
package Model;

import org.j2os.shine.maplet.*;
import org.j2os.shine.jconnection.JDBC;
import java.sql.*;

public class Controller extends Maplet {
public String name;
public String email;
public String ph_num;
private String forward_tag,forward_page;
JDBC db=new JDBC();

public void initialize() throws Exception{

db.login("com.mysql.jdbc.Driver","jdbc:mysql://localhost/j2os", "Username", "pass", true);

}

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+"'");

while (r.next())
{
ph_num= r.getString("phone");
}
addURL("ph_num",ph_num);
forward_page="../service/PhoneServiceResponses.jsp";
if (!(ph_num.equals("")))
{
forward_tag = "search_success";
} else {
forward_tag = "search_error";
}
}

public void rater() throws Exception {
db.commit();
forward(forward_page, forward_tag);
}
}
//////////////////////////////////////////////////////

Collapse -

Not only does this break the page,

by CharlieSpencer In reply to i hava a maplet for pate ...

but I'm really concerned about what those 'Submit' might buttons do.

Collapse -

Shinola

by GSG In reply to Not only does this break ...

I think they'll take you to Shinola land.

The PTB's need to remove this whole thread.

Collapse -

a sample for jshooter

by mattina In reply to What is Shine Enterprise ...

I found a sample for jshooter! check it! I dont know if it works true or no!

jsp pages:

----------------index.jsp---------------

<%@ page contentType="text/html;charset=windows-1256"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>untitled</title>
</head>
<body>
<form action="servlet/client.Caller" method="get">
<input type="submit" value="view list of server's class mathods"/>
</form>
</body>
</html>

-------------callMethod.jsp--------------

<%@ page contentType="text/html;charset=windows-1256"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>untitled</title>
</head>
<body>
<P>call one of methods:</P>
<form action="servlet/client.Caller" method="get">
<P>Method name:
<input type="text" name="method_name"/>
</P>
<P>
<input type="submit" value="Call"/>
</P>
</form>

</body>
</html>


----------------response.jsp----------------

<%@ page import="java.util.ArrayList"%>
<%@ taglib uri="/WEB-INF/maplet.tld" prefix="maplet"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
<title>untitled</title>
</head>
<body>
<maplet:Service name="view">
<%
String a=request.getParameter("methods");
String[] b=a.split("&");
for(int i=0;i<b.length;i++){
out.print(b+"<br>");
}
%><br/><br/><br/>
<iframe src="CallMethod.jsp" frameborder="0"> </iframe>
</maplet:Service>
<maplet:Service name="call">
output of <%=request.getParameter("method_name")%> method:<br/>
<%=request.getParameter("return_value")%>
</maplet:Service>
<maplet:ErrorService>No Access</maplet:ErrorService>
</body>
</html>

Classes:

client package:

---------------caller.java------------

<%@ page import="java.util.ArrayList"%>
<%@ taglib uri="/WEB-INF/maplet.tld" prefix="maplet"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
<title>untitled</title>
</head>
<body>
<maplet:Service name="view">
<%
String a=request.getParameter("methods");
String[] b=a.split("&");
for(int i=0;i<b.length;i++){
out.print(b+"<br>");
}
%><br/><br/><br/>
<iframe src="CallMethod.jsp" frameborder="0"> </iframe>
</maplet:Service>
<maplet:Service name="call">
output of <%=request.getParameter("method_name")%> method:<br/>
<%=request.getParameter("return_value")%>
</maplet:Service>
<maplet:ErrorService>No Access</maplet:ErrorService>
</body>
</html>

server package:

--------------Distributer.java----

package server;

import org.j2os.shine.jshooter.*;


public class Distributer {
public static void main(String[] arg) throws Exception {
Application app = new Application();
app.distribute(1099, "firstApp");
}
}

-------------SourceClass.java----

package server;

public class SourceClass
{

public String helloWorld() {
return "Hello World!";
}
public String byeEverybody() {
return "bye bye!";
}

}

Back to Software Forum
6 total posts (Page 1 of 1)  

Related Forums