Results 1 to 5 of 5
Thread: use bean problem
- 10-26-2010, 10:37 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 50
- Rep Power
- 0
use bean problem
im trying to use a use-bean tag to submit information into the DB but all the data from the form appear to be null
i cant see what is wrong...
the form///
Java Code:<%@page import="mBank.MBank"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <%@ include file="/admin.jsp"%> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <form method="post" action="addcusresulte.jsp"> password<input type="text" name="pass"><br> first name<input type="text" name="firstname"><br> last name<input type="text" name="lastname"><br> addresses<input type="text" name="addresses"><br> email<input type="text" name="email"><br> phone number<input type="text" name="phonenumber"><br> comments<input type="text" name="comments"><br> <input type="submit" name="submit"><input type="reset" name="reset"></form> </body> </html>
nextpage
Java Code:<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="il.co.mbank.data.Customer"%> <%@page import="mBank.MBank"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <%@ include file="/admin.jsp" %> <jsp:useBean id="user" class="il.co.mbank.data.Customer" scope="session"></jsp:useBean> <jsp:setProperty name="user" property="*" /> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <%-- MBank bank = MBank.instance(); bank.addClient(user.getPassword(), user.getFirstName(), user.getLastName(), user.getAddrese(), user.getEmail(), user.getPhoneNum(), user.getComments()); --%> user name is ..<%=user.getFirstName() %> <h4>customer has been added to the DB</h4> --</body> </html>
- 10-26-2010, 11:45 PM #2
Member
- Join Date
- Oct 2010
- Posts
- 4
- Rep Power
- 0
Just to clarify...
The first page displays your form and lets the user fill it in and submit it to the page addcusresulte.jsp
Is the code under "nextpage" in your post what is in addcusresulte.jsp?
- 10-27-2010, 10:04 AM #3
Member
- Join Date
- Mar 2010
- Posts
- 50
- Rep Power
- 0
this code invoking a method that suppose to insert new data into the DB
i comment it because i dont want to receive NULL EXCEPTION
the output for the code now will beJava Code:<%-- MBank bank = MBank.instance(); bank.addClient(user.getPassword(), user.getFirstName(), user.getLastName(), user.getAddrese(), user.getEmail(), user.getPhoneNum(), user.getComments()); --%>
Java Code:user name is .. NULL customer has been added to the DB
- 10-27-2010, 11:15 AM #4
Member
- Join Date
- Oct 2010
- Posts
- 4
- Rep Power
- 0
You have to read the response object to get the form data. That should be done, in your case, in addcusresulte.jsp (directly or indirectly). Getting nulls maybe a sign that your not reading the response object or you are not putting the values from the response object in Mbank.
As I don't see code that reads the response object I can only speculate on want your problem is. That's why I asked the question I did in my first post.
- 10-27-2010, 09:50 PM #5
Member
- Join Date
- Mar 2010
- Posts
- 50
- Rep Power
- 0
Similar Threads
-
Problem retrieving data to JSP from Bean [using Hibernate]
By linking90 in forum JavaServer Pages (JSP) and JSTLReplies: 11Last Post: 09-09-2010, 05:50 PM -
Problem with Session Scope while using with Java Bean
By sulthanmytheen in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 03-27-2009, 10:50 AM -
UREGENT-accessing session bean ok but entity bean
By parimal in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 08-28-2008, 01:34 PM -
How to use Inner bean definitions via nested bean elements
By Java Tip in forum Java TipReplies: 0Last Post: 03-30-2008, 10:03 AM -
How to use Inner bean definitions via nested bean elements
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:36 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks