About Question enthuware.jwpv6.2.1024 :
Moderator: admin
About Question enthuware.jwpv6.2.1024 :
My question is: where is guarantee, that body of the tag will be processed? I was little confused, because <body-content> could be set to tagdepandent. So there is no guarantee (only posibility) to print correct output... What is wrong with my assumption?
From my point of you in question should be word "could", or info about <body-content>...
From my point of you in question should be word "could", or info about <body-content>...
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1024 :
In the context of the question, I think your assumption is kind of on the borderline between valid and invalid A question cannot specify everything. Anything that is not specified should be assumed to not affect the answer. For example, where is the guarantee that scripting is enabled on the page? It is possible to disable it in the deployment descriptor in which case the give fragment will not work.
The actual exam also expects you to make similar assumptions i.e. if anything is not specified in the question then it should be assumed to be ok.
We have updated the question as per your suggestion.
The actual exam also expects you to make similar assumptions i.e. if anything is not specified in the question then it should be assumed to be ok.
We have updated the question as per your suggestion.
If you like our products and services, please help us by posting your review here.
-
- Posts: 13
- Joined: Sun Jan 20, 2013 5:58 am
- Contact:
Re: About Question enthuware.jwpv6.2.1024 :
Which version of JSP spec should be studied for OCEJWCD 1Z0-899 exam?
Where can I download pdf version of that JSP spec from?
And which section or page number provides details for variables that are set for custom tags, as asked in this question?
Where can I download pdf version of that JSP spec from?
And which section or page number provides details for variables that are set for custom tags, as asked in this question?
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1024 :
JSP 2.2 You can download it from Oracle.
Take a look at chapter titled "Package javax.servlet.jsp.tagext" page 1-69
HTH,
Paul.
Take a look at chapter titled "Package javax.servlet.jsp.tagext" page 1-69
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Mon Jan 11, 2016 1:52 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1024 :
What about putting scriplet code inside custom tag body, isn't it forbidden?
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1024 :
No, it is not forbidden for classic tags. For simple tags (i.e. tags implementing SimpleTag interface or tags based on tag Files), it is forbidden.grendel777@o2.pl wrote:What about putting scriplet code inside custom tag body, isn't it forbidden?
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Mon Jan 11, 2016 1:52 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1024 :
Aghr, right! Forgot
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1024 :
This is an example to demonstrate this random number tag:
Index.jsp:
Code: Select all
package com.tags;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.*;
public class RandomNumberGen extends TagSupport {
public Double randomValue;
@Override
public int doStartTag() throws JspException {
randomValue = Math.random();
pageContext.setAttribute("value", randomValue.toString());
return EVAL_BODY_INCLUDE;
}
}
Code: Select all
package com.tei;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
public class MyTEI extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData data){
VariableInfo[] values = new VariableInfo[1];
values[0] = new VariableInfo("value", "java.lang.String", true, VariableInfo.NESTED);
return values;
}
}
Code: Select all
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
<tlib-version>1.0</tlib-version>
<short-name>mytld</short-name>
<uri>http://www.mytlds.com</uri>
<tag>
<name>randomNum</name>
<tagclass>com.tags.RandomNumberGen</tagclass>
<body-content>JSP</body-content>
<tei-class>com.tei.MyTEI</tei-class>
</tag>
</taglib>
Code: Select all
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
<body>
<%@ taglib prefix="my" uri="http://www.mytlds.com" %>
<my:randomNum><%=value%></my:randomNum>
</body>
</html>
Who is online
Users browsing this forum: No registered users and 8 guests