• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Suggest me

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please quote your sources.
 
Gorkal Raghavendra
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its form Javaranch mock exam
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Verre
 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 836
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks charles even I was thinking of the same reason too but just wanted to confirm.
 
See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic