You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Maruthi <ma...@yahoo.com> on 2004/06/10 21:34:12 UTC
Information on JSP POrtlets
Hi Folks ,
I have a problem regarding JSP Portlet.I developed a JSP
(pure JSP with no Jetspeed coding) for User Registration Information that has
to store in mySQL database and i would like to deploy it as Portlet.
Here with i am attaching my JSP file named Registrationdummy1.jsp and
JSP Portlet Registry Fragment File.When i deployed the JSP in jetspeed
its not working....!..Anything else should be there?.Can anybody help me whats
wrong with my code?.
Thanks in advance,
Maruthi.
===========================================
This is my Registrationdummy1.jsp file
=================================================
<%@ page
language="java" contentType="text/html"
import = "java.io.*"
import = "java.lang.*"
import = "java.sql.*"
%>
<%@ taglib uri='/WEB-INF/templates/jsp/tld/template.tld' prefix='jetspeed' %>
<head><title>Registration Process </title></head>
<body background=green text=#FFFAFA >
<FONT face=Verdana,Geneva,Arial color=#FFFAFA size=1><b><br><br>
<center>
<%
try
{
String uid1=request.getParameter("userid");
if(uid1!=null)
{
String pass1=request.getParameter("password");
String fname1=request.getParameter("fname");
String lname1=request.getParameter("lname");
String email1=request.getParameter("email");
String dob1=request.getParameter("dob");
String sex1=request.getParameter("sex");
String education1=request.getParameter("education");
String telhome1=request.getParameter("th");
String telmob1=request.getParameter("tm");
String street1=request.getParameter("streetnhno");
String city1=request.getParameter("city");
String zip1=request.getParameter("zip");
String country1=request.getParameter("country");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("Jdbc:odbc:ravuri");
Statement st=con.createStatement();
String str="INSERT into Thesiswork.registration VALUES('"+uid1+"','"+pass1+"','"+fname1+"','"+lname1+"','"+dob1+"','"+education1+"','"+sex1+"','"+email1+"',"+telhome1+","+telmob1+",'"+street1+"','"+city1+"',"+zip1+",'"+country1+"')";
int i=st.executeUpdate(str);
out.println("Number of Rows inserted:" +i+"<br>");
out.println( "<HTML><HEAD><TITLE>Registration Process Completed</TITLE></HEAD>" );
out.println( "<BODY background=background.jpg text=#FFFAFA>");
out.println( "<H2 align=center>Hello "+lname1+" : These are the details you entered.</H2>" );
out.println("<FONT face=Verdana,Geneva,Arial color=#FFFAFA size=1>");
out.println( "<table bgcolor=#CDC673 align=center>");
out.println("<tr><td>USERID:</td><td></td><td>"+uid1+"</td></tr><br>");
out.println("<tr><td>Password:</td><td></td><td>"+pass1+"</td></tr><br>");
out.println("<tr><td>First Name:</td><td></td><td>"+fname1+"</td></tr><br>");
out.println("<tr><td>Last Name:</td><td></td><td>"+lname1+"</td></tr><br>");
out.println("<tr><td>Date Of Birth:</td><td></td><td>"+dob1+"</td></tr><br>");
out.println("<tr><td>Education:</td><td></td><td>"+education1+"</td></tr><br>");
out.println("<tr><td>Sex:</td><td></td><td>"+sex1+"</td></tr><br>");
out.println("<tr><td>E-Mail:</td><td></td><td>"+email1+"<br>");
out.println("<tr><td>Telephone Home :</td><td></td><td>"+telhome1+"</td></tr><br>");
out.println("<tr><td>Telephone Mob:</td><td></td><td>"+telmob1+"</td></tr><br>");
out.println("<tr><td>Street & H.NO:</td><td></td><td>"+street1+"</td></tr><br>");
out.println("<tr><td>City:</td><td></td><td>"+city1+"</td></tr><br>");
out.println("<tr><td>ZIP:</td><td></td><td>"+zip1+"</td></tr><br>");
out.println("<tr><td>Country:</td><td></td><td>"+country1+"</td></tr><br>");
out.println("</table>");
out.println("</font>");
out.println("</BODY>");
out.println("</HTML>");
out.close();
}
else
{
%>
<FONT face=Verdana,Geneva,Arial color=#FFFAFA size=1><b><br><br>
<h3 align="center"><font color=red>REGISTRATION FORM</font></h3>
<center>
<form align="center" name="Registration" action="Registrationdummy1.jsp" method="POST"><br><br>
<table bgcolor=#CDC673 align="center">
<tr>
<td><b>User-ID:<b></td>
<td><input type="text" name="userid" value="" size="20"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" size="20"></td>
</tr>
<tr>
<td>Re-Enter Password:</td>
<td><input type="password" name="rpassword" size="20"></td>
</tr>
<tr>
<td>First Name:</td>
<td><input type="text" name="fname" value="" size="20" align='right'></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type="text" name="lname" value="" size="20" /></td>
</tr>
<tr>
<td>E-Mail:</td>
<td><input type="text" name="email" value="" size="20"></td>
</tr>
<tr>
<td>Date Of Birth (DD/MM/YY):</td>
<td><input type="text" name="dob" value="" size="20"></td>
</tr>
<tr>
<td>Sex:</td>
<td >Male:<input type="radio" name="sex" value="Male" checked> Female:<input type="radio" name="sex" value="Female"></td>
</tr>
<tr>
<td>Education:</td>
<td>
<select name="education">
<option value="ar"> A&R(ET & IT)
<option value="ce">CE.
<option value="eeit">EE&IT
<option value="me">ME
</select>
</td>
</tr>
<tr>
<td>Telephone Home:</td>
<td><input type="text" name="th" value="" size="20">
</td>
</tr>
<tr>
<td>Telephone Mobile:</td>
<td><input type="text" name="tm" value="" size="20">
</td>
</tr>
<tr>
<td>Street&H.NO:</td>
<td><input type="text" name="streetnhno" value="" size="20">
</td>
</tr>
<tr>
<td>City:</td>
<td><input type="text" name="city" value="" size="20">
</td>
</tr>
<tr>
<td>ZIP :</td>
<td><input type="text" name="zip" value="" size="20">
</td>
</tr>
<tr>
<td>Country:</td>
<td><input type="text" name="country" value="" size="20"></td>
</tr>
</table>
<br><br>
<input type="submit" value="Submit" />
</form>
</center>
</font>
</body>
<%
}
}catch(Exception ex)
{
ex.printStackTrace();
}
%>
</html>
===============================================
Registry Fragment file to Registrationdummy1.jsp
===============================================
<portlet-entry name="RegistrationJSP" hidden="false" type="ref" parent="JSP" application="false">
<meta-info>
<title>RegistrationJSP</title>
<description>Registration JSP Portlet</description>
</meta-info>
<parameter name="template" value="Registrationdummy1.jsp" hidden="true"/>
<media-type ref="html"/>
<category>demo</category>
<category>jsp.demo</category>
</portlet-entry>
=================================================================
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger