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

Similar Messages

  • Question about JSP, XSLT and JDOM

    hi, folks. Let's say within page1.jsp, i have <jsp:include page="page2.jsp" flush="true"> On the other hand, i have a servlet helper class which queries the database, then converts the ResultSet object into a JDOM Document object. My question is i want to make the transformed output of the JDOM Document and XSLT template to be a partial content of the page2.jsp page. How can i get this done properly? I have no problem of doing the transformation, but just dont know how to concatenate the output with the rest content of page2.jsp. Hope i clearly explained the question. Any advice is greatly appreciated.
    //code fragment on page2.jsp
    <td valign="top" width="788">
        <font size="3"><br>  
            <p>
           //i want put the transformed results here
           </p>
         </font>
    </td>

    this is a fragment of my testing program, which transform direct to response output stream. but i dont want put this bounch of java code within page2.jsp. do i some other way around to get it done?
    Document myDocument = createDocument();
                   TransformerFactory tFactory = TransformerFactory.newInstance();
                // Make the input sources for the XML and XSLT documents
                org.jdom.output.DOMOutputter outputter = new org.jdom.output.DOMOutputter();
                org.w3c.dom.Document domDocument = outputter.output(myDocument);
                javax.xml.transform.Source xmlSource = new javax.xml.transform.dom.DOMSource(domDocument);
                StreamSource xsltSource = new StreamSource(new FileInputStream("d:/tomcat/webapps/project/car.xsl"));
            //Make the output result for the finished document
                StreamResult xmlResult = new StreamResult(response.getOutputStream());
                //StreamResult xmlResult = new StreamResult(System.out);
            //Get a XSLT transformer
            Transformer transformer = tFactory.newTransformer(xsltSource);
            //do the transform
                transformer.transform(xmlSource, xmlResult);

  • Question about jsp tags

    Hello to all the programmers ,
    I have the code below , i get from servlet the attribute that called carList and then i use the forEach iterator for
    view the list of employees.
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <html>
    <head><title>The list of the Employees</title></head>
    <body>
      <table>
         <tr>
           <th bgcolor="cccccc">EMP_ID</th>
           <th bgcolor="cccccc">FIRST_NAME</th>
           <th bgcolor="cccccc">LAST_NAME</th>
         </tr>
      <c:forEach items='${empList}' var='emp' >
        <tr>
        <td>${emp.id }</td>
        <td>${emp.first_name}</td>
        <td>${emp.last_name}</td>
        </tr>
      </c:forEach>
      </table>
    </body>
    </html>The result that i get us :
    EMP_ID FIRST_NAME LAST_NAME
    ${emp.id} ${emp.first_name} ${emp.last_name}
    with the suitable headers of course.
    Why i get this result and not get as i expected the empBean.
    Regards
    Ofer

    I checked the web.xml and version is 2.4.
    I don't thhink that problem related to the web.xml , because i have another example that worked like this one :
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%
        // DON'T FREAK OUT!!! This scriptlet code will go away once
        // we have a model and controller in place...
        String[  ][  ] empList = {
                {"22254", "Joe", "Pashi"},
                {"15487", "Yos", "Alke"},
                {"8777", "Jhon", "Gatez"}
        pageContext.setAttribute("empList", empList);
    %>
    <html>
    <body>
      <table border="1">
        <tr>
          <th bgcolor="cccccc" align="left">Id</th>
          <th bgcolor="cccccc" align="left">First_Name</th>
          <th bgcolor="cccccc" align="left">Last_Name</th>
        </tr>
        <c:forEach items='${empList}' var='emp'>
          <tr>
          <td align="left">${emp[0]}</td>
          <td align="left">${emp[1]}</td>
          <td align="left">${emp[2]}</td>
          </tr>
        </c:forEach>
      </table>
    </body>
    </html>when i run this jsp page in tomcat i get the this result as expected :
    Id First_Name Last_Name
    22254 Joe Pashi
    15487 Yos Alke
    8777 Jhon Gatez
    I think that maybe i missed something in the previous example , something that related to the iterator forEach.
    I try to do the same thing but get the array of the employee from the servlet that's all , i see that the arrayList of the employees is created and i assign as an attribute.

  • Very basic questions about JSP server and plug-in.

    Hi all,
    I am wondering what are other ways to make use of the JSP script on a server running normal Apache without changing it to Tomcat. Is there a plug-in version of JSP for Apache that will enable JSP? I am looking for something like PHP plug-in, which is quite generic. They even have a php.exe that OHTTP (a great shareware Win32 web server) can call to run PHP. Is there such thing along this line with JSP on Win32 or Linux? Thanks!

    You need a jsp/servlet engine, and in effect, Tomcat is the "plug-in" you described. Tomcat has basic web server functionality built in, so it can run stand-alone, but it's most commonly used with a robust web server like Apache. You don't have to "change it" to Tomcat - you just configure Apache to forward specific urls (anything ending in *.jsp, for example) to Tomcat.

  • Question about somepage.jsp?id=10

    I have a few questions about passing variables inside the actual URL.
    Say for example i have a products list, each product has an id. When i click on the product various information will be displayed including price, name etc etc. At the same time comments from various customers will be displayed.
    I was just wondering how i'll generate the number embedded inside the jsp which takes the user to the product information page. For example <a href="getProduct.do?id=10> how is 10" generated? Is it generated based on the productID?
    If i have 10 and in the products table i have the values do i just extract them according to the id and list the various values? At the same time i'll just locate the product id (which is a foreign key) in the comments table and list the comments also. I'm using struts if that makes any difference.
    Do i have the right idea?

    In other words, if i've printed out all the customer names from the database to my jsp how do i make it a hyperlink to point to the customer id using show.jsp?cust=1

  • Questions about  hosting and integration of jsp

    hi,
    I have been searching about jsp for a while and i need to ask some question which confuse me.
    First, I have been looking for hosting for jsp but i haven't yet found a useful one.
    And hosting is pretty expensive than php hosting especially in turkey. Do you suggest some international hosting which price is agreable. Also I couldnt find any commercial site (except ibm, java.sun) which is implemented in jsp, if you know some, give some instance.
    Php is much more widespread than jsp. but it still has some disadvantages of being opensource. but lately, I have read an article about sun has started to support php, According to this supprort, can php has an advantage on jsp.

    Dear dudushr,
    This is not at all a pbm.
    what u can do is,
    write ur servlet class and configure that in ur web.xml.(put servlet class in ur WEB-INF/classes dir)
    now in the action part of form tag call the url (just configured in web.xml) for this servlet.
    after executing the query and doing further process within the servlet ,use RequestDispatcher's forward method to pass this values to ur jsp.
    try it and let me know..
    cheers..
    kuttus
    .

  • Newbie question about loading servlets on tomcat

    I have what is probably a very basic question about loading simple servlets on to tomcat to test its installation. I have followed instructions from numerous tutorials to the letter but still I can't get it to work.
    I have installed tomcat on win2k in c:\tomcat. I set up the jdk, environment vars (JAVA_HOME, CATALINA_HOME, TOMCAT_HOME) which all point at the correct dirs. I can compile a servlet without errors. I can also place a test jsp and html file into the root directory and they both work fine.
    However, now I am trying a test servlet and no matter what I do it gives me a 404. I have a servlet class file called "HelloServlet.class" which I placed into the %install_dir%\webapps\ROOT\WEB-INF\classes directory. I try to reference it using this url:
    http://localhost/servlet/HelloServlet
    Tomcat is configured to use port 80 and has been restarted after adding the servlet class file. Does anyone have a clue why this is not working for me?
    Many thanks
    Marc

    You have to add in the web.xml file that it is in the WEB-INF dir, the information about your servlet. An example:
    <web-app>
    <servlet>
    <servlet-name>HelloServlet</servlet-name>
    <servlet-class>HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet</servlet-name>
    <url-pattern>/HelloServlet</url-pattern>
    </servlet-mapping>
    </web-app>

  • BASIC Questions about JavaMail

    Hi Everyone
    I have some very basic questions about java mail.
    I have a weblogic web server. I think it's version 5 or something like that.
    when a user clicks a form on my application sends some information to my database (via my jsp/java program) , I need to send email to a person?
    Does anyone know how to do that ?
    Could someone please describe the process
    Stephen

    I would recommend that you first read the JavaMail design specifications http://java.sun.com/products/javamail/JavaMail-1.2.pdf
    Then, download JavaMail. It comes with a reference implementation of the API and also very good samples.
    Those samples should get you started very quickly on how to send email from Java program.

  • I need info about JSP!

    Hi,
    I have some simple questions for jsp "experts". is it possible to get a version of jsp for free or how much does it cost?
    how safe is it to use in a big network of computers?
    Which databases does JSP support?
    please, please, answer as soon as possible!! =)
    thanks
         /jenny

    There are many JSP/Servlet server products which are free. These include Tomcat, Resin, JBoss, etc. These are all great for development-level work or small Net apps). If you need to implement a larger J2EE solution you will definitely want to look into one of the retail server products. These range from the very inexpensive (like Allaire's JRun) all the way up to expensive (like BEA's WebLogics) and everywhere in between. Just depends on your needs, budget, and requirements.
    Extremely safe. Especially when you look at the alternatives/competition (i.e., M$ COM/DCOM/ASP).
    Java supports just about every RDBMS on the market right now (you will run into difficulties with M$ SQLServer, but there are options). There are also drivers available for many legacy data sources. The subset of java which deals with database access is named JDBC; you may want to research this a little. Here is a link to the available JDBC drivers search page:
    http://industry.java.sun.com/products/jdbc/drivers

  • Question about dependent projects (and their libraries) in 11g-Oracle team?

    Hello everyone,
    I have a question about dependent projects. An example:
    In JDeveloper 10.1.3.x if you had for instance 2 projects (in a workspace): project 1 has one project library (for instance a log4j library) and project 2 is a very simple webapplication which is dependent on project 1. Project 2 has one class which makes use of log4j.
    This compiles fine, you can run project 2 in oc4j, and the libraries of project 1 (log4j) are added on the classpath and everything works fine. This is great for rapid testing as well as keeping management of libraries to a minimum (only one project where you would update a library e.g.)
    However in 11g this approach seems not to work at all anymore now that weblogic is used, not even when 'export library' is checked in project 1. The library is simply never exported at all - with a noclassdeffound error as result. Is this approach still possible (without having to define multiple deployment profiles), or is this a bug?
    Thanks!
    Martijn
    Edited by: MartijnR on Oct 27, 2008 7:57 AM

    Hi Ron,
    I've tried what you said, indeed in that .beabuild.txt when 'deploy by default' is checked it adds a line like: C:/JDeveloper/mywork/test2/lib/log4j-1.2.14.jar = test2-view-webapp/WEB-INF/lib/log4j-1.2.14.jar
    Which looks fine, except that /web-inf/lib/ is empty. I presume its a sort of mapping to say: Load it like it in WEB-INF/lib? This line is not there when the deploy by default is not checked.
    I modified the TestBean as follows (the method that references Log4j does it thru a Class.forName() now only):
    public String getHelloWorld() {
    try {
    Class clazz = Class.forName("org.apache.log4j.Logger");
    System.out.println(clazz.getName());
    catch(Exception e) {
    e.printStackTrace();
    return "Hello World";
    In both cases with or without line, it throws:
    java.lang.ClassNotFoundException: org.apache.log4j.Logger
         at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
         at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:42)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:169)
         at nl.test.TestBean.getHelloWorld(TestBean.java:15)
    Secondly I added weblogic.xml with your suggested code, in the exploded war this results in a weblogic.xml which looks like:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
    <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    <jsp-descriptor>
    <debug>true</debug>
    <working-dir>/C:/JDeveloper/mywork/test2/view/classes/.jsps</working-dir>
    <keepgenerated>true</keepgenerated>
    </jsp-descriptor>
    <library-ref>
    <library-name>jstl</library-name>
    <specification-version>1.2</specification-version>
    </library-ref>
    <library-ref>
    <library-name>jsf</library-name>
    <specification-version>1.2</specification-version>
    </library-ref>
    </weblogic-web-app>
    The only thing from me is that container-descriptor tag, the rest is added to it during the deployment. Unfortunately, it still produces the same error. :/ Any clue?

  • Question about Weblogic

    Hello,
    I have a question about Weblogic and would like someone to help me with it.
    I created a JSP and everything was doing fine while i was testing it in Tomcat. But once I started the tests with Weblogic, it seemed Weblo wasn't accepting a class that i used to call from my JPS ( a sax parser). Instead of using my parser, Weblogic was using his default SAXParser, what causes problems to my JSP. Trying to solve this, I changed the classpath in Weblo and putted the jar of my parser in the beginning of the classpath, but it still didn't work. Does anyone have an idea of why Weblogic don't accept my parser and uses its default parser instead?
    Thanks in advance!!
    M@G

    naveen.g wrote:
    How to get the path of the domain, where my application is running, in a java code?
    For example, my domain path is "D:\bea\user_projects\domains\production". How to get this path dynamically?Please start a new topic instead of resurrecting an old and non-related thread and hijacking others' threads.

  • Question about upcoming Studio 8

    Hi
    i have some question about upcomming studio 8 if some on know
    1-when will it come available as EA ?
    2-does it contain visuall web service design presented in conf?
    3-can it be integrate with Creator 2 or creator be installed into it as a module ?
    4-does it contain wysiwyg for jsp/struts/jsp ?
    5-can it deploy to other Apps ?
    thank you

    Sun Java Studio Enterprise 8 Early Access Program will be started soon.
    Here is registration link: https://feedbackprograms.sun.com/callout/default.html?callid=E53199507DE44123B7A13841206FFE08
    And AFAIK direct deployment will be supported into Sun Java System Application Server, Tomcat and WebLogic

  • Some question about 9iAs R1.2.2 & R2, need your help:

    Some question about 9iAs R1.2.2 & R2, need your help:
    Since 2000, we has used 9iAS Core (R1.2.2) to publish our website. The platform is Suns Solaris (SPARC). The database is Oracle 8i. But there are so many questions:
    1.     The Web Cache cant be installed well
    2.     The web pages use JSP to query database with SQL show errors when we refresh the page a few times. The error will disappear after restarting the 9iAS or refreshing the page again. On the other hand, the same pages dont show error on resin. The error is java.sql.SQLException : Closed Connection: next. I supposed that the connection of database has some hidden troubles, but I can find it, could you give me some advice.
    Now I have installed 9iAS R2, But when I visited the manage page, I found that a password is needed to visit the web cache manage page. I dont think I have set the password, and then I cant control the web cache. I want to know is a default password occurred? If not, what is the password.

    The default password for Web Cache is: administrator
    See walkthrough on the sample code page: http://otn.oracle.com/sample_code/products/ias/content.html
    HTH,
    Ashesh Parekh
    Oracle9iAS product management

  • Questions about JavaFX

    Hi all,
    I'm new to JavaFX. I have a couple of questions about this new technology.
    1. Can JavaFX provides a GUI layer like SWING in a standalone application where the GUI collects input and sends a request to the core application?
    2. Regarding Web applications, what can JavaFX do? I guess JavaFX allows us to create applets, and it does not provide what JSPs/Servlets or JSF do. Is it right?
    Thank you very much!

    The new technology is already 6 months old and the version 1.2 have just been released... :-)
    Which is good news: yes, JavaFX has now a rather complete GUI layer. Previously it depended on Swing to provide most GUI components, now it has native components.
    So it can indeed collect (and display) information and send requests to a server (via HttpRequest class).
    JavaFX is on the client side: you can create applets, drag them to the desktop, start programs with JNLP or even as standalone applications. But it is not suitable to build Web pages on the server side, so no JSP/JSF/Servlets. But it can communicate with them, of course.

  • Question about EJB and thread safe coding - asking again!

    sorry everyone, no one seems to be interested in helping me on this, so i post it again.
    i have a question about the EJB and thread safe coding. when we build EJBs, do we need to worry about thread safe issue? i know that EJBs are single threaded, and the container manages the thread for us. maybe i am wrong about this. if i wasnot, how can we program the EJB so that two or more instance of EJB are not going to have deadlock problem when accessing data resources. do we need to put syncronization in ours beans, do we even need to worry about creating a thread safe EJB? thanks in advance. the question really bothers me a lot lately.

    sorry everyone, no one seems to be interested in
    helping me on this, so i post it again.Excellent plan. Why not search a little bit on your own instead of waiting for your personal forum slaves to answer your call. See below.
    i have a question about the EJB and thread safe
    coding. when we build EJBs, do we need to worry about
    thread safe issue? Read this: http://forum.java.sun.com/thread.jsp?forum=13&thread=562598&tstart=75&trange=15
    i know that EJBs are single
    threaded, and the container manages the thread for us.
    maybe i am wrong about this. if i wasnot, how can we
    program the EJB so that two or more instance of EJB
    are not going to have deadlock problem when accessing
    data resources. do we need to put syncronization in
    ours beans, do we even need to worry about creating a
    thread safe EJB? thanks in advance. the question
    really bothers me a lot lately.
    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial

Maybe you are looking for

  • How to export the Apex web page to PDF with click of a button?

    How to export the Apex web page to PDF with click of a button? Am looking at exporting the Form view on APEX to be exported to PDF.

  • Remove the Enter key binding from a JPopupMenu

    Hi, Does anyone know how to remove the Enter key binding from a JPopupMenu? So when the popupmenu is showing and you type Enter, nothing should happen and the menu should stay where it is. I have tried: popup.getActionMap().put("enter", null); popup.

  • Corrupted .pst files due to mistakenly trying to open them with Adobe Reader

    This is a second post re the same problem, as I previously got only one response (from B. Alheit), which asked me to identify my operating system. I am beyond desperate to get this problem fixed. As described previously (S Giraffe - 11/14), I was abo

  • UNDO and TEMP usage by a schema

    Hi, How can I findout UNDO and TEMP space usage by a schema? do we have any tables for this? If I want to get UNDO,TEMP space or any other resource used by a schema for 24 Hours period,can get this info. Can you please suggest the procedure to know t

  • IDVD6 quits unexpectedly

    I am having all kinds of trouble with iDVD 6. I am unable to open the movies list under "media", and the application will quit unexpectedly when I am doing something even as simple as typing in text in one of the text fields. I have been able to impo