473,435 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,435 software developers and data experts.

sample code for maplet framework ?

i need a sample code for maplet framework ?
how can help me ?
maplet in belongs to shine enterprise pattern
Jul 18 '10 #1
1 1607
filename : maplet.tld
==============================================
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
  3. <taglib>
  4.   <tlibversion>1.0</tlibversion>
  5.   <jspversion>1.1</jspversion>
  6.   <shortname>maplet</shortname>
  7.   <tag>
  8.     <name>Service</name>
  9.     <tagclass>org.j2os.shine.maplet.tag.Service</tagclass>
  10.     <bodycontent>JSP</bodycontent>
  11.     <attribute>
  12.       <name>name</name>
  13.     </attribute>
  14.   </tag>
  15.   <tag>
  16.     <name>SecureService</name>
  17.     <tagclass>org.j2os.shine.maplet.tag.SecureService</tagclass>
  18.     <bodycontent>JSP</bodycontent>
  19.     <attribute>
  20.       <name>name</name>
  21.     </attribute>
  22.   </tag>
  23.   <tag>
  24.     <name>ErrorService</name>
  25.     <tagclass>org.j2os.shine.maplet.tag.ErrorService</tagclass>
  26.     <bodycontent>JSP</bodycontent>
  27.   </tag>
  28. </taglib>
================================================


request page
filename : AddEmail.jsp
================================================
Expand|Select|Wrap|Line Numbers
  1. <%@ page contentType="text/html;charset=windows-1252"%>
  2. <html>
  3.   <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5.     <title>untitled</title>
  6.   </head>
  7.   <body>
  8.     <DIV align="center">
  9.       <P>&nbsp;</P>
  10.       <P>
  11.         <STRONG><FONT size="5">Add a new Email to my email list</FONT></STRONG>
  12.       </P>
  13.       <P>&nbsp;</P>
  14.       <P>&nbsp;</P>
  15.       <form action="../../servlet/Model.Controller" method="get">
  16.         <DIV align="left">
  17.           <P>Name: &nbsp;
  18.             <input type="text" name="name"/>
  19.           </P>
  20.           <P>Email: &nbsp;
  21.           <input type="text" name="email"/></P>
  22.           <P>
  23.             <input type="submit" value="Submit"/>
  24.             <input type="reset" value="Reset"/>
  25.           </P>
  26.         </DIV>
  27.       </form>
  28.     </DIV>
  29.   </body>
  30. </html>
================================================


request page
filename : SearchEmail.jsp
================================================
Expand|Select|Wrap|Line Numbers
  1. <%@ page contentType="text/html;charset=windows-1252"%>
  2. <html>
  3.   <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5.     <title>untitled</title>
  6.   </head>
  7.   <body>
  8.     <P>&nbsp;</P>
  9.     <P align="center">
  10.       <STRONG><FONT size="5">Search an email in my list</FONT></STRONG>
  11.     </P>
  12.     <P>&nbsp;</P>
  13.     <form action="../../servlet/Model.Controller" method="get">
  14.       <P>Name: &nbsp;
  15.         <input type="text" name="name"/>
  16.       </P>
  17.       <P>
  18.         <input type="submit" value="Submit"/>
  19.         <input type="reset" value="Reset"/>
  20.       </P>
  21.     </form>
  22.   </body>
  23. </html>
================================================

request page
filename : AddPhoneNumber.jsp
================================================
Expand|Select|Wrap|Line Numbers
  1. <%@ page contentType="text/html;charset=windows-1252"%>
  2. <html>
  3.   <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5.     <title>untitled</title>
  6.   </head>
  7.   <body>
  8.     <DIV align="center">
  9.       <P>&nbsp;</P>
  10.       <P>
  11.         <STRONG><FONT size="5">Add a new phone to my phone book</FONT></STRONG>
  12.       </P>
  13.       <P>&nbsp;</P>
  14.       <P>&nbsp;</P>
  15.       <form action="../../servlet/Model.Controller" method="get">
  16.         <DIV align="left">
  17.           <P>Name: &nbsp;
  18.             <input type="text" name="name"/>
  19.           </P>
  20.           <P>phone num: &nbsp;
  21.           <input type="text" name="ph_num"/></P>
  22.           <P>
  23.             <input type="submit" value="Submit"/>
  24.             <input type="reset" value="Reset"/>
  25.           </P>
  26.         </DIV>
  27.       </form>
  28.     </DIV>
  29.   </body>
  30. </html>
================================================

request page
filename : SearchPhoneNumber.jsp
================================================
Expand|Select|Wrap|Line Numbers
  1. <%@ page contentType="text/html;charset=windows-1252"%>
  2. <html>
  3.   <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5.     <title>untitled</title>
  6.   </head>
  7.   <body>
  8.     <P>&nbsp;</P>
  9.     <P align="center">
  10.       <STRONG><FONT size="5">Search a&nbsp;phone&nbsp;number in my phone book</FONT></STRONG>
  11.     </P>
  12.     <P>&nbsp;</P>
  13.     <form action="../../servlet/Model.Controller" method="get">
  14.       <P>Name: &nbsp;
  15.         <input type="text" name="name"/>
  16.       </P>
  17.       <P>
  18.         <input type="submit" value="Submit"/>
  19.         <input type="reset" value="Reset"/>
  20.       </P>
  21.     </form>
  22.   </body>
  23. </html>
================================================

response page
filename : EmailServiceResponses.jsp
================================================
Expand|Select|Wrap|Line Numbers
  1. <%@ page contentType="text/html;charset=windows-1252"%>
  2. <%@ taglib uri="/WEB-INF/maplet.tld" prefix="maplet"%>
  3.     <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>
  4.     <maplet:Service name="search_success"><%=request.getParameter("name")%>'s email : <%=request.getParameter("email")%></maplet:Service>
  5.     <maplet:Service name="add_error">your email address failed! there was a problem!</maplet:Service>
  6.     <maplet:Service name="search_error">you had entered a wrong value!</maplet:Service>
  7.     <maplet:ErrorService>No Access!</maplet:ErrorService> 
================================================


response page
filename : PhoneServiceResponses.jsp
================================================
Expand|Select|Wrap|Line Numbers
  1. <%@ page contentType="text/html;charset=windows-1252"%>
  2. <%@ taglib uri="/WEB-INF/maplet.tld" prefix="maplet"%>
  3.     <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>
  4.     <maplet:Service name="search_success"><%=request.getParameter("name")%>'s phone : <%=request.getParameter("ph_num")%></maplet:Service>
  5.     <maplet:Service name="add_error">your number failed! there was a problem!</maplet:Service>
  6.     <maplet:Service name="search_error">you had entered a wrong value!</maplet:Service>
  7.     <maplet:ErrorService>No Access!</maplet:ErrorService> 
================================================


engine page (maplet)
filename : Controller.java
================================================
Expand|Select|Wrap|Line Numbers
  1. package Model;
  2.  
  3. import org.j2os.shine.maplet.*;
  4. import org.j2os.shine.jconnection.JDBC;
  5. import java.sql.*;
  6.  
  7. public class Controller extends Maplet {
  8.     public String name;
  9.     public String email;
  10.     public String ph_num;
  11.     private String forward_tag,forward_page;
  12.     JDBC db=new JDBC();
  13.  
  14.     public void initialize() throws Exception{
  15.  
  16.         db.login("com.mysql.jdbc.Driver","jdbc:mysql://localhost/j2os", "Username", "pass", true); 
  17.  
  18.     }
  19.  
  20.     public void addEmail() throws Exception {
  21.         boolean a=db.executeSQLQuery("insert into email_table (name,email) values ('"+name+"','"+email+"')");
  22.         forward_page="../service/EmailServiceResponses.jsp";
  23.         if (a) {
  24.             forward_tag = "add_success";
  25.         } else {
  26.             forward_tag = "add_error";
  27.         }
  28.     }
  29.     public void searchEmail() throws Exception {
  30.         ResultSet r = db.getSQLQueryContent("select email from email_table where name like '"+name+"'");
  31.  
  32.         while (r.next()) {
  33.             email= r.getString("email");
  34.         }
  35.         addURL("email",email);
  36.         forward_page="../service/EmailServiceResponses.jsp";
  37.         if (!(email.equals(""))) {
  38.             forward_tag = "search_success";
  39.         } else {
  40.             forward_tag = "search_error";
  41.         }
  42.     }
  43.     public void addPhoneNumber() throws Exception {
  44.         boolean a=db.executeSQLQuery("insert into phon_table (name,phone) values ('"+name+"','"+ph_num+"')");
  45.         forward_page="../service/PhoneServiceResponses.jsp";
  46.         if (a) {
  47.             forward_tag = "add_success";
  48.         } else {
  49.             forward_tag = "add_error";
  50.         }
  51.     }
  52.     public void searchPhoneNumber() throws Exception {
  53.         ResultSet r = db.getSQLQueryContent("select phone from phone_table where name like '"+name+"'");
  54.  
  55.         while (r.next()) 
  56.         {
  57.             ph_num= r.getString("phone");
  58.         }
  59.         addURL("ph_num",ph_num);
  60.         forward_page="../service/PhoneServiceResponses.jsp";
  61.         if (!(ph_num.equals(""))) 
  62.         {
  63.             forward_tag = "search_success";
  64.         } else {
  65.             forward_tag = "search_error";
  66.         }
  67.     }
  68.  
  69.     public void rater() throws Exception {
  70.         db.commit();
  71.         forward(forward_page, forward_tag);
  72.     }
  73. }
================================================== =
Jul 22 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: John MacIntyre | last post by:
Hi, Can anybody give me a hint as to how to convert a javascript array into a vbscript array? BTW-it only needs to work in IE5 & 6 Thanks in advance, John MacIntyre VC++ / VB / ASP /...
15
by: Alex Vinokur | last post by:
I am looking for any custom allocator sample code for std::vector. Thanks. -- Alex Vinokur http://mathforum.org/library/view/10978.html http://sourceforge.net/users/alexvn
1
by: Curious | last post by:
Hi List, Obviously my google-fu is very weak and I can't find a simple sample code for C++ that allows me to simply download the source of a specified web page. I'm looking at downloading the...
2
by: Sivana | last post by:
Hey, Does anyone have any sample code where I can transfer list items between two list boxes. C# and WinForms. Thanks
1
by: Peri | last post by:
Dear All, Can you one give me some sample code for connecting to the SQL server DB and executing a stored procedure in the SQL server using ASP.NET ? I also need to display the result set in...
30
by: Chad Z. Hower aka Kudzu | last post by:
I need to provide a series of demos for an assembly. There are potentialy several dozen of them. None of them are very complex, however maintaining two versions of them will be very maintainance...
4
by: Scott Lezberg \(Deltek\) | last post by:
Does anyone have some sample code that can validate a domain username and password account to check to see if it is a valid account? Thanks in advance. Scott
3
by: Nikolay Petrov | last post by:
I've found some sample code in MSDN, which is interesting to me. There are two problems about it. It is in C# and second it think somethig is wrong with it. The some namespaces used in it does not...
5
by: Will | last post by:
- I know enough ASP and Access to be dangerous :) - I need to put up a data base on our web server with 3 related tables. - They will be accessed by a limited number of people. - Each user will...
0
by: Andrus | last post by:
MSDN Winforms DataGridView VirtualMode with caching sample code DataRetriever loads two pages always to cache thus making 2 database accesses. If datagridview uses one page of data, second page...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.