Sei sulla pagina 1di 36

Enjoy Your Study .

Com
Developed by Omprakash About Me
Search

Contact us

GNIIT TUTOTIALS

PERSONALITY DEVELOPMENT & SUCCESS TIPS

GNIIT SEM D MT1 EXAM QUESTION


Posted by omprakash October 12, 2013

Search

1. Paul has created a bean called myclass that wraps a collection of student objects. He has Written the following code snippet to iterate over the myclass bean and produce one row for each student: <c:forEachvar=student items=${myclass.myclass}> <tr> <td>${student.name}</td> <td>${student.age}</td> <td>${student.height}</td> </tr> </c:forEach> Now, Paul wants to write the preceding code snippet using scriptlets and unordered list. Which of the following code snippets fulfills Pauls requirement? 1, <ul> <% Iterator items = myclass.iterator(); while ( items.hasNext() ) { myclass myclass1 = (myclass) items.next(); %> <li><%= student.getTitle() %></li> <% } %> </ul> m 2, <ul>
Facebook social plugin

Enjoyyourstudy
Like

196 people like Enjoyyourstudy.

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

<% Iterator items = myclass.iterator(); while ( items.hasNext() ) { myclass myclass1 = items.next(); %> <li><%= student.getTitle() %></li> <% } %> </ul> m 3, <ul> <% Iterator items = myclass.iterator(); myclass myclass1 = (myclass) items.next(); %> <li><%= student.getTitle() %></li> <% } %> </ul> m 4, <ul> <% Iterator items = myclass.iterator(); while ( items.hasNext() ) { myclass myclass1 = (myclass) items.next(); %> <li><%= myclass.getTitle() %></li> <% } %> </ul> m 2.Mark is developing a shopping site for Nucleus Inc., using the Struts framework. He has to write the code to track the items that a user adds to the shopping cart. To implement this functionality, he writes the following code in the AddItemsAction class: public class AddItemsAction extends Action

Recent Posts
Bsc-IT 5th sem exam solutions Bsc-IT 4th sem Dumps of 2013 Software Engineering Arkestra special songs of 2013 How to prepare Gate exams Tips about GATE Exams 2014

Categories
.net interview solutions All types Of Bhojpuri Songs.. All Types of links All Types of wallpapers Arkesta special songs of 2013 Basic java Interview Question With Answer Best Sites To Download Free eBooks Bhojpuri bhakti mp3 songs Bhojpuri Video Songs Boot Windows Xp very Fast BSC-IT 4TH SEM ASSIGNMENT BSIT-42 ( TB) BSC-IT 4TH SEM ASSIGNMENT BSIT-43(TB) BSC-IT 4TH SEM ASSIGNMENT BSIT-44 (TB) Bsc-IT 4th sem assignment BSIT-ta BSC-IT 4TH SEM ASSIGNMENTS BSIT-41 (TB) Bsc-IT 4th sem Dumps of 2013 Software Engineering Bsc-it 4th sem practical sol BSC-IT 5TH SEM ASSIGNMENT BSIT-52 (TA) BSC-IT 5TH SEM ASSIGNMENT BSIT-53 (TB)

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

{ publicActionForward execute(ActionForm form, HttpServletRequest request, HttpServletResponse response) { List errorMsgs = new LinkedList(); request.setAttribute(errorMsgs, errorMsgs); try { String itemStr = request.getParameter(Item).trim(); String itemCode = request.getParameter(Code).trim(); . . } catch(Exception E) { E.printStackTrace() } } } However, the preceding code causes errors during compilation. Analyze the preceding code to identify the cause of error and provide the solution. 1, The setAttribute() method is used incorrectly in the code. The correct code is: response.setAttribute(errorMsgs, errorMsgs); 2, The setAttribute() method is used incorrectly in the code. The correct code is: request.setAttribute(errorMsgs, errorMsgs); 3, The incorrect signature of the execute() method is used in the code. The correct signature is: publicActionForward execute(ActionMapping mapping, ActionForm form, HttpServletResponse response) 4, The incorrect signature of the execute() method is used in the code. The correct signature is: publicActionForward execute(ActionMapping mapping, ActionForm

BSC-IT 5TH SEM ASSIGNMENT BSIT-54 (TA) BSC-IT 5TH SEM ASSIGNMENT BSIT-54 (TB) Bsc-IT 5th sem exam solutions BSC-IT 5TH SEMESTER ASSIGNMENTS BSIT51(TA) & (TB) BSC-IT 6TH SEM ASSIGNMENT BSIT-63 TA & TB BSC-IT 6TH SEM ASSIGNMENTS BSIT 62 (TA & TB) BSC-IT 6TH SEM ASSIGNMENTS BSIT-64 (TA & TB) BSC-IT 6TH Sem practical sol BSC-IT 6TH SEMESTER ASSIGNMENTS BSIT61(TA) & (TB) BSC-IT Practicals With Solutions Bsc-It result of all semester C Programing C Programing Array Interview question with solution C Programming Array Interview question with Answer C Programming Bits and Bytes Interview Question C Programming Interview Question with Answer C# INTERVIEW QUESTION WITH ANSWER Career in Information Technology(IT) Field CBSE CTET (Central Teacher Eligibility Test) exams full sms GNIIT SEM B MT1 EXAM QUESTION GNIIT SEM B MT2 EXAM QUESTIONS GNIIT SEM C MT1 EXAM QUESTION GNIIT SEM C MT2 EXAM QUESTION GNIIT SEM D MT1 EXAM QUESTION GNIIT SEM D MT2 EXAM QUESTION Hardware Queation With Answers How To Breakup With Interview Phobia how to celebrate free pollution diwali How to Install the Apache Web Server on a Windows PC [32 -Bit] How to Lock Your Computer With USB how to prepare AIIMS exams How to prepare Gate exams

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

form, HttpServletRequest request,HttpServletResponse response) 3.Jenny has been assigned the task to develop a login module of a Web application that authenticates the users and provides success and failure messages depending upon the user credentials. The two types of users of the Web application are provider and consumer. As, the Web application has been developed using the Struts framework, Jenny creates two action classes to validate the users. The ValidateProvideAction class validates the users who log in as provider. However, the ValidateConsumerAction class the users who log in as consumer. She stores the two action classes in the validate package of the application. After creating the action classes, she writes the following code in the struts-config.xml file to configure the action classes: <action-mappings> <action path=/StrutsApp/form type=/ValidateProvideAction> <forward name=success path=/webpage/success.view/> <forward name=error path=/webpage/error.view/> </action> <action path=/StrutsApp/form type=/ValidateConsumerAction> <forward name=success path=/webpage/success.view/> <forward name=error path=/webpage/error.view/> </action> </action-mappings> However, Jenny is not able to perform the desired task with the preceding mapping. Identify the correct code that Jenny can use to perform the desired task. 1, <action-mappings> <action path=/StutsApp/form type=validate.ValidateProvideAction> <forward name=success path=/webpage/success.view/> <forward name=error path=/webpage/error.view/> </action> <actionpath=/StrutsApp/formtype=validate.ValidateConsumerAction > <forward name=success path=/webpage/success.view/> <forward name=error path=/webpage/error.view/> </action> </action-mappings> 2, <action-mappings> <action path=/StutsApp/form type=validate/ValidateProvideAction> <forward name=success path=/webpage/success.view/>

How To Use Computer Shortcuts key and function key Html interviews questions with ans J2ME DUMPS For GNIIT Java interview solutions Java programing JEE Mains Exam 2014 Online Application begins 15th November 2013 KU ASSIGNMENT 4TH SEM: TB 43 UNIX & SHELL PROGRAMMING Kuvempu University 4th Sem 2013 may/june solve Paper (BSIT -42 Part A) Kuvempu University 4th Sem 2013 may/june solve Paper (BSIT -43 Part A) Kuvempu University 4th Sem 2013 may/june solve Paper (BSIT -44 Part A) Kuvempu University 4th Sem 2013 may/june solve Paper (BSIT -44 Part B) Kuvempu University 4th Sem 2013 may/june solve Paper(Part A) Kuvempu University 5th Sem 2013 may/june solve Paper Kuvempu University 5th Sem 2013 may/june solve Paper (BSIT -52 Part A) Kuvempu University 5th Sem 2013 may/june solve Paper (BSIT -53 Part A) Kuvempu University 5th Sem 2013 may/june solve Paper (BSIT -54 Part A) Kuvempu University 6th Sem 2013 may/june solve Paper Kuvempu University 6th Sem 2013 may/june solve Paper (BSIT -62 Part A) Kuvempu University 6th Sem 2013 may/june solve Paper (BSIT -63 Part A) Kuvempu University 6th Sem 2013 may/june solve Paper (BSIT -64 Part A) Latest antivirus latest Bhojpuri Mix songs Learning videos Motivational stories mscit assignments My website New bhojpuri mp3 songs download New bollywood Latest songs

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

<forward name=error path=/webpage/error.view/> </action> <action path=/StrutsApp/form type= validate/ValidateConsumerAction > <forward name=success path=/webpage/success.view/> <forward name=error path=/webpage/error.view/> </action> </action-mappings> 3, <action-mappings> <action path=/StutsApp/form type=/validate/ValidateProvideAction> <forward name=success path=/webpage/success.view/> <forward name=error path=/webpage/error.view/> </action> <action path=/StrutsApp/form type= /validate/ValidateConsumerAction > <forward name=success path=/webpage/success.view/> <forward name=error path=/webpage/error.view/> </action> </action-mappings> 4, <action-mappings> <action path=/StutsApp/form type=validate.ValidateProvideAction> <forward name=success path=/webpage/success.view/> <forward name=error path=/webpage/error.view/> </action> <action path=/StrutsApp/form type= validate.ValidateConsumerAction> <forward name=success path=/webpage/success.view/> <forward name=error path=/webpage/error.view/> </action> </action-mappings> 4.Martin has created a Web application in which a servlet stores a JDBC URL as an attribute of the session object to access a database. He wants other servlets of the application to retrieve the URL attribute from the session object to access the database. Which of the following code

New C# interview Question With Answer New Google Chrome Laptop Available In India. news paper NIIT DUMPS FOR ALL SEMESTER.. Nirahua Bhojpuri movie songs Part time job links Play on line Games Preapration of banking exams Prepration of UPSC and IPS. programiong books Sql interview solutions Succes Stories In Business Superstar khesari lal yadav movies collection Sustainability summer school hosted by Imperial for first time Tips & Tricks Tips about GATE Exams 2014 Tips and Tricks: CBSE chemistry std 12th Tips for job interview Tips For Windows 7 Make Faster UPSC (Union Public Service Commission) Indian Engineering Services (IES) 2013 Results Why English-language Channels are Growing Ziddi Aashiqi Pawan Singh movie and Songs

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

snippets can Martin use to retrieve the URL from the session object? 1, HttpSession session = request.getSession(); =(String)session.getAttribute(URL); 2, HttpSession session = request.getSession(); =session.getAttribute(URL); 3, String url=(String)session.getSession(URL); 4, HttpServletRequest session = request.getSession(); =(String)session.getAttribute(URL);
TrulyShare

String url

String url

String url

5.Richard creates a servlet that retrieves the user name and stores it in a cookie called user. The servlet, then, sends the cookie to the client using the response object. Now, Richard wants to obtain the cookie from the request object and retrieve the user name from it. Which of the following code snippets will help Richard implement this nctionality? 1,public void doPost(HttpServletRequestreq, HttpServletResponse res) throwsServletException, IOException { PrintWriter pw=res.getWriter(); String username=null; Cookie ck[] = res.getCookies(); if (ck!=null) { for (int i=0; i<ck.length; i++) { if (ck[i].getName().equals(user)) username = ck[i].getValue(); } pw.println(username); } else

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

{ pw.println(No cookies found); } } 2, public void doPost(HttpServletRequestreq, HttpServletResponseres) throwsServletException, IOException { PrintWriter pw=res.getWriter(); String username=null; Cookie ck[] = req.getCookies(); if (ck!=null) { for (int i=0; i<ck.length; i++) { if (ck[i].getName().equals(user)) username = ck[i].getValue(); } pw.println(username); } else { pw.println(No cookies found); } } 3, public void doPost(HttpServletRequestreq, HttpServletResponse res) throwsServletException, IOException { PrintWriter pw=res.getWriter(); String username=null; Cookie ck[] = req.getCookies();

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

if (ck!=null) { for (int i=0; i<ck.length; i++) { if (ck[i].getCookies().equals(user) username = ck[i].getValue(); } pw.println(username); } else { pw.println(No cookies found); } } 4, public void doPost(HttpServletRequestreq, HttpServletResponse res) throwsServletException, IOException { PrintWriter pw=res.getWriter(); String username=null; Cookie ck[] = req.getName().equals(user); if (ck!=null) { for (int i=0; i<ck.length; i++) { username = ck[i].getValue(); } pw.println(username); } else { pw.println(No cookies found);
2 9 16 23 30 3 10 17 24 31 Nov 4 11 18 25 5 12 19 26 6 13 20 27 7 14 21 28

www.enjoyyourstudy.com
December 2013 M T W T F S S 1 8 15 22 29

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

} } 6.Paul is developing an application for library management using JSP. The AddBooks and RemoveBooks pages should be accessible only by the library staff and not the users. For this, he decides to create a role, staff. Mark should be assigned to this role. Which of the following code snippets correctly maps Mark to the staff role? 1, <security-role-ref> <role-name>staff</role-name> <role-link>Mark</role-link> </security-role-ref> 2, <security-role> <role-name>staff</role-name> <role-link>Mark</role-link> </security-role> 3, <security-role-ref> <role-name>staff</role-name> <role>Mark</role> </security-role-ref> 4, <security-role-ref> <role>staff</role> <role-link>Mark</role-link> </security-role-ref> 7.Peter is developing a Web application for a bank. The application needs to accept the user credentials through the login.html page and validate them. If the user credentials are successfully validated, a success message should be displayed. In case of a failed logon attempt, the logonerror.html should be displayed. For this, Peter decides to use the form-based authentication. Which of the following code snippets correctly defines the deployment descriptor tags for the formbased authentication? 1, <login-config> <auth-method> FORM <realm-name>Secure Form Authentication</realm-name> <form-login-config> <form-login-page>/login.html</form-login-page>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

<form-error-page>/logonerror.html</form-error-page> </form-login-config> </auth-method> </login-config> 2, <login-config> <auth-method>FORM</auth-method> <realm-name>Secure Form Authentication</realm-name> <form-login-config> <form-login-page>/login.html</form-login-page> </form-login-config> </login-config> 3, <login-config> <auth-method>FORM</auth-method> <realm-name>Secure Form Authentication</realm-name> <form-login-config> <form-login-page>/login.html</form-login-page> <form-error-page>/logonerror.html</form-error-page> </form-login-config> </login-config> 4, <login-config> <auth-method>FORM</auth-method> <realm-name>Secure Form Authentication</realm-name> <form-login-page>/login.html</form-login-page> <form-error-page>/logonerror.html</form-error-page> </login-config> 8.Larry has created aa tag handler, Account.java, which displays the information about the various types of accounts a person can open with the bank. Now, he needs to create a TLD file named Mytaglib.tld for the same. Which of the following code snippets can Larry use to create the TLD file? 1, <?xml version=1.0 encoding=UTF-8?> <taglib version=2.0 xmlns=http://java.sun.com/xml/ns/j2ee xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd> <tlib-version>1.0</tlib-version> <short-name>mytaglib</short-name> <uri>Mytaglib</uri> <tag> <name>Account</name> <tag-class>Account</tag-class> <body-content>JSP</body-content> </tag> </taglib> 2, <?xml version=1.0 encoding=UTF-8?> <taglib version=2.0 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-jsptaglibrary_2_0.xsd> <tlib-version>1.0</tlib-version> <short-name>mytaglib</short-name> <uri>/WEB-INF/tlds/Mytaglib</uri> <tag> <name>Account</name> <tag-class>Account</tag-class> <body-content>JSP</body-content> </tag> </taglib> 3, <?xml version=1.0 encoding=UTF-8?> <taglib version=2.0 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-jsptaglibrary_2_0.xsd> <tlib-version>1.0</tlib-version>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

<short-name>mytaglib</short-name> <uri>/WEB-INF/tlds/Mytaglib</uri> <tag> <name>Account</name> <body-content>JSP</body-content> </tag> </taglib> 4, <?xml version=1.0 encoding=UTF-8?> <taglib version=2.0 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-jsptaglibrary_2_0.xsd> <tlib-version>1.0</tlib-version> <short-name>mytaglib</short-name> <uri>./Mytaglib</uri> <tag> <name>Account</name> <tag-class>Account</tag-class> <body-content>JSP</body-content> </tag> </taglib> 9.Quentin is developing a Web application for an educational institute. The administration and archive pages of the application should be accessed by the senior management only. For this, Quentin creates a role, Senior Staff. Now, he needs to define the following security constraint: <security-constraint> <display-name>SecurityConstraint</display-name> <web-resource-collection> <url-pattern> /*</url-pattern> </web-resource-collection> <auth-constraint> <role-name> Senior Staff</role-name>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

</auth-constraint> <user-data-constraint> <transport-guarantee> NONE</transport-guarantee> </user-data-constraint> </security-constraint> Identify the error, if any, in the preceding code snippet. 1, There is no error in the given code snippet. 2, The given code snippet does not contain the auth-method element after the auth-constraint element. 3, The given code does not contain the web-resource-name element. 4, The given code contains the NONE value in the transport-guarantee element. 10.You are developing a web application for the soccer league using Struts framework. For this, you need to create a Struts controller that extends the Struts Action base class and implements the execute method. How will you declare the execute method in the Struts controller class? 1, public ActionForwardexecute(ActionMapping mapping, ActionFormform, HttpServletRequest request, HttpServletResponse response) { //write the code }m 2, public void execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { //write the code } 3, public intexecute(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response) { //write the code } 4, public ActionForwardexecute(ActionForm form, HttpServletRequest request, HttpServletResponse response) {

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

//write the code }

1. Jack Smith is working as a Java developer in P. Tech Ltd. He is developing a web application using Servlets and JSP. He decides to use Filters in the web application. He has to ensure that the filter would only be applied to internal dispatches to the URL pattern *.do and not to any direct client requests. He uses the following code to declare the filter mapping: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*.do</url-pattern> <dispatcher>REQUEST</dispatcher> </filter-mapping> However, the above code make the auditFilter apply to the direct client requests for a URL which matches *.do pattern. Identify the error and provide the solution.

1, Replace the code with the following: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*.do</url-pattern> <dispatcher>request</dispatcher> </filter-mapping> 2, Replace the code with the following: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*.do</url-pattern> <dispatcher>ERROR</dispatcher> </filter-mapping> 3, Replace the code with the following: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*.do</url-pattern> <dispatcher>include</dispatcher> </filter-mapping>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

4, Replace the code with the following: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*.do</url-pattern> <dispatcher>INCLUDE</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping>

1. Jack Smith is working as a Java developer in P. Tech Ltd. He is developing a web application using Servlets and JSP. He decides to use Filters in the web application. He uses the following code to declare the filter in the application: <filter> <filter-name>perfFilter</filter-name> <init-param> <param-name>Log Entry Prefix</param-name> <param-value>Performance: </param-value> </init-param> </filter> However, the above code is incomplete in terms of filter declaration. Identify the error?

1, filter-class element is missing in the filter declaration. 2, servlet-name element is missing in the filter declaration. 3, servlet-mapping element is missing in the filter declaration. 4, url-pattern element is missing in the filter declaration.

1. Consider the code for filter mapping in the web application deployment descriptor file: <servlet-mapping> <servlet-name>MyController</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping>

1)<filter-mapping>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

<filter-name>First</filter-name> <servlet-name>MyController</servlet-name> </filter-mapping> 2)<filter-mapping> <filter-name>Second</filter-name> <servlet-name>MyController</servlet-name> </filter-mapping> 3) <filter-mapping> <filter-name>Third</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> 4)<filter-mapping> <filter-name>Fourth</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> Predict the order in which filter will be applied if the request was made for the URL /admin/add_league.do?

1,First>Second>Third>Fourth 2,Third>Fourth>First>Second 3,Fourth>Third>Second>First 4,Second>First>Fourth>Third 1. A code for filter mapping has to be written for a filter called Login Filter for components in such a manner that it should be applied to component whenever an error occurs. Predict the code for filter mapping to perform the required task from the following options.

1,<filter-mapping> <filter-name>LoginFilter</filter-name> <dispatcher>ERROR</dispatcher> </filter-mapping> 2,<filter-mapping> <filter-name>LoginFilter</filter-name>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

<url-pattern>*.do</url-pattern> <dispatcher>ERROR<dispatcher> </filter-mapping> 3,<filter-mapping> <filter-name>LoginFilter</filter-name> <dispatcher>ERROR</dispatcher> <url-pattern>ERROR.do</url-pattern> </filter-mapping> 4,<filter-mapping> <filter-name>LoginFilter</filter-name> <url-pattern>*.do</url-pattern> <dispatcher>dispatcher.ERROR</dispatcher> </filter-mapping>

1. Predict the correct code for the declaration of a form bean called employeeform in the struts framework?

1,importorg.apache.struts.action.ActionForm; public class employeeform implements ActionForm { //required code } 2,importorg.apache.struts.action.ActionForm; public class employeeform extends ActionForm { //required code } 3,import org.apache.struts.ActionForm; public class employeeform extends ActionForm { //required code

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

} 4,importorg.apache.struts.action.ActionForm; public class employeeform { //required code }

1. Stem text : Consider the following code regarding accessing of session attributes in a session management program. But this program has few errors. Predict the correct code for the program. String login=request.getParameterValue(login); if(login.equals(tim) { returnmapping.Forward(error); } if(login.equals(David) { returnmapping.Forward(success); } where mapping is an object of ActionMapping Class. 1,String login=request.getParameter(login); if(login.equals(tim) { returnmapping.Forward(error); } if(login.equals(David) { returnmapping.Forward(success); } 2,String login=request.getParameter(login); if(login.equals(tim) {

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

returnmapping.findForward(error); } if(login.equals(David) { returnmapping.findForward(success); } 3,String login=request.getParameterValue(login); if(login.equals(tim) { returnmapping.findForward(error); } if(login.equals(David) { returnmapping.findForward(success); } 4,String login=request.getParameter(login); if(login.equals(tim) { returnmapping.findForward(error); } if(login.equals(David) { returnmapping.findForward(success); }

1. Which of the following lines of code can be used for adding a pre-defined applet named chatApp to a JSP page? The chatApp class file is present in the /applets directory.

1,<jsp:plugin type=applet code=chatApp.classcodebase=/applets width=400 height = 300></jsp:plugin> 2,<jsp:plugin type=applet code=chatApp.class codebase=applets width=400 height = 300>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

</jsp:plugin> 3,<jsp:plugin type=applet code=chatApp.class codebase=/applets width=400 height = 300/> 4,<jsp:plugin code=chatApp.class codebase=/applets width=400 height = 300> </jsp:plugin>

1. What will be the output of the following code snippet: <%@ page language=java%> <html> <head></head> <body> <%java.util.Date now=new java.util.Date(); %> <H1><%= now.getHours() %>:<%=now.getMinutes()%>:<%=now.getSeconds()%></H1> </body> </html> 1,It will display the date as mm:dd:yy. 2,It will display the date and time. 3,It will display time as hh/mm/ss. 4,It will display the current time as hh:mm:ss.

1. You have deployed two servlets named servlet1 and servlet2 in your Web server. You want to create an attribute called customernumber and assign the value of a variable cnum to it. Which of the following codes is the correct method for doing it?

1,ServletContext c=getServletContext(); c.setAttribute(cnum,customernumber); 2,ServletConfig c=getServletConfig(); c.setAttribute(cnum,customernumber); 3,ServletContext c=getServletContext() c.setAttribute(customernumber, cnum) 4,ServletConfig c=getServletConfig();

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

c.setAttribute(customernumber, cnum);

1. What will be the output of the following code snippet: <%@ page language=java%> <html> <head></head> <body> <%java.util.Date now=new java.util.Date(); %> <H1><%= now %></H1> </body></html>

1,It will display the date and time. 2,It will display the time and day of the week. 3,It will display the date and day of the week. 4,It will display the date, time, and day of the week.

1. Consider the following code: <%@ page language=java%> <html> <body> <% String login=(request.getParameter(Login)); String password=(request.getParameter(Password)); for(int i=0;i<10;i++) out.println(Login is+ +login); out.println(Password is+ +password); %> </body> </html> What will be the output of the above code if login name and password are accepted through user interface?

1,Login message will be displayed ten times and Password messageonce.

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

2,Both login and password message will be displayed ten times. 3,Login Message will be displayed nine times and Password message once. 4,Both login and password message will be displayed nine times.

1. Consider the usage of JSTL forEach tag in the following code snippet: <font color=green> <ul> <c:foreach flag=errmsg items=${errorMsgs}> <li>$errmsg</li> </c:forEach> </ul> </font> However, the preceding code snippet contains some errors. Predict the correct code.

1,<font color=green> <ul> <c:forEachvar=errmsg items=${errorMsgs}> <li>$errmsg</li> </c:forEach> </ul> </font> 2,<font color=green> <ul> <c:forEachvar=errmsg items=${errorMsgs}> <li>${errmsg}</li> </c:forEach> </ul> </font> 3,<font color=green> <ul> <c:forEachvar=errmsg items=${errorMsgs}>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

<li>$errmsg</li> </c:forEach> </ul> </font> 4,<font color=green> <ul> <c:forEachvar=errmsg items=${errorMsgs}> <li>${errmsg}</li> </c:forEach> </ul> </font>

1. Consider the following code snippet of JSP Bean: <jsp:usebean identity=login scope=Session class=s1314.beans.LoginBean> <%!login.setValue(request.getParameter(Loginid)); login.setAddress(request.getParameter(address)); %> <jsp:usebean> However, the preceding code contains errors. Predict the correct code.

1,<jsp:useBean id=login scope=Session> <%login.setValue(request.getParameter(Loginid)); login.setAddress(request.getParameter(address)); %> </jsp:useBean> 2,<jsp:useBean identity=login scope=Session >

<%!login.setValue(request.getParameter(Loginid)); login.setAddress(request.getParameter(address)); %> <jsp:useBean> 3,<jsp:useBean id=login scope=Session class=s1314.beans.LoginBean>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

login.setValue(request.getParameter(Loginid)); login.setAddress(request.getParameter(address)); </jsp:useBean> 4,<jsp:useBean id=login scope=Session class=s1314.beans.LoginBean> <login.setValue(request.getParameter(Loginid));/> <login.setAddress(request.getParameter(address));/> </jsp:useBean>

1. While configuring the JSP Environment, you want to turn off scripting as well as ignore EL in the JSP file. What would be the code for this?

1,<jsp-config> <jsp-property-group> <url-pattern>/scriptting_off/*</url-pattern> <scripting-invalid>true</scripting-invalid> </jsp-property-group> <jsp-property-group> <url-pattern>/EL_off/*</url-pattern> <el-ignored>true</el-ignored> </jsp-property-group> </jsp-config> m 2,<jsp-property-group> <url-pattern>/scriptting_off/*</url-pattern> <scripting-invalid>true</scripting-invalid> </jsp-property-group> <jsp-property-group> <url-pattern>/EL_off/*</url-pattern> <el_ignored>true</el_ignored> </jsp-property-group> m 3,<jsp-config> <url-pattern>/scriptting_off/*</url-pattern>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

<scripting-invalid>true</scripting-invalid> <url-pattern>/EL_off/*</url-pattern> <el_ignored>true</el_ignored> </jsp-config> m 4,<jsp-config> <jsp-property-group> <url-pattern>scriptting_off</url-pattern> <scripting-invalid>true</scripting-invalid> </jsp-property-group> <jsp-property-group> <url-pattern>EL_off</url-pattern> <el_ignored>true</el_ignored> </jsp-property-group> </jsp-config>>

1. List down the methods of ServletContext Interface.

1,getInitParameter(name:String):String getInitParameterNames():Enumeration getResource(path):URL getResourceAsStream(path):InputStream 2,getInitParameter(name:String):String getInitParameterList():Enumeration getResourceUrl(path):URL getResourceAsStream(path):InputStream 3,getInitParameter():String getInitParametervalues():Enumeration getResource(path):URL getResourceAsStream(path):void 4,getInitParameter(name:String):String getInitParameterList():Enumeration

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

getResourceAsInputStream(path):InputStream

1. Predict the output of the following code: import java.io.*; import java.net.*; importjavax.servlet.*; importjavax.servlet.http.*; public class earnmore extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String pageTitle = Welcome to EarnMore Bank; response.setContentType(text/html); out.println(<html>); out.println(<body>); out.println(pageTitle); out.println(</body>); out.println(</html>); } }m 1, The code will compile and execute successfully. The string, Welcome to EarnMore Bank, will be displayed. m 2, The code will compile successfully but give a runtime error. m 3, The code will display a blank page. m 4, The code will give compilation error.

1. Jennifer has created an HTML form that accepts two numbers from the user. This form contains a button. When this button is clicked, the numbers are passed to a servlet. Jennifer creates a servlet named Calculate to calculate the sum of the numbers entered by the user. She, then, creates another servlet named Display to display this sum. Now, she wants the sum calculated by the Calculate servlet to be passed to the Display servlet. The code of the Calculate servlet is: importjavax.servlet.*;

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

importjavax.servlet.http.*; import java.io.*; public class Calculate extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int num1=Integer.parseInt(request.getParameter(number1)); int num2=Integer.parseInt(request.getParameter(number2)); int result= num1+num2; } Which of the following code snippets will help Jennifer use to provide the required functionality? }

1, request.setAttribute(result,new Integer(result)); RequestDispatcherreqDisp=request.getRequestDispatcher(/Display); reqDisp.forward(request,response);

2, RequestDispatcherreqDisp=request.getRequestDispatcher(/Display); reqDisp.forward(request,response); m 3, request.setAttribute(result,new Integer(result)); RequestDispatcherreqDisp=request.getRequestDispatcher(Display); reqDisp.forward(request,response);

4, response.setAttribute(result,new Integer(result)); RequestDispatcherreqDisp=request.getRequestDispatcher(Display); reqDisp.forward(request,response);

1. Michelle has created the Hello servlet that displays Welcome in the browser window. The code of the servlet is: packagemyworld; importjava.io.IOException;

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

importjava.io.PrintWriter; importjavax.servlet.ServletConfig; importjavax.servlet.ServletException; importjavax.servlet.http.HttpServlet; importjavax.servlet.http.HttpServletRequest; importjavax.servlet.http.HttpServletResponse; public class hello extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println(<html>); out.println(<head>); out.println(<title>My Servlet</title>); out.println(</head>); out.println(<body>); out.println(<h1>WELCOME</h1>); out.println(</body>); out.println(</html>); out.close(); } } Which of the following code snippets correctly defines the deployment descriptor for the preceding servlet? 1, <servlet> <servlet-name>hello</servlet-name> <servlet-class>hello</servlet-class> </servlet> <servlet-mapping> <servlet-name>hello</servlet-name>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

<url-pattern>/hello</url-pattern> </servlet-mapping> m 2, <servlet> <servlet-name>hello</servlet-name> <servlet-class>myworld.hello</servlet-class> </servlet> <servlet-mapping> <servlet-name>hello</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> m 3, <servlet> <servlet-name>myworld.hello</servlet-name> <servlet-class>hello</servlet-class> </servlet> <servlet-mapping> <servlet-name>hello</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> m 4, <servlet> <servlet-name>hello</servlet-name> <servlet-class>myworld.hello</servlet-class> </servlet> <servlet-mapping> <servlet-name>hello</servlet-name> <url-pattern>hello</url-pattern> </servlet-mapping>

1. Margaret is developing a Web application for a travel agency. She creates a servlet with the initialization parameter, holiday_destination. Based on the values of the initialization parameter, the servlet displays the relevant information. Margaret now wants to retrieve the value of the initialization parameter. Which of the following code snippets helps retrieve the initialization parameter successfully? 1, public void doGet(HttpServletRequestreq, HttpServletResponse res)

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

throwsServletException, IOException { String strValue=getInitParameter(holiday_destination); }

2, public void init() throws ServletException { String strValue=getInitParameter(holiday_destination); }

3, public void doPost(HttpServletRequestreq, HttpServletResponse res) throwsServletException, IOException { String strValue=getInitParameter(holiday_destination); }

4, public void init() throws ServletException { String strValue=request.getInitParameter(holiday_destination); }

1. Samantha is developing an online book store. She creates a JavaBean that accepts and stores the book preferences of a user in the array, userpref. Now, Samantha wants to develop a servlet that retrieves the book preferences from the JavaBean. Which of the following code snippets will help her retrieve the third element of the userpref array? 1, ${param.userpref[2]} 2, ${paramValues.userpref[3]} 3, {paramValues.userpref[2]} 4, ${paramValues.userpref[2]}

1. Eric has created the following class named first containing a public static method:

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

package mypackage1; public class first { public first() { } public static String newmsg(){ return Welcome to class; } } Now, Eric wants to invoke the newmsg() method using EL. So, he creates a TLD file with the following code: <uri>newfunc</uri> <function> <name>newmsg</name> <function-class> mypackage1.first </function-class> </function> Identify the error, if any, in the preceding code snippet.

1, There is no error in the given code snippet. 2, The function-class element should have the value, first, and not mypackage1.first. 3, The given code does not contain the function-signature element. 4, Theuri element should have the value, newmsg, and not newfunc.

1. Sandra is developing an application that accepts a string from the user and displays it on the screen. She decides to develop this application using custom tags. She has created an HTML with a text field and button. She, then, creates a TLD file. Now, she creates the following tag handler: importjava.io.IOException; importjavax.servlet.jsp.JspException; importjavax.servlet.jsp.JspWriter; importjavax.servlet.jsp.tagext.BodyContent;

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

importjavax.servlet.jsp.tagext.BodyTagSupport; public class tagdemo extends BodyTagSupport { private String name; publictagdemo() { super(); } public void setName(String name){ this.name=name; } public void doAfterBody() throws JspException{ try{ BodyContentbc=getBodyContent(); String body=bc.getString(); JspWriter out=bc.getEnclosingWriter(); if(body!=null) out.print(<center>Hi+body+! </center>); out.print(</body>); } catch(Exception e){ throw new JspException(Error: +e.getMessage()); } return SKIP_BODY; } } Identify the error, if any, in the preceding code of the tag handler.

1, There is no error in the code of the tag handler. 2, The tag handler class extends the BodyTagSupport class instead of the TagSupport class. 3, The return type of the doAfterBody() method is void, and not int. 4, The tag handler class does not implement the doStartTag() method.

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

1. Linda Parker, a senior manager of Nortel Ltd., assigns Peter, a software engineer with the organization, the task to develop a Web application. The Web application will be accessible to the customers as well as the employees. Peter decides to implement the form-based authorization in this Web application. He creates the following logon form: <html> <head> <title> Form-based Login Authentication </title> </head> <body> <br><br> <center> <h2>Please Login to Authenticate Yourself</h2> <form method=post action=j_security_check> <table> <tr> <td>User Name: </td> <td><input type=j_username name=text></td> </tr> <tr> <td>Password: </td> <td><input type=j_password name=password></td> </tr> <tr> <td><input type=submit value=Login></td> <td><input type=reset value=Reset></td> </tr> </table> </form> </center> </body>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

</html> However, the preceding code generates error. Identify the reason for the error and provide a solution for the same.

1,The line causing the error is: <form method=post action=j_security_check> Linda needs to replace the line by: <form method=post action=Form-based authentication> m 2, The lines causing the error are: <td><input type=j_username name=text></td> <td><input type=j_password name=password></td> Linda needs to replace the preceding lines by: <td><input name=j_username type=text></td> <td><input name=j_password type=password></td> m 3, The line causing the error is: <form method=post action=j_security_check> Linda needs to replace the preceding line by: <form method=post action=security_check> m 4, The lines causing the error are: <td><input type=j_username name=text></td> <td><input type=j_password name=password></td> Linda needs to replace the preceding lines by: <td><input name=username type=text></td> <td><input name=password type=password></td>

Updated: October 12, 2013 at 7:36 am

Tags: 4th sem exam dumps, gniit dumps, gniit dumps for niit sem d, gniit sem d exam solution, gniit sem d mt1 dumps, GNIIT SEM D MT1 EXAM QUESTION, GNIIT SEM D MT1 EXAM QUESTIONS, niit 4th sem dumps, niit 4th semester mt1 dumps, niit dumps, niit dumps for 4th sem mt1, niit mt1 question, niit sem d dumps, sem d exam question, SEM D MT1 EXAM QUESTION, sem d niit dumps of servlet and jsp, servlet, servlet exam question

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

New Google Chrome Laptop Available In India.

BSC-IT 5TH SEM ASSIGNMENT BSIT-54 (TB)

Comments
parajumpers homme
October 21, 2013 at 5:59 am

Wow, tthis article is good, myy younger sister is analyzing suh things, therefore I am going to convey her.
Reply

nintendo ds rose

October 24, 2013 at 5:40 pm

Thanks for supplying these kinds of a excellent report, it was superb and very informative. as a very first time customer to your blog I am really amazed. I identified a whole lot of insightful stuff in your write-up. Preserve it up. Thank you.
Reply

LEAVE A REPLY
Your email address will not be published. Required fields are marked Name Email Website

one + Comment

=5

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Comment

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

Asteroid Theme

'); var MainContentW = 1000; var LeftBannerW = 100; var RightBannerW = 100; var LeftAdjust = 10; var RightAdjust = 10; var TopAdjust = 80; ShowAdDiv(); window.onresize=ShowAdDiv; }

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

Potrebbero piacerti anche