Is it neccessary to add the tld definition in web.xml

I am using OC4J 10g so the servlets 2.4.
And i have included my tld under web-inf folder fo the project.
I include the tld in the JSP and use it.
It works.
But my question is is it neccessary to add its definition in web.xml file too.
Because it works without it.
What is the reason behind it.
Edited by: rhea111 on Oct 26, 2007 9:05 AM

With the JSP 1.2 specification, you needed to add the TLD mappings to your web.xml. With JSP 2.0, the container will make it's own mappings from:
1. Any explicit mappings that you've done. They're still valid and override implicit mappings
2. It will check for TLDs under /WEB-INF and any directory under /WEB-INF
3. It will check for TLDs in the (/META-INF folder and sub-folders of /META-INF) of any JARs under /WEB-INF/lib
Using those TLDs, it will build a mapping of <uri> to TLD and will use that.
I include the tld in the JSP and use it.I'm sure you mean the <uri> declared in the TLD don't you? I hope you're not using the actual path to the TLD? Because that would also work but it's a bad practice.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
----------------------------------------------------------------

Similar Messages

  • [svn] 2277: 1) Update the messaging-config. xml under resource and add the cluster definition with shared-backend attribute .

    Revision: 2277
    Author: [email protected]
    Date: 2008-06-27 08:22:18 -0700 (Fri, 27 Jun 2008)
    Log Message:
    1) Update the messaging-config.xml under resource and add the cluster definition with shared-backend attribute. [#blz-197]
    2) Minor update to the session test.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/blz-197
    Modified Paths:
    blazeds/branches/3.0.x/qa/apps/qa-regress/WEB-INF/src/remoting/session/FlexSessionAttribu teListenerTest.java
    blazeds/branches/3.0.x/resources/config/messaging-config.xml

    To use servlets u have indeed to update your web.xml...Well I'm not sure this is relevant to your case anyway.
    You have to add a <servlet> element to this file.
    Something like this:
    <servlet>
    <servlet-name>blabla</servlet-name>
    <servlet-class>blablapackage.Blablaclass</servlet-class>
    <init-param>...</init-param>
    </servlet>
    Now this may not solve your problem. Make sure you refer to your servlets using their full qualified names.btw, just to be sure, what is your definition of "servlet"? (i mean: any java class or only javax.servlet.Servlet)

  • How to chage the welcome file in web.xml using creator?

    Hi guys,
    I want to set the welcome file in web.xml to index.html but every time I run my project in creator, creator replaces index.html by faces/index.jsp. I need the index.html to check if the browser enables cookies & javascript and then I redirect to index.jsp. If I change the web.xml in a common editor, build the war-file with ant and deploy the project with tomcat, everything is fine. but how can I change it in creator?
    thanks in advance

    Sorry, that doesn't make much sense.
    The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
    Are you a user of this utility?

  • Problem with the data source and web.xml

    I have an issue where JSC is removing my resource reference:
    <resource-ref>
    <description>Creator generated DataSource Reference</description>
    <res-ref-name>jdbc/localOracleDatabase</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    from the web.xml and sun-web.xml.
    The application has been working great in the IDE for months then wham, no more data source definition. I try and add the reference manually and the IDE takes it out. I am "NOT" adding it to the .xml's in the build area. Why is JSC removing the data source entry?

    This continues to be a problem. The only way that I can get around the problem is to drag a table from the data source onto the design pallete and then the datasource is added back to the web.xml. I can run fine for 10 or 15 runs then the entry is once again removed from the web.xml.
    Help please!

  • How to add another secure url in web.xml?

    hello i want to secure my web application i have two kind of users i have users and admin.each of them has each certificat users have permission to enter /users and admin have permission to enter /admins/ but i want also users to enter another folder which is /otheruserplace how can i add this in my web.xml file here is my code
    http://pastebin.com/m3e13d3d9

    Just add another url-pattern.
    This has nothing to do with JSF however. More suitable place would have been the Servlets forum.

  • Add virtual directory to orion-web.xml file of embedded OC4J instance

    I'd like to add a virtual directory to the orion-web.xml file of the embedded OC4J application which comes with JDeveloper (version 10.1.3.3.0.4157). Every time I run my application however, a new orion-web.xml file is created which overwrites the orion-web.xml file with my virtual directory. The orion-web.xml is located in the <JDev_Home>\jdev\system\oracle.j2ee.10.1.3.41.57\embedded-oc4j\application-deployments\current-workspace-app\<app Name> directory.
    Does anybody know a solution to this problem?
    Regards,
    Matthieu

    hi there,
    i have the same problem, all the configuration files are included in the EAR file, like application.xml,...
    but the orion-web.xml is not included.
    I dont have that option that you mencioned File->New->Deployment Descriptiors -> web...for oc4j...
    I can create a EAR, WAR or JAR in File->New->Deployment Profiles.
    I need the orion-web.xml to define the MIME types the servlet can return, is it really needed?
    regards,
    Laura

  • Someone said to add the title on each web page on the main text box. Which is that?

    I read in the discussion items that you should not bother with meta tags but just wirte the title in your main text box on each page with the word image in the beginning. Where in the main text box? The first one on the page? That has my web page title. Help. Judy

    iWeb uses the textbox in the Header layer of an iWeb page as the title in the browserwindow.
    Do not remove the original textbox, as you cannot replace it other than by selecting another theme and then change it back to the original theme again. Ruining the layout in the process.
    If the textbox in the Header is missing, iWeb uses a textbox down the page in the Content layer. If that textbox is also missing, it uses another textbox. If that fails it uses the pagename in the Sidebar.
    Sometimes you may want a different text in the titlebar and not display it on the page itself. Or not display it at all.
    So use that textbox in the Header layer. Type your text. Then select the textbox. In the Inspector choose T, click a color to open the color palette and drag the opacity slider to 0 (zero).
    Do Command-T to open the font palette and make the font smaller. (Or do Command--(minus)) Also use a font that doesn't change to an image. Arial is a good font. Perhaps do it first before making the text invisble.
    Resize the textbox. You may want to change the height of the Header layer.
    Do Command-Shift-B to move the textbox to the back, possibly behind other objects.
    Next add a optional second textbox to the Header layer and use that one to display text on the page.
    If you want to move the textbox to the front again to make changes, but can't remember the location on the page, drag the area with the mouse to select the objects.
    Deselect objects you do not want to move forward by Command-dragging the mouse over these objects.
    Next do Command-Shift-F to move the textbox to the front. Repeat the steps in reverse order to make the text visible.
    Practice.

  • How to store the tld file somewhere else...

    Is it possible to not be forced to always copy the tld file for a tag library into the WEB-INF directory but to pick up the file from a jar/linked resource/project instead.
    The JSTL seems to be able to do it. Though it may be being referenced by some web.xml file that I can't find. The JSTL stores it's template file in the META-INF directory of its jar and then id's the tag file via the uri tag in the template.
    Would doing something similar work for ones own tags?
    I must apologise if this topic has already been dealt with but I did search the forum and on google before posting.

    The JSTL seems to be able to do it. Though it may be
    being referenced by some web.xml file that I can't
    find.
    The JSTL stores it's template file in the
    META-INF directory of its jar and then id's the tag
    file via the uri tag in the template.
    Would doing something similar work for ones own
    tags?
    Yes. Please take a look at post #11 in this thread http://forum.java.sun.com/thread.jspa?threadID=664068, specifically #3 that deals with packaging tag library classes.
    Please note there needn't any references in any web.xml, all you have to is jar your tag classes, have the tlds in META-INF directory. The container picks up the tld definition either from web.xml or from the META-INF of a jar found in WEB-INF/lib (Please see the jsp 2.0 spec section 7.3. The spec itself can be downloaded from http://www.jcp.org/en/jsr/detail?id=152)
    All thats then required to access the tags is the have the jar in the classpath and a taglib directive in jsps.
    You can take a look at this IBM article http://www-128.ibm.com/developerworks/library/j-jsp09023.html?ca=dnt-435 (though it says you require a web.xml entry)
    cheers,
    ram.

  • Unable to add the Listener class in project .

    Hi friends ,
    I'm using deploytool of Sun's AppServer 8.2.
    I'm not abel to add the Eventlistener class in the project.
    In the Help Menu the given following discription to Add the Event Listener call
    Web Application WAR File -> Event Listeners tabbed pane
         1. Click Add to add an event listener to the Event Listener Classes list.
         Locate any event listener classes contained in this WAR file in the drop-down list in the Event Listener Classes      pane.
         (note:There is no any drop-down list in in the Event Listener Classes pane.)
    2. If the event listener class is not in the list, in the General tab, click Edit and to go to the Edit Contents      dialog box where the event listener class can be added to the contents of the WAR file. Upon return the event      listener class will be in the pull-down list.
              (note:But the listener class is present in General tab ,WEB-INF->classes->listeners(In the Contents of the           General tab.))
    How could i resolved this , i mean how to add Event Listener Classes in project ?
    (Same problem while adding error page and filter classes which are also present in the General tab)
    Regards,
    Sachin Warang.

    I suggest using NetBeans IDE 5.5, which integrates easily with various appservers, including Sun Java System Application Server.
    -cheng

  • Is it possible to add a filter to a webapp without declaring it in web.xml

    Hello,
    I'd like to add a filter in my web.xml file, but without declaring it in my webapp.
    Indeed, I have multiple webapps, and I'd like to have a common web.xml file that should be directly included in all the webapps including this package ?
    Is it possible or not ?
    As for JSF, it is possible to add faces-config file by putting it in the META-INF of the package.
    Thanks in advance.
    bgOnline

    Your title and your question are opposites...
    A filter must be specified in a web.xml to be used. That doesn't mean the Filter's class HAS to be in your webapp, it just must be accessible to the Servlet container (you could place it in the common/classes directory or shared/classes directory or even the server/classes directory).
    I've not tried it, but I see no reason why you couldn't declare the filter and filter-mapping in the server's web.xml which would then filter all requests in all webapps.
    HTH.

  • Do we need to put the following code in the web-xml for the project to run

    Hi^^^,
    actually I have created a project in Eclipse WTP and I am running it from remote server. Its giving me 404 error when I tried to run it.
    I know 404 error is generally due to some error in deployment descriptor.
    I am going through this tutorial for creating project in eclipse WTP
    this says that I need to include the following code in web-xml. Please look at the quotes below
    "Web modules in J2EE has a deployment descriptor where you configure the web application and its components. This deployment descriptors is called the web.xml. According to the J2EE specification, it must be located in the WEB-INF folder. web.xml must have definitions for the Servlet and the Servlet URI mapping. Enter the following lines into web.xml:"
    "Listing 2. Deployment Descriptor web.xml"
    <servlet>
    <servlet-name>Snoop Servlet</servlet-name>
    <servlet-class>org.eclipse.wtp.tutorial.SnoopServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Snoop Servlet</servlet-name>
    <url-pattern>/snoop/*</url-pattern>
    </servlet-mapping>
    My question is, it is necessary to include the above lines between <servlet> and </servlet-mapping> in web-xml
    thanks and regards,
    Prashant

    pksingh79 wrote:
    actually I have created a project in Eclipse WTP and I am running it from remote server. Its giving me 404 error when I tried to run it.
    I know 404 error is generally due to some error in deployment descriptor. what's the url you've put.
    <servlet>
    <servlet-name>Snoop Servlet</servlet-name>
    <servlet-class>org.eclipse.wtp.tutorial.SnoopServlet</servlet-class>
    </servlet> Every Servlet has to have a <servlet></Servlet> tag in the web.xml
    the <servlet-name>is for the naming the servlet and the <servlet-calss>is for class file of the servlet in your case the .class file is to be in the package of tutorial,if it's not then how the container will no where the calss file is
    <servlet-mapping>
    <servlet-name>Snoop Servlet</servlet-name>
    <url-pattern>/snoop/*</url-pattern>
    </servlet-mapping>You type something in your url likk http://localhost:8080/webappname (Tomcat server),so for url mapping instead of typing the entire class file name ,you just enough have to type what you've put in the <url-mapping> tag and it has to be inside of <servlet-mapping>
    I think the problem is in <url-pattern> change it like /snoop<url-pattern>
    My question is, it is necessary to include the above lines between <servlet> and ></servlet->mapping> in web.xmlSo now you think whether you need something inside <servlet>and </servlet-mapping>

  • The file should be in XML-DATA-TEMPLATE format

    Hi,
    When I am trying to upload the Data Definition file in XML publisher with EBS 11.5.10.2, I got "The uploaded file GLPAYBDXDO.xml is invalid. The file should be in XML-DATA-TEMPLATE format". I have tried changing the file name to different names including XML-DATA-TEMPLATE but I could not succeed. I appreciate for any help.
    Thanks,
    Ram.

    What is the content of your xml file. Is this sample xml file or Data Template.

  • Web.xml + jsp-config element missing in definition?

    Hi,
    I have problem with jsp-config element definition in web.xml - I checked web-app_2_5.xsd it's reffering to javaee_5.xsd - but it's missing there
    from web xsd:
    <xsd:element name="jsp-config"
              type="javaee:jsp-configType"/>
    There is no javaee:jsp-configType. Is jsp-config deprecated? I couldnt find it in 1.4 as well. Please advice.
    Thanks
    Y

    ok - there are includes in web-add_2_5.xsd to jsp_2_1.xsd ... missed that - sorry
    <xsd:include schemaLocation="javaee_5.xsd"/>
    <xsd:include schemaLocation="jsp_2_1.xsd"/>
    Y

  • Impossible to get the Sun NS and XSD to validate my web.xml

    Hello,
    I'm having a problem getting the namespace and schema to validate my web.xml file. Three days ago, everythings were working fine, but since friday I can't get the XSD.
    The top of my web.xml looks like this :
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
         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"
    >When I try to validate my web.xml, I got error like this :
    s4s-elt-character: Non-whitespace characters are allowed ...I've recently seen other topics like this, but I'm not sure it's the same issue.
    Is it a known issue? What can I do to validate my web.xml? Are there mirrors for this XSD?
    Best Regards.
    Message was edited by:
    Arlo

    Please help, I still have the problem and it seems it's a known issue :
    http://dev.eclipse.org/newslists/news.eclipse.webtools/msg03484.html

  • Configuring the web.xml to run Servlets

    Hi,
    Can i get some help to configure my web.xml file... ?
    I am trying to run servlets. Do i need to map each servlet i use or can i just create a folder and map the folder. Which web.xml file do i need to change... ? And under which directory shall i place the servlet folder.
    Thanks

    Hi,
    which server ur using ? if its tomcat then this can help u out..
    u have to change the web.xml file in ur own directory.
    for example u have ur directory in tomcat/webapps/<ur directory>
    then in ur directory u have to create 1 WEB-INF directory and copy the web.xml file in that. another thing u have to make 2 direcotries in WEB-INF.
    one is classes - u can keep ur servlets class files + ResourceProperty file
    second is lib - u can keep the library files here
    and u have to register ur each and every servlet in web.xml file
    take care
    enjoy the coading
    kedar

Maybe you are looking for

  • Opening a .pdf in a Portfolio causes pop up "For best experienc use Acrobat 9 or Reader 9 or later."

    I created a portfolio. In it is a converted Word doc .pdf with links to two other .pdf's that are inside the same portfolio.  The other two .pdf's open normally when clicked on.  The one with the links gives me a pop up message when the icon is click

  • Dynamically generated Google Map in new window

    I've got a detail page for restaurants and would like to have a "MAP IT" link that, when clicked, opens a map of the location in a new window, preferably using Google maps since I like them (but that's not critical). I've got the WebAssist extension

  • Recursive By reference passing of hashtable value in C#

    Basically, I'm trying to graft a hashtable to to another, and in any other language, I can get it to work...C#, not so much. If anyone could give me some insight on how I should be doing this, I'd appreciate it. This is what I have so far (which does

  • Setting the layer color property with javascript

    Is it possible to set a layer's color in the layers palette using javascript? By default everything shows up with no layer color but if you right click (ctrl-click) on a layer you have the option to change the color to Red, Orange, Yellow, etc. My qu

  • OTL timecard customisation - add Project Name - change DFF???

    Hi, In Metalink note 294866.1 it describes a way of adding Project Name to a timecard, and it describes adding a layout component with the following qualifiers to the .ldt file:- BEGIN HXC_LAYOUT_COMP_QUALIFIERS "Projects Timecard Layout - Project Na