MVC �Best Practice� (handling multiple views per action/event)

Looking for the best approach for handling multiple views for one action/event class? Background: I have a small application using a basic MVC model, one controller servlet, multiple event classes, and multiple JSP views. For performance reasons, the controller Servlet is loaded once, and each event class is an instance within it. Each event has an �eventProcess()� and an �eventForward()� method called by the controller, standard stuff.
However, because event classes should not use instance variables, how should I communicate which view to forward to should based upon eventProcess() logic (e.g. if error, error.jsp, if success, success.sjp)? Currently, there is only one view mapped per event, and I'm having to put error handling logic in the JSP, which goes against the JSP being for just view only.
My though was 1) A session object/variable that the eventProcess() sets, and the eventForward() reads, or 2) Have eventProcess() return a mapping key and have the conroller lookup a view page based upon that key, as opposed to 1-1 event/view mapping.
Would like your thoughts!
Thanks
bRi

Your solution seems ok to me, but maybe the Struts framework from Apache
that implements MVC for JSP is a better solution for you:
http://jakarta.apache.org/struts/index.html
You should take a look at it. It has in addition some useful taglibs that makes life much easier.
We have successfully used it in a project with about 50 pages.

Similar Messages

  • Best Practice for Multiple iTunes and One Account?

    My wife and I share our account for our iPhone Applications and Songs in iTunes.
    Can someone point me to a topic that covers a best practice for multiple iTunes syncing?
    I travel a lot and keep my iPhone synced to my Macbook Pro while she uses the workstation at home to sync to. We keep the addresses and contacts and calendars synced through MobileMe, however, I'm trying to find the best way of pushing applications and songs I've bought over to the other PC so they're still around while I'm traveling for her to sync with.
    Thoughts?

    Hi Steve,
    Might be trying for solution for a long time, If i understood your question clear let me clarify you few points.
    You are trying to access the bex query which is designed with the exit's in the background based on the logic and trying to call the entire dimensions and key-figures in a single connection. Then you are trying to map those data in the charts.
    Steve, try to make more connections based upon the logic and split them. use the same query but split them by sales per customer group, sales per day, sales per week by making three different connections and try. You can merge the prompts from all connections.
    Hope this Helps!!!
    Sorry if i misunderstood your question.
    --SumanT

  • Best practice for multiple instances of the same BEX query

    Hi there,
    I'm wondering what's the best way to use multiple instances of the same BEX query. Let me explain what I mean:
    I have a dashboard with different queries feeding different period of time such as: week to date, month to date and so on. One query for each since it is based on a user exit.
    For each query I want to show different data in different sections of my dashboard. Per example: sales per directors or sales per customer group, sales per day, sales per week and the like.I tried to connect a simple bar chart via a direct connection but with no success due to the multiple lines generated by the addition of the sales director, customer group, week number and so on.
    My question is about the way to connect the different queries efficiently in order to show the different data while avoiding multiple useless lines.
    The image above shows the query browser where, per example, for a Month to date query there will be mutiple line for each week as well as one line for each director. If, for two different components, I want to show data per week and data per director or other representation what is the best practice:
    Add another instance of the same query and only put the week information and another one will only the director info?
    Should I bind those to the excel file and use formulas to make final calculations?
    Will there be a performance issues for adding different instances of the same query
    I have 6 different queries (read 6 user exit that filters time via user exit).
    Depending on the best practices there might be 4 instances for each for a total of 24 instances in the query browser.
    I hope my question is clear enough, if not please do not hesitate I'll clarify as much as possible.
    Regards,
    Steve

    Hi Steve,
    Might be trying for solution for a long time, If i understood your question clear let me clarify you few points.
    You are trying to access the bex query which is designed with the exit's in the background based on the logic and trying to call the entire dimensions and key-figures in a single connection. Then you are trying to map those data in the charts.
    Steve, try to make more connections based upon the logic and split them. use the same query but split them by sales per customer group, sales per day, sales per week by making three different connections and try. You can merge the prompts from all connections.
    Hope this Helps!!!
    Sorry if i misunderstood your question.
    --SumanT

  • Best practice to create views

    Hi,
    I've a question about best practice to develop a large application with many complex views.
    Typically at each time only one views is displayed. User can go from a view to another using a menu bar.
    Every view is build with fxml, so my question is about how to create views and how switch from one to another.
    Actually I load fxml every time the view is required:
    FXMLLoader loader = new FXMLLoader();
    InputStream in = MyController.class.getResourceAsStream("MyView.fxml");
    loader.setBuilderFactory(new JavaFXBuilderFactory());
    loader.setLocation(OptixController.class.getResource("MyView.fxml"));
    BorderPane page;
    try {
         page = (BorderPane) loader.load(in);
         } finally {
              if (in != null) {
                   in.close();
    // appController = loader.getController();
    Scene scene = new Scene(page, MINIMUM_WINDOW_WIDTH, MINIMUM_WINDOW_HEIGHT);
    scene.getStylesheets().add("it/myapp/Mycss.css");
    stage.setScene(scene);
    stage.sizeToScene();
    stage.setScene(scene);
    stage.sizeToScene();
    stage.centerOnScreen();
    stage.show();My questions:
    1- is a good practice reload every time the fxml to design the view?
    2- is a good practice create every time a new Scene or to have an unique scene in the app and every time clear all elements in it and set the new view?
    3- the views should be keep in memory to avoid performace issue or it is a mistake? I think that every time a view should be destroy in order to free memory.
    Thanks very much
    Edited by: drenda81 on 21-mar-2013 10.41

    >
    >
    My questions:
    1- is a good practice reload every time the fxml to design the view?
    2- is a good practice create every time a new Scene or to have an unique scene in the app and every time clear all elements in it and set the new view?
    3- the views should be keep in memory to avoid performace issue or it is a mistake? I think that every time a view should be destroy in order to free memory.
    In choosing between 1 and 3 above, I think either is fine. Loading the FXML on demand every time will be slightly slower, but assuming you are not doing something unusual such as loading over a network connection it won't be noticeable to the user. Loading all views at startup and keeping them in memory uses more memory, but again, it's unlikely to be an issue. I would choose whichever is easier to code (probably loading on demand).
    In choosing between reusing a Scene or creating a new one each time, I would reuse the Scene. "Clearing all elements in it" only needs you to call scene.setRoot(...) and pass in the new view. Since the Scene has a mutable root property, you may as well make use of it and save the (small) overhead of instantiating a new Scene each time. You might consider exposing a currentView property somewhere (say, in your main controller, or model if you have a separate model class) and binding the Scene's root property to it. Something like:
    public class MainController {
      private final ObjectProperty<Parent> currentView ;
      public MainController() {
        currentView = new SimpleObjectProperty<Parent>(this, "currentView");
      public void initialize() {
        currentView.set(loadView("StartView.fxml"));
      public ObjectProperty<Parent> currentViewProperty() {
        return currentView ;
      // event handler to load View1:
      @FXML
      private void loadView1() {
        currentView.set(loadView("View1.fxml"));
      // similarly for other views...
      private Parent loadView(String fxmlFile) {
        try {
         Parent view = FXMLLoader.load(getClass().getResource(fxmlFile));
         return view ;
        } catch (...) { ... }
    }Then your application can do this:
    @Override
    public void start(Stage primaryStage) {
       Scene scene = new Scene();
       FXMLLoader loader = new FXMLLoader(getClass().getResource("Main.fxml"));
       MainController controller = (MainController) loader.getController();
       scene.rootProperty().bind(controller.currentViewProperty());
       // set scene in stage, etc...
    }This means your Controller doesn't need to know about the Scene, which maintains a nice decoupling.

  • Tabular Model Best Practice - use of views

    Hi,
    I've read in some sites that using views to get the model data is a best practice.
    Is this related to the fact tables only right? Friendly names can be configured in the model, so views can be used to restrict data volume but besides from that what are the other advantages?
    Model needs to know all the relation between tables, so using a unique view that combines joins to present one big view with all the data isn't useful.
    Best regards

    Yes, I think most people would agree that it isn't helpful to "denormalise" multiple tables into a single view. The model understands the relationships between tables and queries are more efficient with the multiple smaller related tables.
    Views can be helpful in giving a thin layer of independence from the data. You might want to change data types (char() to date etc), split first/last names, trim irrelevant columns or simply isolate the model from future physical table changes.
    In my view, there aren't any hard and fast rules. Do what is pragmatic and cleanest.
    Hope that helps,
    Richard

  • Best-practice for Catalog Views ? :|

    Hello community,
    A best practice question:
    The situtation: I have several product categories (110), several items in those categories (4000) and 300 end-users.    I would like to know which is the best practice for segment the catalog.   I mean, some users should only see categories 10,20 & 30.  Other users only category 80, etc.    The problem is how can I implement this ?
    My first idea is:
    1. Create 110 Procurement Catalogs (1 for every prod.category).   Each catalog should contain only its product category.
    2. Assign in my Org Model, in a user-level all the "catalogs" that the user should access.
    Do you have any idea in order to improve this ?
    Saludos desde Mexico,
    Diego

    Hi,
    Your way of doing will work, but you'll get maintenance issues (to many catalogs, and catalog link to maintain for each user).
    The other way is to built your views in CCM, and assign these views to the users, either on the roles (PFCG) or on the user (SU01). The problem is that with CCM 1.0 this is limitated, cause you'll have to assign one by one the items to each view (no dynamic or mass processes), it has been enhanced in CCM 2.0.
    My advice:
    -Challenge your customer about views, and try to limit the number of views, with for example strategic and non strategic
    -With CCM 1.0 stick to the procurement catalogs, or implement BADIs to assign items to the views (I experienced it, it works, but is quite difficult), but with a limitated number of views
    Good luck.
    Vadim

  • What is the best practice for changing view states?

    I have a component with two Pie Charts that display
    percentages at two specific dates (think start and end values).
    But, I have three views: Start Value only, End Value only, or show
    Both. I am using a ToggleButtonBar to control the display. What is
    the best practice for changing this kind of view state? Right now
    (since this code was inherited), the view states are changed in an
    ActionScript function which sets the visible and includeInLayout
    properties on each Pie Chart based on the selectedIndex of the
    ToggleButtonBar, but, this just doesn't seem like the best way to
    do this - not very dynamic. I'd like to be able to change the state
    based on the name of the selectedItem, in case the order of the
    ToggleButtons changes, and since I am storing the name of the
    selectedItem for future reference.
    Would using States be better? If so, what would be the best
    way to implement this?
    Thanks.

    I would stick with non-states, as I have always heard that
    states are more for smaller components that need to change under
    certain conditions, like a login screen that changes if the user
    needs to register.
    That said, if the UI of what you are dealing with is not
    overly complex, and if it will not become overly complex, maybe
    states is the way to go.
    Looking at your code, I don't think you'll save much in terms
    of lines of code.

  • Best Practices for multiple authors using single project?

    We are having many issues, particularly with moving, renaming, and multiple check out warnings.  We have a single project with many authors and it seems like RH is not designed to work that way. There is an article in the RH devnet-archive in an article entitled "Sharing RoboHelp Project Among Multiple Authors" that says"
    "At first there may be the temptation to let every author work on every file in a project.  This is certainly not a best practice. Regardless of source contraol, it is always best to designate certain authors as owning certain content-related sections, folders, or topics within a project -particulary at the folder level."
    This statement, and our experience seems to indicate that RH is not a true CMS as we had envisioned.  What are the best practices for this scenario to avoid stepping on each others toes and having problems with source control.

    I have moved this to the source control forum for the gurus there to answer.
    Meantime I must admit I read that statement the same way as you first time. However, on rereading I think what the author is saying is not that what you want cannot be done, rather it is best practice to guide authors to work in discrete areas.
    I will leave it to the author or another guru to give you a more complete answer.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Configuring AD Sites and Services best practice for multiple office site ?

    Hi People,
    Can anyone here please suggest me or share the link of what is the best practice in configuring the AD Sites and Service for single AD domain with multiple office sites ?
    I'd like to know more about the number and the direction of the connection between Domain Controllers in one site to the Data Center and vice versa.
    Thanks.
    /* Server Support Specialist */

    Hi People,
    Can anyone here please suggest me or share the link of what is the best practice in configuring the AD Sites and Service for single AD domain with multiple office sites ?
    This series can be useful:
    Active Directory Structure Guidelines – Part 1
    Mahdi Tehrani   |  
      |  
    www.mahditehrani.ir
    Please click on Propose As Answer or to mark this post as
    and helpful for other people.
    This posting is provided AS-IS with no warranties, and confers no rights.
    How to query members of 'Local Administrators' group in all computers?

  • Best practice for multiple email accounts

    Hello
    I have set up a Mac mini server with virtual hosts. So, how is the best practice to set up email accounts for each host? I want to have emails like
    [email protected]
    [email protected]
    and
    [email protected]
    [email protected]
    and so on.
    Should I create groups for each domain, and then user "info" and "contact" in each group. Or just add a user something like "infomysite1" and have a second short name "[email protected]"
    Advices are welcome
    Best regards, Magnus

    If user1@domain1 and user1@domain2 are the same person then you just add the other domain to Hosting-> Local Host Aliases. Same user will get all mail for both domains.
    However, I'm presuming that the user1@domain1 and user1@domain2 are two separate people (i.e., same name but different mail account). If so...
    See Chapter: A Mail Service Virtual Host in Apple's Mail Services Administration PDF download at http://www.apple.com/server/macosx/resources/documentation.html
    Also, see MakingVirtual_Mail_Users_in_OS_XServer.pdf from http://osx.topicdesk.com (downloads sections)
    The topicdesk pdf was written for 10.5 server but I think it is still applicable to 10.6 (but follow the Apple doc just in case). However, it is good for explaining why you might want postfix-style aliases rather than the simpler Apple server-style aliases.

  • FIM R2 - best practice handling large AD groups

    On attempting to create large security group (with 35k users) in AD, i get "dropped connection from the domain controller.
    The MS AD guy we have attached here tells me that there are some limitations on LDAP and even some known issues with writing 5k+ objects to a DC.
    Are there any "best practices" for writing large groups to AD?
    /Nicolai

    Well, that is a large group indeed, and I would say most organizations use nested groups instead of adding these behemoths to the directory as they are quite difficult to work with.  If it's a one-time thing, you could create it manually in bite-sized
    chunks with LDIF or the like, so that FIM only has to do small delta changes afterwards.
    The 5,000 member limit mostly applies to groups prior to the change to linked value storage.  What is your forest functional level, and have you verified that this group is using linked values?
    Steve Kradel, Zetetic LLC

  • UI Design - Best Practice when Two UIs Trigger Same Event

    I have an application that allows users to take actions using several methods - right-click context menu selection, menu bar selected, key strokes, etc. I was wondering if anyone had any suggestions as to teh best practices for handling this in Cairngorm...
    Is it best to dispatch the same Cairngorm event in several places? I know this is one of the major reasons to use MVC, but, I hate to create duplicate code - maintenance is pain.
    Would is be considered good practice to have the container that serves as a parent for the context menu, menu bar, etc. to listen for events from these components, and then dispatch the Cairngorm Event?
    Thanks.

    Would it be considered good practice to have the container that serves as a parent for the context menu, menu bar, etc. to listen for events from these components, and then dispatch the Cairngorm Event?
    Yes, this is described by Steven Webster in his series of articles on Cairngorm.
    Dispatching the same Cairngorm event from different locations is a perfectly regular practice. This is even an advantage. The same code (the command, the delegate) can be triggered from different places.

  • Best practice for multiple VIs talking to same PXI

    I am looking for a reccomended practice for my use case, which I feel has to be what a lot of people do/need.
    I have a NI-SCOPE PXI device, but this applies to most instruments on some level.  I have multiple VIs that do simple things, such as one VI that changes the horizontal settings, one VI that changes trigger settings, one VI that reads the current trace from the scope.  How can I have multiple VIs talk to the same instrument, some of them might even be called at the same time.
    Some more specifics about my use case is that I am calling these VIs from a web service, and the trace VI is called very frequently and streamed to the user (via the web service).  
    I was thinking of implementing a VI that would give me the VISA connection for the instrument and a semephore.  I would then have the VI doing the work aquire the semephore, make the instrument calls and then release the semephore.  Are there better or different ways?  Maybe something I am over looking with the semephore implementation?

    Typically for this sort of thing I would have a device handler VI which contains your VIs for talking to the instrument. This VI acts like a 'server' and does your device communications and then you can send commands to the device handler VI (e.g. via a queue/event) and it will return the result.
    I would implement this as a state machine (normally using queues) - states for initialising the device, a state for each action you want to perform and a close/shutdown state when your application finishes.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • How best to handle multiple web sites using iWeb 08

    I currently am using iWeb08. I am maintaining two websites; The church site resides on a Rogers server. I use Transmit as a FTP loader. The other site is an engineering society's website that is posted on Apple's server. I have an ME account just for the latter group. iWebsites is used to alternate between the two sites. The church group has a .ca web address.
    Is it worth upgrading to iWeb 09? How does iWeb09 handle 2 websites? I wish I could publish both to the Mac account but have not figured out how. I must retain the rogers account for viewing the church site
    Has anyone deleted iWebsites from OX10.5.6? How was it done? I know that backups are mandatory before attempting these changes.
    Thanks,
    Bill

    In its current form, iWeb '09 doesn't handle publishing well at all!
    I keep all my sites on separate domain files, each in their own folder. Any site is launched in iWeb by double clicking the domain file. I start each new site from a new, blank domain file.
    I keep all my website folders in a folder in a second dock so that I can launch any site with two mouse clicks - faster than you can launch iWebsites!
    You can publish as many sites as you want to one MobileMe account but you can only have domain name forwarded as Cname. Any more have to use masking with all its inherent problems.
    I would be more inclined to dump MobileMe and publish both sites to a decent hosting company.
    The new iWeb '09 FTP works for some. I have tested it with my server - Host Excellence - which doesn't force you to upload to a Public_html folder and this goes as planned.
    Having said that, I still publish to a local folder as I optimize and upload my files using Web Site Maestro. Once you have published your site for the first time, this application will then use its Smart Handling feature to process the changed files only.
    Unless all your viewers use Macs you have to optimize to get your pages to download in that browser that all the Fred Flintstones of the world use.

  • Best practices for multiple users on a network?

    We have a centralized server storing all of our media, and a Final Share system allowing about 10 clients to connect.  The details of the system aren't important, it mounts just like a local drive on each client and bandwidth is higher than FW800.
    My question is what is the best way to handle cache files, sidecar files, autosave, etc. when passing edits between editors?  What should be stored locally, what can be placed on the server?  Of course all media has to be placed on the server, but can everything else sit alongside the footage? 
    The reason I ask is we started by pointing everything at the server, but now are having the good old Serious Error whenever two editors (in different project files) are referencing the same media.  We'd love to resolve this... assistant editors can't log footage if doing so causes the editor's project file to lock up. 
    Thanks!
    P.S. first tried called adobe phone support about this... not making that mistake again.  The most apathetic customer service rep I think I've ever spoken with told me they wouldn't provide support because our Serious Error was the result of network issues and not their fault.  And then that we should be storing our media files locally.  I didn't see it necessary to mention that local storage on 10 machines isn't that viable with almost 50TB of data.

    klonaton wrote:
    The reason I ask is we started by pointing everything at the server, but now are having the good old Serious Error whenever two editors (in different project files) are referencing the same media.  We'd love to resolve this... assistant editors can't log footage if doing so causes the editor's project file to lock up.
    Hi Klonaton.
    Are you using two Premiere projects or one Prelude project (for logging) and one Premiere project (for editing) ? I'll have to check tomorrow to be absolutely sure but we do sometimes have simultaneous logging and editing with -respectively- Prelude and Premiere through our small network, with no issues.
    Changes to metadata and comment markers created into Prelude instantly appears and update into Premiere. Subclip don't and have to be sent from Prelude to Premiere on the same computer (or the media has to be imported again inside Premiere). I think it's normal considering how subclips work a bit differently in Prelude and Premiere.
    Every files are on a thunderbolt raid drive shared on the network through an iMac. The Media Cache and Media Cache DB are on the network shared drive too, and common to every users and computers.
    Also I don't get if crashes happen when your two projects are running simultaneously or not (in the latter case, that's a huge problem).

Maybe you are looking for

  • Error in using the apache jars with jsf-ibm jars

    Hi, I am doing an application which needs apache jars for implementing the custom component(calendar).The WEB-INF/lib folder contain the jsf-api,jsf-impl jars along with the myfaces and tomahawk jars.When i tried to run the server i am getting the fo

  • Need Inputs on transferring data thru Webservice

    Hi All, Can we use webservice to transfer huge amount of data (i.e. An XML which has 20,000 rows from a table of 15 columns) from the webserver to the client. Currently am passing this as a String. Is it okay to pass it in this way? or is there any o

  • After Sync, Firefox often won't "Open Link in New Window"

    It works fine on the 32 bit laptop but on the 64 bit desktop I usually have to try twice to get the page to open. It seems to work fine if I "Open Link in New Tab" just not a new window. Both computers run Vista and run FF5.0.

  • High level attennuation in remote LAPs

    Hi, I have a 5508 WLC with some LAPs connected to local switch and others connected to remote site. Users connected to remotes LAPs reporte disconecctions ramdomly, after carrying out site survey I noticed low level signal in all remotes LAPs (all LA

  • How I show more episodes on my podcast feed?

    My podcast feed (http://itunes.apple.com/us/podcast/inside-the-phoenix/id502305447) only displays 20 episodes.  What do I need to do to expand it to display 35 episodes?