About JSP's application variables

Hi,
I want to use some XML files in my project for which i have got some URLs. Now there are two ways to use the files. The first is that i get these XML files from their particular URLs and store them into application variable, while the second way is, i save them into my disk and use it from disk only. Now i want to know, which one is the best solution.......storing in application variable or storing on disk?

Thanx for your suggestion...
I have around 10-15 MBs of XML files. I just want to
know the access time of getting it from Disk or
getting it from application variable. Which one is
best in regards of access time?Well it depends on how you are trying to access it and what you are accessing. You could use the DOM parser which stores it in memory anyway or the SAX parser , or you could process it with XSLT.
Either ways, you can test the speed yourself. Just use a Java Probing tool to measure performance.

Similar Messages

  • How to Create and Use Application Variables in Java

    I Have this need to have a common variable (Counter) for all the users(Sessions) accessing my Site witch is in JSP.
    I think An Application Variable is the solution for my problem...
    But I don't know how to use this. Even though I search the web for any tutorials or Examples could not fing any.
    Could any one Please tell me or direct me to a site which has good information about this
    Thanks In Advance!!!
    Badsy.

    // get the application object
    public class myServlet extends HttpServlet
    public void doGet(HttpServletRequest req,
                        HttpServletResponse res)
    ServletContext application = getServletContext();
    }

  • Storage capacity of a Application variable?

    Hi All,
    I want to display a common information to all the user.
    The size of the text information(may consists of html content for formatting) may vary each time.
    1) Is storing the information in application variable a better way?
    2) What is the storage capacity of a Application variable?
    3) Cookies storage capacity is 4k and restricts certain characters.Do Application/ Session variable have storage capacity or it restricts any character.
    Regards,
    Maha

    Hello Friend,
    If U are refering about the mem size of implicit Application varible in JSP.
    Then i think U are refering to an Instance related to ServletContext.
    If that is the case it enitrely depens on the webserver you are using.There would few option by which one can fix the cache size but again how to manage that cache space specified between ServletContext,HttpSession,HttpServletRequest and PageContext is entirely dependent upon webserver you are using.....
    U can try referring the link below which is related to SUN-ONE Application server
    http://docs.sun.com/source/816-7150-10/dwdeploy.html
    and as far as restriction is concerned i don't think u would have restriction of storing any unicode charecters..... But i'm not completely sure abt it through.

  • Problem with application-variables - CFLOCK?

    Hi,
    i have a problem with my application. It is a multi-user
    application with 100 parallel-users and CFMX 7.
    The problem wich occures is with application variables. These
    are mainly structs wich get filled onApplicationStart(). The
    problem is, that the variables suddenly disappear, they are empty.
    I have read about CFLock and found out, that it is necesseary
    to use cflock. And i found out, that onApplicationStart does
    correct locking automatically. That is where i do not understand
    the problem. The variables get intialized correctly and in further
    they only get read-access. Why can they be corrupted?
    My other question about that is, wheather i need cflock for
    all Read-Access to Application and Session-Variables, even if there
    happens no writing to the variables?
    Best Regards,
    Andreas

    > ?The element of position 2, of dimension 2, of an array
    object used as part of
    > an expression, cannot be found.?
    > The array is in this case the struct.
    Well, OK, that could be a problem. Arrays are not structs:
    they are two
    different things, are not interchangeable, and have
    completely different
    sets of functions to utilise them. You cannot treat a struct
    as an array.
    If CF is claiming your "struct" is an array, then it actually
    *is* an
    array, not a struct.
    What's the line of code which is generating that error?
    I suppose one could get this error if you have an array of
    structs thus:
    myArray
    .key1
    myArray.key2
    (etc)
    and you're trying to reference it with a numeric key rather
    than by key
    name, eg:
    myArray
    [n]
    When n is an integer value, rather than a string (which
    corresponds to the
    name of the key).
    > > Have you trapped the error, done a <cfdump>
    of the application scope and
    > > checked to see if it's the whole lot going awry, or
    just some values?
    > I have not used cfdump for it, because the server had to
    be immediately
    > restarted for our customers. But i think, that it is
    not completely empty,
    > because the index runs to pos2 of dimenstion2.
    So does this not happen in your dev / testing environment?
    > Will
    > onApplicationStart() be called before? Or only if
    onRequestStart() returns true?
    I would ***-u-me that the application one would be called
    before the
    request one. It's pretty easy for you to test this though, I
    should think?
    (Sorry: for reasons beyond the scope of this conversation,
    we're still
    forced to use Application.cfm in our software, so I've only a
    passing
    knowledge of how Application.cfc works).
    > Here is the code from onRequestStart()
    > <cffunction name="onRequestStart"
    returntype="boolean">
    > <cfargument name="Requestedpage" required="yes" />
    > <cfscript>
    > var lFile = "/cargorent/Login.cfm";
    > var iPosn = ListFindNoCase( lFile,
    Arguments.Requestedpage );
    > if( iPosn gt 0 )
    > return true;
    >
    > if( NOT IsDefined( "session.user.Loginname" ) or
    session.user.Loginname eq
    > "" )
    > {
    > WriteOutput( "<p><p> The current user is no
    longer valid, please log in
    > again.</p></p>" & chr(10) & chr(13)
    > WriteOutput( "<script
    language=""javascript"">parent.location = ""
    http://"
    > & CGI.HTTP_HOST &
    "/Login/Login.cfm"";</script>" );
    > return false;
    > }
    >
    > return true;
    > </cfscript>
    > </cffunction>
    One thing I will say here is that I really think you should
    be separating
    your processing from your display. A function should do
    processing. it
    should pass that processing back to a CFM template which
    should handle
    whatever needs to be displayed on the browser. Although
    that's nowt to do
    with your current issue.
    Adam

  • JSP and Instance Variables

    I have some questions about JSP presentation (Interactive Component Call in Screenflow):
    - Only BPM Objects are possible to be mapped in JSP?
    - Is possible to map two or more BPM Objects to the JSP?
    - What is the difference of mapping using the variable "attributes" in argument mapping and the option "Select BPM object variable" in main task of Interactive Component Call activity?

    I seem to be having a similar problem.
    If I include this fragment, for an instance variable called "contacts" which is a BPMObject of type "ITSSContactRequest".
    <%
    Object r = request.getAttribute("contacts");               
    Class cl = r.getClass();
    out.println(cl.getName());
    %>
    I get the following output:
    xobject.ITSSContactManagement.ITSSContactRequest
    and I can access the object via reflection:
    <%
    Object r = request.getAttribute("contacts");               
    Class cl = r.getClass();
    out.println(cl.getName());     
    Method getGeneralContacts = cl.getMethod("getGeneralContacts", null);               
    Object rv = getGeneralContacts.invoke(r);
    %>
    and access the rv variable accordingly.
    However, if I try and cast the variable directly:
    <%
    Object r = request.getAttribute("contacts");
    Class cl = r.getClass();               
    out.println(cl.getName());
    xobject.ITSSContactManagement.ITSSContactRequest rq = (xobject.ITSSContactManagement.ITSSContactRequest)r;
    %>
    I get the following error message:
    "The task could not be successfully executed. Reason: 'fuego.web.execution.exception.InternalForwardException: UnExpected error during internal forward process.'.
    See log file for more information [Error code: workspace-1258985548580] "
    The same error occurs if I try and import the object via
    <%@ page import="xobject.ITSSContactManagement.ITSSContactRequest" %>
    Thanks for any help.

  • Questions About JSP?

    hi;
    I am php devloper and I am learning Java now.
    I am using NB6.1 , Tomcat 6.0 , J2ee 5.
    I have some questions about devleoping web application with jsp.
    1.What are
    /WEB-INF/web.xml
    /META-INF/context.xml
    /META-INF/MANIFEST.MF
    files that generated with NB.are important or optional.are auto generated or may I edit.
    2.can I distribute my web application in non text format.How?
    3.if I want to add some files to my application that its running in tomcat.how can i do that with out rebuild all.
    thank you
    Add to mtz1406's Reputation

    thank you all for helping.
    I will write more information about my questions may this help others:
    *{ /WEB-INF/web.xml* - The +Web Application Deployment
    Descriptor+ for your application. This is an XML file describing
    the servlets and other components that make up your application,
    along with any initialization parameters and container-managed
    security constraints that you want the server to enforce for you.
    This file is discussed in more detail in the following subsection.
    As mentioned above, the <code>/WEB-INF/web.xml</code> file contains the
    Web Application Deployment Descriptor for your application. As the filename
    extension implies, this file is an XML document, and defines everything about
    your application that a server needs to know (except the context path,
    which is assigned by the system administrator when the application is
    deployed).
    The complete syntax and semantics for the deployment descriptor is defined
    in Chapter 13 of the Servlet API Specification, version 2.3. Over time, it
    is expected that development tools will be provided that create and edit the
    deployment descriptor for you. In the meantime, to provide a starting point,
    a [basic web.xml file|http://localhost:8080/docs/appdev/web.xml.txt]
    is provided. This file includes comments that describe the purpose of each
    included element.
    NOTE - The Servlet Specification includes a Document
    Type Descriptor (DTD) for the web application deployment descriptor, and
    Tomcat 6 enforces the rules defined here when processing your application's
    <code>/WEB-INF/web.xml</code> file. In particular, you must
    enter your descriptor elements (such as <code><filter></code>,
    <code><servlet></code>, and <code><servlet-mapping></code> in
    the order defined by the DTD (see Section 13.3).
    h4. } from tomcat documentation
    Tomcat Context Descriptor
    bq. A /META-INF/context.xml file can be used to define Tomcat specific \\ configuration options, such as loggers, data sources, session manager \\ configuration and more. This XML file must contain one Context element, which \\ will be considered as if it was the child of the Host element corresponding \\ to the Host to which the The Tomcat configuration documentation contains \\ information on the Context element.
    }from tomcat documentation
    but I still want more information about this question:
    Q3: I want to distribute (sell to another organaization) without give sorce code in jsp files.So I want to precompile it to be just class files or jar files.
    I want to use ant that become with netbeans 6.1.can anyone give me information about how to do that.
    thank you again

  • About jsp tags..............

    Pls help
    I am studing about JSP
    if we write code in scriptlet tag i.e. < % %>
    code goes into service() method of servlet ,which is automatically created by jsp Engine
    if we write code in declaration tag i.e. <%! %>
    code goes outside service() method of servlet ,which is automatically
    created by jsp Engine means at class level.
    is their any tag so that jsp code goes into init() method of servlet ,which is automatically created by jsp Engine for that jsp

    simple and straight u need to code init() method using <%! %> tags.. but in case JSP it has to be jspInit() method.
    The jspInit method is called by the container once and only once for a servlet instance. As you might guess from its name it is used to do initial once only setup such as getting resources and initialising variables that are used in the JSP page. The jspInit method can be overridden within a JSP page with code like the following.
    <%!
    public void jspInit(){
    /*getServletConfig is inherited */
    ServletConfig config= getServletConfig();
    %>REF : http://www.examulator.com/moodle/mod/resource/view.php?id=380
    REGARDS,
    RaHuL

  • Are application variables 'user specific'?

    hi - i've got a feeling i may have done something stupid.
    we have several domains all pointing to one application.
    in application we look at the cgi.http_host to work out which
    site the domain the user is expecting and then serve up customised
    content accordingly.
    only this is i've set put the customised content in
    application scoped vars - is that a bad move?
    eg. in application.cfm i have:
    <cfif cgi.http_host eq 'www.redredred.com' >
    <cfset application.message= "welcome - we love the colour
    red" >
    <cfelseif cgi.http_host eq 'www.blueblueblue.com' >
    <cfset application.message= "welcome - to our site where
    we love blue" >
    <cfelse>
    <cfset application.message= "welcome to our site (we love
    all colours)" >
    </cfif>
    then in the index.cfm:
    <cfoutput>#application.message#</cfouput>
    is there a chance that by doing this someone who has visited
    www.redredred.com will get a message about blue?

    happysailingdude wrote:
    >
    > is there a chance that by doing this someone who has
    visited www.redredred.com
    > will get a message about blue?
    >
    Not only a chance, but there is something wrong if the person
    does not
    get this message, once the next user has set the variable to
    blue.
    Application variables are global to the application and will
    be shared
    by all users of that application. That is the designed and
    desired
    purpose of application variables.
    In ColdFusion an application is defined by any template that
    shares the
    same 'name' as defined in either the name parameter of a
    <cfapplication...> tag or the this.name property of an
    Application.cfc file.
    If all these web sites are using the same string for the
    application
    name then they share the same application scope and they will
    all have
    the same value for application.message. And this value will
    be the
    value set by the last visitor to any of the sites.
    <cflock...> is not relevant to this issue. It will
    prevent the variable
    from being set at the exact same moment by multiple users on
    multiple
    sites, but it will not stop the value from changing
    sequentially as
    first one, then another user visits any of these sites and
    changing the
    value.
    The solution to your problem is to set different application
    scopes by
    dynamically setting the application name. Thus each website
    will be
    separate and distinct applications with their own application
    scope
    variables and your system should behave the way desired.

  • Global Application variable

    How do I set a global application variable in a Swing application?
    Namely
    MDI display opens a new window
    new window sets a variable
    close the new window and return to the MDI window
    MDI window needs to use the variable.
    Note: the new window is is its own class object.

    What are you talking about?
    Static variables are "global".
    In some class (it does not really matter which) define
    a static variable. O.K. now you have a "global"
    variable.
    Some people may say that this is "bad" programming
    practice, but it is what you asked for.public static variables of public classes are 'global' in the sense you can refer to them if anywhere in an application. Public classes are also 'global' in this sense.
    However, we don't call them global variables, they are class variables. A global variable is generally defined to be one that is associated with the running application. It has no context other than that. It can be used anywhere at any time without any qualifications. In other words, the are terrible.
    I had to maintain an application that had 50 or so global variables. Some of these variables represented the exact same piece of information so it was cruicial during modifications to make sure that they were kept in sync. Don't use this type of design.

  • JSP Sample Application

    We installed the SQLTAGLIB application from JSP sample application publish on TECHNET.
    Compiled and Run it successfully.
    Now we are trying to develop some Page using
    sqltaglib.tld but while compiling,
    on this line
    <%@taglib uri="sqltaglib.tld" prefix="sql" %>
    get this error message
    [ Start of root element ]
    pl. give the solution.
    Thanks
    null

    Here is some info from the docs:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Note the following requirements for using SQL tags:
    Install the file ojsputil.jar and include it in your classpath. This file is provided with the OracleJSP installation.
    Make sure the tag library description file, sqltaglib.tld, is deployed with the application and is in the location specified in the taglib directives of your JSP pages, such as in the following example:
    <%@ taglib uri="/WEB-INF/sqltaglib.tld" prefix="sql" %>
    For general information about JSP 1.1 tag library usage, including tag library description files and taglib directives, see "Standard Tag Library Framework".<HR></BLOCKQUOTE>
    Please post follow-ups in the OTN Sample Code forum.
    Thanks,
    -rh
    null

  • Same Application Variables name in different websites on the same server.

    Hi,
    I have two websites in the same server that use both their own Application.cfm file.
    In each Application.cfm file is defined the application variable Application.DB
    In website1 the Application.DB = DB1
    In website2 the Application.DB = DB2
    Since I'm studying Application.CFC solution, and I did read that application variables with same name have as scope the entire server ... I'm a bit worried. This happen also with Application.CFM ?

    Since I'm studying Application.CFC solution, and I did read that application variables with same name have as scope the entire server ... I'm a bit worried. This happen also with Application.CFM ?
    That's not quite how it works.  Each application has its own name, and application.foo on one application (name) is a different variable from application.foo within a different application (name).
    Reading these sections of the docs might help:
    Configuring and using application variables:
    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0c35c -7fec.html
    cfapplication:
    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d 69.html
    About applications:
    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0b63c -7fda.html
    Defining the application and its event handlers in Application.cfc:
    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24 -7d39.html
    You should definitely be using Application.cfc, not Application.cfm, btw.
    Adam
    Adam

  • Monitor my jsp-servlet application through the jmx

    heloo,
    i am new in JMX. and i want to manage(or monitor) my jsp-servlet application. there lots of
    servlets and jsp files. its is running in tomcat. i made simple demo application which
    is given by oracle tutorial. but it is just for one interface and its implementations so how
    can i monitor my whole jsp-servlet application by JMX.
    i want to Monitor three things
    Memory
    JVM
    Thread
    Thanks...

    Hi,
    I fixed my problem by setting the system wide variable (WindowsXP)
    CLASSPATH to r:\\dealershop\\WEB-INF\\classes.
    Thanks,
    Andrea
    andrea costantinis wrote:
    Hi,
    I developed a JSP/servlet test application that makes
    use of kodo 2.2.3 STANDARD EDITION for its persitence.
    I successfully compile and annotate the application.
    I am also able to successfully generate the db
    schema with schematool.
    Unfortunately, when I run the application using
    Resin 2.0.2, Kodo is unable to initialize properly.
    Initially it was not able to find \"system.prefs\" file.
    I fixed that by putting \"system.prefs\" in WEB-INF\\classes.
    Unfortunately, Kodo is still unable to initialize and
    gives the following message:
    The system could not initialize; the following registered
    persistent types are missing metadata
    or have not been enhanced:
    [class com.dpov.purchaseorder.PurchaseOrder,
    class com.dpov.catalog.Product,
    class com.dpov.uidgen.counter.Counter,
    class com.dpov.catalog.dao.jdo.CategoryHierarchyEntry,
    class com.dpov.catalog.dao.jdo.CategoryHierarchyDAO,
    class com.dpov.pricelist.PriceInfo,
    class com.dpov.pricelist.PriceList,
    class com.dpov.catalog.Category,
    class com.dpov.lineitem.LineItem,
    class com.dpov.dealer.Dealer,
    class com.dpov.user.User,
    class com.dpov.customer.Customer].
    I use \"system.jdo\" to describe metadata for the enhancer.
    I tried to put it both in WEB-INF\\lib and WEB-INF\\classes but
    it still fails.
    Please note that:
    1) my classpath variable is not set
    2) my application\'s class file are in WEB-INF\\classes
    3) kodo jars are in WEB-INF\\lib
    4) mysql jdbc driver is in WEB-INF\\lib
    5) system.prefs is in WEB-INF\\classes
    6) system.jdo is in WEB-INF\\classes
    Thanks in advance,
    Andrea

  • Application variable limits?

    I want to use an application variable as a list,but the length of the list could be very long and it's a variable number of entries in the list. 
    The docs say strings can be as large as server memory will allow.  Is there any limit beyond server memory for application variables?
    Thanks!

    I agree with Dan whole-heartedly,  Application variables should be pretty static. but of greater concern: If you are worried about server memory being a problem, would it be better/possible to store your variable in a database?
    On the flipside - "test it" create a big couple gig application variable and see what happens
    -sean

  • How long is the live time of the Application variable???

    Tell me if anyone knows the default live time of the application variable in JSP. Can i set this time?
    Thanks in advance!

    I believe that the answer is application server dependent, but most application servers will keep the values around until the application server is restarted (or crashes).
    Some of the better (and more expensive) application servers can persist application state across server restarts but I haven't witnessed this firsthand. (I've seen it in action with session state, however).
    Hope this helps ...

  • How to run JSP/Servlet applications on Apache?

    As we all know that tomcat is an JSP/Servlet engine. Apache is a web server not a JSP/Servlet enabled web server. Then in order to run JSP/Servlet applications on Apache web server on unix, what should I do?
    Thanks.
    James Liu

    Can you give me some detailed information about how to combine Apache and Tomcat? Note, the application is going to run on Sun Solaris Operating System.
    By the way, where do you put your final version of application? on windows or on Unix? on tomcat or on apache?
    I am building the application using tomcat on windows, but now I almost finished the application, so I decide to move it to Unix which uses apache as the web server. But I got problems, the Servlet engine (JServ) can not understand "RequestDispatcher" (an object used to redirect jsp pages).
    Help please.
    James

Maybe you are looking for

  • How to find out who is logged into portal through webdynpro application

    hi, whenever anyone logs in through the portal and runs a webdynpro iview, the webdynpro application should be such that it gives the name of the user logged in. Eg, if i logiin and run the webdynpro iview, the application should display that I have

  • Distribution of MC with  CHRMAS and CLSMAS in Retail scenario

    Hi guys, I know that I can use WGSE or  BD91/BD92. for distributing Merchandise Categories (MC). But is is possible to trigger  CHRMAS and CLASMAS with change pointers scenario in case of Retail system. I have set change pointers in BD50. But they ar

  • Asset under construction Accounting determination

    Hi dear friends, What accouts shoul I use in accounting determiation for assets under construction? Here should I inform them in OA90? Are Balance account or P&L account? Brazilian legislation just allow its depreciation after its conclusion however

  • Restart CF server through any API?

    Hi All, Is there anyway we can restart the coldfusion server through any code or API? We are having coldfusion MX 7. We do not have access to to the server for restarting. Every time we need to wait for the Administrator to restart it. Thanks in adva

  • Restore MySQL database file into SQL server

    Hi experts, I have a MySQL Server backup file. How can I restore it to SQL Server? Or what is the way around getting the database into SQL Server? ebro