Model 2 and MVC implementation

Hi. While trying to implement Model 2 with a command patern i realized that i maybe could use reflection insted.
My idea is, to create a new class wich inherit from a abstract calss Action
with the public method perform(), for every new "operation" on my website.
I then use reflection to load this class coresponding to a sudden RequestParameter.
I am interested in hearing what you gurus ;) think about this approach? For
me its seems quite elegant from my chair. But i might be missing some
important issues such as extreem performance overhead eg.
This is from my Controller servlet.
<SNIP>
String operation = "com.pdastore.servletActions." +
request.getParameter("operation");
String NextPage = null;
// Load the class corresponding to the operation name
Class annoclass = Class.forName(operation);
Class[] types = new Class[] { HttpServletRequest.class,
HttpServletResponse.class };
// Invoke Perfom() method
Method method = annoclass.getMethod("perform", types);
NextPage = (String)method.invoke(annoclass.newInstance(), new Object[] {
request,response });
// Redirect to the new page determined from the perfrom method
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(NextPage);
rd.forward(request, response); }
<SNIP>
Anders j, denmark

That's what Struts does.
Action, Command - same pattern, IMO. It's elegant, but GoF is ahead of you on this one.
MOD

Similar Messages

  • WebCenter Sites and Model–view–controller (MVC) framework

    A customer of our started developing their sites using Webcenter Sites, they want to support additional functionality such as transaction management, exception handling, custom logging and so on. I was wondering if anyone has experience with the Model–view–controller (MVC) framework, they consider it an ideal candidate for these features. Has anyone here used the MVC framework in conjunction with WebCenter Sites to write additional java classes, facade layers and utilize the Spring controller to wire the same ? Are you aware of any other options available for this purpose ?
    regards,
    Pietro

    Hi Pietro -
    Using Sites IN a MVC framework is very difficult, because the entire context of WebCenter Sites is burned into the COM.FutureTense.Servlet.SContentServer servlet.  You can't really work around that with any degree of reliability.  Unfortunately, that means that dropping Sites into a pre-existing third party MVC framework doesn't really work. 
    There are a lot of good reasons for that, not the least of which is the two-tiered pagelet-level caching system that makes Sites so very fast at delivery... not that it's any consolation.
    To deal with this some former colleagues of mine and I built the GST Site Foundation ("GSF") framework, which provides a Spring-like MVC container WITHIN sites, instead of the other way around.  If you're familiar with Spring, you'll see patterns similar with the GSF.  My current team and I have blogged about this extensively:
    What is this whole GST Site Foundation thing? | Function1
    Create a Simple "Contact Us" Form with GSF | Function1
    How to Add Your Own DAO to the GSF Actions | Function1
    The full stream is here:  GSF | Function1
    But ultimately, the special sauce is the following: in Sites, create an XML element that contains nothing but a <FTCS> tag, a <CALLJAVA> tag, and a closing </FTCS> tag.  Your CALLJAVA will then call a class that implements the Seed or Seed2 interface, and from in there you have access to the (properly managed) ICS object where you can do all of your magic.  You can then build a lightweight controller here to handle any action you can dream up:
    https://github.com/dolfdijkstra/gst-foundation/blob/master/gsf-wra/src/main/java/com/fatwire/gst/foundation/controller/A…
    Let me know if I can help!
    Regards,
    Tony

  • Do we have a way to get the differences between xtext model before and after partial parse?

    Do we have a way to get the differences between xtext model before and after partial parse?
    As an example i have file contains 4 lines, xtext parsed this file and generated its model, then i made small modification in line number 3, so xtext partially parsed the file and generated another model.
    The question is could we get the nodes that has been deleted from the model?
    could we get the new nodes added to the model?
    could we get the differences between the two models?

    Workflow {
    bean = StandaloneSetup {
    scanClassPath = true
    platformUri = "${runtimeProject}/.."
    // The following two lines can be removed, if Xbase is not used.
    registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
    registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
    component = ParseXextModel{
    //Load the xtext model and keep the reference of the inmem model
    component = DirectoryCleaner {
    directory = "${runtimeProject}/src-gen"
    component = DirectoryCleaner {
    directory = "${runtimeProject}/model/generated"
    component = DirectoryCleaner {
    directory = "${runtimeProject}.ui/src-gen"
    component = DirectoryCleaner {
    directory = "${runtimeProject}.tests/src-gen"
    component = Generator {
    pathRtProject = runtimeProject
    pathUiProject = "${runtimeProject}.ui"
    pathTestProject = "${runtimeProject}.tests"
    projectNameRt = projectName
    projectNameUi = "${projectName}.ui"
    encoding = encoding
    language = auto-inject {
    uri = grammarURI
    // Java API to access grammar elements (required by several other fragments)
    fragment = grammarAccess.GrammarAccessFragment auto-inject {}
    // provides a compare view
    fragment = compare.CompareFragment auto-inject {}
    component = ParseXextModel{
    //Load the xtext model again and keep the reference of the inmem model
    component = CompareModel {
    //Implement this using EMF Comapre to see the differnces between 2 models
    }

  • UML: Composition and its implementation aspect?

    UML: Composition and its implementation aspect using a Nested Class (Is it always or depends or is there another equivalent way?)
    1. I read this thread: http://forum.java.sun.com/thread.jsp?forum=425&thread=306033&start=0&range=15&hilite=false&q=
    2. Now, basically I want to understand:
    a. If a nested class is NECESSARILY a form of composition? Or it depends on the meaning of the presented code and/or the meaning of the requirement?
    b. When there is a composition, should we ALWAYS model it using a nested class and in which case/scenario/example, the choice of nested class is justifiable AND mandatory?
    c. Is there any example that the Composition can be implemented by nested class (es) as well as non-nested class? (Equivalent way)
    d. Depends on c., if there is a choice between a nested class and non-nested class? Which is better and from what angle?
    3. 1M Thanks.

    When you say nested class, I interpret that as a Java inner class.
    If that's true, then I don't think that composition is always modeled as an inner class. It's more likely to be a simple private data member that's a public class type.
    I usually see composition as a non-nested class. In his "UML Distilled", Martin Fowler says aggregation is the part-of relationship. Composition is a stronger variety of aggregation, where the part object may belong to only one whole and lives and dies with the whole.
    So if you have a Polygon class that has a Collection of Points as member data, that's composition. No inner classes in sight. - MOD

  • I am trying to use java  file as Model layer and jsf as presentation layer

    I am trying to use java file as Model layer and jsf as presentation layer and need some help
    I successfully get the value of h:outputText from java file by doing simple binding operation but I am facing problems when I am trying to fill h:dataTable
    I create java file
    package oracle.model;
    import java.sql.;*
    import java.util.;*
    *public class TableBean {*
    Connection con ;
    Statement ps;
    ResultSet rs;
    private List perInfoAll = new ArrayList();
    *public List getperInfoAll() {*
    perInfoAll.add(0,new perInfo("name","username","blablabla"));
    return perInfoAll;
    *public class perInfo {*
    String uname;
    String firstName;
    String lastName;
    *public perInfo(String firstName,String lastName,String uname) {*
    this.uname = uname;
    this.firstName = firstName;
    this.lastName = lastName;
    *public String getUname() {*
    return uname;
    *public String getFirstName() {*
    return firstName;
    *public String getLastName() {*
    return lastName;
    right click on the file and choose 'create data control'
    then i wrote the jsf file:
    *<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>*
    *<f:view>*
    *<h:dataTable id="dt1" value="#{bindings.perInfoAll}"*
    var="item" bgcolor="#F1F1F1" border="10"
    cellpadding="5" cellspacing="3" rows="4" width="50%"
    dir="LTR" frame="hsides" rules="all"
    *>*
    *<f:facet name="header">*
    *<h:outputText value="This is 'dataTable' demo" id="ot6"/>*
    *</f:facet>*
    *<h:column id="c2">*
    *<f:facet name="header">*
    *<h:outputText value="First Name" id="ot1"/>*
    *</f:facet>*
    *<h:outputText style="" value="#{item.firstName}"*
    id="ot2"/>
    *</h:column>*
    *<h:column id="c4">*
    *<f:facet name="header">*
    *<h:outputText value="Last Name" id="ot9"/>*
    *</f:facet>*
    *<h:outputText value="#{item.lastName}" id="ot8"/>*
    *</h:column>*
    *<h:column id="c3">*
    *<f:facet name="header">*
    *<h:outputText value="Username" id="ot7"/>*
    *</f:facet>*
    *<h:outputText value="#{item.uname}" id="ot4"/>*
    *</h:column>*
    *<f:facet name="footer">*
    *<h:outputText value="The End" id="ot3"/>*
    *</f:facet>*
    *</h:dataTable>*
    *</center>*
    *</af:document>*
    *</f:view>*
    but nothing is appear in my table
    I know that there is something wrong in calling the binding object
    I need help pls and where can i find some help to deal with another tag types
    thanks

    i dragged the "perInfoAll" from my "Data Controls" and choosed adf table (even I know that new table with adf tags well be generated and i want table with jsf tags)
    and this code is generated
    *<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"*
    *"http://www.w3.org/TR/html4/loose.dtd">*
    *<%@ page contentType="text/html;charset=UTF-8"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>*
    *<%@ taglib uri="http://xmlns.oracle.com/adf/faces/rich" prefix="af"%>*
    *<f:view>*
    *<af:document id="d1">*
    *<af:messages id="m1"/>*
    *<af:form id="f1">*
    *<af:table value="#{bindings.perInfoAll1.collectionModel}" var="row"*
    *rows="#{bindings.perInfoAll1.rangeSize}"*
    *emptyText="#{bindings.perInfoAll1.viewable ? 'No data to display.' : 'Access Denied.'}"*
    *fetchSize="#{bindings.perInfoAll1.rangeSize}"*
    *rowBandingInterval="0"*
    *selectionListener="#{bindings.perInfoAll1.collectionModel.makeCurrent}"*
    *rowSelection="multiple" id="t1">*
    *<af:column sortProperty="uname" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.uname.label}"*
    *id="c1">*
    *<af:inputText value="#{row.bindings.uname.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.uname.label}"*
    *required="#{bindings.perInfoAll1.hints.uname.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.uname.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.uname.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.uname.tooltip}"*
    *id="it3">*
    *<f:validator binding="#{row.bindings.uname.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *<af:column sortProperty="firstName" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.firstName.label}"*
    *id="c2">*
    *<af:inputText value="#{row.bindings.firstName.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.firstName.label}"*
    *required="#{bindings.perInfoAll1.hints.firstName.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.firstName.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.firstName.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.firstName.tooltip}"*
    *id="it2">*
    *<f:validator binding="#{row.bindings.firstName.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *<af:column sortProperty="lastName" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.lastName.label}"*
    *id="c3">*
    *<af:inputText value="#{row.bindings.lastName.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.lastName.label}"*
    *required="#{bindings.perInfoAll1.hints.lastName.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.lastName.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.lastName.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.lastName.tooltip}"*
    *id="it1">*
    *<f:validator binding="#{row.bindings.lastName.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *</af:table>*
    *</af:form>*
    *</af:document>*
    *</f:view>*
    but when run it i see the following errors
    *Class oracle.adf.model.adapter.bean.BeanDataControl can not access a member of class nl.amis.hrm.EmpManager with modifiers "private"*
    *Object EmpManager of type DataControl is not found.*
    *java.lang.NullPointerException*
    *Class oracle.adf.model.adapter.bean.BeanDataControl can not access a member of class nl.amis.hrm.EmpManager with modifiers "private"*
    *Object EmpManager of type DataControl is not found.*
    *java.lang.NullPointerException*
    :(

  • PL/SQL and Java implementation

    Hi all,
    We need to implement a fast solution for reporting to our existing web application. Application is totally based on stored procedures written in PL/SQL.
    We have already java classes for drawing different types of charts
    named Chartdirector (http://www.advsofteng.com/)
    This library can create chart images in memory.
    I have already read about calling java classes from PL/SQL and SQLJ too.
    My questions are;
    1. Is this safe to include classes to database and create
    reports by using loadjava in real life. I mean not in theory, in real life?
    2. Is there any experiments of the audience about this method?
    3. Would it be any performance problems about this?
    4. Should i prefer to use any Java container and jsps instead of this method?
    I will continue to research for necessary steps after i could see the light :)
    Thank you to all,
    Regards,
    Gokhan

    > 1. Is this safe to include classes to database and create
    reports by using loadjava in real life. I mean not in theory, in real life?
    Yes.
    > 2. Is there any experiments of the audience about this method?
    Experiments and actual implementation - yes. It works. Granted, it does not always work as easy as running the Java code from the command line. But it does work.
    > 3. Would it be any performance problems about this?
    This is a potential problem with any software code.
    4. Should i prefer to use any Java container and jsps instead of this method?
    To be honest, I prefer not using Java for web graphics as I'm not impressed with the quality and flexibility of the graphs generated. I prefer using (and paying for commercial use) for the JPGraph classes for PHP - and using that from PL/SQL (via Zend Core for Oracle).
    Another option is to use SVG and generated SVG directly from PL/SQL. But this requires a browser plugin and SVG also does not look that great. (this is btw what Oracle's HTMLDB does and uses)

  • Hello, Im new to this website. Im having issues with my Macbook. I have the old 2009 model Macbook and it is our schools macbook. The school just upgraded these MacBooks to OSX Mavericks and when i try to open Minecraft it won't let me. It says no jd

    Hello, Im new to this website. Im having issues with my Macbook. I have the old 2009 model Macbook and it is our schools macbook. The school just upgraded these MacBooks to OSX Mavericks and when i try to open Minecraft it won't let me. It says no jdk installed. I also try to install Java SE runtime but half way through the Software Update it says cant download software because of network problem but I'm connected to the internet and i can browse stuff just fine. Can any one help with my problems. P.S. I don't know the administrator password or stuff like that. And yes we are allowed to play games and stuff on these laptops but only at home not at school so don't tell me i need to focus on school and not games. 

    Since you updated the operating system, it is probably Minecraft is missing certain files that ware remove or are not longer comparable with the new version of the OSX. what I recommend, is to check is there is an update for Minecraft and install that. If there is not update available, probably the best thing will be reinstalling Minecraft. Hope this will help you.   

  • I have an apple TV Model A1427 and do not have an icon for youtube. How can I add youtube to the home page?

    I have an apple TV Model A1427 and do not have an icon for youtube. How can I add youtube to the home page?

    Have icon but cannot connect - Please Help.
    Mine is Gen. 2 - Model MC572C/A. I have the YouTube icon but cannot access YouTube.  Message says "No content was found - There is a problem communicating with YouTube. Try again later."  This problem has been for at least 1 month now.  Any ideas?

  • I recently got an Ipod touch model A1213 and I cannot figure out how to get apps on it. I have tried everything and when I try to update software, it says Im already up to date, but my software version is only 1.1.5. How do i fix it?

    I recent recieved and Ipod touch model A1213 and i cannot figure out how to get apps on it. I have tried everything i can think of and when i try to update my ipod software it tells me that its already up to date. even though its only 1.1.5. How do i fix it?

    You have a 1st generation iPod Touch.
    It can be updated to 3.1.3 by purchase. See here Purchasing iOS 3.1 Software Update for iPod touch (1st generation)

  • CIF - Integration model name and APO application

    Hi Experts,
    In the CFM1 Transaction, there are 3 mandatory inputs are Model name, Logical system and APO application.
    Logical systems are customized in CFC1 transaction. I couldn't trace the model name and application creation.
    What is the transaction to customize/Create the new Model name and APO application.
    Hope this is very simple question to you and expect your soon.
    Thanks,
    Saravanan V

    Hi Somnath,
    Thanks for ur reply.
    First I saved the selection as variant. But it was not updated in the IM table.
    Then I tried to generate the model and now I can see the details when I use the F4 help.
    So, to create a integration model need to generate the variant once.
    Thanks for the confirmation.
    Thanks,
    Saravanan V

  • What is the difference between APPLE TV  models 30850MD199LLA and 300024854433?

    What is the difference between APPLE TV  models 30850MD199LLA and 300024854433?

    MD199 is as shown below. The other number is not an Apple model number.
    OVERVIEW
    Introduced     March 2012 (A1427) March 2013 (A1469)
    Discontinued     --
    Model Identifier     AppleTV3,1 (A1427) or AppleTV3,2 (A1469)
    Model Number     A1427 or A1469
    EMC     2528
    Order Number     MD199LL/A

  • I have an older macbook model a1181 and i want to delete everything from it and start from zero?

    I bought a macbook model a1181 and I want to delete all the information cause its missing some icons that I cant seem to fibd anywhere in the computer.

    Insert a compatible Mac OS X install DVD, restart the computer with the C key held down, use the Disk Utility to erase the partition with Mac OS X installed, and then install a fresh OS onto it.
    (107814)

  • I have just received two white I Phones 4 Model MC611LL and they bring along the Face Time feature. I own an older I Phone 4 model MC610 LL and it doesn´t have the Face Time feature. How should I get it?.

    I have just received two white I Phones 4 Model MC611LL and they have the Face Time Feature included. I own an older version of I Phone 4 Model MC610LL and it doesn´t have the Face Time feature included. How can I get it?.

    Where did you get the old one? If it came from the Middle East, FaceTime was removed from those due to government regulations. It can NOT be added back to them.

  • Differences between US and UK implementations for HR and Benefits

    Need to know any information about implementing Oracle HR and basic benefits in Europe (France localization with rollup of others). I have HR, OAB implementation experinece in US. Want to understand the differences between US implementations and UK implementations. Any reference documents welcome.
    Thanks
    Alu

    Alu,
    Here are some starting points, but the list is only a subset of published collateral:
    1. MetaLink Note 315928.1 - HRMS for France - Public Sector Updates FP K - June 2005
    2. MetaLink Note 315927.1 - HRMS for France - Commercial Sector Updates FP K - June 2005
    3. MetaLink Note 273558.1 - P11D Implementation and User Guide 2005-2006
    4. MetaLink Note 356684.1 - UK: Payroll Statutory Deductions User Guide incorporating End of Year and Start of Year 2005-2006
    5. MetaLink Note 236455.1 - Teacher''s Pension Extracts in Oracle HRMS
    6. MetaLink Note 236454.1 - Occupational Sick Pay and Occupational Maternity Pay in Oracle HRMS
    7. Oracle HRMS Implementation Guide B14466-01
    8. Oracle HRMS Implementation Guide (UK) B15575-01
    9. Oracle HRMS Implementation Guide (US) B15548-01
    10. Oracle HRMS Enterprise and Workforce Management Guide (Global) B14467-01
    11. Oracle HRMS Compensation and Benefits Management Guide (UK) B15579-01
    Regards,
    Greg

  • Which table if for BADI and its implementation

    Which table if for BADI and its implementation
    I want to know which implementations have already been created and actived for one BADI.

    Hi
    check the tables for BADI
    SXC_ATTR   
    SXC_ATTRT  
    SXC_CLASS  
    SXC_COCO   
    SXC_EXIT   
    SXC_FCODE  
    SXC_FCODET 
    SXC_IMPSWH 
    SXC_SCRN   
    SXC_TABLE  
    SXC_TABLET 
    Regards
    Anji

Maybe you are looking for

  • Final Cut Studio 2 (Academic Version)

    I am a teacher and we have ordered and received 4 Final Cut Studio 2 packages. It came to us as the academic version. I know you cannot get upgrade to future Final Cut Studio packages, but is that the only difference? Does it have all of the other fe

  • Flash SDK and MacBook Pro with Retina display major issues

    Hello, Apple has recently released Macbook Pro's with Retina displays. I have tested my Flash application on the new laptop, and this is what I observe: My Flex SDK Flash application looks blurry and strange when I try to check it out from any Macboo

  • Problems with mouse clicks..

    Hello. i�m having problems with the mouse clicks in a component... i have events that occur when a click is given and others when 2 clicks are given, but these events occurs only once a while....it�s not always that they occur... can anyone help me w

  • Sending material for Packaging to Vendor & receiving while GR

    Dear All, Kindly help in resolving below issue. I have to procure material from vendor in the container sent by me to him. However I dont want to use item Category L / Subcontracting for the same. We wll not maintain BOM as well. Please tell is there

  • About the file size of Default.png

    Hallo forum members, Is there a 2 MB restriction on [email protected]  as there is on normal JPEG pictures? When I save the [email protected] for a widget the filesize goes up to more than 2 MB, as I save the png with 24 Bit. Using 8 bit depth to sav