Can you post the full stack trace?

On Wed, Sep 23, 2009 at 8:20 AM, anu <[email protected]> wrote:

>
> Hi every body,
>
>          iam develpoing a sample application for login form with
> validations and persist the data by using googleappengine with java
> using eclipse.but iam getting the null pointer exception at the time
> of running.plz any one tell me the solution.
> my code is
> registe.jsp
> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> <%@ page import="java.util.List" %>
>
> <%@ page import="java.util.ArrayList" %>
>
> <%@ page import="javax.jdo.PersistenceManager" %>
>
> <%@ page import="javax.jdo.Query" %>
>
> <%@ page import="com.google.org.*" %>
>
> <html>
> <SCRIPT LANGUAGE="JavaScript">
>
> function button_actions()
> {
>  var flag=0;
>  var errors="";
>
>  if(!document.my_form.first_name.value)
>  {
>   alert("you need to supply your first name");
>    document.my_form.first_name.focus();
>    return false;
>  }
>  if(!document.my_form.last_name.value)
>  {
>   alert("you need to supply your last name");
>    document.my_form.last_name.focus();
>    return false;
>  }
>
>    var id = document.my_form.email.value;
>        var re = /^...@.+\..{2,4}$/gi;
>        if(!id.match(re))
>         {
>                        flag++;
>                errors = errors + "E-Mail\n";
>
>     }
>   if(flag > 0)
>    {
>                alert("invalid email adress\n"+
>                        errors+"\nPlease re-enter email-id.");
>                return 0;
>        }
>
>
>   if(!document.my_form.user_password.value)
>     {
>        alert("you need to supply your passsword");
>         document.my_form.user_password.focus();
>         return false;
>         }
>
>
> }
>
> </SCRIPT>
>
>  <body>
>
>    <div class="main">
>     <div class="header">
>      <h1>
>        example
>      </h1>
>     </div>
>
>    <h2>
>     new entry
>    </h2>
>
>  <div class="ex">
>   <form name="my_form" action="./register2" method="get">
>   First Name
>   <input type="text" name="first_name" size="30"></br>
>
>   LastName
>   <input type="text" name="last_name" size="30"></br>
>
>   Email
>   <input type="text" name="email" size="30"></br>
>
>   password
>   <input type="password" name="user_password" size="30"></br>
>
>   confirm password
>   <input type="password" name="confirm_password" size="30"></br>
>
>   <input type="submit" value="submit" onclick="button_actions()"/>
>
>   </form>
>     </div>
>   <h2>
>    entries
>   </h2>
>
>  <div class="entryList">
>   <%
>    List<entry> entries= new ArrayList();
>    PersistenceManager pm=PMF.get().getPersistenceManager();
>    Query query=pm.newQuery("SELECT FROM " +entry.class.getName());
>    entries=(List<entry>) query.execute();
>
>   %>
>  <%
>    if(entries.isEmpty()) {
>   %>
>
>   <%
>   }
>   else {
>   %>
>
>    <%
>      for(entry e:entries){
>    %>
>
>      <div> <%=e.getEmail()%></div>
>      <div class="Quantity"> Quantity is<%=e.getUser_password()%></
> div>
>
>    <%
>    }
>    }
>    %>
>  </div>
>
>  </body>
> </html>
>
>
>
>
> web.xml:
>
> <servlet>
>                <servlet-name>Shop2</servlet-name>
>                <servlet-class>com.google.org.Shop2Servlet</servlet-class>
>        </servlet>
>        <servlet-mapping>
>                <servlet-name>Shop2</servlet-name>
>                <url-pattern>/shop2</url-pattern>
>        </servlet-mapping>
>        <welcome-file-list>
>                <welcome-file>shop2.jsp</welcome-file>
>        </welcome-file-list>
> </web-app>
>
>
>
> enty.java
>
> import javax.jdo.annotations.IdGeneratorStrategy;
> import javax.jdo.annotations.IdentityType;
> import javax.jdo.annotations.PersistenceCapable;
> import javax.jdo.annotations.Persistent;
> import javax.jdo.annotations.PrimaryKey;
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class entry {
>        @PrimaryKey
>    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>    private Long id;
>        @Persistent
>    private String first_name;
>        @Persistent
>        private String last_name;
>        @Persistent
>        private String email;
>        @Persistent
>        private String user_password;
>        @Persistent
>        private String confirm_password;
>        public entry(String email,String user_password)
>        {
>                this.email= email;
>                this.user_password= user_password;
>
>        }
>        public Long getId() {
>                return id;
>        }
>        public void setId(Long id) {
>                this.id = id;
>        }
>        /*public String getFirst_name() {
>                return first_name;
>        }
>        public void setFirst_name(String firstName) {
>                first_name = firstName;
>        }
>        public String getLast_name() {
>                return last_name;
>        }
>        public void setLast_name(String lastName) {
>                last_name = lastName;
>        }*/
>        public String getEmail() {
>                return email;
>        }
>        public void setEmail(String email) {
>                this.email = email;
>        }
>        public String getUser_password() {
>                return user_password;
>        }
>        public void setUser_password(String userPassword) {
>                user_password = userPassword;
>        }
>        /*public String getConfirm_password() {
>                return confirm_password;
>        }
>        public void setConfirm_password(String confirmPassword) {
>                confirm_password = confirmPassword;
>        }*/
>
> }
>
>
> pmf.java
> package com.google.org;
>
>
>
> import javax.jdo.JDOHelper;
> import javax.jdo.PersistenceManagerFactory;
>
> public final class PMF {
>    private static final PersistenceManagerFactory pmfInstance =
>        JDOHelper.getPersistenceManagerFactory("transactions-
> optional");
>
>    private PMF() {}
>
>    public static PersistenceManagerFactory get() {
>        return pmfInstance;
>    }
> }
>
> register.java
>
> package com.google.org;
>
> import java.io.IOException;
> import javax.servlet.http.*;
> import javax.servlet.*;
> import java.util.*;
> import java.io.*;
> import javax.jdo.PersistenceManager;
> import javax.jdo.Query;
>
>
> @SuppressWarnings("serial")
> public class Register2Servlet extends HttpServlet {
>        HttpSession session;
>
>        String user_password,email, clickButton;
>        public void doGet(HttpServletRequest req, HttpServletResponse resp)
>                        throws IOException {
>
>                resp.setContentType("text/plain");
>                PrintWriter pw=resp.getWriter();
>                session=req.getSession(true);
>                clickButton=req.getParameter("submit");
>
>
>                email=req.getParameter("email");
>                user_password=req.getParameter("user_password");
>
>                entry ex=new entry(email,user_password );
>                PersistenceManager pm=PMF.get().getPersistenceManager();
>                pm.makePersistent(ex);
>                if(clickButton.equals("submit"))
>                {
>
>                        if(!(email.equals("")||user_password.equals("")))
>
>                                session.setAttribute(email,user_password);
>
>                                resp.sendRedirect("./register.jsp");
>
>                }
>                pw.close();
>                pm.close();
>
>
>        }
> }
>
>
> plzzzzzzzzzzzzzz help me.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to