Servlets, initArgs and JSP

Could someone from the WebLogic team please comment on this:
          Is it really true that I cannot
          a) Set some common arguments for all of my servlets at once, like:
          servlets.default.initArgs = pooluser=someuser, poolpwd=somepwd
          or
          weblogic.httpd.initArgs.* = pooluser=someuser, poolpwd=somepwd
          b) Read initArgs, added to the *.JSP section, from within a JSP like the
          following:
          String login = config.getInitParameter("pooluser");
          or
          String login =
          getServletConfig().getServletContext().getInitParameter("pooluser");
          or
          String login = pageContext.getServletConfig().getInitParameter("pooluser");
          I'm currently using WL 4.5.1. Neither of the tryouts in problem b works.
          They all return "null".
          As you can probably see from the code-sniplets I'm trying to hide the
          WL-database-pool username and password from the programmer. It should not be
          hardcoded in the servlets / JSPs, but embedded in the weblogic.properties
          where it belong.
          Carsten Jakobsen
          Presys / Denmark
          

husbil,
I think generally speaking, servlets are the next generation of CGI scripts. As you mentioned, servlets are written in Java and CGI scripts are often written in Perl. The main difference between the two is that servlets can persist between requests, but CGI scripts cannot. Servlets are also more portable because of the whole platform-independence thing. In addition, when a request is made to a servlet, only a lightweight thread is spawned to handle the request, whereas each request to a CGI script can spawn a whole new process.
A JSP usually only handles the front-end aspects of Java-based web application. It'll be mostly HTML with a few snippets of Java code thrown in there to make your web page nice and dynamic. All the application logic should really be handled by the servlet, not the JSP, so I think that's why JSP's aren't really considered on the same page (no pun intended) as scripts and programs.
Does that help?
- Sheepy

Similar Messages

  • The relation of Servlet , bean and jsp

    servlet can output to IE directly? I mean that design a servlet adding some code in the service method, compile it, input URL: localhost:8080/test/servletname, can I get result? (Tomcat, register servlet in web.xml)

    yes that's the point!
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class HelloWorld extends HttpServlet {
         public void doGet( HttpServletRequest req, HttpServletResponse resp )
         throws ServletException, IOException {
              resp.getWriter().println( "<html><body>Hello World</body></html>" );
    }

  • Find out if an integer is a power of two - Servlet and JSP

    Hy all,
    I have to write the following programm using the servlet technology and jsp (with Bean).
    "Read a number from the keyboard (through a html file that send the value to the java.class through GET) and find out if this number is a power of two and if it is print on the screen which power it is".
    I know how to do the HTML part (the page where I input the value) and I also have an algorythm that checks if an integer is a number of two but I am not very sure how to implement this into a servlet or jsp (with Beans).
    Thank you for your help!
    Best regards,
    Raul
    public class PowerOfTwo {  
    public static void main(String args[]){  
    for(int n=0,limit=16; n<Math.pow(2, limit);n++)
    if(isPowerOfTwo(n))
    System.out.println(n);
    private static boolean isPowerOfTwo(int n) {  
    double logNbase2 = Math.log(n)/Math.log(2);
    int logNbase2Integer = (int) (Math.floor(logNbase2));
    if(logNbase2-logNbase2Integer==0)
    return true;
    else
    return false;
    }

    Yes, I know it's a messed up code down there. The value that I am trying to check if it is a power of two is sent via the variable "m" to the java class.
    Can anyone correct this piece of code please?
    Thank you in advance,
    Raul
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Putere2 extends HttpServlet{
         public long putere(long m)
         int other = 1;
         if(((~m) & 1) == 1)
         System.out.println("The number is a power of two");
         else
         System.out.println("The number is a NOT A power of two");
    public void doGet(HttpServletRequest req,HttpServletResponse res)
    throws ServletException,IOException{
    String sm=req.getParameter("m");
    String tip=req.getParameter("tip");
    long m=Long.parseLong(sm);
    long x=putere(m);
    PrintWriter out=res.getWriter();
    if(tip.equals("text/html")){
    String title="Putere";
    res.setContentType("text/html");
    out.println("<HTML><HEAD><TITLE>");
    out.println(title);
    out.println("</TITLE></HEAD><BODY>");
    out.println("<H1>"+title+"</H1>");
    out.println("<P>Puterea este: "+x);
    out.println("</BODY></HTML>");
    else{
    res.setContentType("text/plain");
    out.println(x);
    out.close();
    public void doPost(HttpServletRequest req,HttpServletResponse res)
    throws ServletException,IOException{
    doGet(req,res);
         }

  • Help me to convert Java and Jsp Files into WAR File!!!!

    I need someone to help me to convert some java servlet files and jsp files into a WAR file. I need it URGENTLY and I'll be very grateful to anyone who is willing to help me! My email is [email protected] Thanks!!!!

    Are the Oracle JDBC drivers 11g used?
    oracle.jdbc.driver.OracleDriver is not supported in 11g drivers.
    Please replace with:
    oracle.jdbc.OracleDriver

  • Hi frnds i want to help in servlet,java bean and JSP

    hi friends i'm right now in M.SC(IT) and i want to do project in SERVLET,,JAVA BEANS and JSP ,
    so pls give me a title about that
    NOTE: I develop a project in group(2 persons there)
    my email id is : [email protected] , [email protected] , [email protected]

    You cannot pair your iPod to a cell phone, so forget about it.
    The only way you can get free WiFi is to hang out at a Denny's, a Starbucks, or a truck stop, and I don't think your parents would approve....

  • Creating FOrums with Servlet and JSP

    Hi everyone,
    Is there a good resource that explains how to build a forum using servlets and JSP technology?
    Regards,
    Basil Mahdi

    please let me know here if you find any useful resources...I am in the process of writing my own searchable threaded forum for my company with JSP's/servlets. It's a very slow process at the moment though...if I ever finish it, I'll gladly share it.

  • Servlet and JSP in OAS

    I'm developing web application with OAS
    4.0.8.1 and JDeveloper 3.0 and I want to call
    JSP from servlet using "RequestDispatcher".
    I downloaded JSP for OAS from www.olab.com.
    In the Release note, there is a description
    about RequestDispatcher, but I cannot
    understand about details.
    In what configuration can I use servlet and
    JSP together with RequestDispatcher. Anyone
    scceeded about that?
    null

    wan (guest) wrote:
    : Hi everyone,
    : I am using OAS 4.0.8 on Solaris 2.6. After viewing servlet
    : and JSP samples, I am kind of confuse whether OAS supports the
    : following options
    : 1. JSP
    : 2. servlet chaining
    : 3. running JDeveloper DB Servlet wizard
    : (oracle.jdeveloper.servlet.*) and Java Business Objects
    : (oracle.jbo.rt.cs)
    : Thank you for your time.
    I found a white paper 408newfead.pdf, that says under "Future
    Directions" that it will add jsp support. I read somewhere (I
    can't remember where exactly :( ) that said 4.0.8.1 would
    support
    JSPs. I don't know if this release is out yet.
    I wish Oracle would get with the times and put out a product that
    is consistent with the technology they are touting as the
    future.
    Having us download Suns server to run servlets and JSP is
    ridiculous for the worlds second largest software company!
    null

  • Questions about Java Servlets and JSP

    Hi,
    I'm a confident Java Programmer (and really enjoy using this language) but am very new to Java servlets and Java Server Pages.
    I have previously worked with Perl on my web projects (simple 'league' style voting pages). I read in my 'Core Java' book that I should no longer use perl or even cgi.
    I need to know more about Java servlets and Java Server Pages so I can make the switch to a 'real' programming language.
    I have a few questions:
    How should I start to learn JS and JSP?
    How applicable will the java knowlegdge I have already be?
    Are JSP common on the world wide web?
    What tools do I need to start? (I currently develop in JBuilder and have Java 1.4.1 Standard Edition)
    Is it likey my web host (and others) will support JSP?
    Thank-you very much for helping a novice get started,
    Regards,
    Paul

    Hi, Steve ...has to be frustrating! But do not despair.
    Let's suppose the servlet it's named MyServlet on package org.servlets
    WEB-INF should look:
    WEB-INF
    classes
    org
    servlets
    MyServlet.class
    web.xml
    web.xml file should have this two declarations:
    <web-app>
      <servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>org.servlets.MyServlet</servlet-class>
      </servlet>
      <!-- other servlets -->
      <servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>/MyServlet</url-pattern>
      </servlet-mapping>
      <!-- other servlets mappings -->
    </web-app>Now, once the container starts (Tomcat?), you should be able to see that servlet in:
    http://localhost:8080/[my-context/]MyServletAnd what my-context is? The web application context. This string should be empty if your're deploying to the root context, otherwise should the context name. In Tomcat, deploying to root context defaults to using webapps/ROOT.
    Sorry for my English, but I felt the need to answer your request. I hope it helps despite my writing.

  • Serving Java Servlets and JSP

    I have a small hosting company and was wondering what is required to be installed on a Win2k Server to host Java Servlets and JSP pages for a client of mine?

    Ah, so you just want to add a servlet engine to IIS5?
    Tomcat can be used as a plugin for IIS. Check out the Tomcat FAQs - somewhere in there you should find one relating to using Tomcat as an IIS plugin. They're far more comprehensive than I could ever hope to be on the matter!

  • InterMedia Java Classes for Servlets and JSPs and Netscape

    I am using the interMedia Java Classes for Servlets and JSPs to upload and retrieve multimedia data. I have found that it is much more performant in Internet Explorer (5.5) than in Netscape Communicator (4.7). In fact, I cannot upload images larger than 10K at all using netscape. However, the same image can be uploaded into the same application using IE. Is this a known issue?
    Thanks in advance.

    Hi,
    We have successfully uploaded multimedia data in the giga-byte range (Quicktime and AVI files) at the same speed with both the Netscape (4.7n) and MS IE (4.n and 5.n) browsers. One thing we have noticed is that its very important to set the manual proxy settings correctly if you have an environment with a proxy server. If you don't, then uploads can go via the proxy server and, for some reason, that seems to take considerably longer. For example, suppose you are in the www.xyzco.com domain and are connecting to a host named webserver.www.xyzco.com, then specify webserver and webserver.www.xyzco.com (to cover both cases) in the "Do not use proxy servers for..." box in the manual proxy server configuration screen. Also, if you're using a tool such as JDeveloper that uses the host IP address in the debugger environment, then you also need to add the numeric-based (nnn.nnn.nnn.nnn) IP address to this list.
    Hope this helps.
    In order to better understand the variety of ways in which our customers are using interMedia, we'd be very interested in knowing a little more about your application, the interMedia functionality that you are using, and how you are developing and deploying your application. If you are able to help us, please send a short email message with some information about your application, together with any comments you may have, to the Oracle interMedia Product Manager, Joe Mauro, at [email protected] Thank you!
    Regards,
    Simon
    null

  • JDBC installation for servlets and jsp

    Hello All,
    I am trying to use JDBC for my web application. i have a book but not very detailed and cannot find a good search on google.
    they have said that the ODBC-JDBC bridge driver comes with jdk1.2 or forward. and ask me to set up an ODBC data source. so i went in control panel/systems tab and then try to add SQL and then when click finish it asks me how to connect to sql server, i entered my usename and password but says connection failed.
    This is my worst nightmare. please help so i can start building web application using servlets and jsp.

    Let me tell you right now, you have BORING nightmares.

  • Eclipse Plugins for Servlets and JSP.

    Hi Guys,
    Can any one suggest where i can get the eclipse plugins for Servlets and JSP. May i am wrong posting this question in this forum. I already browsed thru all the forum to get the info but in vain. so any help will be appreciated.
    Thank You,
    cheers,
    thrinath.j

    [url http://www.eclipse.org/webtools/]http://www.eclipse.org/webtools/
    Regards

  • When to use servlets and jsp in an application like  shoping cart?

    Hi All
    I m going to design and implement a web application using servelts and jsp. I am still at its requirements analyze stage.
    The application is almost likely a shopping cart. So if any of you have the deep knowledge about this domain with servlets and jsp please help me for a good design. What I realy need to know is that
    1. what are the core requirements for a shoping cart ?
    2. use cases ?
    3. best way to follow mvc with servlets and jsp for it?
    you can answer to this at the abstract level. no need to go in detail.
    if you have any documents like design and use cases mail me to [email protected]
    your cooperation is highly appreciated in this regards.

    Look into this kid
    http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-Session-Tracking.htm

  • Differences between WL or Netscape for Servlets and JSP's

    What are the advantages / disadvantages of running Servlets under WL,
              vs. say, running them in Netscape's servlet engine? Assuming EJB
              container is run separately, either one of these could make calls to the
              WL EJB server, so perhaps it would be simpler and faster to run servlets
              and JSP's under Netscape, and have them call via t3 into a weblogic
              server for EJB's?
              Thoughts
              david
              David Michaels <[email protected]>
              Director of Technology
              ShockMarket Corporation (650) 330-4665
              [david.vcf]
              

    David,
              One of the major reasons to run your servlets on Weblogic is that we have an
              optimization that allows us to pass by reference objects when calling from
              servlets to EJB. This makes things much faster.
              A number of our customers, in addition, have seen performance problems when
              using other servlet engines. It just seems to cause problems due to their
              threading models etc.
              Finally, our servlet engine is by far the most mature and robust on the
              market today. Our JSP implementation is also the best in terms of
              performance.
              Thanks,
              Michael
              Michael Girdley
              WLS Product Manager
              David Michaels <[email protected]> wrote in message
              news:[email protected]..
              > What are the advantages / disadvantages of running Servlets under WL,
              > vs. say, running them in Netscape's servlet engine? Assuming EJB
              > container is run separately, either one of these could make calls to the
              > WL EJB server, so perhaps it would be simpler and faster to run servlets
              > and JSP's under Netscape, and have them call via t3 into a weblogic
              > server for EJB's?
              >
              > Thoughts
              >
              > david
              >
              > --
              > David Michaels <[email protected]>
              > Director of Technology
              > ShockMarket Corporation (650) 330-4665
              >
              >
              

  • Hi, i've a question, how to comunicate from servlet to a JSP and viceversa?

    i would like to know how to do this and if its possible an example i'll appretiate it much. thanks

    You have a mechanism called "forwarding", with which you can pass control from one resource (servlet/jsp) to another resource (servlet/jsp). You do this using a RequestDispatcher, which you can get from the HttpServletRequest object. If for example you want to forward to "index.jsp" which is in the root of your web application, you would do this in your servlet:
    RequestDispatcher rd = request.getRequestDispatcher("/index.jsp");
    rd.forward(request, response);
    return;(watch the return statement, you must manually return after a forward, or else the servlet will continue executing!). A forward will NOT create a new request, the same request is passed to the new resource (to create a new request, use a redirect in stead, also done with the RequestDispatcher).
    To pass objects between the two resources when doing a forward, use request.setAttribute(), request.getAttribute() and jsp:useBean.

Maybe you are looking for

  • Can't change sample rate for digital input on Mac Pro

    Hello all, on my Mac Pro with 10.4.10 I can't change the sample rate for the digital input. Whenever I choose 48000 or 96000 Hz it returns to 44100 Hz after a few seconds. Feeding a 24 bit/96000 Hz signal from an external ADC into the optical input d

  • Sound not working

    Hi, my macBook Pro sound isn't working. It works with earphones but not with out. The headphone jack is glowing red. Please help thank you

  • Problems installing Sun ONE Web Server 7.0 on an x86 with Solaris 10

    I am trying to install the new Sun ONE Java Web Server 7.0 on my Solaris 10 machine. This is the error I am getting: |-1%--------------25%-----------------50%-----------webResources:errorCreatingLogFile Task Failed: java.lang.NullPointsswhereExceptio

  • Grouping by month

    I need to display a month-by-month record of several indicators. The data is entered in daily, and I need to do basic things like average, sum, compare to target, etc. I've got a couple of views that simplify the data down to an organization, a date,

  • Webutil throws 'RegisterWebUtil not found' after applying patch 10.1.2.3

    Hi All, We have set up an OAS server and patched it to release 10.1.2.3. To get webutil to work, I took a fresh copy of frmwebutil.jar (dated 28-1-2008) and jacob.jar (1_8). I signed them both using the same sign_webutil.bat. I had to change the JAR_