PHP vs ASP vs JSP for using privileges

I want to use logins on a dynamic website.
I was tell that I'd rather use jsp with ejb to do so, as ejb would communicate with the database layer and jsp with the presentation layer. In that way I have to use a very complicated business logic (4 layers).
Would you know an other way to do so, perhaps simpler but as much secure ?
God Bless, Olivier.

Its not really mandatory to use EJBs in your project. EJB's provide alot of useful stuff when you are dealing with databases, and one of those features is security. But it sounds has if you want to restrict who can access anything under a certain folder level or maybe certain file types?
If you are looking to apply this kind of security for example then you should look into Filters and apply your custom filter to /auth/*. You might want to look into using JAAS to handle user grouping and login access. Only problem I found when dealing with JAAS is if you would like to set some session attributes during their login that jaas does not do that. It handles authentication but does not give you events to signal (Hey the user logged in, now lets set this attribute)
I hope this helps.
-Richard Burton

Similar Messages

  • From PHP to JSP for a search-responder.php

    I have been asked to use the "search-as-you-type" solution offered up by Google at [http://code.google.com/p/search-as-you-type/|http://code.google.com/p/search-as-you-type/]. The documentation offered by Google is pretty much straight forward but of course the actual piece of code that gets the data is built in PHP and my client needs this to be used on a page serving up JSP.
    I am learning JSP and moving from PHP and ASP and learning quickly but not quick enough to finish the project.
    Would anyone be able and willing to help me convert the functions in the following PHP code into JSP?
    Thanks in advance to anyone who takes the time to help me.
    <?php
    * Copyright (C) 2006 Google Inc.
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    *      http://www.apache.org/licenses/LICENSE-2.0
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    * Search-as-you-type sample Ajax responder
      // Adding a cache control so that browsers won't cache Ajax requests
      header("Cache-Control: no-cache");
      header("Content-Type: text/html; charset=UTF-8");
       * Get the sample data from the text file.
       * @return array Loaded data
      function GetData() {
        $data = array();
        $file = file("test-data.txt");
        foreach($file as $record) {
          $record = explode("|", trim($record));
          if (count($record) == 4) { // Ignore invalid lines
            $data[] = $record;
        return $data;
       * Get the results based on user's query.
       * @param string $query Query
       * @param array $data Sample data
       * @return array Result array
      function GetResults($query, $data) {
        $results = array();
        $queryLength = strlen($query);
        foreach ($data as $record) {
          if (substr(strtolower($record[0]), 0, $queryLength) == $query) {
            $result = array();
            $result['name'] = $record[0];
            $result['type'] = $record[1];
            $result['content'] = $record[2];
            $result['moreDetailsUrl'] = $record[3];
            $result['style'] =
              ($query == strtolower($record[0])) ? 'expanded' : 'normal';
            $results[] = $result;
        return $results;
      // Get the data and the query
      $data = GetData();
      $query = strtolower(ltrim($_GET['query']));
      // Build response
      $response = array();
      $response['query'] = $query;
      $response['results'] = GetResults($query, $data);
      if (count($response['results']) == 1) {
        $response['autocompletedQuery'] = $response['results'][0]['name'];
      // Output response
      echo "searchAsYouType.handleAjaxResponse(";
      echo json_encode($response);
      echo ");";
    ?>

    Thanks for your comment Gimbal2.
    I have already been thoroughly surprised at how different JSP is from PHP. I am finding quite hard to wrap my head around the whole process to be honest.
    I am beginning to see that JSP and PHP work in a totally different way than each other.
    I am not technically trying to translate or convert the PHP file as much as I am trying to build a file in JSP that does the same functions. The main functions of the PHP script are commented by Google and should be easily enough re-written in JSP in order to produce similar results.
    Since the output needs to be in a JSON format when passed to the .js file you'd think this would be better suited as a .jsp file as well or even a JAVA Applet, Servlet or even a bean. Since the whole site is already built in JSP for a multitude of other functions it seems likely that adding on more to read data from a source file and send it back to the .JS would be straight forward, but I could be wrong. But again I am not familiar enough with JAVA or JSP (yet) to make heads or tails of this.
    1. // Adding a cache control so that browsers won't cache Ajax requests
    2. * Get the sample data from the text file. @return array Loaded data
    3. * Get the results based on user's query.
    * @param string $query Query
    * @param array $data Sample data
    * @return array Result array
    4. // Get the data and the query
    5. // Build response
    6. // Output response

  • How can I use 1 JSP for edit/create functionality?

    Hi All,
    Does anybody have an example of using one JSP for both editing and creating an object? I am pretty sure I can handle most of it, but am not sure about how I can specify different messages from the resource bundle (i.e. modifying the screen title for the different uses, "New Campaign" vs. "Edit Campaign").
    My background is in PHP and DHTML (i.e. more front-end) and I'm just starting with Java and JSF. As such, I want to be sure that I'm using appropriate patterns for my programming.
    Thank you in advance for any help,
    Matt

    I make the difference between modifying an existing object and a new one by the ID in the object. Each object has a unique ID in my app assigned by the database. So if the ID is 0, the user is creating a new object, not stored in the DB yet. I store the object to be edited/modified in the session before displaying the page:
    For the title:
    <h:outputText value="Edit Material" rendered="#{sessionScope.selectedMaterial.materialId != 0}"/>
    <h:outputText value="New Material" rendered="#{sessionScope.selectedMaterial.materialId == 0}"/>For the action buttons:
    <h:commandButton value="Update Material" action="#{MaterialControllerBean.updateMaterial}" rendered="#{sessionScope.selectedMaterial.materialId != 0}"/>
    <h:commandButton value="Create Material" action="#{MaterialControllerBean.createMaterial}" rendered="#{sessionScope.selectedMaterial.materialId == 0}"/>

  • Use PHP or ASP to grab part of another site

    Hello all,
    I have permission to grab certain contents of pages of a site
    that is a
    static site. The static pages are updated fairly frequently,
    otherwise,
    I would just copy and paste.
    I'd like to grab all code that is within a standard div tag
    with an id
    and insert it into my pages.
    Is it possible to do this with script? I'm a beginner at both
    PHP and
    ASP, so any pointers would be great.
    PS: to David Powers--great PHP for DW8 book.
    -John

    John R. Lenz wrote:
    > I'd like to grab all code that is within a standard div
    tag with an id
    > and insert it into my pages.
    >
    > Is it possible to do this with script? I'm a beginner at
    both PHP and
    > ASP, so any pointers would be great.
    It's certainly doable with PHP. Do a Google search for screen
    scraping
    with PHP or page scraping with PHP. You'll find quite a few
    tutorials.
    The theory isn't all that difficult, but a lot depends on
    your PHP
    setup. You may need to use cURL or a socket connection if
    your host has
    disabled allow_url_fopen. It would also be a lot easier if
    the target
    page is valid XHTML and you have PHP 5. You could then use
    SimpleXML to
    loop through the page nodes to find the ID you want.
    Rather than try to scrape the page every time somebody
    accesses your
    site, I would suggest scraping on a regular basis, say once
    an hour, and
    storing the content in a text file or a database. Of course,
    that means
    you need the ability to run PHP files as scheduled events.
    It would be much simpler if the other site used a text file
    as an
    include. You could then grab the include yourself. Much
    simpler, much
    less hassle.
    > PS: to David Powers--great PHP for DW8 book.
    Thanks, John. Glad you liked it.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • How to get values from a table(in jsp) for validation using javascript.

    hi,
    this is praveen,pls tell me the procedure to get values from a table(in jsp) for validation using javascript.
    thank you in advance.

    Yes i did try the same ..
    BEGIN
    select PROD_tYPE into :P185_OFF_CITY from
    magcrm_setup where atype = 'CITY' ;
    :p185_OFF_CITY := 'XXX';
    insert into mtest values ('inside foolter');
    END;
    When i checked the mtest table it shos me the row inserted...
    inside foolter .. Now this means everything did get execute properly
    But still the vallue of off_city is null or emtpy...
    i check the filed and still its empty..
    while mtest had those records..seems like some process is cleaining the values...but cant see such process...
    a bit confused..here..I tried on Load after footer...
    tried chaning the squence number of process ..but still it doesnt help
    some how the session variables gets changed...and it is changed to empty
    Edited by: pauljohny on Jan 3, 2012 2:01 AM
    Edited by: pauljohny on Jan 3, 2012 2:03 AM

  • Best Practice for using JSP in OBPM 10gr3

    Hi Guys,
    We are using JSP for UI in our project. We are new to the OBPM. wants to clarify some things.
    1. is it good to have jsp in screenflows or if we can manage it outside BPM also with same effect
    2. How is the BPM database structured. Is the PAPI API's avaialble to get all the desired information from it.
    3. Is notes/attachments/audits managed in BPM database or if we can manage it in external db also.. how to access these from java if it can be managed in BPM db.
    4. What are the pro's and cons of PAPI vs JMS
    Thanks in Advance!!!!

    1. is it good to have jsp in screenflows or if we can manage it outside BPM also with same effectOthers will probably disagree, but I always say to use Screenflows and to use the out of the box Workspace. They are built in as part of the product and you'll be facing a ton of work trying to duplicate this functionality outside.
    2. How is the BPM database structured. Is the PAPI API's avaialble to get all the desired information from it.Unless it's a project variable or a variable that is marked as "Separated", the instance variables are stored in a single blob in a row in the Engine's database. PAPI can retrieve the instance variable information (I posted something on how to do this a while back on this forum and can find it if you need it).
    3. Is notes/attachments/audits managed in BPM database or if we can manage it in external db also.. how to access these from java if it can be managed in BPM db.The out of the box notes and attachments are also stored as part of the blob. On the project I'm currently on, the customer wanted the attachments stored separately in an external database so we did not use the out of the box attachments. They wanted what they call "tasks" stored in a separate database. These tasks were for ad hoc queries to send a question to any department / user and then store the history of responses and routing.
    4. What are the pro's and cons of PAPI vs JMSSorry - you lost me here. Sure someone else will pick up on the comparison between the API Oracle BPM uses and JMS, but I'm not getting it.
    Dan

  • Need a good charting library (for use in a servlet/jsp environment)

    Anyone know of a good charting library for use in a servlet/jsp environment.

    Use JFreechart combined with cewolf.
    www.object-refinery.com/jfreechart/
    To use charts in a jsp page you can use cewolf ( a taglib) based on jfreechart.
    http://cewolf.sourceforge.net/
    Both are free.

  • Session-scope variable for JSP page used in a frame

    Hi,
    I don't know if there's a way to do this at the same time:
    (1)- assign session scope to a variable (in order to be able to retrieve recurrently the previous value each time the JSP is called);
    (2)- set its visibility in a way that it could be accessed only by the page that defines it. The JSP is used in a frameset along with an other JSP that can potentially define identical session-scoped variable (You understand why I want to keep them separate)
    session.setAttribute():
    seems not to be the thing I need
    pageContext.setAttribute():
    with SESSION_SCOPE, it behaves the same way as session.setAttribute(). with PAGE_SCOPE, condition (1) can't be satisfied.
    Does anybody have an idea ?
    Thanx in advance.

    I can see that you will not want to maintain two different files for every possible page on the site!
    It may be possible to do something like <frameset rows="*" cols="50%,*">
      <frame name="content1" src="file.jsp?frame=one" >
      <frame name="content2" src="file.jsp?frame=two" >
    </frameset>and then in the jsp<%
    String frame=request.getParameter("frame");
    session.setAttribute(frame+"AttributeName",attributeValue);
    %>This will set up two session attributes - "oneAttributeName" and "twoAttributeName". Depending on how many variables you have, this may prove just as difficult to maintain.
    You may end up having to simply pass url parameters between pages to maintain state within the individual frames, which is far from elegant also.
    I am interested in how you end up solving this one.

  • How to use taglibs in JSP for Database access

    Hi
    Could any one please tell me how to use taglibs in JSP for Database access
    with regrds
    Jojo

    This is a sample how to connect to a MySQL database with JSTL 1.0:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>JSTL MySQL</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <c:catch var="e">
    <sql:setDataSource var="datasource" url="jdbc:mysql://Your_Server_Name_Here/You_Schema_Here"
                           user="Your_Username_Here" password="Your_Password_Here"
                           driver="com.mysql.jdbc.Driver"/>
    <c:out value="datasource= ${datasource},  Class = ${driver.class}"/>
    <br />
    <br />
    <sql:query var="deejays" dataSource="${datasource}">SELECT * FROM Your_Table_Name_Here</sql:query>
    <table>
    <%-- Get the column names for the header of the table --%>
    <c:forEach var="columnName" items="${deejays.columnNames}"><th><c:out value="${columnName}"/></th></c:forEach>
    <tbody>
    <%-- Get the value of each column while iterating over rows --%>
    <c:forEach var="row" items="${deejays.rows}">
      <tr><c:forEach var="column" items="${row}">
            <td><c:out value="${column.value}"/></td>
          </c:forEach>
      </tr>
    </c:forEach>
    </tbody>
    </table>
    </c:catch>
    <br />
    <br />
    <c:if test="${e!=null}"><span class="error">Error</span>�
      <c:out value="${e}" />
    </c:if>
    </body>
    </html>And this thread might help you:
    http://forum.java.sun.com/thread.jspa?threadID=639471&tstart=44

  • Why not use Jsp for  control in MVC2 ?

    hi
    i am rajendra , i am preparing interview FAQ, so please give me my Que. Ans.
    1) we are using servlet for control in MVC2 Module,then why we can not use
    Jsp for control in mvc2
    2) if we used jsp for control in mvc2 then what is disadvantage compare to if using servlet for control in mvc2
    Please give me ans. as soon as..
    Thanks.

    Are you preparing a FAQ for others or are you just cramming before an upcoming interview and someone gave you a set of questions? It looks more like the latter to me.
    If you haven't actually written any MVC based code, you won't be able to snow the interviewer. It's better to just relax, get a good night's sleep and impress them with your willingness to learn, your fit with the team and whatever real accomplishments you have to show.
    If you really want an answer to this I suggest that you try writing an MVC2 system using JSP for the controller, which is possible, and then try doing the same in a servlet, or better yet using a framework like Spring MVC or Struts to provide the servlet for you and let you concentrate on your application.

  • OC4J 9.0.4 migrate to 10.1.3.1 JSP fails using abstract class for ResultSet

    Consider the following JSP code snipet:
    <%
    com.class.SQLDataSource detail = ((com.class.SQLDataSource)request.getAttribute("AcctList"));
    %>
    <%while detail.next()) {detail.getRow();%>
    <tr ...>
    <td ...><%= detail.getString("ACCT") %></td>
    </tr>
    <%}%>
    blah, blah, blah
    class snipet looks like this:
    public abstarct class SQLDataSource extends serializable {
    private ResultSet resultSet = null;
    private PreparesStatement stmt = null;
    public boolean next() throws SQLException {
    boolean result = getResultSet().next();
    return (result);
    public String getString(String columnName) throws SQLExcpetion {
    return getResultSet().getString(columnName);
    public void execute() throws SQLException {
    -- checks stmt
    -- if null generates resultSet from "AcctList.sql" query
    -- if not null, re-executes as-is stmt for a query only
    protected ResultSet getResultSet() throws SQLException {
    execute(); // see above
    return resultSet;
    The problem:
    <%= detail.getString("ACCT") %> generates a NullPointerException
    Yet, if I add debug statements in the SQLDataSouce class, they conclusively show that resultSet has 1902 rows and I can diplay the contents on these rows (on the console, of course, the JSP still generates a NullPointerException).
    If I "hardcode" the creation of a ResultSet in the JSP, the pages displays properly (not the desired method).
    PLEASE TAKE NOTE: This JSP/Class combination works PERFECTLY in OC4J 9.0.4 using JDeveloper 9.0.5.2. When I deploy the **EXACT SAME** JSP/Class combination in JDeveloper/OC4J 10.1.3.1, I receive the NullPointerException.
    So what this feels like to me (and my VERY limited J2EE experinece) is that the abstract class SQLDataSource has somehow lost/closed/dropped/corrupted resultSet when "returning" to the JSP for display of the contents of resultSet. This is, of course, a laymans explanation of the experienced effect of running this code.
    It makes me wonder if under 10.1.3.1 "something more" must be done so that the (abstract) SQLDataSource class can operate in the same way it did under 9.0.4.
    Last note: this NullPointerException happens whether I deploy to standalone OC4J 10.1.3.1 or if I execute my application withing JDevloper's Embedded OC4J instance.
    Any Assistance on this MOST aggrivating problem would be greatly appreciated.
    Others have yet to solve it in similar posts of mine. Hopefully this more definitive description will help YOU be my personal HERO.
    Ed.

    repost to pique interest

  • Plugin for eclipse for using log4j in jsp ?

    Hello all,
    Plz tell me is there any plugin (eclipse) for using log4j in jsp pages similar to log4e. As log4e is not working with jsp in Myeclipse
    Thanx

    Hello Prasad,
    I used log4e plugin to use log4j in eclipse. Its also working fine with servlets in eclipse. For working with web applications i installed MyEclipse. In this when i right click on the servlet editor log4e item is shown for automatic adding of log4j instructions(like adding logger etc) but when i try to use it by opening the jsp page log4e option is not in menu when right clicked. So i think for jsp seperate plugin is needed.
    What do u think.

  • Master-detail jsp for bc4j using JBO tags

    I have created a master-detail jsp for bc4j using JBO tags. However, I can not get the correct result. There are some examples on OTN, but they are about jsp programs. How to define the relationship of the master view-object and the detail view-object?
    Thanks for your help.

    I know you're having a problem upgrading, but...
    Could you upgrade to 9.0.3 and tell us what problems you're encountering?
    Thanks.
    Sung

  • Can anyone give me a bean class for JAVAMAIL, for using in JSP?

    Can anyone give me a bean class for JAVAMAIL, for using in JSP?
    I hate coding everything inside a jsp page!! Anyone out there who can help me out??

    hi
    see my post in the javamail forum... here you can see a bean.. I'm trying to connect it with the mysql database - may you can help me

  • PHP to ASP?

    Hi!
    We are looking into upgrading our intranet files at my company. Right now, although they are effectively "plain vanilla" html, for some reason we have been using the asp format.
    Our next evolution may involve using FMStudio to allow the intranet users to interact with our Filemaker database. These pages would be output in the php format.
    I am wondering if I can convert these to asp without losing significant functionality. Thanks!

    Xynoplas wrote:
    ...whether a page with an .asp extension can be used to call PHP functions, and how this would be done.
    In case you´re running an Apache server, this is possible by adding one of the following lines to a .htaccess file which should be placed in the "public_html" user directory to affect all .asp files
    a) AddType application/x-httpd-php .asp
    b) AddHandler application/x-httpd-php .asp
    Version a) applies when PHP is installed as module in Apache, the second version is suitable when PHP is installed as CGI binary.
    The result is, that your .asp pages will be parsed by PHP and hence can contain PHP stuff.

Maybe you are looking for

  • Error messages appear while booting Satellite A100

    I tried booting my notebook and this error messages are displayed: system bios shadowed, video bios shadowed, resource conflict-PCI serial bus controller on motherboard Bus:07, Device:06, Function 01 resource conflict-PCI mass storage controller on m

  • Population of Oracle DBs from XML?

    Forgive me if I haven't fully understood Oracle's new XML parser for Java, but is it possible to >>directly<< populate an Oracle database from an XML file or do you have to use the Java parser. As a developer using Delphi it would be most useful to h

  • Problem to installing oracle9i software! please help me..

    Hai good afternoon!! When i am installing oracle9i software it displaying the following error. Please tell how i am clear this error.. please help. Advanced thank you to all Configuration Tools Tool Name Status Agent configuration Assistant failed(se

  • File Adapter: Flat-file to XML

    New to the Oracle ESB. I am using the file adapter to read in a fixed-length flat file, have mapped it to an xsd and now I just want to dump the resulting xml into a directory. I don't see an obvious way to do this without converting it back to a fla

  • Storage problem

    Hello. I have a problem with the storage of my Mac. In Mac's Info it shows that my Apps are 161 GB, but the problem is that my full storage is 121GB, please tell me how can I solve the problem.