Also, beans should implement the java.io.Serializable interface if you are
going to store them in the Session object.

On Mon, Feb 7, 2011 at 10:12 PM, Stephen Johnson <[email protected]>wrote:

> Do you have sessions enabled for your application?
>
>
> On Mon, Feb 7, 2011 at 5:39 AM, Louis H. <[email protected]> wrote:
>
>> Hi,
>> I am trying jsp form handling via bean and I am wondering why this jsp
>> page gives me an NPE after submitting. This happening with scope "session"
>> (when I change scope to "page" it's working correctly):
>>
>> *<%@ page contentType="text/html;charset=UTF-8" language="java" %>*
>> *<jsp:useBean id="testik" class="formBeans.Test1" scope="session"/>    
>> *//Works
>> ok with scope="page"
>> *<jsp:setProperty name="testik" property="*"/>                         *//NPE
>> thrown here
>> *<html xmlns="http://www.w3.org/1999/xhtml";> *
>> *  <head> *
>> *    <title>TestFormPage</title> *
>> *  </head> *
>> *  <body>*
>> *    <form action="testForm.jsp" method="post">*
>> *     <input type="text" id="testPole" name="testPole" value="<%=
>> testik.getTestPole() %>"/>*
>> *     <input type="submit"/>*
>> *    </form>*
>> *  </body>*
>> *</html>*
>>
>> Source of bean for handling data (nothing interesting here):
>> *package formBeans;*
>> *public class Test1 {*
>> * private String testPole="";*
>> *
>> *
>> * public String getTestPole() {*
>> * return testPole;*
>> * }*
>> * public void setTestPole(String testPole) {*
>> * this.testPole = testPole;*
>> * }*
>> *}*
>>
>> If I get it right, the "<jsp:useBean id="testik" class="formBeans.Test1"
>> scope="session"/>" should create and initialize a bean in session (if it
>> is not present already) but it seems the bean is not created.
>> Any suggestion appreciated.
>>
>> --
>> 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.
>>
>
>

-- 
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