Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Suggest me

 
Gorkal Raghavendra
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please quote your sources.
 
Gorkal Raghavendra
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its form Javaranch mock exam
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gorkal Raghavendra:

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





one ")" is missing the end of statement
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option D has TR and TD tags inside the scriptlet, which is not correct
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Verre
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks charles even I was thinking of the same reason too but just wanted to confirm.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic