Enjoyyourstudy Com Gniit Sem d Mt1 Exam Question

March 18, 2018 | Author: Mohit Bhansali | Category: Http Cookie, Java Servlet, Html Element, Web Application, Java Server Pages


Comments



Description

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 Paul’s 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 After creating the action classes.com . <action-mappings> <action path=”/StutsApp/form” type=”validate. <action-mappings> <action path=”/StutsApp/form” type=”validate/ValidateProvideAction”> <forward name=”success” path=”/webpage/success. 1. Jenny creates two action classes to validate the users.xml file to configure the action classes: <action-mappings> <action path=”/StrutsApp/form” type=”/ValidateProvideAction”> <forward name=”success” path=”/webpage/success. Jenny is not able to perform the desired task with the preceding mapping.view”/> <forward name=”error” path=”/webpage/error.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. However.HttpServletResponse response) 3.ValidateProvideAction”> <forward name=”success” path=”/webpage/success.view”/> </action> </action-mappings> However.ValidateConsumerAction “> <forward name=”success” path=”/webpage/success.view”/> <forward name=”error” path=”/webpage/error. As.view”/> </action> <action path=”/StrutsApp/form” type=”/ValidateConsumerAction”> <forward name=”success” path=”/webpage/success.form. the Web application has been developed using the Struts framework.view”/> <forward name=”error” path=”/webpage/error.view”/> </action> <actionpath=”/StrutsApp/form”type=”validate. the ValidateConsumerAction class the users who log in as consumer. HttpServletRequest request. she writes the following code in the struts-config. She stores the two action classes in the validate package of the application. The ValidateProvideAction class validates the users who log in as provider. The two types of users of the Web application are provider and consumer.view”/> <forward name=”error” path=”/webpage/error.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.view”/> </action> </action-mappings> 2. Identify the correct code that Jenny can use to perform the desired task. view”/> <forward name=”error” path=”/webpage/error.view”/> <forward name=”error” path=”/webpage/error.view”/> </action> </action-mappings> 4. Nirahua Bhojpuri movie songs Part time job links Play on line Games Preapration of banking exams Prepration of UPSC and IPS.view”/> </action> </action-mappings> 4. <action-mappings> <action path=”/StutsApp/form” type=”/validate/ValidateProvideAction”> <forward name=”success” path=”/webpage/success.ValidateConsumerAction> <forward name=”success” path=”/webpage/success.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. <action-mappings> <action path=”/StutsApp/form” type=validate.<forward name=”error” path=”/webpage/error.view”/> <forward name=”error” path=”/webpage/error.view”/> </action> <action path=”/StrutsApp/form” type= validate.view”/> </action> </action-mappings> 3.ValidateProvideAction> <forward name=”success” path=”/webpage/success. 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.view”/> <forward name=”error” path=”/webpage/error. 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 .view”/> <forward name=”error” path=”/webpage/error..view”/> </action> <action path=”/StrutsApp/form” type=” validate/ValidateConsumerAction “> <forward name=”success” path=”/webpage/success.view”/> </action> <action path=”/StrutsApp/form” type=” /validate/ValidateConsumerAction “> <forward name=”success” path=”/webpage/success. He wants other servlets of the application to retrieve the URL attribute from the session object to access the database. getSession().getAttribute(“URL”). 3.getSession(“URL”). Which of the following code snippets will help Richard implement this nctionality? 1.getAttribute(“URL”). } else open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.Richard creates a servlet that retrieves the user name and stores it in a cookie called user. HttpServletRequest session = request. i++) { if (ck[i].getValue(). =session.getSession(). String url=(String)session. String username=null. 2. IOException { PrintWriter pw=res. TrulyShare String url String url String url 5.getCookies(). HttpServletResponse res) throwsServletException.getWriter().length.getName(). } pw. Cookie ck[] = res. if (ck!=null) { for (int i=0.equals(“user”)) username = ck[i]. HttpSession session = request.getSession().println(username). HttpSession session = request.snippets can Martin use to retrieve the URL from the session object? 1. The servlet. =(String)session. i<ck.public void doPost(HttpServletRequestreq. then. sends the cookie to the client using the response object. 4. =(String)session. Richard wants to obtain the cookie from the request object and retrieve the user name from it. Now.com .getAttribute(“URL”). Cookie ck[] = req. public void doPost(HttpServletRequestreq. i++) { if (ck[i]. String username=null.length. } } 2.getValue(). } else { pw.getCookies().getWriter().println(username). HttpServletResponse res) throwsServletException. } pw. HttpServletResponseres) throwsServletException. IOException { PrintWriter pw=res.getWriter().com . open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd. IOException { PrintWriter pw=res.equals(“user”)) username = ck[i]. Cookie ck[] = req.println(“No cookies found”). public void doPost(HttpServletRequestreq.println(“No cookies found”). } } 3. String username=null.getCookies(). if (ck!=null) { for (int i=0.{ pw.getName(). i<ck. public void doPost(HttpServletRequestreq. IOException { PrintWriter pw=res. } else { pw.println(username).com . } } 4. } else { pw.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. i++) { if (ck[i].println(“No cookies found”).equals(“user”) username = ck[i]. } pw.equals(“user”).getValue().getCookies(). HttpServletResponse res) throwsServletException.getWriter().if (ck!=null) { for (int i=0. String username=null. i<ck.getValue().length.println(“No cookies found”).enjoyyourstudy. Cookie ck[] = req. 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. i++) { username = ck[i].getName().length. i<ck. if (ck!=null) { for (int i=0.println(username). } pw. } } 6.Paul is developing an application for library management using JSP. he decides to create a role. For this. If the user credentials are successfully validated. <security-role> <role-name>staff</role-name> <role-link>Mark</role-link> </security-role> 3. Mark should be assigned to this role. <security-role-ref> <role-name>staff</role-name> <role>Mark</role> </security-role-ref> 4. In case of a failed logon attempt. staff. The AddBooks and RemoveBooks pages should be accessible only by the library staff and not the users.html should be displayed. Which of the following code snippets correctly maps Mark to the staff role? 1. For this. <login-config> <auth-method> FORM <realm-name>Secure Form Authentication</realm-name> <form-login-config> <form-login-page>/login. a success message should be displayed. Which of the following code snippets correctly defines the deployment descriptor tags for the formbased authentication? 1. the logonerror.html</form-login-page> open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.html page and validate them. <security-role-ref> <role>staff</role> <role-link>Mark</role-link> </security-role-ref> 7.Peter is developing a Web application for a bank. <security-role-ref> <role-name>staff</role-name> <role-link>Mark</role-link> </security-role-ref> 2. Peter decides to use the form-based authentication. The application needs to accept the user credentials through the login.com . he needs to create a TLD file named Mytaglib.html</form-login-page> <form-error-page>/logonerror.sun.html</form-login-page> </form-login-config> </login-config> 3.html</form-error-page> </form-login-config> </login-config> 4.w3. Account. which displays the information about the various types of accounts a person can open with the bank.Larry has created aa tag handler. Now.html</form-login-page> <form-error-page>/logonerror.java.html</form-error-page> </login-config> 8.org/2001/XMLSchema-instance” open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.tld for the same.0″ encoding=”UTF-8″?> <taglib version=”2.0″ xmlns=”http://java. Which of the following code snippets can Larry use to create the TLD file? 1. <?xml version=”1. <login-config> <auth-method>FORM</auth-method> <realm-name>Secure Form Authentication</realm-name> <form-login-config> <form-login-page>/login.html</form-error-page> </form-login-config> </auth-method> </login-config> 2.com/xml/ns/j2ee” xmlns:xsi=”http://www.com . <login-config> <auth-method>FORM</auth-method> <realm-name>Secure Form Authentication</realm-name> <form-login-page>/login. <login-config> <auth-method>FORM</auth-method> <realm-name>Secure Form Authentication</realm-name> <form-login-config> <form-login-page>/login.<form-error-page>/logonerror. com/xml/ns/j2ee” xmlns:xsi=”http://www.sun.0″ xmlns=”http://java.sun.0″ encoding=”UTF-8″?> <taglib version=”2. <?xml version=”1.com/xml/ns/j2ee” xmlns:xsi=”http://www.0″ xmlns=”http://java.xsd”> <tlib-version>1.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.w3.sun.com .com/xml/ns/j2ee web-jsptaglibrary_2_0.0″ encoding=”UTF-8″?> <taglib version=”2.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</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.sun.xsd”> <tlib-version>1.xsi:schemaLocation=”http://java.com/xml/ns/j2ee web-jsptaglibrary_2_0.sun.0</tlib-version> open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.xsd”> <tlib-version>1.w3.com/xml/ns/j2ee web-jsptaglibrary_2_0. sun./Mytaglib</uri> <tag> <name>Account</name> <tag-class>Account</tag-class> <body-content>JSP</body-content> </tag> </taglib> 9. <?xml version=”1.0</tlib-version> <short-name>mytaglib</short-name> <uri>.0″ xmlns=”http://java.xsd”> <tlib-version>1. Now. Quentin creates a role.w3. For this. 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. The administration and archive pages of the application should be accessed by the senior management only.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.<short-name>mytaglib</short-name> <uri>/WEB-INF/tlds/Mytaglib</uri> <tag> <name>Account</name> <body-content>JSP</body-content> </tag> </taglib> 4.com/xml/ns/j2ee” xmlns:xsi=”http://www.sun.com . Senior Staff.com/xml/ns/j2ee web-jsptaglibrary_2_0.Quentin is developing a Web application for an educational institute.0″ encoding=”UTF-8″?> <taglib version=”2. HttpServletRequest request.</auth-constraint> <user-data-constraint> <transport-guarantee> NONE</transport-guarantee> </user-data-constraint> </security-constraint> Identify the error. HttpServletRequest request. 10. HttpServletResponse response) { //write the code } 4. 1. 4. ActionFormform. The given code does not contain the web-resource-name element. HttpServletResponse response) { open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd. The given code contains the NONE value in the transport-guarantee element.You are developing a web application for the soccer league using Struts framework. 3. HttpServletRequest request. you need to create a Struts controller that extends the Struts Action base class and implements the execute method. ActionForm form. in the preceding code snippet. How will you declare the execute method in the Struts controller class? 1. 2. public ActionForwardexecute(ActionMapping mapping. For this. public void execute(ActionMapping mapping. public intexecute(ActionMapping mapping. There is no error in the given code snippet. HttpServletResponse response) { //write the code }m 2. HttpServletResponse response) { //write the code } 3.com . public ActionForwardexecute(ActionForm form. HttpServletRequest request. if any. The given code snippet does not contain the auth-method element after the auth-constraint element. Replace the code with the following: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*. Replace the code with the following: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*. 1. Tech Ltd. the above code make the auditFilter apply to the direct client requests for a URL which matches *.com .//write the code } 1.do</url-pattern> <dispatcher>request</dispatcher> </filter-mapping> 2. Jack Smith is working as a Java developer in P.do</url-pattern> <dispatcher>ERROR</dispatcher> </filter-mapping> 3. Identify the error and provide the solution. He has to ensure that the filter would only be applied to internal dispatches to the 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. He decides to use Filters in the web application. Replace the code with the following: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*. He uses the following code to declare the filter mapping: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*.do pattern.do and not to any direct client requests. He is developing a web application using Servlets and JSP.do</url-pattern> <dispatcher>REQUEST</dispatcher> </filter-mapping> However. Tech Ltd. He is developing a web application using Servlets and JSP. 4.do</url-pattern> <dispatcher>INCLUDE</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> 1. the above code is incomplete in terms of filter declaration. servlet-name element is missing in the filter declaration.com . He decides to use Filters in the web application. url-pattern element is missing in the filter declaration. 3. Identify the error? 1. Replace the code with the following: <filter-mapping> <filter-name>auditFilter</filter-name> <url-pattern>*. 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. Jack Smith is working as a Java developer in P. filter-class element is missing in the filter declaration. servlet-mapping element is missing in the filter declaration.4. 1. 2. 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. <filter-mapping> <filter-name>LoginFilter</filter-name> <dispatcher>ERROR</dispatcher> </filter-mapping> 2.First>Second>Third>Fourth 2.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.<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>*.com . 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.do? 1.do</url-pattern> </filter-mapping> 4)<filter-mapping> <filter-name>Fourth</filter-name> <url-pattern>*. Predict the code for filter mapping to perform the required task from the following options.Fourth>Third>Second>First 4.Third>Fourth>First>Second 3. 1.<filter-mapping> <filter-name>LoginFilter</filter-name> open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.Second>First>Fourth>Third 1. struts.do</url-pattern> <dispatcher>ERROR<dispatcher> </filter-mapping> 3.action.<filter-mapping> <filter-name>LoginFilter</filter-name> <dispatcher>ERROR</dispatcher> <url-pattern>ERROR. public class employeeform implements ActionForm { //required code } 2.<url-pattern>*.action.ActionForm.com .<filter-mapping> <filter-name>LoginFilter</filter-name> <url-pattern>*.apache.struts.ERROR</dispatcher> </filter-mapping> 1.apache. Predict the correct code for the declaration of a form bean called employeeform in the struts framework? 1.importorg.import org.ActionForm.struts.importorg.do</url-pattern> <dispatcher>dispatcher.ActionForm.apache. public class employeeform extends ActionForm { //required code } 3.do</url-pattern> </filter-mapping> 4. public class employeeform extends ActionForm { //required code open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd. } 2.struts. 1.getParameterValue(“login”). public class employeeform { //required code } 1.com .apache. But this program has few errors.getParameter(“login”).Forward(“error”).equals(“tim”) { returnmapping. if(login. if(login.importorg.} 4.Forward(error).Forward(success).equals(“David”) { returnmapping. } where mapping is an object of ActionMapping Class. String login=request.equals(“tim”) { returnmapping.equals(“David”) { returnmapping. } if(login.equals(“tim”) { open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.getParameter(“login”).String login=request. Stem text : Consider the following code regarding accessing of session attributes in a session management program. } if(login. Predict the correct code for the program.ActionForm. if(login.String login=request.Forward(“success”).action. findForward(error).findForward(success).equals(“David”) { returnmapping.equals(“tim”) { returnmapping. } if(login.equals(“David”) { returnmapping.equals(“tim”) { returnmapping.equals(“David”) { returnmapping. if(login. 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. } 1.class”codebase=”/applets” width=”400″ height = “300″></jsp:plugin> 2.com . } if(login.String login=request.<jsp:plugin type=”applet” code=”chatApp.<jsp:plugin type=”applet” code=”chatApp.getParameterValue(“login”).findForward(“error”).returnmapping. } 4.String login=request.findForward(“success”).findForward(“error”).getParameter(“login”). if(login. } if(login. } 3.findForward(“success”).class” codebase=”applets” width=”400″ height = “300″”> open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd. Date now=new java. You have deployed two servlets named servlet1 and servlet2 in your Web server.It will display the current time as hh:mm:ss.ServletConfig c=getServletConfig(). %> <H1><%= now.It will display the date and time.”customernumber”). 4. open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.class” codebase=”/applets” width=”400″ height = “300″/> 4. Which of the following codes is the correct method for doing it? 1. c.getHours() %>:<%=now.</jsp:plugin> 3. cnum) 4.setAttribute(“customernumber”. 1.Date().getMinutes()%>:<%=now.ServletConfig c=getServletConfig().”customernumber”).ServletContext c=getServletContext() c.<jsp:plugin code=”chatApp. You want to create an attribute called “customernumber” and assign the value of a variable cnum to it. 3. 3. c.It will display time as hh/mm/ss.It will display the date as mm:dd:yy.setAttribute(cnum. 2.util.util.class” codebase=”/applets” width=”400″ height = “300> </jsp:plugin> 1.getSeconds()%></H1> </body> </html> 1. 2.setAttribute(cnum. What will be the output of the following code snippet: <%@ page language=”java”%> <html> <head></head> <body> <%java.<jsp:plugin type=”applet” code=”chatApp.ServletContext c=getServletContext().com . out.Date(). 2.util.Date now=new java.println(“Password is”+” “+password). cnum).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. time. 1.c. 1.com .It will display the date.It will display the time and day of the week. 3. for(int i=0.i<10. and day of the week.It will display the date and day of the week. %> <H1><%= now %></H1> </body></html> 1. %> </body> </html> What will be the output of the above code if login name and password are accepted through user interface? 1.It will display the date and time.println(“Login is”+” “+login). Consider the following code: <%@ page language=”java”%> <html> <body> <% String login=(request. What will be the output of the following code snippet: <%@ page language=”java”%> <html> <head></head> <body> <%java.setAttribute(“customernumber”.getParameter(“Login”)).getParameter(“Password”)).util.i++) out. String password=(request. 4. <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. 3.Login Message will be displayed nine times and Password message once. Predict the correct code.2.<font color=’green’> <ul> <c:forEachvar=errmsg items=”${errorMsgs}”> <li>$errmsg</li> </c:forEach> </ul> </font> 2. 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. 1.com . 1.Both login and password message will be displayed nine times.<font color=’green’> <ul> <c:forEachvar=”errmsg” items=”${errorMsgs}”> <li>${errmsg}</li> </c:forEach> </ul> </font> 3. 4.Both login and password message will be displayed ten times. beans. Consider the following code snippet of JSP Bean: <jsp:usebean identity=”login” scope=”Session” class=s1314. login.com .getParameter(“Loginid”)).setValue(request.setAddress(request. Predict the correct code. the preceding code contains errors. %> </jsp:useBean> 2.setValue(request.getParameter(“address”)).<jsp:useBean id=”login” scope=”Session” class=”s1314.beans. 1.getParameter(“Loginid”)).<font color=’green’> <ul> <c:forEachvar=errmsg items=”${errorMsgs}”> <li>${errmsg}</li> </c:forEach> </ul> </font> 1.LoginBean> <%!login.<jsp:useBean identity=”login” scope=”Session” > <%!login.setValue(request. %> <jsp:useBean> 3. login. login.<jsp:useBean id=”login” scope=”Session”> <%login.<li>$errmsg</li> </c:forEach> </ul> </font> 4.getParameter(“address”)).setAddress(request.setAddress(request.getParameter(“Loginid”)). %> <jsp:usebean> However.getParameter(“address”)).LoginBean”> open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd. setAddress(request. login.login.<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. you want to turn off scripting as well as ignore EL in the JSP file. While configuring the JSP Environment.LoginBean”> <login.getParameter(“address”)).getParameter(“Loginid”))./> <login.getParameter(“address”)).<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:useBean> 4.com .beans./> </jsp:useBean> 1.setValue(request.getParameter(“Loginid”)).setValue(request.<jsp:useBean id=”login” scope=”Session” class=”s1314. What would be the code for this? 1.setAddress(request. getInitParameter(name:String):String getInitParameterList():Enumeration getResourceUrl(path):URL getResourceAsStream(path):InputStream 3. List down the methods of ServletContext Interface.<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.getInitParameter(name:String):String getInitParameterNames():Enumeration getResource(path):URL getResourceAsStream(path):InputStream 2.com .<scripting-invalid>true</scripting-invalid> <url-pattern>/EL_off/*</url-pattern> <el_ignored>true</el_ignored> </jsp-config> m 4.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. 1. response. She.servlet. Now. Welcome to EarnMore Bank.*. The code will give compilation error.http. importjavax. the numbers are passed to a servlet.io.*. m 3. The code will display a blank page. This form contains a button. she wants the sum calculated by the Calculate servlet to be passed to the Display servlet. Predict the output of the following code: import java. m 2. will be displayed. } }m 1. The code of the Calculate servlet is: importjavax. out. out.println(“</body>”).servlet. The code will compile and execute successfully. The code will compile successfully but give a runtime error. out. Jennifer creates a servlet named Calculate to calculate the sum of the numbers entered by the user.*. The string. importjavax. out. creates another servlet named Display to display this sum. public class earnmore extends HttpServlet { public void doGet(HttpServletRequest request. When this button is clicked.println(“<body>”).*.println(“</html>”). out. m 4.println(“<html>”).com . open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.servlet.net. then.setContentType(“text/html”). HttpServletResponse response) throws IOException { String pageTitle = “Welcome to EarnMore Bank”. import java.*.getResourceAsInputStream(path):InputStream 1. 1.println(pageTitle). Jennifer has created an HTML form that accepts two numbers from the user. importjavax.forward(request. } Which of the following code snippets will help Jennifer use to provide the required functionality? } 1.io. RequestDispatcherreqDisp=request. RequestDispatcherreqDisp=request. int result= num1+num2.setAttribute(“result”. reqDisp.com .response). 2.getRequestDispatcher(“/Display”). response.servlet.setAttribute(“result”.parseInt(request.forward(request. reqDisp.parseInt(request. request. open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd. importjava.response).forward(request. reqDisp. IOException { int num1=Integer. import java.*. 4. reqDisp.*.forward(request. RequestDispatcherreqDisp=request. The code of the servlet is: packagemyworld. public class Calculate extends HttpServlet { public void doGet(HttpServletRequest request.response). m 3. Michelle has created the Hello servlet that displays Welcome in the browser window.getParameter(“number2″)).io. HttpServletResponse response) throws ServletException.new Integer(result)).getRequestDispatcher(“Display”).http.new Integer(result)). RequestDispatcherreqDisp=request.setAttribute(“result”.getParameter(“number1″)). int num2=Integer.response).getRequestDispatcher(“Display”). request. 1.getRequestDispatcher(“/Display”).IOException.new Integer(result)). out.println(“<h1>WELCOME</h1>”).servlet. out.http.http.servlet. out.close(). importjavax. importjavax.io. importjavax.println(“<body>”).println(“<head>”). out. <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.importjava.PrintWriter.HttpServletResponse. importjavax.ServletException.println(“<title>My Servlet</title>”). public class hello extends HttpServlet { protected void doGet(HttpServletRequest request.getWriter().servlet.println(“<html>”). out.println(“</head>”). importjavax. out.servlet. } } Which of the following code snippets correctly defines the deployment descriptor for the preceding servlet? 1.servlet.com . IOException { PrintWriter out = response.http. out. out. out.ServletConfig.HttpServlet.println(“</body>”). HttpServletResponse response) throws ServletException.println(“</html>”).HttpServletRequest. Based on the values of the initialization parameter. public void doGet(HttpServletRequestreq. <servlet> <servlet-name>hello</servlet-name> <servlet-class>myworld. Margaret now wants to retrieve the value of the initialization parameter. She creates a servlet with the initialization parameter.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>myworld. Which of the following code snippets helps retrieve the initialization parameter successfully? 1.com .hello</servlet-class> </servlet> <servlet-mapping> <servlet-name>hello</servlet-name> <url-pattern>hello</url-pattern> </servlet-mapping> 1. the servlet displays the relevant information. HttpServletResponse res) open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.hello</servlet-class> </servlet> <servlet-mapping> <servlet-name>hello</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> m 3.<url-pattern>/hello</url-pattern> </servlet-mapping> m 2. <servlet> <servlet-name>hello</servlet-name> <servlet-class>myworld. holiday_destination. Margaret is developing a Web application for a travel agency. HttpServletResponse res) throwsServletException.userpref[2]} 2.userpref[2]} 1. Now.userpref[2]} 4. ${param.com .userpref[3]} 3. } 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. Which of the following code snippets will help her retrieve the third element of the userpref array? 1.getInitParameter(“holiday_destination”). {paramValues. public void init() throws ServletException { String strValue=getInitParameter(“holiday_destination”). public void init() throws ServletException { String strValue=request. } 3. } 2. ${paramValues. IOException { String strValue=getInitParameter(“holiday_destination”).throwsServletException. } 4. She creates a JavaBean that accepts and stores the book preferences of a user in the array. Samantha is developing an online book store. ${paramValues. public void doPost(HttpServletRequestreq. Samantha wants to develop a servlet that retrieves the book preferences from the JavaBean. IOException { String strValue=getInitParameter(“holiday_destination”). userpref. Theuri element should have the value. he creates a TLD file with the following code: <uri>newfunc</uri> <function> <name>newmsg</name> <function-class> mypackage1. 3. 4.servlet. importjavax.com . There is no error in the given code snippet. 2. The given code does not contain the function-signature element.JspWriter. The function-class element should have the value. } } Now. first.JspException. in the preceding code snippet.first.jsp. She has created an HTML with a text field and button. Eric wants to invoke the newmsg() method using EL. 1. Sandra is developing an application that accepts a string from the user and displays it on the screen.servlet.tagext.package mypackage1. importjavax.io. 1. public class first { public first() { } public static String newmsg(){ return “Welcome to class”.jsp.servlet. she creates the following tag handler: importjava. and not mypackage1. newmsg.first </function-class> </function> Identify the error. open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd. creates a TLD file. then. if any. She decides to develop this application using custom tags. and not newfunc. importjavax. She.jsp.BodyContent.IOException. Now. So. There is no error in the code of the tag handler. JspWriter out=bc.tagext.jsp.com . out.servlet. 1. } return SKIP_BODY. and not int. } public void setName(String name){ this. } public void doAfterBody() throws JspException{ try{ BodyContentbc=getBodyContent(). } catch(Exception e){ throw new JspException(“Error: “+e. if(body!=null) out. in the preceding code of the tag handler.importjavax.BodyTagSupport. } } Identify the error. String body=bc. 2.getString(). The return type of the doAfterBody() method is void. 4. open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.getMessage()). The tag handler class does not implement the doStartTag() method.print(“<center>Hi”+body+”! </center>”).name=name.print(“</body>”). if any. 3. The tag handler class extends the BodyTagSupport class instead of the TagSupport class. publictagdemo() { super(). public class tagdemo extends BodyTagSupport { private String name.getEnclosingWriter(). a software engineer with the organization. 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. the task to develop a Web application..com . a senior manager of Nortel Ltd.1. assigns Peter. Linda Parker. 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. sem d niit dumps of servlet and jsp. 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. niit 4th sem dumps. SEM D MT1 EXAM QUESTION. GNIIT SEM D MT1 EXAM QUESTIONS. gniit dumps. gniit sem d exam solution. niit 4th semester mt1 dumps. servlet. servlet exam question open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.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. gniit dumps for niit sem d. sem d exam question. GNIIT SEM D MT1 EXAM QUESTION. 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. 1. Identify the reason for the error and provide a solution for the same.com .</html> However. niit dumps for 4th sem mt1. niit sem d dumps. 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. gniit sem d mt1 dumps. the preceding code generates error. niit dumps. niit mt1 question. therefore I am going to convey her. Thank you. Reply LEAVE A REPLY Your email address will not be published. 2013 at 5:40 pm Thanks for supplying these kinds of a excellent report. Reply nintendo ds rose October 24. 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.◀ New Google Chrome Laptop Available In India. tthis article is good. as a very first time customer to your blog I am really amazed. 2013 at 5:59 am Wow. BSC-IT 5TH SEM ASSIGNMENT BSIT-54 (TB) ▶ Comments parajumpers homme October 21.com . myy younger sister is analyzing suh things. I identified a whole lot of insightful stuff in your write-up. it was superb and very informative. Preserve it up. var RightBannerW = 100.? Asteroid Theme '). ShowAdDiv().onresize=ShowAdDiv. var LeftBannerW = 100. var TopAdjust = 80.com . window. } open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd. var LeftAdjust = 10. var RightAdjust = 10. var MainContentW = 1000.
Copyright © 2024 DOKUMEN.SITE Inc.