Sponsored Links

Interview Questions



INTERVIEW QUESTIONS J2EE JSP DETAILS

Question: How to pass java script array to jsp
page?

Answer: I just started to learn java script. working on practice project to create shopping cart. The jsp page will getting the information from database, after user key in quantity in text box, it will submit to servlet.

Code:
<input type=text name="<%= newit.getItem() %>Qty" value = "0">

now I wanna use javascript to validate if the input is positive integer, so I change the name to "Qty", and added a hidden field right after this.

Code:
<input type=text name="Qty" value = "0"><input type="hidden" name="<%= newit.getItem() %>Qty" value = "<%=keyinQty%>">
the next step will be pass the array Qty from javascript back to keyinQty and sent to servlet, but I couldn't figure out how to do it.
Could anybody help? or is this a right method to do? anyone has good link that i could find helpful info? thanks!

Code:
<SCRIPT LANGUAGE=JAVASCRIPT> function validate() { var y = new Array(x.length) for ( i=0; i<x.length; i++) { if (parseInt(x[i].value) < 0 ) { alert("Please enter positive number:"); return false; } } return true; }</SCRIPT>




Show Page [ 1 ]


Go To Top





Related Questions
1. How to pass java script array to jsp page?
2. hi Freinds, How can i use the array values which are defined in Test. Action1 in another Test. Action2?Is there any function?I can pass the values of var
3. HII have a problem in QTP to pass parameter to array. Example:Dim myparaDim myarray(100)mypara = "myname"myarray(mypa ra) = "senthil" ' its show the err
4. I am testing a Java executable application and and IE based application. I have a script that I would like to launch the Java executable, enter a recor
5. The way to declare an array is not dependent on the programming language used to write your program. Skill/Topic: ArrayA) TrueB) FalseExplanation: The way to declare an array depends on the programming language used to write your program. It is simil
6. Why do we Use a Multidimensional Array? Skill/Topic: ArrayA) A multidimensional array can be useful to organize subgroups of data within an array. In addition to organizing data stored in el
7. To pass parameters to the job we can use Unix shell program. But I do not know exactly how to do that. Plz let me know detail steps to pass the paramet
8. Which of the following is/are true for Window Manager- Skill/Topic: BeginnerA) Includes KeyBoardManager Component that allows hotkey to be defined for navigation purpose. B) Provides WindowManagement functi
9. You want to pass object data from a component that resides on a client computer to a component that resides on a server. You want to keep network traf Answer: A, B, C
10. What steps have you followed while automating? 1) Running the test manually and ensuring a "pass". 2)Recording3)Checkpo ints/Verification points4)Parameteriza tion if necessary5)Output values if neces

Related Articles
1. Introduction Tutorial: Tutorial Written By: Till JavaScript (also referred to as JS) is a programming language that you can use to add some cool and important functions to your webpages. Sometimes it is also referred to as a scripting language (Java Script ) with the implication that it is somehow easier to script than to
2. Choose a method for passing arrays to the Oracle Provider for OLEDB: We show you how to pass an array of values to a PL/SQL stored procedure, wrapped in the proper structure
3. Tips for Scripting Java with Jython: by Noel Rappin , co-author of Jython Essentials 03/27/2002 You have a programming dilemma. Maybe you're writing a Java program, and you need to do a quick one-off script to clean up your database. Sure, you could write it in Java, but that can involve a lot of overhead for a quick script. You could
4. Using Script Extensions in Xalan-Java: ( Page 1 of 8 ) This article will look at scripting languages that are not covered in the Xalan documentation, in particular, Python, VBScript, and PerlScript. In addition, we will show how Java Object instances, created in XSLT as part of the Java language extensions mechanism, are passed to these
5. Community-Submission: Converting a ksh Function to a ksh Script: A BigAdmin reader describes how to create a script that behaves as both an executable script and a ksh function.
6. Determining the size of a VB dynamic array: by ElementK Journals on Visual Basic Read Comments Rate this resource Viewed 24259 times Rating: 98 users 4.43 out of 5 Next > Dynamic arrays are great tools for creating a collection of values on the fly. However, you may have run into trouble when trying to determine if the array contains any i
7. Avoiding a Type Mismatch Error When Using ByRef with ASP and COM: By Stephen Lian Rating: 4.2 out of 5 Rate this article email this article to a colleague Introduction Those of you who have built ASP applications with middle-tier components have come across the need to pass information from an ASP page to a component and then back to the ASP page. In Visual Basic
8. Overland Delivering First Primary Storage Array: The fruit of Overland's acquisition of Zetta Systems, the array features a single storage processor with both iSCSI and Fibre Channel connectivity.
9. Client-Side Scripting and ASP: by Kannaiah Vadlakunta Introduction Most web applications involve both client-side and server-side script. Client-side script is often used to program the user interface for an application - for example, to change a web page's text dynamically, respond to user actions such as button clicks, and perf
10. ASP Based Reverse DNS Lookup: by Jason Withrow Many people fail to realize the full power of ASP. You don't need components for everything. ASP can be utilized for many things people never knew it could be. So, as an example of this, I wrote this script to perform a reverse DNS Lookup, and did it in about 5 minutes. There are so


Category JSP Interview Questions & Answers - Exam Mode / Learning Mode
Rating (0.3) By 8223 users
Added on 7/17/2011
Views 68501
Rate it!

Question: How to pass java script array to jsp
page?



Answer:

I just started to learn java script. working on practice project to create shopping cart. The jsp page will getting the information from database, after user key in quantity in text box, it will submit to servlet.

Code:
<input type=text name="<%= newit.getItem() %>Qty" value = "0">

now I wanna use javascript to validate if the input is positive integer, so I change the name to "Qty", and added a hidden field right after this.

Code:
<input type=text name="Qty" value = "0"><input type="hidden" name="<%= newit.getItem() %>Qty" value = "<%=keyinQty%>">
the next step will be pass the array Qty from javascript back to keyinQty and sent to servlet, but I couldn't figure out how to do it.
Could anybody help? or is this a right method to do? anyone has good link that i could find helpful info? thanks!

Code:
<SCRIPT LANGUAGE=JAVASCRIPT> function validate() { var y = new Array(x.length) for ( i=0; i<x.length; i++) { if (parseInt(x[i].value) < 0 ) { alert("Please enter positive number:"); return false; } } return true; }</SCRIPT>




Show Page [ 1 ]


Go To Top





Related Questions
1. How to pass java script array to jsp page?
2. hi Freinds, How can i use the array values which are defined in Test. Action1 in another Test. Action2?Is there any function?I can pass the values of var
3. HII have a problem in QTP to pass parameter to array. Example:Dim myparaDim myarray(100)mypara = "myname"myarray(mypa ra) = "senthil" ' its show the err
4. I am testing a Java executable application and and IE based application. I have a script that I would like to launch the Java executable, enter a recor
5. The way to declare an array is not dependent on the programming language used to write your program. Skill/Topic: ArrayA) TrueB) FalseExplanation: The way to declare an array depends on the programming language used to write your program. It is simil
6. Why do we Use a Multidimensional Array? Skill/Topic: ArrayA) A multidimensional array can be useful to organize subgroups of data within an array. In addition to organizing data stored in el
7. To pass parameters to the job we can use Unix shell program. But I do not know exactly how to do that. Plz let me know detail steps to pass the paramet
8. Which of the following is/are true for Window Manager- Skill/Topic: BeginnerA) Includes KeyBoardManager Component that allows hotkey to be defined for navigation purpose. B) Provides WindowManagement functi
9. You want to pass object data from a component that resides on a client computer to a component that resides on a server. You want to keep network traf Answer: A, B, C
10. What steps have you followed while automating? 1) Running the test manually and ensuring a "pass". 2)Recording3)Checkpo ints/Verification points4)Parameteriza tion if necessary5)Output values if neces

Related Articles
1. Introduction Tutorial: Tutorial Written By: Till JavaScript (also referred to as JS) is a programming language that you can use to add some cool and important functions to your webpages. Sometimes it is also referred to as a scripting language (Java Script ) with the implication that it is somehow easier to script than to
2. Choose a method for passing arrays to the Oracle Provider for OLEDB: We show you how to pass an array of values to a PL/SQL stored procedure, wrapped in the proper structure
3. Tips for Scripting Java with Jython: by Noel Rappin , co-author of Jython Essentials 03/27/2002 You have a programming dilemma. Maybe you're writing a Java program, and you need to do a quick one-off script to clean up your database. Sure, you could write it in Java, but that can involve a lot of overhead for a quick script. You could
4. Using Script Extensions in Xalan-Java: ( Page 1 of 8 ) This article will look at scripting languages that are not covered in the Xalan documentation, in particular, Python, VBScript, and PerlScript. In addition, we will show how Java Object instances, created in XSLT as part of the Java language extensions mechanism, are passed to these
5. Community-Submission: Converting a ksh Function to a ksh Script: A BigAdmin reader describes how to create a script that behaves as both an executable script and a ksh function.
6. Determining the size of a VB dynamic array: by ElementK Journals on Visual Basic Read Comments Rate this resource Viewed 24259 times Rating: 98 users 4.43 out of 5 Next > Dynamic arrays are great tools for creating a collection of values on the fly. However, you may have run into trouble when trying to determine if the array contains any i
7. Avoiding a Type Mismatch Error When Using ByRef with ASP and COM: By Stephen Lian Rating: 4.2 out of 5 Rate this article email this article to a colleague Introduction Those of you who have built ASP applications with middle-tier components have come across the need to pass information from an ASP page to a component and then back to the ASP page. In Visual Basic
8. Overland Delivering First Primary Storage Array: The fruit of Overland's acquisition of Zetta Systems, the array features a single storage processor with both iSCSI and Fibre Channel connectivity.
9. Client-Side Scripting and ASP: by Kannaiah Vadlakunta Introduction Most web applications involve both client-side and server-side script. Client-side script is often used to program the user interface for an application - for example, to change a web page's text dynamically, respond to user actions such as button clicks, and perf
10. ASP Based Reverse DNS Lookup: by Jason Withrow Many people fail to realize the full power of ASP. You don't need components for everything. ASP can be utilized for many things people never knew it could be. So, as an example of this, I wrote this script to perform a reverse DNS Lookup, and did it in about 5 minutes. There are so


Source: CoolInterview.com



If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification Enter the above shown code: *
Inform me about updated answers to this question

Related Questions
View Answer
What is the difference between session and cookie ?


View Answer
Where do we use hidden variables and url rewriting? and wat is the difference between them?

View Answer
How to overwrite the init and destroy method in a JSP page.

View Answer
A] Is the response.sendRedirect ends the existing session?
B] If I logged in to a site ( say a.com) & then in same browser window I type the url for another site (say b.com), then does my session gets ended on first site ( a. com ) ?

View Answer
How do we perform redirect action without using
response.sendRedirect(" ");


- JSP Interview Questions & Answers"> View Answer
What is the difference between Difference between doGet() and doPost()?
View Answer
When many Users are browsing the same application at the same time and they click the "Submit" button will many objects be created for each and every User?

View Answer
What is the default scope of jsp tags?

View Answer
What are the default objects provided by JSP container? Other than page, request, session and context objects.

View Answer
What is the difference between , page directive include, action tag include ?

View Answer
I have a String name & Map m, in my bean class. I have get & set methods on both.

To Display the String name, i do


The above one works fine.
Te below one, displays the entire Map contents


I know the KEY, how do i display the VALUE for that KEY
View Answer
what is the use of extends in jsp...we we want to import a class in current jsp file which i am working how can i do that ...if i use extnds for that means how can i do that...pls explain me this

View Answer
How to check the value in the text field is not a number

View Answer
What is the diff. b/n declaring members in and declaraing in jspinit() method ?

View Answer
How to generate BAR & PIE Graphs using JSP code...?

View Answer
When jsp is compiled into servlet, where the servlet is actually stored(storage location)?

View Answer
Why should we setContentType() in servlet ?what is the use of that method?

View Answer
What is the difference between servlet session and jsp session?

View Answer
What is the architecture of JSP?
View Answer
How to call EJB from JSP.

View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

View All JSP Interview Questions & Answers - Exam Mode / Learning Mode



User Options
India News Network

Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal



Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |




Copyright ©2003-2024 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions