Jsp,bean
Hello
i have to create a form with combobox ,after that the chosen option have to regist in database,and after that it has to display on web -side. if some one have the same profil. them name show on the web-side.
after that all the people have to list up in
histogram, i mean how many have take the test in procent
im not god in english. hope someone can help me
1.Form
<HTML>
<HEAD><TITLE></TITLE></HEAD>
<BODY>
<H3></H3>
<FORM METHOD="POST" action="test1.jsp">
<P> Name<BR>
<INPUT TYPE="TEXT" NAME="name" SIZE="20">
<P> What you like best <BR>
<INPUT TYPE="RADIO" NAME="fruit" VALUES="grapes" > Grapes
<INPUT TYPE="RADIO" NAME="fruit" VALUES="cherry" > cherry
<INPUT TYPE="RADIO" NAME="fruit" VALUES="banana" >banana
<P> your best tv-serial <BR>
<INPUT TYPE="RADIO" NAME="tv-serial" VALUES="Lost">Lost
<INPUT TYPE="RADIO" NAME="tv-serial" VALUES="prison break">prison
<INPUT TYPE="RADIO"NAME="tv-serial VALUES="Supernatural">
<P> Wich color like you <BR>
<INPUT TYPE="RADIO" NAME="color" VALUES="black" >black
<INPUT TYPE="RADIO" NAME="color" VALUES="green >green
<INPUT TYPE="RADIO" NAME="color" VALUES="red" >red
<P>Animals<BR>
<INPUT TYPE="RAD NAME="Animals" VALUES="frog">frog
<INPUT TYPE="RAD NAME="Animals" VALUES="dog">dog
<INPUT TYPE="RAD NAME="Animals" VALUES="cat">cat
<P>
<INPUT TYPE="SUBMIT" VALUE="Next">
<INPUT TYPE="RESET" VALUE="Reset">
</FORM>
</BODY>
</HTML>
2.beans
<%@ page import="com.java2s.*"%>
<jsp:useBean id="Profile" scope="session" class="Profile"
type=""/>
<jsp:setProperty name="Profile" property="*"/>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
3.class
package com.java2s.tags;
import java.iu.*;
import sql.*;
class.forName("org.gjt.mm.mysal.Driver").newInstan ce();
connection =DriverManager.getConnection("jdbc:mysql://localhost/test");
Statement commando= createStatemenr();
public class Profil
{
privat String name;
Private String fruit;
Private String Animals;
Private String TV-serial;
Private String color;
public String getName()
{
return name;
}
public String getFruit()
{
return fruit;
}
public String getAnimals()
{
return Animals;
}
public String getTv-serial()
{
return Tv-serial;
}
public String getColor()
{
return color;
}
public void setName()
{
this.name=name;
Commando.executeUpdate()
}
public void setNFruit()
{
this.fruit=fruit;
Commando.executeUpdate()
}
public void setAnimals()
{
this.animals=animals;
Commando.executeUpdate()
}
public void setTv-serial()
{
this.tv-serial=tv-serial;
Commando.executeUpdate()
}
public void setColor()
{
this.color=color;
Commando.executeUpdate()
}
|