• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

name conflict in web.xml and web-fragment.xml

 
Ranch Foreman
Posts: 1904
13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to EPractice Lab:


Configuration conflicts between the main web.xml and a web fragment are resolved such that the configuration in the web.xml takes precedence.


But when I try this:


//in web.xml
<context-param>
<param-name>B</param-name>
<param-value>30</param-value>
</context-param>




// in web-fragment.xml in A.jar's META-INF
<web-fragment xmlns="http://xmlns.jcp.org/xml/ns/javaee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd";
version="3.1"
metadata-complete="true">

<context-param>
<param-name>valueB</param-name>
<param-value>20</param-value>
</context-param>
</web-fragment>



In my main index.jsp :
<%=application.getInitParameter("valueB")%>


Which valueB was printed? I got 20 , which comes from the web-fragment.xml.
 
Himai Minh
Ranch Foreman
Posts: 1904
13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I made a mistake in the web.xml. The param value should be "valueB".
Now, it prints 30, which comes from web.xml.
Please ignore this post.
 
I am going to test your electrical conductivity with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic