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



Home Answers Viewqa JSP-Servlet creating a feedback form
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


nishi
creating a feedback form
1 Answer(s)      5 years ago
Posted in : JSP-Servlet



Advertisement
View Answers

September 18, 2009 at 2:24 PM


Hi Friend,

Try the following code:

1)radioForm.jsp:

<%@page import="java.util.*"%>
<html>
<form method="post" action="feedback.jsp">
<table>
<%
int i=0;
ArrayList list=new ArrayList();
list.add("How would you rate course to your friends?");
list.add("How much help was textbook? ");
list.add("Interesting?");
list.add("Course material sufficient?");
list.add("Challenging?");
Iterator itr;

for(itr=list.iterator(); itr.hasNext();){
String ans=itr.next().toString();

%>
<tr><td><%=ans%></td><td><input type="hidden" name="question<%=i%>" value="<%=ans%>" ></td>
<td><input type="hidden" name="quid<%=i%>" value="<%=i%>"></td><td><input type="radio" value="Poor" name="radio<%=i%>"/>Poor</td><td><input type="radio" value="Average" name="radio<%=i%>"/>Average</td><td><input type="radio" value="Good" name="radio<%=i%>"/>Good</td></tr>
<% i++;
}
%>
<tr><td><input type="Submit" value="Submit"></td></tr>
</table>
</form>
</html>

2)feedback.jsp:

<%@page import="java.sql.*"%>
<%
String id[]= new String[5];
for(int i=0;i<5;i++){
id[i]=request.getParameter("qid"+i);
System.out.println(id[i]);
}
String option[]= new String[5];
for(int i=0;i<5;i++){
option[i]=request.getParameter("radio"+i);
System.out.println(option[i]);
}
String ques[]= new String[5];
for(int i=0;i<5;i++){
ques[i]=request.getParameter("question"+i);
System.out.println(ques[i]);
}
try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn =DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root","root";);
Statement st=conn.createStatement();
for(int j=0;j<5;j++){
String optionValue=option[j];
String qid=id[j];
String question=ques[j];
st.executeUpdate("insert into question(question,options) values('"+question+"','"+optionValue+"')");
}

out.println("Inserted Successfully");
}
catch(Exception e){
out.println(e);
}
%>

Thanks


Related Tutorials/Questions & Answers:
creating a feedback form - JSP-Servlet
i am refining this problem as follows: i am creating a feedback form of a college. this feedback form will ask some question. now depending upon those...creating a feedback form  hi, first of all thank you very much
to creating a registration form
to creating a registration form  how to create a registration form
Advertisements
Dynamically creating a form in gwt?
Dynamically creating a form in gwt?  how can i create a gwt form by retrieving fields dynamically from a map? i have all the fields set in the data... fields in a map and creating a form with them
creating web page for form registration
creating web page for form registration  I am creating web page for form registration to my department ..I have to Reprint the Application Form (i.e Download the PDf File from the Database ) , when the user gives the Application
Need some help creating an order form.
Need some help creating an order form.  Hi there. I am looking to create an order form for clients to customize the way a product looks. The codes I found on the form html page are useful. My question is: can I tie them all
feedback of o/p - Java Beginners
feedback of o/p  Java feedback program  Hi,In the code:ssint data=100;ssint is a data type class.But in java "ssint" is not a data type.From where you have take the code?I am not able to find it on the net
put image on form creating in swing-swing code - Swing AWT
put image on form creating in swing-swing code  i want to display image on swing panel and get the image co ordinate by mouse clicking.and also zoom the image at particular area of image. please give solution on my email id
Creating Canvas Form Example
Creating Canvas Form Example       This example shows that how to use the Canvas Class in a Form. In this example we take two field in which integer number passed from the form
form
form   Can I prevent a form from being submitted again
How to handle a form in JSP
JSP code which used the HTML code for creating a form and this form is handled... How to handle a form in JSP       This section teaches you about the creating a from
Creating Views
Creating Views Struts provides their own JSP tag library for creating view...; <s:form action="loginSuccess"> <s:textfield name="...; The action is the action in the form tag is the struts action. The form sends
Creating Volume Bar Using Gauge Class
Creating Volume Bar Using Gauge Class       This example is all about creating a volume bar using Gauge class. We are creating the object of Gauge class that contains
Creating an Applet
Creating an Applet  Hi, I have get a task regarding Creating an Applet using all Layout Manager, can anyone help me in this regard. I donā??t know how to make and please help me. Thanks.   To answer of your query
Creating Exception
Creating Exception  class Myexception extends Exception{ private int detail; Myexecption(int a){ detail=a; } public String toString(){ return "Myexception["+detail+"]"; } } class Exceptiondemo{ static void Compute(int a) throws
Creating a Frame
, calender, combobox checkbox and many more for creating GUI in Java based... with your applet. Swing libraries is used for creating desktop applications...; Creating a Frame     
struts form
struts form  Hi, This is Rajesh.I'm creating struts form in jsp.i have two textboxes in my jsp.During Jsp page loading focus will automatically should come to second textbox(That means during page loading cursor automatically
Creating a memory leak with Java
Creating a memory leak with Java  Creating a memory leak with Java
How to create form in Swings
How to create form in Swings  How to create registration, login and question form in Java Swing?   Creating different forms in Java Swing - Examples how to create registration form in swing swing login form example
form validation
form validation  how the form validation is done in jsf form using javaScript
creating windo chat
creating windo chat   hi ... please could you help me in creating chat aprograme in java ???? with comments beside codes please
Creating circle inside a circle
Creating circle inside a circle  hi can any one give code for following output by awt/swing creating circle inside a circle ,outside cirlce and intersect a circle
Creating PDF in JAVA
Creating PDF in JAVA  How create pdf in java ? Take value from database for particular PDF
print a form of *
print a form of *   * *** ***** ******* ********* ******* ***** *** *   Post the format properly
creating inheritance of cars
creating inheritance of cars   hi ... please help me in creating inheritance between some types of cars like car that is parent and both of private car and public car are extends it then bus and truck extends public car
Creating a setup file
Creating a setup file  How to create a setup file in tomcat as done in visual studio... could plz tell me as early as possible
creating JD ialog
creating JD ialog   hi ... please help me in creatin a JDialog box that contains two buttons of minimization and exit
creating reports in java
creating reports in java  how to create reports automatically in java and send it via mail by scheduling tine for weekly,monthly basis
Multipage form
Multipage form  I have a multipage form in php with 2 pages wnhen i submit the form data from both the pages should go in database how should i pass teh data from 1st page to 2nd page and then put the entire form data in mysql
jsp form
jsp form  hi sir, one got one got in jsp form after entering the data into the form the data is not saving in the database i will send you code of two forms if dnt understand my problem
submit a form
submit a form  How can we submit a form without a submit button
Creating XMl file - XML
Creating XMl file   I went on this page: http://www.roseindia.net/xml/dom/createblankdomdocument.shtml and it shows me how to create an XML file, however there is something I don't understand. I have to create an XML file
Advertisements
 

 

 

DMCA.com