Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sowmyalakshmi
jsp,servlets
1 Answer(s)      4 years and 7 months ago
Posted in : JSP-Servlet


Good Afternoon Sir,
I am sowmya i have a doubt that is whether it is possible to use arrays in servlets.how to declare that arrays in servlets and i am getting values from textbox in jsp and that values stores in arrays within servlet.
Thankingyou sir

Advertisement
View Answers

February 18, 2010 at 4:45 PM


Hi Friend,

Try the following code:

1)sports.jsp:

<html>
<form action="../HelloWorldExample" method="post">
<b>Select favourite sports:</b><br>
<input type="checkbox" name="sport" value="Cricket">Cricket<br>
<input type="checkbox" name="sport" value="Football">Football<br>
<input type="checkbox" name="sport" value="Tennis">Tennis<br>
<input type="checkbox" name="sport" value="Badminton">Badminton<br>
<input type="checkbox" name="sport" value="Hockey">Hockey<br>
<input type="Submit" value="Submit">
</form>
</html>

2)HelloWorldExample.java

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorldExample extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException{
PrintWriter out = response.getWriter();
String checkValues[]=request.getParameterValues("sport");
for(int i=0;i<checkValues.length;i++){
out.println(checkValues[i]);
}

}
}

Thanks


Related Tutorials/Questions & Answers:
Difference between JSP and Servlets
Difference between JSP and Servlets  What is the difference between JSP and Servlets ?   JSP is used mainly for presentation only. A JSP can only be HttpServlet that means the only supported protocol in JSP is HTTP
how to execute jsp and servlets with eclipse
how to execute jsp and servlets with eclipse  hi kindly tell me how to execute jsp or servlets with the help of eclipse with some small program
Advertisements
JSP-Servlets-JDBC
JSP-Servlets-JDBC  Hi all, 1, Create - i want sample code ( if possible with explanation) to create a registration form in JSP, and the form..... It will be helpful if it's made into sub modules, JSP, Driver Constants, Servlets, Java Beans
how to execute jsp and servlets with eclipse
how to execute jsp and servlets with eclipse  hi kindly tell me how to execute jsp or servlets with the help of eclipse with some small program... http://www.roseindia.net/jsp/crud-application.shtml This will help you in how
using jsp and servlets andin Mvc architecture
using jsp and servlets andin Mvc architecture  how to insert a form data in different tables, that means education details in education table, address details in address table,like that and finally if we fetch all must come
jsp -servlets
jsp -servlets  i have servlets s1 in this servlets i have created emplooyee object, other servlets is s2, then how can we find employee information in s2 servlets
jsp and servlets
jsp and servlets  i want code for remember password and forget password so please send as early as possible ............. thanks in advance   Please visit the following link: http://www.roseindia.net/jsf/richfaces
jsp and servlets
jsp and servlets  what is difference between jsp and servlet?? what should a person use to develop website ??   JSP is used for view in MVC... the request submitted from browser and process the data and redirect it to JSP
need a sample project using java technologies like jsp, servlets, struts
need a sample project using java technologies like jsp, servlets, struts  Hi everybody! I have learnt core java,jdbc,jsp,servlets & struts. Please guide me where can i find sample project like library management, CMS or any
How to export web page to excel using java or jsp or servlets
How to export web page to excel using java or jsp or servlets  Hi I am trying to export web page(jsp page ) to excel using jsp or servlets. I am... errors. Please can anyone tell me how to do this using java or jsp or servlets
JSP and servlets - JSP-Servlet
JSP and servlets  Hi sir, This is vanisree in my project i need to add the start time of examination and end time of examinaion and if the time between end and start are greater than one hour then i need to close that session
jsp,servlets - JSP-Servlet
jsp,servlets   Good Afternoon Sir, I am sowmya i have a doubt that is whether it is possible to use arrays in servlets.how to declare that arrays in servlets and i am getting values from textbox in jsp
How to Upload a file directly to Oracle database using JSP or Servlets?
How to Upload a file directly to Oracle database using JSP or Servlets?  Hi I want to upload a file(csv or excel) to Oracle 10g Database using JSP, here is my code which gives me an error.. Addfile.jsp <%@ page import
how do i provide down a pdf document fecility on my web page using jsp and servlets?
this program by using jsp-servlets. any one can help me please?? Thanks&...how do i provide down a pdf document fecility on my web page using jsp and servlets?  Hai, I need a program to provide download option for pdf file
how to write the coding for converting the database data for example population into any type of graph using jsp and servlets?//
jsp and servlets pls help me out how to write the coding for converting the database data for example population into any type of graph using jsp and servlet
Using MYSQL Database with JSP & Servlets.
Using MYSQL Database with JSP & Servlets.  ...; Edit command with $EDITOR   exit (\q)  Exit... current command   quit (\q)  Quit mysql  
Advance Java Training
; 1. Programming with Servlets & JSP JSP/Servlets  Training Course Objective Explaining  HTML and HTTP. Explaining  JSP
Tomcat Quick Start Guide
application using JSP, Servlets and JDBC technologies. In this quick and very fast tomcat jsp tutorial, you will learn all the essential steps need to start... advance JSP and Servlets. Resources for advance study: JSP Servlet JDBC
Online Training Courses
Online Training Courses        Core Java Training Topics Advance Java (JSP/Servlets) Training Topics Jakarta Struts & Advanced JSP Topics Java Server Faces (JSF) Training
Jsp - JSP-Servlet
JSP Servlets Advantages  What are the advantages of JSP and Servlets
Synchronization
Synchronization  i want code for synchronization using in jsp and servlets
java
update and delete record using JSP  how to update and delete record using JSP and Servlets
codecode
codecode  hi please give me code for login page using jsp and servlets and also having validations
file insertion - JSP-Servlet
file insertion  How to insert and retrieve .doc files into sql server with example using jsp and servlets
Java
Java  How to upload a pdf,txt,doc,images file with a specfic size using jsp and servlets in the serve??? Thanks in advance minni
Java Source code
Java Source Code for text chat application using jsp and servlets  Code for text chat application using jsp and servlets
struts
struts  we have the concept of jsp's and servlets right we can develop the web-pages each and everything then why what for struts inturdouced
online bookstore - JSP-Servlet
online bookstore  i want to display some books like online shoping.please send me code for that using jsp and servlets
Advertisements
 

 

 

DMCA.com