Using MVC framework with LCCS

I'm developing a project in PureMVC and seperate skin classes.
Now there are a few 'view' components available in the lccs sdk, but when I use
them they require data far away from the skin. The approach we made in the project
is far from simple but extremely oop based and it's not very nice to use the
standard components in the sdk.
When looking to the WebcamSubscriber for instance, I would like to use basic netstreams in the
skin with live streams. Is there a simple way to get the netstream out of the streamManager
in the sdk? Or do I need to pull apart the WebcamSubscriber and seperate the code?
Thanks, Florus

Ok, sorry for my vague question.
What I'm trying to do is, creating a skin which has got a minimized amount of intelligent code.
To show a webcam there should be only a videocomponent for instance.
That videocomponent can handle netstreams which are created in our framework.
At the moment we are using all the components in the sdk like WebcamSubscriber, etc  for rapid prototyping.
But that component needs a lot of data related references like connectsession, etc which I don't like to pass on
to a skin component.
So, We've looked into the WebcamSubscriber yesterday and found out that the streammanager is indeed the model
layer for the WebcamSubscriber but that it is only meta data. The actual netstream used inside the WebcamSubscriber
is build up on the meta data out of the streammanager. So there's no hard connection between netstreams and streamdescriptors,
if I'm correct?
Then we can split most of the code inside WebcamSubscriber and divide the blocks over our framework. And pass
netstreams to the skin component, which are created in the framework, I would think?
I hope you understand what I'm trying to achieve, and maybe you've got ideas or advices.
Thanks, Florus

Similar Messages

  • Must I use spring Framework with JSF2 and Hibernate?

    Hi all,
    I'm starting to develop a web portal and I would use JSF2 and Hibernate.
    Now I don't know JSF2 so I searched some tutorial.
    I found a tutorial on JSF2 that seems very complete but in this tutorial I found a section where the author use Hibernate for the "model section", JSF2 for the "view section" and Spring for the "controller section"!
    Now I have a doubt, can I develop a web portal without Spring MVC or I can't develop any controller's component with JSF2?
    Thank you for your replies!

    For Ram, do you mean that JSF2 isn't a MVC framework with your reply?
    For Kayaman, the author did some examples how implements some frameworks with JSF2 and he do 3 examples:
    1) JSF2 and JDBC;
    2) JSF2 and Spring;
    3) JSF2, Spring and Hibernate!
    However, after this thread, I found a forum in linked to the tutorial and I asked why they use JSF2 and Spring together! Now Im waiting the answer!
    For Gimbla2: well, I'm novice on JSF2 but I develop for some years with ADF and JBO framework!
    You are right to tell me "On the official sites you can find all informations" but I would know some things from some one that used both frameworks!
    Thanks again to all.
    Edited by: Filippo Tenaglia on 20-giu-2011 14.16

  • Using Entity Framework with SQL Azure - Reliability

    (This is a cross post from http://stackoverflow.com/questions/5860510/using-entity-framework-with-sql-azure-reliability since I have yet to receive any replies there)
    I'm writing an application for Windows Azure. I'm using Entity Framework to access SQL Azure. Due to throttling and other mechanisms in SQL Azure, I need to make sure that my code performs retries if an SQL statement has failed. I'm trying to come up with
    a solid method to do this.
    (In the code below, ObjectSet returns my EFContext.CreateObjectSet())
    Let's say I have a function like this:
      public Product GetProductFromDB(int productID)
         return ObjectSet.Where(item => item.Id = productID).SingleOrDefault();
    Now, this function performs no retries and will fail sooner or later in SQL Azure. A naive workaround would be to do something like this:
      public Product GetProductFromDB(int productID)
         for (int i = 0; i < 3; i++)
            try
               return ObjectSet.Where(item => item.Id = productID).SingleOrDefault();
            catch
    Of course, this has several drawbacks. I will retry regardless of SQL failure (retry is waste of time if it's a primary key violation for instance), I will retry immediately without any pause and so on.
    My next step was to start using the Transient Fault Handling library from Microsoft. It contains RetryPolicy which allows me to separate the retry logic from the actual querying code:
      public Product GetProductFromDB(int productID)
         var retryPolicy = new RetryPolicy<SqlAzureTransientErrorDetectionStrategy>(5);
         var result = _retryPolicy.ExecuteAction(() =>
               return ObjectSet.Where(item => item.Id = productID).SingleOrDefault;
         return result;
    The latest solution above is described as ahttp://blogs.msdn.com/b/appfabriccat/archive/2010/10/28/best-practices-for-handling-transient-conditions-in-sql-azure-client-applications.aspx Best Practices for Handling Transient Conditions in SQL Azure Client
    Application (Advanced Usage Patterns section).
    While this is a step forward, I still have to remember to use the RetryPolicy class whenever I want to access the database via Entity Framework. In a team of several persons, this is a thing which is easy to miss. Also, the code above is a bit messy in my
    opinion.
    What I would like is a way to enforce that retries are always used, all the time. The Transient Fault Handling library contains a class called ReliableSQLConnection but I can't find a way to use this with Entity Framework.
    Any good suggestions to this issue?

    Maybe some usefull posts
    http://blogs.msdn.com/b/appfabriccat/archive/2010/12/11/sql-azure-and-entity-framework-connection-fault-handling.aspx
    http://geekswithblogs.net/iupdateable/archive/2009/11/23/sql-azure-and-entity-framework-sessions-from-pdc-2009.aspx

  • Using Entity Framework with Crystal Master Detail Reporting

    My project is a WPF project connected to a SQL Server Compact Edition database.  Since Crystal does not support nullable types, I have created classes specifically for the report to consume.  This is a simplified version of what I am attempting to do.
    For example...
    class Band
    public string BandName { get; set; }
    public string BandCity { get; set; }
    public List<BandRecording> RecordingsList { get; set; }
    class BandRecording
    public string Year { get; set; }
    public string Description { get; set; }
    In my code behind for this report, I am using Entity Framework to pull the data.  Just pulling information for one band...
    using (RockEntities re = new RockEntities())
    var bandinfo = (from b in re.Band
    where b.BandName == "BT"
    select new
    b.BandName,
    b.BandCity,
    Recordings = b.Recordings.OrderBy(z => z.Year)
    }).FirstOrDefault();
    OK, now I start moving to the data to class I have defined...
    Band b = new Band();
    b.RecordingsList = new List<BandRecording>();
    b.BandName = bandinfo.BandName;
    b.BandCity = bandinfo.BandCity;
    foreach(var Recording in bandinfo.Recordings)
    BandRecording br = new BandRecording();
    br.Year = Recording.Year;
    br.Description = Recording.Description;
    b.RecordingsList.Add(br);
    Since Crystal Supports IEnumerable, I create a list to hold the main record (although I am only reporting on one band)...
    List<Band> lb = new List<Band>();
    lb.Add(lb);
    ReportDocument rd = new ReportDocument();
    rd.Load("BandReport.rpt");
    rd.SetDataSource(lb);
    I have put the Band info in the Report Header section.  This is all working fine. In the details section I would like to put the Band Recording info.  I haven't figured out how to do this.  I have put the fields in the Details section, but how do I tell the details section to use the inner List<BandRecordings>?
    Any help would be greatly appreciated.

    Only way I can see of doing this would be to place emprty formulas into the section. The populate the formula(s) with the required field;
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim Report As New CrystalReport1()
    Dim FormulaFields As FormulaFieldDefinitions
    Dim FormulaField As FormulaFieldDefinition
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    FormulaFields = Report.DataDefinition.FormulaFields
    FormulaField = FormulaFields.Item(0)
    FormulaField.Text = "[formula text]"
    CrystalReportViewer1.ReportSource = Report
    End Sub
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • How to use online Files with LCCS FileManager

    Hi,
    I'm discovering LCCS and the FileManager.
    I would like to use images already uploaded on my server with the FileManager. But i'm don't sure if i have to use "download" or "upload" methods to do it. I don't want to use the "browse()" method, the files have to be loaded from the server to the FileManager when the application starts. Can you give me some examples to do it?
    Thanks,
    (I'm french please, use simple words ).

    http://www.google.com/#sclient=psy-ab&hl=en&q=convert+mxf+avi&oq=convert+mxf+avi&aq=f&aqi= g-v4&aql=&gs_l=hp.3..0i15l4.4835.9343.0.12811.15.13.0.2.2.0.168.1138.11j2.13.0...0.0.EDKQ8 U_mDpc&pbx=1&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=e3a93c99a6099aba&biw=1905&bih=701

  • How to  we  use Tiles Framework  with ADF Faces  ?

    Hello Every body,
    Can anyone tell me whether We mix Tiles framework of Struts, and ADF Faces Framework?
    I 've found that we can mix JSF and Tiles, but can we use ADF Faces and Tiles together?
    Waiting for your answer!
    Thanking you ,
    Samba.

    Dear Experts,
    Please help me !
    As I could not get enough help from you masters,
    I set out to do on my own, hoping that at some time you would come to my rescue.
    I designed a simple jspx page SiteLayout.jspx whose code is given below:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces"
    xmlns:afh="http://xmlns.oracle.com/adf/faces/html"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:tiles="http://jakarta.apache.org/struts/tags-tiles">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>SiteLayout</title>
    </head>
    <body>
    <h:form binding="#{backing_SiteLayout.form1}" id="form1">
    <af:table id="PageLayout" width="100%" >
    <!-- <tiles:getAsString name="title" /> -->
    <f:subview id="siteview">
    <tiles:insert definition="siteLayoutDef">
    <af:table id="headertable" width="100%">
    <tr>
    <td width="100%" colspan="2">
    <f:subview id="header">
    <tiles:insert attribute="header"/>
    </f:subview>
    </td>
    </tr>
    <tr>
    <td width="100%" colspan="2">
    <f:subview id="topview">
    <tiles:insert attribute="topmenu"/>
    </f:subview>
    </td>
    </tr>
    <tr>
    <td width="100%" colspan="2">
    <f:subview id="navigationview">
    <tiles:insert attribute="navigationbar"/>
    </f:subview>
    </td>
    </tr>
    <tr>
    <td width="30%">
    <f:subview id="leftview">
    <tiles:insert attribute="leftmenu"/>
    </f:subview>
    </td>
    <td width="70%">
    <f:subview id="contentview">
    </f:subview>
    <tiles:insert attribute="content"/>
    </td>
    </tr>
    <tr>
    <td width="100%" colspan="2">
    <f:subview id="footerview">
    <tiles:insert attribute="footer"/>
    </f:subview>
    </td>
    </tr>
    </af:table>
    </tiles:insert>
    </f:subview>
    </af:table>
    </h:form></body>
    </html>
    </af:document>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_SiteLayout-->
    </jsp:root>
    My SiteLayout.jspx defines the layout of the pages on my Web application.
    My Home page is this:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:afc="http://xmlns.oracle.com/adf/faces/webcache"
    xmlns:af="http://xmlns.oracle.com/adf/faces"
    xmlns:afh="http://xmlns.oracle.com/adf/faces/html"
    xmlns:afi="http://xmlns.oracle.com/adf/industrial/faces"
    xmlns:graph="/webapp/graph.tld"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:tiles="http://jakarta.apache.org/struts/tags-tiles">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Home</title>
    </head>
    <body>
    <!-- <tiles:getAsString name="title" ignore="true" /> -->
    <h:form binding="#{backing_Home.form1}" id="form1">
    <tiles:insert definition="siteLayoutDef" flush="false">
    <tiles:put name="header" value="/Header.jspx" />
    <tiles:put name="footer" value="/Footer.jspx" />
    <tiles:put name="leftmenu" value="/LeftMenu.jspx" />
    <tiles:put name="content" value="/Content.jspx" />
    <tiles:put name="header" value="/TopMenu.jspx" />
    <tiles:put name="footer" value="/NavigationBar.jspx" />
    </tiles:insert>
    </h:form>
    </body>
    </html>
    </af:document>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_Home-->
    </jsp:root>
    My <tiles-defs> page is this:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
    <tiles-definitions>
    <definition name="tiles-defs"/>
    <definition name="siteLayoutDef" path="/SiteLayout.jspx">
    <!--<put name="title" value="SiteBean.getQuoteofDay()" /> -->
    <put name="header" value="/header.jspx" />
    <put name="footer" value="/footer.jspx" />
    <put name="content" value=""/>
    <put name="topmenu" value="/TopMenu.jspx"/>
    <put name= "leftmenu" value="/LeftMenu.jspx"/>
    <put name="navigationbar" value="/NavigationBar.jspx"/>
    </definition>
    </tiles-definitions>
    My Web.xml is this:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
    </context-param>
    <!-- Tiles ViewHandler config file -->      
    <context-param>      
    <description>Tiles configuration      
    definition files and a listener need to be defined.      
    the listener will initialize JspTilesViewHandlerImpl with tiles definitions.      
    </description>
    <param-name>tiles-definitions</param-name>      
    <param-value>/WEB-INF/tiles-defs.xml</param-value>      
    </context-param>
    <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml, /WEB-INF/tiles-defs.xml</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.jspx</param-value>
    </context-param>
    <context-param>
    <param-name>oracle.adf.view.faces.ALTERNATE_VIEW_HANDLER</param-name>
    <param-value>
    org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl
    </param-value>
    </context-param>
    <filter>
    <filter-name>adfFaces</filter-name>
    <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>adfFaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>resources</servlet-name>
    <servlet-class>oracle.adf.view.faces.webapp.ResourceServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>35</session-timeout>
    </session-config>
    <servlet>
    <servlet-name>Tiles Servlet</servlet-name>
    <servlet-class>
    org.apache.struts.tiles.TilesServlet
    </servlet-class>
    <init-param>
    <param-name>definitions-config</param-name>
    <param-value>/WEB-INF/tiles-defs.xml</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    </web-app>
    The Error I'm getting is :
    IllegalStateException :No ADFRenderingContext;
    What happened?
    Where did I go wrong?
    could you please help me?
    Thanking you in advance,
    Waiting for your response,
    Samba.
    Message was edited by:
    saasira
    Message was edited by:
    saasira
    Message was edited by:
    saasira

  • How to Use Ajax Framework with Netbean6.0

    Hello Friends....
    I am using netbeans IDE to develop Java enabled web application
    now i want to use ajax technology in my webapp.
    So how can i use ajax with netbeans.
    I add Jmaki plugins in netbeans and i got various jmaki component but i dont know how to use them.....!
    Please somebody help me.........

    vasim_saiyad2000 wrote:
    Yes My Friend in the past i made a web application and all html, jsp and java code was written in notepad.
    I want that how to use ajax with java. IDE does not matter i wrote about netbeans because now i am very good aware of netbeans and i am using netbeans ide to develop my app.
    You just tell me how to use ajax with java like .net has some ajax toolkit in its palette..
    How can we use same thing in java /netbeans.Uh, look for a plugin which does that? Or, better, just write code yourself inside Netbeans.
    Can u tell one most import thing .......Suppose when user log in i have created session.
    Suppose user does not logout manually by clicking LOGOUT link its close directly browser so can be I sure that session may have been expired......!
    Please solve my this doubt.....!Implement HttpSessionListener and do the desired task in sessionDestroyed() method.

  • How to use MVC AntiForgeryToken with partial views

    My question is more driven by what is the proper approach when dealing with partial views. Is there a token for each partial view, or the container as a whole?
    Currently our form contains divs for 5 partial views. The user is responding to a list of certification questions, and based on responses 1 or more divs/partial views are displayed. Each partial view is accepted/declined (button select) and the form as a
    whole is submitted (button). Currently, each partial view has its own AntiForgeryToken and corresponding token validation in the controller (in the manner as you indicated).
    With this approach we periodically see the System.Web.Mvc.HttpAntiForgeryException
    If I have a form/view that will display 1 or more partial views based on user responses. Where do I need to place the AntiForgeryToken? In the parent view? In the partial views? Both?
    My theory is that when multiple partial views are represented a mismatch of tokens occurs and the error is reported. My thinking is to move the token to the main/parent view.
    Am I on the right track? Anybody had to deal with something similar?

    Questions related to ASP.NET should be posted in the ASP.NET forums (http://forums.asp.net ).

  • Can I use Text Layout Framework with Flex 3 SDK?

    Greetings,
    I have to develop a complex custom widget, with custom text wrapping behaviour. Text Layout framework seem to offer fine level of control, but we are trying to keep our project in Flash player 9, and therefore we are using Flex 3 sdk.
    Can I use the framework with flex sdk 3 and therefore flash player 9?
    Best Regards
    Seref

    For that you need to install flex sdk 3.5 framework and choose your defauls framework to flex 3.5 it will work and as well instal flash player 10

  • Related to MVC framework(struts)

    Hi all
    Friends i am having a small application which i had developed in servlets and jsp ... The problem is comming when i have to implement in struts..
    means I am having
    1>> 15 Servlet classes
    2>>10 Jsp's
    3>>7 UserServices class (BussinessLogic class)
    4>>3 bean class (for getter and setter methods)
    In this MVC framework the problem is comming at the time when i have
    to implement all the above points in the MVC framework
    please help
    Thanks all

    Hi,
    MVC stands for
    M ---- Model (Business Logic, FormBeans, Database Related)
    V ---- View (JSP, HTML etc..)
    C ---- Controller (Servlet)
    This is how you have to use MVC Framework.

  • Should I use a MVC framework for an large RIA application

    The book of "Adobe Flex 3 Training from the Source" does not
    talk about any MVC frameworks in its
    eCommerce example. I think Flex's events, functions, and mx
    components are MVC already. Do they have to be in separate file to
    call them MVC? I do not find that core Flex is harder to read and
    understand than using a MVC framework. I think using the MVC
    framework would hurt the performance because too many additional
    events are dispatched. Any comments?

    MVC is one design pattern that is pretty darn useful for a
    lot of applications, IMHO. There are frameworks that more or less
    force you to think in MVC pattern terms, like Cairngorm and
    PureMVC. But you certainly don't need to use a framework to create
    an overall design pattern of model, view, controller. However, it
    sure can make it easier if you're doing a large project. The book
    you're talking about is a good example. They don't use a framework
    but they have tried to use a form of MVC in the way that they
    implement all the components to ensure things are loosely coupled.
    As far as hurting performance, I'm no expert but there are so
    many thousands of events occurring all the time in Flex that you
    might actually enhance performance if you take more control by
    using custom events of your own creation within a well designed
    framework.
    I'm a fan of the Mate because I get it and it doesn't impose
    a strict structure like Cairngorm. I don't have a whole lot of
    experience with OOP (though I'm sure getting it thanks to this
    forum). Many others have their own opinions and will surely
    recommend other frameworks. However, the bottom line is that if
    you're doing a big project, I would think it would be a huge help
    to at least have a conceptual framework approach in your mind, if
    not part of the code.
    Here's a video intro to Mate
    http://tinyurl.com/mateintro

  • MVC 4 Using Entity Framework How to save Images in Database

    Iam Beginner to
    MVC 4 ... I want to Upload Image from my form and save to the SQL Database by Using Entity Framework . I have searched alot but couldnt succeed yet,,

    http://forums.asp.net/
    You should post to the MVC section of above forum first.

  • Regarding RESTful WEB SERVICES with SPRING MVC Framework

    Hi,
    Can anyone explain me about RESTful WEB SERVICES with SPRING MVC Framework .
    It is urgent for me.
    Thanks
    Venkat Jalli

    Hi Manoj,
    I am also new to Spring MVC portlet. But, I tried to see the difference between sample spring portlet and your code below. Issue that I can see is, in your code, you have not mapped your servlet container with portlet application. So, in theory, your servlet containder do not know that you have a servlet. Let me try to explain from sample portlet,
    In portlet.xml, they have something like below:-
    <portlet-name>swf-booking-mvc</portlet-name>
    <display-name>Spring Webflow Booking MVC</display-name>
    <portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
    And in web.xml, they have below:-
    <servlet-name>swf-booking-mvc</servlet-name>
    <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
    <init-param>
    <param-name>portlet-name</param-name>
    <param-value>swf-booking-mvc</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    This web.xml is for Pluto portlet container and there will something similar for Weblogic portal as well that I am trying to figure out :(
    Thanks,
    Sanjeev

  • What is your strategy for form validation when using MVC pattern?

    This is more of a general discussion topic and will not necessarily have a correct answer. I'm using some of the Flex validator components in order to do form validation, but it seems I'm always coming back to the same issue, which is that in the world of Flex, validation needs to be put in the view components since in order to show error messages you need to set the source property of the validator to an instance of a view component. This again in my case seems to lead to me duplicating the code for setting up my Validators into several views. But, in terms of the MVC pattern, I always thought that data validation should happen in the model, since whether or not a piece of data is valid might be depending on business rules, which again should be stored in the model. Also, this way you'd only need to write the validation rules once for all fields that contain the same type of information in your application.
    So my question is, what strategies do you use when validating data and using an MVC framework? Do you create all the validators in the views and just duplicate the validator if the exact same rules are needed in some other view, or do you store the validators in the model and somehow reference them from the views, changing the source properties as needed? Or do you use some completely different strategy for validating forms and showing error messages to the user?

    Thanks for your answer, JoshBeall. Just to clarify, you would basically create a subclass of e.g. TextInput and add the validation rules to that? Then you'd use your subclass when you need a textinput with validation?
    Anyway, I ended up building sort of my own validation framework. Because the other issue I had with the standard validation was that it relies on inheritance instead of composition. Say I needed a TextInput to both check that it doesn't contain an empty string or just space characters, is between 4 and 100 characters long, and follows a certain pattern (e.g. allows only alphanumerical characters). With the Flex built in validators I would have to create a subclass or my own validator in order to meet all the requirements and if at some point I need another configuration (say just a length and pattern restriction) I would have to create another subclass which duplicates most of the rules, or I would have to build a lot of flags and conditional statements into that one subclass. With the framework I created I can just string together different rules using composition, and the filter classes themselves can be kept very simple since they only need to handle a single condition (check the string length for instance). E.g. below is the rule for my username:
    library["user_name"] = new EmptyStringFilter( new StringLengthFilter(4,255, new RegExpFilter(/^[a-z0-9\-@\._]+$/i) ) );
    <code>library</code> is a Dictionary that contains all my validation rules, and which resides in the model in a ValidationManager class. The framework calls a method <code>validate</code> on the stored filter references which goes through all the filters, the first filter to fail returns an error message and the validation fails:
    (library["user_name"] as IValidationFilter).validate("testuser");
    I only need to setup the rule once for each property I want to validate, regardless where in the app the validation needs to happen. The biggest plus of course that I can be sure the same rules are applied every time I need to validate e.g. a username.
    The second part of the framework basically relies on Chris Callendar's great ErrorTipManager class and a custom subclass of spark.components.Panel (in my case it seemed like the reasonable place to put the code needed, although perhaps extending Form would be even better). ErrorTipManager allows you to force open a error tooltip on a target component easily. The subclass I've created basically allows me to just extend the class whenever I need a form and pass in an array of inputs that I want to validate in the creationComplete handler:
    validatableInputs = [{source:productName, validateAs:"product_name"},
                         {source:unitWeight, validateAs:"unit_weight", dataField:"value"},
                   {source:unitsPerBox, validateAs:"units_per_box", dataField:"value"},
                        {source:producer, validateAs:"producer"}];
    The final step is to add a focusOut handler on the inputs that I want to validate if I want the validation to happen right away. The handler just calls a validateForm method, which in turn iterates through each of the inputs in the validatableInputs array, passing a reference of the input to a suitable validation rule in the model (a reference to the model has been injected into the view for this).
    Having written this down I could probably improve the View side of things a bit, remove the dependency on the Panel component and make the API easier (have the framework wire up more of the boilerplate like adding listeners etc). But for now the code does what it needs to.

  • Which is more in line with MVC architecture with Struts?

    Hello all
    When using the MVC Model 2 architecture, the JSP's are the view, servlets the control, and the beans are the model. If we say that a control method should represent a specific use case, then in theory, you should be able to call the control method from any interface to request that a specific use case be performed, whether it be over a simple socket connection receiving bytes, or using HTTP.
    However, when using jsp's/servlets, if thr servlet is the control, then it means that the interface must make the request using HTTP and contain a request/response object. But supposing you wanted to change the interface to request the same use case, but makes an http request but supplying XML (instead of several request parameters) which contains the request data, you cannot then simply use the same servlet use-case.
    So what is the solution? If you write another servlet to handle the different request format (XML) it copies a lot of the control code from the other servlet which is a bit messy. Or, would it be correct to write a seperate Controller class (standard Java class), which would contain a set of related use cases, and are called by the servlet. Each use case (which would be a method call in the controller class), would take in its parameter list the exact type and data it needs to complete the use case. In this case the servlets are simply pulling data from the HttpRequest object, converting them to the correct java type to be passed to the controller class you create.
    This introduces an extra layer; the servlet now sits between the request interface and control. It means that the control methods can be called from any type of interface, but is it the right way of doing things, and how would the new control objects be held in the servlet?
    Please could someone give their opinion on which they think is the best way of architecting this?
    Many thanks,
    Shaun.

    Shaun,
    I'm going through the same issues as I try to build my own MVC framework. Struts is useful, but does not cover everything. If you're interested, I've found that the book "Core J2EE Patterns - Best Practices and Design Strategies" by Alur, Crupi and Malks is very helpful. It contains design patterns for all the various tiers. It does not describe a framework, just a set of patterns from which you can pick and choose.
    In the example you describe, one of the applicable patterns is the "Session Facade" which is basically a high-level business interface. The goal is to hide the complexity of the entire business API from the client. The book recommends each facade to correspond to a related set of use cases. e.g. methods in one facade could include OpenAccount, CloseAccount, GetBalance etc. Implementation would be Java classes.
    This facade should be independent of the request protocol and could be used for HTTP, by a Java application, by a web service etc. Usually the facade classes would be located close to the business objects to minimize network delay and traffic.
    In your example, the controller servlet (Struts Action) would invoke services from the Session Facade.
    You're right about this introducing an extra layer. Depending on your present and future needs, you can end up with others such as abstracting the persistence layer. The trade-off is between up-front effort and future flexibility.
    You ask how to reference the new objects. In my case, the initialization servlet calls a factory class method to get references to the facades. These references are stored in an application-specific object that is added as a ServletContext attribute for use by other controller servlets.
    I know this doesn't fully answer your question, but hopefully it helps a little.

Maybe you are looking for

  • 404 can't find page Error when logging into Exchange 2013 OWA, after a refresh, login works

    Hi, I've upgrade two of my customers to Exchange 2013. On of them was coming from 2007, and the other was already running 2010. Migration from both of the servers went good. However with the customer which upgraded from 2010 to 2013 i'm experiencing

  • Multiple fileupload in the Solman support iView

    Hi Solman experts I need to make a modification to the portal solman support iView in order to attach multiples files to a support request (like it is possible to do when creating a OSS message to SAP). I have tried to look at the configuration but i

  • Tree and XML Question

    Hi, I have this XML that is returned from a ColdFusion CFC. So in Flex I have this code: var treeXML:XML = new XML(event.result); I am then assigning this to the dataProvider of my tree. This works fine, but how can I get at each top level node in th

  • R-Tree and Disc IO

    Hi, I have a question how Oracle Spatial saves the data on disc. Is there a connection between r-tree-index-leafes and the data on disc ? Is it the case that data is stored like they are in the index-leafes ? I could imagine that this could have perf

  • LOV in paramter form

    Hi All, I have a parameter called FF_Code and have created a LOV the values are 01A, 02B,03A...11B( database values)as option . And my DATA_MODEL looks like this SELECT      FF_CODES.FF_CODE ,REQUEST_DATE      EMPLOYEES.FIRST_NAME, EMPLOYEES.LAST_NAM