• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Qn on welcome-file-lsit tag

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

Could there be more than one occurance of <welcome-file-list> tag in a DD. Please confirm.

Thanks in Advance
Chandu
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. Its possible to mention more than one welcome file name inside the <welcome-file-list> tag.. The welcome file will be called depends upon the location request..

Correct me if something is wrong..
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, though <welcome-file-list> is optional tag, more than one occurance is not possible. one per webapp. <welcome-file> can be more than one. correct me if i'm wrong.
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The <welcome-file-list> element define the ordered list of files to look for the directory. There can be more than one element of this type. If more than one entries present in the web.xml, the container mergers them in oreder they define in the web.xml.

Hope it help

Thanks
 
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the servlet spec 2.4 (SRV 13.3), from the XML-Schema of the DD, some elements are in a xsd:choice element with this definition :



Which means elements declared in this choice block can be used (minOccurs) to any times (no limit, as unbounded value of maxOccurs tells us).

In these elements you find :

  • welcome-file-list
  • servlet
  • servlet-mapping
  • mime-mapping
  • error-page
  • jsp-config
  • etc...


  • This proves that welcome-file-list element may appear 0 to multiple times in a DD.

    About the welcome-file sub-elements, they are defined in the welcome-file-listType complex type this way :


    This means they can appear 1 (no minOccurs attributes, default for xsd:element is 1) to many (maxOccurs set to unbounded).

    So in a welcome-file-list, you must have at least one welcome-file, but beside this rule, you may have as many as you wish.

    Specs always help
    [ March 22, 2006: Message edited by: Frederic Esnault ]
     
    Sheriff
    Posts: 14691
    16
    Eclipse IDE VI Editor Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hum... As if there was not enough people answering here,
    I'll add my little spice.

    In the spec, looking at the nice diagrams in "SRV.13.4 Deployment Descriptor Diagram" is much easier to understand. To check for mandatory tags, subtags, etc..., it is very handy.
     
    Frederic Esnault
    Ranch Hand
    Posts: 284
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Yes you're right, it's simple, but this is a schematic translation of the XML Schema. And the XSD (XML-Schema) defines very clearly the occurences allowed, and should be the last reference when in doubt.

    But knowing the schema translates the XSD, then you're right. I just didn't want to say "look at the star in from of the welcome-file-list block in the schema, it means 0 o many". So I explained deeply.

    I'm sorry, i'll never do it again
     
    Narendra Dhande
    Ranch Hand
    Posts: 951
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi fred,

    I'm sorry, i'll never do it again



    Sorry for what ? You are doing really good job. Not everybody can do this. Please carry on.

    Thanks
     
    Chandra Sagi
    Ranch Hand
    Posts: 162
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks friends. In the book it said it cannot have more than one. In one mock exam it was the other answer. Thanks for clearing my doubt.

    Cheers
    Chandu
     
    Ranch Hand
    Posts: 30
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Guys,
    I understand that <welcome-file-list> can appear multiple times, but i have a question, if we declare <welcome-file-list> what is the order of processing,

    ex:
    <welcome-file-list>
    <welcome-file> index.html</welcome-file>
    <welcome-file> index.do</welcome-file>
    </welcome-file-list>

    <welcome-file-list>
    <welcome-file> index.jsp</welcome-file>
    </welcome-file-list>

    in this scenario, can we predict the behaviour.
     
    Christophe Verré
    Sheriff
    Posts: 14691
    16
    Eclipse IDE VI Editor Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Narendra Dhande:

    Sorry for what ? You are doing really good job. Not everybody can do this. Please carry on.
    Thanks



    Haha. You don't even know what your own signature means (or seems to mean):
    "Man is always sorry for what is not"
     
    Narendra Dhande
    Ranch Hand
    Posts: 951
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Satou,

    My mother tongue is not english and my english is not so good. I am using this signature from lot of year, no one had any comments on it. I really appreciate if you can tell me what is wrong with this signature.

    Thanks
     
    Christophe Verré
    Sheriff
    Posts: 14691
    16
    Eclipse IDE VI Editor Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Narendra,
    I was just kidding English is not my mother tongue either.

    I thought it meant something like "Man is always sorry for what he should not be sorry for".
    Meaning that you should not tell Fred not to be sorry, because man is always sorry for what he should not be sorry for. Hummmmm... I'm lost

    Anyway, you were right about him doing a really good job.
     
    Gunaselan Varathan
    Ranch Hand
    Posts: 30
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Guys,
    In this scenario
    <welcome-file-list>
    <welcome-file> index.html</welcome-file>
    <welcome-file> index.do</welcome-file>
    </welcome-file-list>

    <welcome-file-list>
    <welcome-file> index.jsp</welcome-file>
    </welcome-file-list>

    it is treated as

    <welcome-file-list>
    <welcome-file> index.html</welcome-file>
    <welcome-file> index.do</welcome-file>
    <welcome-file> index.jsp</welcome-file>
    </welcome-file-list>

    I tested this in tomcat 5.
     
    First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
    Gift giving made easy with the permaculture playing cards
    https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    reply
      Bookmark Topic Watch Topic
    • New Topic