Do I have to register all *.jsp servlets in web.xml?

All,
I'm hoping someone in this forum can help me. I'm working on a report generator that uses JSP to generate a template which is fed to a formatter. What I want is to programatically call the JSP without having to add an entry for every single report to my web.xml. As you can imagine this doesn't scale well since every time a new type of report is added, someone has to go edit the web.xml.
The options I can think of:
1) Pre-compile the JSP's
2) Have a servlet mapping where *.jsp "does the right thing" for me
3) ?
Any suggestions? I'm not sure which is the best/practical approach. I really want to get away from having to modify the web.xml for every single type of report that I can generate.
Thanks!!
-Javier Delgadillo
Message was edited by:
javidel

Our web app is a web service where all requests get processed by an XFire servlet. So just adding the jsp on the disk somewhere won't do the trick. I have to register the jsp's.
Is there a better way to do this?
-Javier

Similar Messages

  • Programmatically Registering a JSP/Servlet Portlet

    ???Programmatically Registering a JSP/Servlet Portlet???
    OK, I have read all the literature on how to register a JSP/Servlet Portlet and have not seen any info on how to register a JSP/Servlet Portlet programmatically.
    I know for sure that you can register a PL/SQL Portlet programmatically via a couple of SQL and PL/SQL scripts that were given in the PL/SQL PDK examples.
    Bottom line, I want a way to register a new JSP/Servlet Portlet with ZERO GUI/User interface.
    My questions are:
    Is it possible to register a JSP/Servlet Portlet programmatically?????
    If it is possible to register a JSP/Servlet Portlet programmatically, were is the info on it or can you give me some examples of it????
    THANKS MUCH!!!
    null

    For a faster response, you may want to ask this question on the Portal Developer's Kit (PDK) Forum.

  • Do I have to register all the plugins again?

    Do i have to register all the plugins again if I already installed and registered the plug-ins when Iupdate from CC2014 to CC2014.2 ? (Red Giant Genarts or FX factory).
    Message was edited by: Kevin Monahan
    Reason: More searchable title, more understandable text.

    HI Yazzmatazz,
    It should be OK, but it's always wise to check with the plug-ins manufacturers before updating Premiere Pro.
    Thanks,
    Kevin

  • How to set two different welcome-file to different servlets in web.xml

    Hi friends,
    Can some one help with web.xml file
    I have to different servlets in applications.
    I want to set two different welcome files for my two different
    servlets in web.xml
    Please, can some one give me sample code to achieve this.
    Here web.xml code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>     
         <servlet>
              <servlet-name>reports</servlet-name>
              <servlet-class>com.caremark.ivr.servlet.IvrReportsServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>reports</servlet-name>
              <url-pattern>/reports</url-pattern>
         </servlet-mapping>
         <session-config>
              <session-timeout>30</session-timeout>
         </session-config>
         <welcome-file-list>
              <welcome-file>reportsindex.jsp</welcome-file>
         </welcome-file-list>
         <servlet>
              <servlet-name>calldetails</servlet-name>
              <servlet-class>com.caremark.ivr.servlet.IvrCallDetailsServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>calldetails</servlet-name>
              <url-pattern>/calldetails</url-pattern>
         </servlet-mapping>
    <welcome-file-list>
              <welcome-file>calldetailsindex.jsp</welcome-file>
         </welcome-file-list>
    </web-app>
    I need this fix immediately. Your help will be really appreciated. Thanks in advance.

    First of all, my understanding is that you need to have a Servlet 2.4 complaint server to do this...Given that, you're supposed to be able to simply specify the Name of the servlet as the welcome-file to get it to work. For example:
    Your servlet section:
    <servlet>
      <servlet-name>Controller</servlet-name>
      <servlet-class>com.company.ControllerServlet</servlet-class>
    </servlet>Now you would add the following to your welcome file list:
    <welcome-file-list>
      <welcome-file>Controller</welcome-file>
    </welcome-file-list>Note that you use the servlet-name value from the servlet definition, NOT the url-mapping from the servlet-mapping section.
    Please note that I cannot verify this as I am running a 2.3 server at home. When I get to work Friday I can test on a 2.4 machine. However this shouldn't take you more than a minute to test.
    Note that I did try this on the 2.3 compliant server and it did NOT work (as I expected)...
    HTH.

  • MUST I include every servlet in web.xml??

    I am learning servlet and trying to write some codes by myself.
    When I want to invoke servlet by form, tomcat always shows that the requested resource is not available.
    I've tried some different paths for the value of ACTION, but none of them work.
    Hence, I'm wondering whether I can invoke a servlet in form without explicitly write it in web.xml??
    Could anyone generously give me an answer?

    It may be possible to configure your web server so it executes servlets with URLs like http://the.ser.ver/servlet/com.yourcompany.yourpackage.TheServlet. URLs like that are ugly and can lead to security problems so I definitely recommend against them.
    You could write a front controller servlet. Then you'll need to configure the servlets in YourFrontControllerServletConfig.xml instead of web.xml so I'm not sure if that buys you much.
    I'd just configure servlets in web.xml. That's what it is there for.
    When you write a servlet you gather requirement specs for your servlet, do architecture and technical design, graphic layout design, servlet programming, back end code programming, unit testing, jar deployment, system (& performance, security, usability, etc) testing. After all that, the task of copy&pasting ten lines in web.xml shouldn't be a terribly large task. Unless you have lost nine of your fingers in a horrible chain saw accident or something.
    (Apologies to anyone out there who has lost nine of his fingers in a terrible chain saw accident.)

  • Use of jsp-file in web.xml

    hello
    can anybody explain about , when we need <jsp-file> in web.xml
    and why we use this tag in place of <url-pattern>?

    If you want to declare a JSP in your web.xml file you use the jsp-file tag instead of the servlet-class tag. Normally there is no need to declare a JSP in the web.xml file unless you want to use init-params.
    Usually people can access a JSP directly wether it is declared in the web.xml or not. So it is not that the jsp-file tag replaces the url-pattern tag so much as the url-pattern tag is not needed for a JSP. However notthing prevents you from declaring the JSP in the web.xml and then mapping the JSP to a different url that doesn't end in '.jsp'.

  • Registered servlets in web.xml do not work....WHY????

    Hi i am executing a web application on tomcat 4.1.29 and have the following structure...the jsp pages are executed but when sendinga request to a servlet the servlets are not executed...Can somebody guide me out of this....
    webapps
    {MyApp}->[web-inf][jsp]
    {web-inf}->[classes][lib]
    {classes}->[com][src]
    {src}->[source files]
    when the source files are compiled package structure is followed and the class files are grneated in
    com.MyApp.servlets
    ...etc
    the servlets are registered in the web.xml file as shown below.....few lines of my web.xml file
    <servlet>
    <servlet-name>userServlet</servlet-name>
    <servlet-class>com.MyApp.servlets.UserServlet</servlet-class>
    </servlet>
    even then when accessing a servlet it says the resource not found
    The requested resource (/MyApp/servlet/UserServlet) is not available.
    am i missing something some where...why are the servlets not executed????

        <servlet>
            <servlet-name>UserServlet</servlet-name>
            <servlet-class>com.MyApp.servlets.UserServlet</servlet-class>
            <load-on-startup>2</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>UserServlet</servlet-name>
            <url-pattern>/User</url-pattern>
        </servlet-mapping>I'd invoke it with this URL:
    http://localhost:8080/MyApp/UserServlet
    hmm something seems to be wrong here ;-)
    URL should be
    http://localhost:8080/MyApp/User (see <url-pattern>)

  • Why PHP is better than JSP,Servlet(Java Web Apps) ?

    Well, my heart says JSP, Servlets are better but rent a coder and job market, demand-supply seems to be saying a different story... ? Why we should not learn PHP then ?

    dcminter wrote:
    You can develop web sites in PHP in two shakes of a lambs tail. But they aren't maintainable as they would be in .NET or J2EE and again the performance (which dicates what you can do as well as scalability) is between a scripted language with buggy runtime and a compiled language with an optimized runtime so you tell me. Yes, but rather like Spinoza's argument for the existence of God, an application that has existence is more perfect than one which exists only in the conception. Even if the conceptual one is faster.
    I don't denigrate languages like PHP that help novices get stuff done.
    To address the OP's complaint: If one language was objectively "best" then we would only need one language. In practice they all have strengths. The more you learn the more you'll know which to use for the task at hand. That said, to learn any language (even PHP) in profound depth will take the best part of ten years and maybe longer. Sometimes expediency leads us to use the language we understand better to solve a problem for which it is not ideally suited.Eloquent - well said.
    Bonus points for that Spinoza reference.
    %

  • Which folder i have to put my .jsp file for web report?

    for web report(not the paper report) i put my .jsp files in the
    \reports\j2ee\reports_ids\web
    folder
    this is for the DS(Developer Suite)
    i'm trying to move this file to different machine where AS(Application Server)
    is installed.
    but couldn't find above path. where do i have to put .jsp file for
    web report?
    or do i have to modify in the registry? if so, where?
    Thanks

    Hello,
    Take a look to the thread :
    where to add new jsp reports directory location in path
    "...You have to keep jsp files under document root that is OH/j2ee/OC4J_BI_Forms/applications/reports/web directory. You can create sufbolders under this directory and keep jsp files. ..."
    Regards

  • How to set an 'alias' for a JSP page in web.xml

    Hi
    Suppose I have a JSP page called SimplePage.jsp and I want to refer to it by someother name while running the application how do I do this in the web.xml file. I have used <servlet-mapping> to do this in the case of a servlet. However I am not sure how to do this with a JSP
    Could somebody show me how to do this. I would be very much grateful.
    All help appreciated and acknowledged.
    thanks in advance
    ilango

    It worked. The correct web.xml version is as below:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd" [
    ]>
    <web-app>
    <!-- Define servlets that are included in the example application -->
    <servlet>
    <servlet-name>ControllerServlet</servlet-name>
    <servlet-class>ControllerServlet</servlet-class>
    <init-param>
    <param-name>base</param-name>
    <param-value>http://localhost:8080/MVCIIapp/servlet/ControllerServlet</param-value>
    </init-param>
    <init-param>
    <param-name>jdbcDriver</param-name>
    <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value>
    </init-param>
    <init-param>
    <param-name>imageUrl</param-name>
    <param-value>http://localhost:8080/MVCIIapp/images/</param-value>
    </init-param>
    <init-param>
    <param-name>dbUrl</param-name>
    <param-value>jdbc:odbc:Burnaby</param-value>
    </init-param>
    <init-param>
    <param-name>ilangocal</param-name>
    <param-value/>
    </init-param>
    <init-param>
    <param-name>mangla</param-name>
    <param-value/>
    </init-param>
    </servlet>
    <servlet>
    <servlet-name>Header</servlet-name>
    <jsp-file>/MVCIIapp/jsp/Header.jsp</jsp-file>
    </servlet>     
    <servlet-mapping>
    <servlet-name>ControllerServlet</servlet-name>
    <url-pattern>/Master</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>Header</servlet-name>
    <url-pattern>/Opener</url-pattern>
    </servlet-mapping>     
    </web-app>
    I have other jps files too.I am going to try and put aliases for them and see how they perform.
    I hope I have not spoken too soon by saying that the aliases work. Let me wait and watch with bated breath.
    But thanks a lot for your suggestions without which this would not have been possible
    ilango

  • URL Mapping for packaged JSP's in web.xml file

              Hi,
              I am using weblogic6.0sp2 enterprise edition.I have my JSP's in package structure.
              Suppose my login.jsp is in package com.advice.document. So for URL mapping in
              web.xml what should be given so that by giving that my JSP runs. I have tried
              many options but not got success.
              Here is my web.xml file..
              <web-app>
              <servlet>
              <servlet-name> Login </servlet-name>
              <jsp-file> com\advice\document\login.jsp</jsp-file>
              </servlet>
              <servlet-mapping>
              <servlet-name> Login </servlet-name>
              <url-pattern> /Login</url-pattern>
              </servlet-mapping>
              </web-app>
              If any body knows or have worked on the same then let me know.
              Thanks in advance.
              --- Vipul
              

    Did you try specifying the jsp-file with forward slashes (e.g.,
              com/advice/document/login.jsp)?
              Vipul Garg wrote:
              > Hi,
              > I am using weblogic6.0sp2 enterprise edition.I have my JSP's in package structure.
              > Suppose my login.jsp is in package com.advice.document. So for URL mapping in
              > web.xml what should be given so that by giving that my JSP runs. I have tried
              > many options but not got success.
              > Here is my web.xml file..
              > <web-app>
              > <servlet>
              > <servlet-name> Login </servlet-name>
              > <jsp-file> com\advice\document\login.jsp</jsp-file>
              > </servlet>
              > <servlet-mapping>
              > <servlet-name> Login </servlet-name>
              > <url-pattern> /Login</url-pattern>
              > </servlet-mapping>
              > </web-app>
              >
              > If any body knows or have worked on the same then let me know.
              > Thanks in advance.
              > --- Vipul
              

  • Cannot find JSP file through web.xml

    Content of a.jsp
    function Thisthing (id, name) {
    this.id = id;
    this.descr = name;
    I want to access a.jsp from b.jsp. like
    <script type="text/javascript" src="a.js"></script>
    I have web.xml content
    <servlet>
    <servlet-name>DomainObjectis</servlet-name>
    <jsp-file>/a.jsp</jsp-file>
    </servlet>
    <servlet-mapping>
    <servlet-name>DomainObjectis</servlet-name>
    <url-pattern>*.js</url-pattern>
    </servlet-mapping>
    However its showing me an error -> .Thisthing undefined whenever I run this in Tomcat 5.5.
    I appears its not finding my a.jsp file. It's working fine when I do
    <%@ include file="a.jsp" %>

    thanks for replying jgalacambra.
    I have deployed several web applications before. But this is the first one where I am trying to include a JSP file as a javascript.
    tomcat recognizes when I simply including the jsp file with import but when I try to include it as a script it's not working. So I am hoping that there are some experts here who can help me. I saw this being done in a project and am trying to build a similar web application myself.

  • Servlets within web.xml

              I am using WLS 5.1.0 with SP6.
              Previously I was controlling servlet access via an ACL in the weblogic.properties file.
              I have now moved the servlet into the web.xml file and specified
              some security constraints on this servlet. I can access the servlet. However regardless of what type of security I specify I cannot control access of the server by anything other than the guest user. Here is the web.xml file I have been using.
              <servlet>
              <servlet-name>AuthServlet</servlet-name>
              <servlet-class>com.myapp.web.servlet.AuthServlet</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>AuthServlet</servlet-name>
              <url-pattern>auth</url-pattern>
              </servlet-mapping>
              <security-constraint>
                   <web-resource-collection>
                        <web-resource-name>Test Deployment Descriptor</web-resource-name>
                        <description>Test Deployment Descriptor for test Authentication Servlet.</description>
                        <url-pattern>/cam/auth</url-pattern>
                        <http-method>GET</http-method>          
                        <http-method>POST</http-method>
                   </web-resource-collection>
                   <auth-constraint>
                        <role-name>MarkEngstrom</role-name>
                   </auth-constraint>
                   <user-data-constraint>
                        <transport-guarantee>NONE</transport-guarantee>
                   </user-data-constraint>
              </security-constraint>
              <login-config>
                   <auth-method>FORM</auth-method>
                   <realm-name>default</realm-name>
              <form-login-config>
                        <form-login-page>/form.jsp</form-login-page>
                        <form-error-page>/error.jsp</form-error-page>
                   </form-login-config>
              </login-config>
              Note : the <role-name> is a user I have specified in my weblogic.properties file. I am using the default security realm.
              I don't get any exceptions reported in the log files and I think it must be some configuration I have missed because the security constraints appear to be totally ignored.
              Does anyone have any suggestions ?.
              Thanks,
              Mark Engstrom
              

              hi, I pump to the same problem before.
              I think you url mapping when you define web resource should starts with /, or
              you say url pattern to be *
              Good luck
              "MarkE" <[email protected]> wrote:
              >
              >
              >I am using WLS 5.1.0 with SP6.
              >Previously I was controlling servlet access via an ACL in the weblogic.properties
              >file.
              >
              >I have now moved the servlet into the web.xml file and specified
              >some security constraints on this servlet. I can access the servlet.
              >However regardless of what type of security I specify I cannot control
              >access of the server by anything other than the guest user. Here is
              >the web.xml file I have been using.
              >
              > <servlet>
              > <servlet-name>AuthServlet</servlet-name>
              > <servlet-class>com.myapp.web.servlet.AuthServlet</servlet-class>
              > </servlet>
              >
              > <servlet-mapping>
              > <servlet-name>AuthServlet</servlet-name>
              > <url-pattern>auth</url-pattern>
              > </servlet-mapping>
              >
              > <security-constraint>
              >      <web-resource-collection>
              >          <web-resource-name>Test Deployment Descriptor</web-resource-name>
              >          <description>Test Deployment Descriptor for test Authentication Servlet.</description>
              >          <url-pattern>/cam/auth</url-pattern>
              >          <http-method>GET</http-method>          
              >          <http-method>POST</http-method>
              >     </web-resource-collection>
              >     <auth-constraint>
              >          <role-name>MarkEngstrom</role-name>
              >     </auth-constraint>
              >     <user-data-constraint>
              >          <transport-guarantee>NONE</transport-guarantee>
              >     </user-data-constraint>
              > </security-constraint>
              >
              > <login-config>
              >      <auth-method>FORM</auth-method>
              >     <realm-name>default</realm-name>
              > <form-login-config>
              >           <form-login-page>/form.jsp</form-login-page>
              >           <form-error-page>/error.jsp</form-error-page>
              >      </form-login-config>
              > </login-config>
              >
              >Note : the <role-name> is a user I have specified in my weblogic.properties
              >file. I am using the default security realm.
              >
              >I don't get any exceptions reported in the log files and I think it must
              >be some configuration I have missed because the security constraints
              >appear to be totally ignored.
              >
              >Does anyone have any suggestions ?.
              >
              >Thanks,
              >
              >Mark Engstrom
              >
              

  • Eclipse, WTP, Servlets and Web.xml

    I wonder if you could help me.
    I am using Eclipse and Web Tools Platform.
    In eclipse, when I create a Servlet, I believe the servlet details (such as name, class, url-pattern) should be included into web.xml file automatically. However, this is not happening.
    Would you know how I can configure Eclipse and WTP to automatically write Servlets details into web.xml files.
    Thanls

    Thanks for the reply
    I have Eclipse 3.2 and WTP 1.5
    Yes, I am creating my Servlet in a project under the Dynamic Web Projects.
    I deploy my WAR file using the 'Export' menu.
    Now, I have manually added the servlet details into the web.xml file:
    <servlet>
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>com.mycom.HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/HelloWorld</url-pattern>
    </servlet-mapping>
    I am accessing the servlet as:
    http://localhost:9090/MyFirstServlet/HelloWorld
    But I still get HTTP 404 error when accessign HelloWorld servlet. I am not sure what I am missing.
    Thanks

  • Can two urls map to same servlet in web.xml

    Hello All,
    I need to map the two urls in my web application with the same servlet.
    I tried as follows:
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <servlet>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>fileredirectsolution.TestServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>TestServlet</servlet-name>
    <url-pattern>/testservlet</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>TestServlet</servlet-name>
    <url-pattern>/filerepository/*</url-pattern>
    </servlet-mapping>
    </web-app>
    However, I am getting an error while accessing the TestServlet.
    When I remove the second servlet-mapping tag..it is working fine.
    How can I map the two urls with the same servlet.
    Thanks
    Saikrishna

    it is not ur requirement. but
    i think it will help 2 u.
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4"; xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <servlet>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>fileredirectsolution.TestServlet<;/servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>TestServlet</servlet-name>
    <url-pattern>*.xxx</url-pattern>
    </servlet-mapping>
    </web-app>
    if ur configure web.xml like above.
    any request that ends with .xxx call the TestServlet.
    ex:
    1)http://ip:port/contextpath/abc.xxx
    2) http://ip:port/contextpath/xyz.xxx
    here both urls calls the same servlet.
    -lakshman.
    save a life by sending information.
    www.help2patients.wordpress.com.

Maybe you are looking for