Dear Stijn,
Thanks for your your suggestions.I changed the code accordingly.... and one tip i dont
understinf is :: in the buildNormalContext () method you asked me to write down
code(you commented like this.....//write code here)..What should be there actually..i
mean i kept all my logic (Database Operations) in the doUpdate() method.Rest of the
things are clear.I will try and send the feedback to you ...what the log files are
telling.
Many thanks for your guidance,
Maruthi
Stijn de Witt <[EMAIL PROTECTED]> wrote:
----- Original Message -----
From: "Maruthi"
To: "Jetspeed Users List"
Sent: Monday, June 21, 2004 5:24 PM
Subject: Re: Not able to find JSP Portlet ...Problem with mysql database
> Hello Stijn....The home page i was telling is after logging as "Admin"
only.Here i am pasting my JSP and Action class.
>
> Thanks for your patience.
> Maruthi.
>
> =========================================
> JSP:: RegistrationJSPTemplate.jsp
> =========================================
> > language="java" contentType="text/html"
> import = "java.io.*"
> import = "java.lang.*"
> import = "java.sql.*"
> %>
>
> prefix='jetspeed' %>
>
>
>
>
>
>
>
Tip: Don't render the head of the document, Jetspeed already does that,
you'll end up with two...
>
>
>
>
>
>
> REGISTRATION
FORM
>
>
>
>
>
>
>
> User-ID:
> [input]
>
>
>
> Password:
> [input]
>
>
>
> Re-Enter Password:
> [input]
>
>
>
>
> First Name:
> [input] align='right'>
>
>
>
> Last Name:
> [input] />
>
>
>
>
> E-Mail:
> [input]
>
>
>
>
>
> Date Of Birth (DD/MM/YY):
> [input]
>
>
> Sex:
> Male: [input] checked> Female: [input]
>
>
>
> Education:
>
>
> >> A&R(ET & IT)>CE.>EE&IT>ME>
>
>
>
> Telephone Home:
> [input]
>
>
>
>
> Telephone Mobile:
> [input]
>
>
>
>
> Street&H.NO:
> [input] size="20">
>
>
>
>
> City:
> [input]
>
>
>
>
> ZIP :
> [input]
>
>
>
>
>
>
> Country:
> [input] size="20">
>
>
>
>
>
>
>
> ********************* -->
>
>
>
> action="">
> [input] " name=js_peid>
>
>
> [input]
>
>
>
>
>
>
> > try
> {
>
> // rundata contains seseeion data and data from Action Class::
>
> RunData rundata=(RunData)request.getAttribute("rundata");
> String jspeid = (String) request.getAttribute("js_peid");
> final String userid = rundata.getUser().getUserName();
>
> > String address = (String) request.getAttribute("address"); ??
> ??
> ??
>
> -->
>
> String userid=(String)request.getAttribute("userid");
> String password=(String)request.getAttribute("password");
> String fname=(String)request.getAttribute("fname");
> String lname=(String)request.getAttribute("lname");
> String email=(String)request.getAttribute("email");
> String dob=(String)request.getAttribute("dob");
> String sex=(String)request.getAttribute("sex");
> String education=(String)request.getAttribute("education");
> String telhome=(String)request.getAttribute("th");
> String telmob=(String)request.getAttribute("tm");
> String street=(String)request.getAttribute("streetnhno");
> String city=(String)request.getAttribute("city");
> String zip=(String)request.getAttribute("zip");
> String country=(String)request.getAttribute("country");
>
> }
> catch(Exception ex)
> {
> AppObjects.log("Error:error in RegistrationJSPTemplate.jsp
page",ex);
> return;
> }
>
> %>
>
>
>
This all looks ok on first glance...
> ========================================
> Action Class ::RegistrationJSPAction.java
> ========================================
>
> // Java Resources
> import java.util.*;
> import java.sql.*;
>
> // Jetspeed Resources
>
> import org.apache.jetspeed.modules.actions.portlets.JspPortletAction;
> import org.apache.jetspeed.portal.Portlet;
>
Put here:
import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
import org.apache.jetspeed.services.logging.JetspeedLogger;
> // Turbine Resources
> import org.apache.turbine.util.RunData;
> import org.apache.turbine.util.Log;
>
>
>
> public class RegistrationJSPAction extends JspPortletAction
> {
Put here:
private static final JetspeedLogger logger = JetspeedLogFactoryService.
getLogger(RegistrationJSPAction.class.getName());
// Default constructor. Creates a RegistrationJspAction.
public RegistrationJspAction()
{
// Call superclass' constructor and log a message
super();
logger.info("Created a RegistrationJspAction.");
}
> /**************
> * Build the normal state content for this portlet.
> * @param portlet The jsp-based portlet that is being built.
> * @param rundata The turbine rundata context for this request.
> **************/
>
> protected void buildNormalContext(Portlet portlet, RunData rundata)
> {
put this here:
logger.info("buildNormalContext: Starting...");
// Write code here
logger.info("buildNormalContext: Starting...");
> }
> public void doUpdate(RunData rundata,Portlet portlet)
> {
put this here:
logger.info("doUpdate: Starting...");
> Hashtable args = new Hashtable();
> try
> {
> // String address = rundata.getParameters().getString("address");
>
>
>
> String userid= rundata.getParameters().getString("userid");
> String password= rundata.getParameters().getString("password");
> String fname= rundata.getParameters().getString("fname");
> String lname= rundata.getParameters().getString("lname");
> String email= rundata.getParameters().getString("email");
> String dob= rundata.getParameters().getString("dob");
> String sex= rundata.getParameters().getString("sex");
> String education= rundata.getParameters().getString("education");
> String telhome= rundata.getParameters().getString("th");
> String telmob= rundata.getParameters().getString("tm");
> String street= rundata.getParameters().getString("streetnhno");
> String city= rundata.getParameters().getString("city");
> String zip= rundata.getParameters().getString("zip");
> String country= rundata.getParameters().getString("country");
>
>
>
> // Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> // Connection con =
DriverManager.getConnection("Jdbc:odbc:ravuri");
> // Class.forName("com.mysql.jdbc.Driver");
> Class.forName("org.gjt.mm.mysql.Driver");
> Connection
con=DriverManager.getConnection("Jdbc:mysql://localhost:3306/Thesiswork","ro
ot","");
> Statement st=con.createStatement();
> String str="INSERT into registration
VALUES('"+userid+"','"+password+"','"+fname+"','"+lname+"','"+dob+"','"+educ
ation+"','"+sex+"','"+email+"',"+telhome+","+telmob+",'"+street+"','"+city+"
',"+zip+",'"+country+"')";
> int i=st.executeUpdate(str);
> System.out.println("Number of Rows inserted:" +i+"
");
>
> // rundata.getRequest().setAttribute("address",address);
>
> st.close();
> con.close();
> }
> catch(Exception e)
> {
> Log.error(e);
>
> }//catch()
>
> }//doUpdate
>
> } // class
>
> =======================================
> RegistrationJSPAction.xreg
> =======================================
>
>
>
>
>
hidden="false" type="ref" parent="JSP" application="false">
>
>
>
> Registration JSP Template and
Action
>
> RegistrationJSPAction
>
hidden="true" cachedOnName="true" cachedOnValue="true"/>
>
value="org\apache\jetspeed\modules\actions\portlets\RegistrationJSPAction"
hidden="true" cachedOnName="true" cachedOnValue="true"/>
This looks a bit strange...But you said you could select your portlet in the
customizer right?
For me this looks more like this:
I don't specify a path for the action. Instead, I regiser my module path
with Turbine in webapp/WEB-INF/TurbineResources.properties. But apparently
this works fine too.
>
>
> demo
myPortlets
Make your own category so you can easily find your own portlets...
> jsp.demo
>
>
Just some general tips I'm afraid. But if you put in that logging, you can
at least see what's happening.
-Stijn
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!