• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Servlet init param (JavaRanch mock question)  RSS feed

 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The Element in the Deployment Descriptor for a servlet initialization parameter is :

<!ELEMENT init-param(param-name, param-value, description?)>


TRUE <<---
FALSE



Answer says true,
as I know servlet init param is defined in the DD as:



Did i read between the lines, regarding that question?
Please help!


Thanks,
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
init-param contains zero or more "description", one "param-name" and one "param-value".
 
Ranch Hand
Posts: 893
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
description?

? means zero or more I conclude
 
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe

Will these work? If No, why?

<servlet>
<servlet-name>...</servlet-name>
<servlet-class>...</servlet-class>
<init-param>
<param-value>...</param-value>
<param-name>...</param-name>
</init-param>
</servlet>



<servlet>
<init-param>
<param-name>...</param-name>
<param-value>...</param-value>
</init-param>
<servlet-name>...</servlet-name>
<servlet-class>...</servlet-class>
</servlet>

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The order of tags does not matter in Servlets 2.4, so both will be ok.
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means, it's OK for SCWCD CX-310-081

As the exam is based on Servlet 2.4, JSP 2.0 and tld-version 1.2

Am I right Christophe??

Regards,
Khushhal
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

it's OK for SCWCD CX-310-081


That's right.

And be careful the Javaranch's mock exam was aimed at SCWCD2.3, so it may contain some old questions.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Remko]:
description?

? means zero or more I conclude


? means zero or one. In other words, there can be none or one <description>
sub-element.

Am I correct?


Thanks for your replies!
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Christophe

Regards,
Khushhal
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Chandra

You are right

<description> is an optional element.
And can appear zero to multiple times.

Regards,
Khushhal
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is prior to current version, the init parameters were declared like this?

<!ELEMENT init-param(param-name, param-value, description?)>

What does this mean?


Thanks,
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they were described using a DTD. Now they are using an XML schema, which you can see here.

The init-param is now defined this way : (I've done a bit of editing)

[ August 07, 2007: Message edited by: Christophe Verre ]
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christophe,

I got it.

Khushal, my reply mismatches to what you said.
I know it is zero or one. You say it is zero or more.

Please confirm!


Thanks,
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the old version (DTD), description? means that there may be 0 or 1 description.
The new version tells that there may be 0 or more (minOccurs="0" maxOccurs="unbounded") description tags.
That's confusing, so try to forget about version 2.3
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandra..

As per DTD

<!ELEMENT init-param (param-name, param-value, description?)>



It's zero or one.

But as per XML schema

<xsd:sequence>
<xsd:element name="description" type="j2ee escriptionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="param-name" type="j2ee:string"/>
<xsd:element name="param-value" type="j2ee:xsdStringType"/>
</xsd:sequence>



It's zero to many

And I am using XML schema.

<web-app 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/web-app_2_4.xsd"
version="2.4">



Regards,
Khushhal
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you very much Christopher!


Khushhal, I got your point as well.

There has been very quick replies to this thread. I appreciate this.


Thanks,
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks a good thread. We need to be always cautious on which version the exam (be it real or mock) covers! isnt it?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!