wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Suggest me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Suggest me " Watch "Suggest me " New topic
Author

Suggest me

Gorkal Raghavendra
Ranch Hand

Joined: May 21, 2008
Posts: 30
A.<% if(session.isNew())
out.print("Hello");
%>

B.
<%
Enumeration names = request.getParameterNames();%>
<% jsp:while(names.hasMoreElements())
{ %>

<tr>
<td>
<%= request.getParameter((String)names.nextElement()) %>
</td>
</tr>

<% } %>


C. <%@ jsp:if condition="<%= session.isNew() %>">
<h2>Hello</h2>
</jsp:if>


D.<%
Enumeration names = request.getParameterNames();
while(names.hasMoreElements())
{
<tr>
<td>
out.print(request.getParameter((String)names.nextElement());
</td>
</tr>
} %>


In the above examples option D is correct right when we are using JSP technology.
But in mock exam its showing otion A.
Suggest me in this.
Thanks in advance
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Please quote your sources.


[My Blog]
All roads lead to JavaRanch
Gorkal Raghavendra
Ranch Hand

Joined: May 21, 2008
Posts: 30
Its form Javaranch mock exam
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by Gorkal Raghavendra:

out.print(request.getParameter((String)names.nextElement());





one ")" is missing the end of statement
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Option D has TR and TD tags inside the scriptlet, which is not correct
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Verre
Srividhya Kiran
Ranch Hand

Joined: Feb 17, 2008
Posts: 166
Hello

Sorry If I am asking a very basic question. Is

<%jsp:while(cond)
{
}%>
and

<%@ jsp:if cond=" ">

</jsp:if>

are they valid jsp standard action tag?

Thanks
Srividhya
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
No question too small... but you are incorrect. Scriptlets don't need the XML namespace prefix jsp: - so you just have:or alternativelywhere 'c' is the prefix conventionally used for the JSTL core library (there are no standard actions for flow control or setting scoped variables - other than bean instances). You'd need to complete the various ... with correct things - for example, "items", "begin" and/or "end" attributes in the <c:forEach>.
[ July 29, 2008: Message edited by: Charles Lyons ]

Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
Srividhya Kiran
Ranch Hand

Joined: Feb 17, 2008
Posts: 166
Thanks charles even I was thinking of the same reason too but just wanted to confirm.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Suggest me