Hi, I'm working on a CRUD app. I have a customer bean, with Name, City,
Phone, etc..
I also have a jsp page (CustomerEdit.jsp) with all the text fields,
that should be used to Add a new customer AND Edit an existent customer.
----------------------------------------
<FORM method="POST" ACTION="CustomerController">
<jsp:useBean id="customer" class="com.enplater.ofertes.Client"
scope="request">
<jsp:setProperty name="customer" property="*" />
</jsp:useBean>
<table>
<tr>
<td>NOM</td><td><INPUT name="name" TYPE="text" size="10"
value="${client.nom}"></td>
</tr>
----------------------------------------
When submited, the FORM calls a Servlet, the CustomerController
servlet. From this Servlet, I should create a Customer Bean, and then
get all request parameters and calling the correspondent setters of the
Bean:
Customer c=new Customer();
String name=request.getParameter("name");
String phone=request.getParameter("phone");
c.setName(name);
c.setPhone(phone);
The question is:
Can I fill all the properties of the Bean magically on a line, The
same way that the jsp does it via <jsp:setProperty property="*"> ???
There must be a trick or a workaround, because this method doesn't
scale. There must be some trick to achieve to get a Customer object as a
parameter:
HttpSession sess=request.getSession();
Customer c=(Customer) sess.getParamter("customer");
Or is this all stuff as easy as using session-scoped attributes?
--
Dani Pardo, [EMAIL PROTECTED]
Enplater S.A
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html