Protecting Presentation JSP in a MVC Pattern

why should I use "login-config" type authentication to protect my presentation JSP used in an MVC pattern from direct access, when I can protect it simply by placing it in my WEB-INF?

Authentication is not just to protect presentation layer but any resource served by the application server.

Similar Messages

  • Can i use Custom Tags for Database retrieval (as per MVC pattern)?

    In our project we are dealing with database, and i've used the Cutom Tags for database retrieval (as per the Article from Mr Faisal Khan) and it is working fine. But i have a doubt if it affects the performance in any way . I wanted to know if its recommendable to use Custom Tags for the DB retrieval as per MVC Pattern or shall i create a intermediate bean and then call the bean in custom tag.
    Thanks
    Prakash

    Putting database code in your JSPs certainly couples your view to the database. That's usually not good.
    If it's a simple app, it might be justified.
    When you start having lots of pages and complex business logic it becomes less attractive. - MOD

  • MVC pattern in flash builder

    I am trying to figure out the MVC patter in flash builder. I understand we can seperate view and controller by building custom components as view and populate them in the controller file. However, I don't know how to apply the Model login in flash builder. Do i create a Model folder and file and using that file to receive data?
    For example:
    Main controller:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:s="library://ns.adobe.com/flex/spark"
                                     xmlns:mx="library://ns.adobe.com/flex/mx"
                                     minWidth="955" minHeight="600"
                                     xmlns:components="components.*">
              <fx:Declarations>
                        <!-- Place non-visual elements (e.g., services, value objects) here -->
                        <s:HTTPService url="test.come" id="testData" result="testData_resultHandler(event)"/>  //Data here
              </fx:Declarations>
              <fx:Script>
                        <![CDATA[
                                  import mx.collections.ArrayCollection;
                                  import mx.rpc.events.ResultEvent;
                                  public var testData:ArrayCollection;
                                  protected function testData_resultHandler(event:ResultEvent):void
                                            testData=event.result.something...   //How to seperate the Data with the main controller?????
                        ]]>
              </fx:Script>
    //view
              <components:videoList />
         <components:videoList2 />
         <components:videoList3 />
    </s:Application>
    I appreciate any replies. Thanks a lot.

    The usual pattern in flex is to have an mxml component 'the view', an actionscript class (the controller), and some additional actionscript classes that represent the data objects (the model). Your 'main' application class is responsible for creating a new instance of the controller, usually as response to the creationComplete event. The controller then initiallizes/retrieves the 'Model' objects and passes them back to the view which binds them to the appropriate fields. So at the bare minimum for an MVC project your are going to have Main.mxml, MainController.as, and Model.as.
    This is not the most elegant solution since it tends to create tight coupling between the controller and the view. If you want to use the MVC pattern on any project that involves more than 3 or 4 simple views you will probably want to look into a custom MVC framework like Cairingorm or the Tide framework from GraniteDS. Make sure you have a solid understanding of the basics first though. 

  • How to apply mvc pattern  to mastermind game coding?

    Hello,
    I am trying to create the mastermind board. i want to know how to apply the MVC pattern to the design
    View -- creating the board
    Model --??
    Controller --??
    I am not able to understand what should be in the model and what shud be in the controller.
    Can anybody help
    Thanks,
    Manju

    * Model - The model represents enterprise data and the business rules that govern access to and updates of this data. Often the model serves as a software approximation to a real-world process, so simple real-world modeling techniques apply when defining the model.
    * View -The view renders the contents of a model. It accesses enterprise data through the model and specifies how that data should be presented. It is the view's responsibility to maintain consistency in its presentation when the model changes. This can be achieved by using a push model, where the view registers itself with the model for change notifications, or a pull model, where the view is responsible for calling the model when it needs to retrieve the most current data.
    * Controller - The controller translates interactions with the view into actions to be performed by the model. In a stand-alone GUI client, user interactions could be button clicks or menu selections, whereas in a Web application, they appear as GET and POST HTTP requests. The actions performed by the model include activating business processes or changing the state of the model. Based on the user interactions and the outcome of the model actions, the controller responds by selecting an appropriate view.
    http://java.sun.com/blueprints/patterns/MVC-detailed.html

  • 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.

  • How to Compile Jsp File in Class File , Protect my JSP from outworld

    Hello Friends
    My name is chandra prakash, I'm new for u. I've develop a web based software completely in JSP, some files are also written in Java Script. This software have aprox. 40 files --> 30 in JSP + 2 in Java Script + 8 image files .
    Each JSP calls another. and run this on 58 clints machine simultaneusly. we used Oracle 9iAS as back end and Oracle9iAS web Server . Where we found less clients like 20-30 we use Tomcat 5.0 web server .Sir problem is this we don't wan't to leave our jsp source code on server.
    Is any method or third party tool by which we can convert our JSP source file in CLASS file as like real class files provide by javac.
    For this perpose we make a folder and put all files in it. Create a context on Tomcat for this folder.Create a data source for this in tomcat. Bcase this program uses Data source and connect many times to database & fetches many type of data from database. We use servlet files of tomcat for this context in WORK folder of Tomcat. and after that rename our Source file Folder. and again run our program through batch file i'm strange program runs 2-3 steps, after few times it start producing errors.
    Sir do u hava work on this field can u help me to protect this JSP source code.
    I've Use Jikes.com compiler but not get any succes, It may be i'm not using correctly .
    Pls sir give me any suggesition.
    Chandra prakash

    1. Highlight your web project or the individual file
    2. Right click
    3. Select Rebuild to build all jsp files or Make to rebuilt only changed files

  • Java server faces mvc pattern

    Well i dont know any knowledge of java servr faces.Dows java Server faces encapsulate mvc pattern like struts other then html tag library.
    Thanks.

    JSF only addresses the "user interface" framework portion of a web application. You can perhaps think of it as standardizing the "V" in MVC (I don't know if this is quite right, is it so Craig?). We wish that there will be another JSR in the future that standardizes rest of the "C" of the MVC.
    -Mete

  • MenuItem ActionListener bug (MVC pattern)

    Hello. I'm implementing a book store system using the MVC pattern, but due to the fact that the method actionPerformed() is in class libraryController it doesn't work (and I need it in this class due to the MVC pattern). Can anyone help me? Thanks.
       class libraryView extends JFrame{
      JMenuItem addBook = new JMenuItem("Add Book");
      JMenuItem deleteBook = new JMenuItem("Delete Book");
       JMenuItem modifyByTitle = new JMenuItem("Modify by Title");
       JMenuItem modifyByAuthor = new JMenuItem("Modify by Author");
       JMenuItem searchByTitle = new JMenuItem("Search by Title");
        JMenuItem searchByAuthor = new JMenuItem("Search by Author");
        JMenuItem searchByID = new JMenuItem("Search by ID");
        JMenuItem bookListing = new JMenuItem("Book Listing");
       public JPanel createContentPane()
            JPanel totalGUI = new JPanel();
            totalGUI.setBackground(Color.white);
            totalGUI.setMinimumSize(new Dimension(300, 200));
            totalGUI.setPreferredSize(new Dimension(500, 500));
            totalGUI.setMaximumSize(new Dimension(300, 200));
            totalGUI.setOpaque(true);
            return totalGUI;
        public JMenuBar createMenuBar(){
            JMenuBar menuBar = new JMenuBar();
            JMenu menu = new JMenu("Options");
            menuBar.add(menu);
            menuBar.setBackground(Color.pink);
            addBook.setFont(new Font("Helvetica",Font.PLAIN,13));
            menu.add(addBook);
            deleteBook.setFont(new Font("Microsoft Sans Serif",Font.PLAIN,13));
            menu.add(deleteBook);
           JMenu modifyBook = new JMenu("Modify Book");
            modifyBook.setFont(new Font("Helvetica",Font.PLAIN,13));
            menu.add(modifyBook);
            modifyByTitle.setFont(new Font("Helvetica",Font.PLAIN,13));
            modifyBook.add(modifyByTitle);
            modifyByAuthor.setFont(new Font("Helvetica",Font.PLAIN,13));
            modifyBook.add(modifyByAuthor);
            JMenu searchBook = new JMenu("Search Book");
            searchBook.setFont(new Font("Helvetica",Font.PLAIN,13));
            menu.add(searchBook);
            searchByTitle.setFont(new Font("Helvetica",Font.PLAIN,13));
            searchBook.add(searchByTitle);
            searchByAuthor.setFont(new Font("Helvetica",Font.PLAIN,13));
            searchBook.add(searchByAuthor);
            searchByID.setFont(new Font("Helvetica",Font.PLAIN,13));
            searchBook.add(searchByID);
            bookListing.setFont(new Font("Helvetica",Font.PLAIN,13));
            menu.add(bookListing);
            return menuBar;
        private static void createAndShowGUI(){
            //Create and set up the window.
            // JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("[=] JMenuBar [=]");
            //Create and set up the content pane.
            libraryView libr_obj = new libraryView();
            frame.setContentPane(libr_obj.createContentPane());
            // We now also set the MenuBar of the Frame to our MenuBar
            frame.setJMenuBar(libr_obj.createMenuBar());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
       public void init_view(){
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
        void MenuActionListeners(ActionListener al) {
            addBook.setActionCommand("addBook");
            addBook.addActionListener(al);
            deleteBook.setActionCommand("deleteBook");
            deleteBook.addActionListener(al);
            modifyByTitle.setActionCommand("modifyByTitle");
            modifyByTitle.addActionListener(al);
            modifyByAuthor.setActionCommand("modifyByAuthor");
            modifyByAuthor.addActionListener(al);
            searchByTitle.setActionCommand("searchByTitle");
            searchByTitle.addActionListener(al);
            searchByAuthor.setActionCommand("searchByAuthor");
            searchByAuthor.addActionListener(al);
            searchByID.setActionCommand("searchByID");
            searchByID.addActionListener(al);
            bookListing.setActionCommand("bookListing");
            bookListing.addActionListener(al);
    class libraryController implements ActionListener{
         libraryModel model;
         libraryView view;
       public libraryController (libraryModel model, libraryView view) {
            this.model = model;
            this.view  = view;
            this.view.init_view();
            view.MenuActionListeners(this);
       public void actionPerformed(ActionEvent ae)
        String action_com = ae.getActionCommand();
            if (action_com.equals("addBook"))
              System.out.println("add Book");
    }

    Thanks. I think you were right with the new object created, but I still have the problem, although I add the menu bar directly to the frame. Could you provide me a good link or smtg cause I really can't figure it out how to do it. Thank you.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package librabrymanagementf;
    import java.awt.event.ActionEvent;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    public class Main {
        public static void main(String[] args) {
                  // Creates a model of the system logic.
            libraryModel model = new libraryModel();
            // Creaties a view for the system logic.
            libraryView view = new libraryView();
            // Creates a controller that links the two.
            libraryController controller = new libraryController(model, view);
      class libraryModel{
      class libraryView extends JFrame{
        JFrame frame = new JFrame("[=] JMenuBar [=]");
        JMenuItem addBook = new JMenuItem("Add Book");
        JMenuBar menuBar = new JMenuBar();
        JMenu menu = new JMenu("Options");
        public libraryView()
        frame.setSize(400,400);
          frame.setVisible(true);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          menuBar.add(menu);
          menu.add(addBook);
          menu.add(deleteBook);
          frame.setJMenuBar(menuBar);
        public void MenuActionListeners(ActionListener al) {
            addBook.setActionCommand("addBook");
            addBook.addActionListener(al);
    class libraryController implements ActionListener{
         libraryModel model;
         libraryView view;
       public libraryController (libraryModel model, libraryView view) {
            this.model = model;
            this.view  = view;
            view.MenuActionListeners(this);
       public void actionPerformed(ActionEvent ae)
        String action_com = ae.getActionCommand();
            if (action_com.equals("addBook"))
              System.out.println("oki");
       

  • Observer, MVC pattern

    Hi!
    I am trying to learn about the Observer, MVC pattern.
    The problem is that I cant find any good tutorial... Does anyone know any?

    Hi!
    Sorry for the delay, I have been away!
    I hear what you are saying. Can you then recommend me some Observer guide?
    Can you please give me some tips on how I should design the program.
    This is the design problem I have:
    In the program there are about 4 different components where each component is well suited for the MVC-pattern.
    These for components depend on each other. So for example if the components are A, B, C and D, D can depend on A, B and C. But B only depends on A and B. "depend" may be blurry. In the first case were D depended on A, B and C. That means that when something happens in A, B or C. They will have to update/call a method or something like that in D.

  • Design dialog program using the MVC pattern

    Hi,
    I have to design a dialog program using the MVC pattern , with all the controllers lying inside function modules.
    I have searched out on net and could find out that BSP applications are designed using the MVC concept.Please suggest how can the dialog program be designed using MVC pattern.

    I'm currently developing a classic Dynpro dialog program.  I have a module pool, with screens.  I've tightly coupled the module pool with a controller class.  Anything that happens in the module pool, is handled by the controller class. All the logic of screen handling is done by the controller class.
    What remains in the module pool is the capturing of the okcode. the next screen to go to (if applicable), the setting of field attributes.  But the okcode is sent straight to the controller for processing, and the screen/field information is also held in the controller.
    I've also rewritten the auto-generated tab handling code, so the logic is done via a class. 
    So, it is possible - just aim to have as LITTLE as possible in the module pool or function group.
    The model, of course, is in a separate class.

  • Sample jsp servlet bean (MVC) code

    We want to look into the JSP/Servlet/Bean area for our next project. We wish to understand the technology and as such want to hand build simple applications, and as such do not want to use JDeveloper just yet.
    We have searched and searched for suitable material but cannot anywhere find a sample application that :
    A. Lists contents of a databse table
    B. Each item in trhe list is a link to a page that allows that item, to be edited.
    C. A new item can be added.
    D. Uses the MVC model of JSP/Servlet and bean (preferably with no custom tags)
    There are examples that are too simplistic and do not cover the whole picture. Having spent over 100 GBP on books lately, only to be disappointed with the examples provided, we need to see some sample code.
    The samples provided by Oracle are too simplistic. They should really have provided ones built around the EMP and DEPT tables.
    Anyone know where we can get hold of this sample code.

    At the risk of sounding really dumb the examples are just too complex. There does not appear to be anywhere on the web where I can find a simple JSP/servlet/bean example of the type I described. There is enouigh material describing each individual component, but what I need is an example to cement the ideas, but the ones suggested are too much for a newbie. Even the much vaunted Pet Store thingy causes my eyes to glaze over.
    I dont expect anyone to have written something with my exact requirements, but surely to goodness there must be something that:
    1. On entry presents a search form on a table (e.g. EMP)
    2. On submission list all rows in EMp matchiung the criteria.
    3. The user can either click the link 'Edit' which opens up a form dispalying the row allowing the user to edit and save the changes, or click the 'New' button to show a blank form to create a new EMP.
    All this via a Controller servlet, with the database logic handled by a java bean, and all the presentation done via JSP.
    To me this is the most obvious and instructive example of this technology, but after days of trawling the web, and looking through a number of books, I cannot find such a thing.
    CGI with Perl DBI/DBD was a breeze to work with compared to this stuff ..... maybe ASP with SQL/Server would be a more fruitful use of time.

  • Password Protecting a JSP Home Page

    Hi,
    Can anyone help me set up some type of login & password authentication on a site I have set up on web logic server? It's a portal type home page that has links to some sites but I would like to have password protection before it gets to the portal page. Is there a good way to do this possibly using a JSP.
    Any help would be greatly appreciated.
    Thanks,
    Dino

    Assuming you have a database with usernames and passwords and would use cookies, here's a Q&D approach...
    On your pages, check for the presence of a specific session cookie ( you name it ). You can do this with a simple include file on each page.
    If no cookie:
    Prompt for login. Upon successful login, write session cookie (you named) with value of the current session ID.
    If cookie is found:
    Check it's value against session.getId(). If it matches, let 'em in, otherwise prompt for login.
    good luck!

  • Why servlet is use a contoller in mvc pattern

    hi
    in j2ee technology we have use servlet as a controller. if i have use jsp as a controller what happen

    Nothing stops you from using a Jsp as a controller. However, using jsp as a controller is a bad idea, 'cause jsp s are suited for presentation ie for your views. Use jsps only for displaying data

  • LDAP protection for JSP and Servlets

    Environment: WL 5.1 sp 8 on Solaris 7
    Question: I want to use LDAP Security on my site. Does Weblogic only utilze LDAP
    for servlets. What about my JSP files? And no, I can't protect just a directory
    with iPlanet Web Server because my JSP files are all over my directories and my
    servlets are in my /servlets directory. I need security on some of the jsp files.
    how would I accomplish this?

    Hello
    What do I install in order to create and use .jsp's
    and servlets and jdbc connectivity as well? Is it
    J2SE or J2EE. The answer is "Yes."
    In order to use J2EE, you need J2SE. If you do not feel comfortable with J2SE and programming Java in general (as is suggested by not being able to differentiate between J2SE and J2EE and how to download one/both), J2EE may be a bit complex to get started with.
    My suggestion:
    1) Start Here: http://java.sun.com/learning/new2java/index.html
    2) Download J2SE: http://java.sun.com/j2se/1.5.0/download.jsp choose the JDK 5.0 Update 3
    3) Do a beginners Java Tutorial: http://java.sun.com/docs/books/tutorial/index.html
    4) Read a book, try a lot, get comfortable doing it.
    Then Choose the JDBC:
    http://java.sun.com/docs/books/tutorial/jdbc/index.html
    Then, only after being compfortable in how Java and JDBC work, move to J2EE
    1) Download a Server (examples):
    Full J2EE implementation: J2EE Software Development Kits (SDK)
    Servlet/JSP Engine (Tomcat): http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
    There are others, Tomcat is fairly popular.
    2) Read the server's documentation thoroughly
    3) Read a J2EE tutorial: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
    Note: depending on your server, the above tutorial may only be partially relevant.
    The download section is overwhelming
    and confusing to me :(
    Thanks for any guidance.

  • TreeView Error in MVC pattern

    <htmlb:tree id        = "ztr_dpt"
                      showTitle = "false"
                      table2 = "//MODEL/ZA_IT_TREETAB">
          </htmlb:tree>
    table2(MODEL/ZA_IT_TREETAB) structure:
    treeid   |  childid  |  text   |   statues |   click
    ztr_dpt |   001     |  aaa  |  open     |   001            
    ztr_dpt |   02       |  bbb  |  open     |   02        
    the error text:
    Type conflict in the ASSIGN statement in the program CL_HTMLB_TREE=================CP .
    why?

    the sample itab content you had shown, is it in the same fashion
    whats there in the parent field?
    it should be some thing like below
    Treeid     parent id  child id     
    S       |         |C1       |          |          |
    S       |SA       |C2       |          |          |
    S       |SAB      |C4       |          |          |
    S       |SA       |D5       |          |          |
    S       |SAC      |E        |          |
    Regards
    Raja

Maybe you are looking for

  • Fpga: Communicat​ing between fpga and third party program running on pc

    I am using a C-Rio to control a planar robotic joystick. The goal is to use the joystick as a force feedback controller for a computer game running on a pc. My program as is for now runs a program on the fpga to read the encoder values and run the pw

  • Has support for the iTunes Store been discontinued for G3s?

    Both my sisters have a G3 iBook on which they run iTunes 8 (they can't d/l any newer version as it won't run on a G3). Just recently they have been unable to access the iTunes Store, all they get is a message inviting them to d/l iTunes 10. Has suppo

  • Daemons in java

    Hello, Is there any way to have a Java program detach itself from the console and run in the background as a daemon?

  • MailInfo does not work under Y-OS X

    Under the new Yosemite, MailInfo (to see new mail, etc), does not work. Does not open. Any free substitute to do the same job? Thanks for your help. Cheers.

  • ATP check for EDI orders

    hello all, When we create a sales order manually, we get a delivery proposal screen with the options of choosing different dates and quantity. Can I know how this works with an Inbound EDI order? Whether the sales order will be created with unconfirm