Solved

javabean <jsp:setProperty name="customer" property="*"/> no result

Posted on 2004-04-22
33
1,543 Views
Last Modified: 2013-12-03
hi experts,

I've got some more problems.  This code is not setting properties to the bean.
Display customer page is working fine,  I tested it with other code.  I am not sure if I am placing the line <jsp:setProperty name="customer" property="*"/>  in a proper place

Can someone help?  thanks in advance


<body>


      <table border="0" width="100%">
      <tr>
       <td colspan="2"><jsp:include page="Titlebar.jsp" flush="true" /></td>
      </tr>
      <tr>
       <td valign="top" width="15%"><%@ include file="Sidebar.jsp" %></td>
            
       <td valign="top" >
            <div align="center"><h2>Create A New Customer</h2></div>
            
            
<jsp:useBean id="customer" class="business.Customer" scope="session" />      

<%
   if (request.getParameter("submitPorm") != null) {
      customer.clear();
   }
%>


      
            <form name="myform" action="/TaxiGlobe/DisplayCustomer.jsp" method="post" >

      
            <hr width=90%>
            <br>
            
                        
            <font color=red><b><center>Required fields *</center></b></font>
            <table border="0" width="90%" cellpadding="5" align=center>
            <br>
            <tr>
                  <td align="left" width="30%"><b>Company name</b></td>
                  <td align=top><%= session.getAttribute("companyName") %></td>
            </tr>
            <tr>
                  <td align="left"><b>Company address</b></td>
                  <td align=top><input type="text" name="companyAddress" size="60"
                        onKeypress="if (event.keyCode==34 || event.keyCode==39) event.returnValue = false;">
                  <font color=red>* </font></td>
            </tr>
            <tr>
                  <td align="left"><b>Company phone number</b></td>
                  <td align=top><input type="text" name="companyPhoneNo" size="20"
                         onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
                  <font color=red>*</font></td>
            </tr>
            <tr>
                  <td align="left"><b>Company fax number</b></td>
                  <td align=top><input type="text" name="companyFaxNo" size="20"
                         onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
                  <font color=red>*</font></td>
            </tr>
            <tr>
                  <td align="left" ><b>Main contact names</b></td>
                  <td align=top><input type="text" name="mainContactName" size="50">
                  <font color=red>*</font></td>
            </tr>
            <tr>
                  <td align="left"><b>Main contact email address</b></td>
                  <td align=top><input type="text" name="mainContactEmail" size="40">
                  <font color=red>* eg. name@domain.com</font> </td>
            </tr>
            <tr>
                  <td align="left"><b>Main contact phone number</b></td>
                  <td align=top><input type="text" name="mainContactPhoneNo" size="20"
                        onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
                  <font color=red>*</font></td>
            </tr>
            <tr>
                  <td align="left"><b>Secondary contact names</b></td>
                  <td align=top><input type="text" name="secondaryContactName" size="50">
                  </td>
            </tr>
            <tr>
                  <td align="left"><b>Secondary contact email address</b></td>
                  <td align=top><input type="text" name="secondaryContactEmail" size="40">
                  <font color=red> eg. name@domain.com</font></td>
            </tr>
            <tr>
                  <td align="left"><b>Secondary contact phone number</b></td>
                  <td align=top><input type="text" name="secondaryContactPhoneNo" size="20"
                        onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
                  </td>
            </tr>
            <tr>
                  <td align="left"><b>Card number</b></td>
                  <td><input type="text" name="creditCardNumber" size="30"
                        onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
                  <font color=red>*</font></td>
            </tr>
            <tr>
                  <td align="left"><b>Expiation date</b></td>
                  <td><input type="text" name="creditCardExpirationDate"
                        onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
                  <font color=red>* eg.(mm/yyyy)</font> </td>
            </tr>
            <tr>
                  <td align="left"><b>Card type</b></td>
                  <td><select name="creditCardType" value="">
                        <option value="">
                        <option value="Visa">Visa
                         <option value="Mastercard">Mastercard
                    <option value="American Express">American Express
                    <option value="Switch">Switch
                    </select><font color="red">*</font>
                    </td>
            </tr>
            <tr>
                  <td align="left"><b>Card holder name</b></td>
                  <td><input type="text" name="creditCardHolder" size="30">
                  <font color=red>*</font></td>
            </tr>
            <tr>
                  <td align="center" colspan="2"><font color=red>
                  <b>Please, make sure that the data entered is correct</b></font>
                  </td>
            </tr>
            <tr>
                  <td>&nbsp;</td>
            </tr>            
            </table>

            <center>
            <input type="submit" name="submitPage" value="Save Details" onClick="return validate(this);">
            <input type="reset" name="reset" value="Reset" >

            </center>      
            </form>
      
                  <jsp:setProperty name="customer" property="*"/>      

      

       </td>
      </tr>
</table>
</body>
0
Comment
Question by:anna_suchodolska
  • 14
  • 11
  • 8
33 Comments
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10895818
try this..

change it to here

<%
   if (request.getParameter("submitPorm") != null) {
     <jsp:setProperty name="customer" property="*"/>
      customer.clear();
   }
%>
Cheers
Ghost
0
 
LVL 7

Expert Comment

by:searlas
ID: 10897384
If you're trying to take the input from the form and set properties of your bean, you need the jsp:setProperty tag to be in your jsp /TaxiGlobe/DisplayCustomer.jsp.  i.e. the JSP related to the action of the form.
0
 

Author Comment

by:anna_suchodolska
ID: 10897604
I got an error, try without catch and catch without try, ghost

searlas, can I use setProperty "*" on the next page?
I don't want to read all parameters from the bean to set them then and so on, unless it is not going to work in any ohter way,

I was trying to set them here and redirect but redirect is not working
what shoud I put in is else clause?  
if button not pressed
<html>
<all html or jsp>
</html>
else
<jsp: forward page= ....>

0
 

Author Comment

by:anna_suchodolska
ID: 10897714
that's what I have now, I can see the form, java script validates input, but bean is empty
maybe because i am not using forward

if you can't suggest anything i am going to give up and try to change it in other ways, i just have no more strength for it...

Cheers guys


</head>
<body>


      <table border="0" width="100%">
      <tr>
       <td colspan="2"><jsp:include page="Titlebar.jsp" flush="true" /></td>
      </tr>
      <tr>
       <td valign="top" width="15%"><%@ include file="Sidebar.jsp" %></td>
            
       <td valign="top" >
            <div align="center"><h2>Create A New Customer</h2></div>
            


<jsp:useBean id="customer" class="business.Customer" scope="session" />      

<%  if (request.getParameter("submitForm") != null) {
      customer.clear();
%>

      
            <form name="myform" action="/TaxiGlobe/DisplayCustomer.jsp" method="post" >

      
            <hr width=90%>
            <br>
            
                        
            <font color=red><b><center>Required fields *</center></b></font>
            <table border="0" width="90%" cellpadding="5" align=center>
            <br>
            <tr>
                  <td align="left" width="30%"><b>Company name</b></td>
                  <td align=top><%= session.getAttribute("companyName") %></td>
            </tr>
            <tr>
                  <td align="left"><b>Company address</b></td>
                  <td align=top><input type="text" name="companyAddress" size="60"
                        onKeypress="if (event.keyCode==34 || event.keyCode==39) event.returnValue = false;">
                  <font color=red>* </font></td>
            </tr>
            <tr>
                  <td align="left"><b>Company phone number</b></td>
                  <td align=top><input type="text" name="companyPhoneNo" size="20"
                         onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
                  <font color=red>*</font></td>
            </tr>
            <tr>
                  <td align="left"><b>Company fax number</b></td>
                  <td align=top><input type="text" name="companyFaxNo" size="20"
                         onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
                  <font color=red>*</font></td>
            </tr>
            <tr>
                  <td align="left" ><b>Main contact names</b></td>
                  <td align=top><input type="text" name="mainContactName" size="50">
                  <font color=red>*</font></td>
            </tr>
            <tr>
                  <td>&nbsp;</td>...
            </tr>            
            </table>

            <center>
            <input type="submit" name="submitPage" value="Save Details" onClick="return validate(this);">
            <input type="reset" name="reset" value="Reset" >


            </center>      
            </form>
            
<%      } else {   %>
     <jsp:setProperty name="customer" property="*"/>
<%    }%>


      

       </td>
      </tr>
</table>
</body>

</html>
0
 

Author Comment

by:anna_suchodolska
ID: 10898078
Hi gentelman,

i sorted the problem, and it is working, i used another techniques,
what do i  do with points in this case?

can i request to cancel the question?

thank you for your assistance
let me know what is right to do here (I am rather new), please

anna
0
 
LVL 7

Expert Comment

by:searlas
ID: 10898141
Out of interest, what's the other technique you used?

The way setProperty is usually used is:
Page 1: a form; action attribute points to another JSP
Page 2: contains a jsp:setProperty tag; the browser sends all the form data to this page when you submit the form on page 1.




0
 

Author Comment

by:anna_suchodolska
ID: 10898662
but you have to
use String x = getParameter(...)  
bean.setProperty
on page 2
 don't you?
0
 
LVL 7

Expert Comment

by:searlas
ID: 10898786
No.  From your code, there doesn't seem much point having the useBean tag on Page 1 at all.  You'd have both the useBean and the setProperty tags on page 2.

0
 

Author Comment

by:anna_suchodolska
ID: 10898922
I see...

but what I am doing now is combining to pages in one
if submit button not clicked display form, else set paroperties, and display them next

I couldn't figure out how to use forward, it is causing me lots of trouble

i have a question, maybe you can help me out with this one

when i get the customer object from the session get its properties and display, can I still use getAttribute on the same bean in the session on the next page, or is it not there already?

I  am working with update.  data is brought from the db, placed into the form to enable correction, but when i try to use getParatmeter on inout boxes on the next page, it seems to be empty

this code does,'t semm to be working

HttpSession session = request.getSession(true);

   
      Customer customer = (Customer)session.getAttribute("customer");
   
    String companyName = request.getParameter("companyName");
    String cphone = request.getParameter("companyPhoneNo");
      String cfax = request.getParameter("companyFaxNo");
      String caddr = request.getParameter("companyAddress");
      String mainnames = request.getParameter("mainContactName");
      String mainemail = request.getParameter("mainContactEmail");
      String mainphone = request.getParameter("mainContactPhoneNo");
      String secondarynames = request.getParameter("secondaryContactName");
      String secondaryemail = request.getParameter("secondaryContactEmail");
      String secondaryphone = request.getParameter("secondaryContactPhoneNo");
      String cardnumber = request.getParameter("creditCardNumber");
      String creditCardExpirationDate = request.getParameter("creditCardExpirationDate");
      String cardtype = request.getParameter("creditCardType");
      String cardHolder = request.getParameter("creditCardHolder");
   
    customer.setCompanyName(companyName);
      customer.setCompanyPhoneNo(cphone);
      customer.setCompanyFaxNo(cfax);
      customer.setCompanyAddress(caddr);
      customer.setMainContactName(mainnames);
      customer.setMainContactEmail(mainemail);
      customer.setMainContactPhoneNo(mainphone);
      customer.setSecondaryContactName(secondarynames);
      customer.setSecondaryContactEmail(secondaryemail);
      customer.setSecondaryContactPhoneNo(secondaryphone);
      customer.setCreditCardNumber(cardnumber);
      customer.setCreditCardExpirationDate(creditCardExpirationDate);
      customer.setCreditCardType(cardtype);
      customer.setCreditCardHolder(cardHolder);
0
 

Author Comment

by:anna_suchodolska
ID: 10898963
but hold on, coming back to your answer

You'd have both the useBean and the setProperty tags on page 2.

can you tell me how exactly?
0
 
LVL 7

Expert Comment

by:searlas
ID: 10898981
What's your page called?

<form name="myform" action="/TaxiGlobe/DisplayCustomer.jsp" method="post" >

The whole point of jsp:setProperty is to avoid that boring code you just pasted (endless calls to getParameter and setFoo, setBar, setBlah)

In answer to:
    when i get the customer object from the session get its properties and display, can I still use getAttribute on the same bean in the session on the next page, or is it not there already?

Yes, that's the whole point of having a session.

What are you two pages called, and what code is in each page?


0
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10898986
well you do what you're doing..

but

String companyName = request.getParameter("companyName");
    String cphone = request.getParameter("companyPhoneNo");
     String cfax = request.getParameter("companyFaxNo");
     String caddr = request.getParameter("companyAddress");
     String mainnames = request.getParameter("mainContactName");
     String mainemail = request.getParameter("mainContactEmail");
     String mainphone = request.getParameter("mainContactPhoneNo");
     String secondarynames = request.getParameter("secondaryContactName");
     String secondaryemail = request.getParameter("secondaryContactEmail");
     String secondaryphone = request.getParameter("secondaryContactPhoneNo");
     String cardnumber = request.getParameter("creditCardNumber");
     String creditCardExpirationDate = request.getParameter("creditCardExpirationDate");
     String cardtype = request.getParameter("creditCardType");
     String cardHolder = request.getParameter("creditCardHolder");
   
    customer.setCompanyName(companyName);
     customer.setCompanyPhoneNo(cphone);
     customer.setCompanyFaxNo(cfax);
     customer.setCompanyAddress(caddr);
     customer.setMainContactName(mainnames);
     customer.setMainContactEmail(mainemail);
     customer.setMainContactPhoneNo(mainphone);
     customer.setSecondaryContactName(secondarynames);
     customer.setSecondaryContactEmail(secondaryemail);
     customer.setSecondaryContactPhoneNo(secondaryphone);
     customer.setCreditCardNumber(cardnumber);
     customer.setCreditCardExpirationDate(creditCardExpirationDate);
     customer.setCreditCardType(cardtype);
     customer.setCreditCardHolder(cardHolder);

goes on the second page..
the way you are doing it now is fine.
Ghost
0
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10899001
actually forget that post. I was thinking about something else..

you can use this..
<jsp:setProperty name="customer" property="*"/>

to set all the variables in your bean with the corresponding form values.
Ghost
0
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10899009
>>I got an error, try without catch and catch without try, ghost

do you have any try and catch blocks on your jsp page?
Ghost
0
 

Author Comment

by:anna_suchodolska
ID: 10899090
sorry, not clear

1)can I still use getAttribute on the same bean in the session on the next page,
2)or is it not there already?

Yes, that's the whole point of having a session.

And I just realised that i left DisplayCustomer.jsp there
after changes the form is pointing to the same page, which is called CreateNewCustomer

it is very long but i will try to explain

<body>
<jsp:useBean id="customer" class="business.Customer" scope="session" />      

<%  
      if (request.getParameter("submitPage") != null) {
      customer.clear(); }
%>

<%  
      String companyName = (String)session.getAttribute("companyName");
      String posted = request.getParameter("submitPage");
      if (posted == null) {
%>

      
            <form name="myform" action="/TaxiGlobe/CreateNewCustomer.jsp" method="post" >
....
</form>

<%      } else {  %>
<jsp:setProperty name="customer" property="*"/>
<% customer.setCompanyName(companyName); %>

<br>
<br>
<table border="0" cellspacing="5" width="80%">
<tr><td colspan="2" align=center><font size="4">You have entered the following details<p></font></td></tr>

<tr><td align=left width="50%"><b>Company name:</b></td>
      <td><jsp:getProperty name ='customer' property='companyName'/><br></td>
</tr>

...
<td align=center><form action="/TaxiGlobe/servlet/SaveNewCustomerServlet" method=get>
<input type="submit" value="Save"></form>

<% }   %>

Can it be done more easily?


Ghost, the posted bit is working fine...? What else can i do?
no i don't have try catch, but I had a spare {      :)
0
 
LVL 7

Accepted Solution

by:
searlas earned 40 total points
ID: 10899156
1)can I still use getAttribute on the same bean in the session on the next page,

yes
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10899189
wait...does it work now?
Ghost
0
 

Author Comment

by:anna_suchodolska
ID: 10899726
yes Ghost, i thought that i told you last time when i was so happy

the thing is that there was another but a similar page and i thought that i could make it simlper, but i didn't manage

remember the problem with my javascript?  form had different name that this on called in the javascript.  all is working perfect at that area

so i can enter a new customer, employee, save them, but i have a problem with the update part, for some reason, as i mentioned earlier, customer details which are brought from the database an placed on the form for correction are not available in my update servlet

Searlas is saying that i can use the bean again, so I am trying,
EditCustomer -> UpdateCustoemrServlet -> confirmation


(sorry for confusing you Ghost this is UpdateCustomerServlet)


HttpSession session = request.getSession(true);

 Customer customer = (Customer)session.getAttribute("customer");
   
String companyName = request.getParameter("companyName");
String caddr = request.getParameter("companyAddress");
String cphone = request.getParameter("companyPhoneNo");
String cfax = request.getParameter("companyFaxNo");
String mainnames = request.getParameter("mainContactName");
String mainemail = request.getParameter("mainContactEmail");
String mainphone = request.getParameter("mainContactPhoneNo");
String secondarynames = request.getParameter("secondaryContactName");
String secondaryemail = request.getParameter("secondaryContactEmail");
String secondaryphone = request.getParameter("secondaryContactPhoneNo");
String cardnumber = request.getParameter("creditCardNumber");
String creditCardExpirationDate = request.getParameter("creditCardExpirationDate");
String cardtype = request.getParameter("creditCardType");
String cardHolder = request.getParameter("creditCardHolder");
   
 customer.setCompanyName(companyName);
customer.setCompanyAddress(caddr);
customer.setCompanyPhoneNo(cphone);
customer.setCompanyFaxNo(cfax);
customer.setMainContactName(mainnames);
customer.setMainContactEmail(mainemail);
customer.setMainContactPhoneNo(mainphone);
customer.setSecondaryContactName(secondarynames);
customer.setSecondaryContactEmail(secondaryemail);
customer.setSecondaryContactPhoneNo(secondaryphone);
customer.setCreditCardNumber(cardnumber);
customer.setCreditCardExpirationDate(creditCardExpirationDate);
customer.setCreditCardType(cardtype);
customer.setCreditCardHolder(cardHolder);
...
try...    
 //this method is returning true if the customer is found in db
boolean found = CustomerDB.overwriteRecord(connection, customer);
            
 if (found){
            
                  
messageU = "<center><b>The customer data has been successfully placed to the database.</b></center>";
        session.setAttribute("messageU", messageU);
                
            customer = CustomerDB.readRecord(connection, companyName);      
            session.setAttribute("customer", customer);      
          
              } else {
                   
                   String address = customer.getCompanyAddress();
                   messageU = "<center><b>The customer data has not been placed to the database.</b></center>";
                  session.setAttribute("messageU", messageU);
                  session.setAttribute("address", address); <-- I used this bit to check if it returns null, and it does
                  }}

  ////////

mu EditCustomer is using
<jsp:useBean id="customer" class="business.Customer" scope="session" />      

and

<td align="left"><b>Expiation date</b></td>
<td><input type="text" name="creditCardExpirationDate"
            value="<jsp:getProperty name ="customer" property="creditCardExpirationDate"/>">
</td>

and it is displaying what i have in my db, can someone tell me what is wrong?
0
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10899793
I don't think you can use beans within servlets...
I might be wrong but I don't think you can
Ghost
0
 
LVL 7

Expert Comment

by:searlas
ID: 10899971
Ghost, remember that JSP's are compiled into servlets... of course you can use beans in servlets.

anna, you say:
> and it is displaying what i have in my db, can someone tell me what is wrong?

I'm not sure if that's a mistake in your english.  Are you saying your UpdateCustomerServlet
shows information from the database?  What's wrong with that?  It sounds like things
are working?

0
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10900020
you can use beans in the java code that makes up the servlet?

I know that jsp gets complied into a servlet but I didn't know that you could reference them from java? are you sure about that?
Ghost
0
 

Author Comment

by:anna_suchodolska
ID: 10900385
This bit is the bean: Customer customer = (Customer)session.getAttribute("customer");

customer.getCompanyName();
customer.setCompanyName(companyName);
 
searlas, it was a mistake, let me explain again

when i save a customer details in db, i can then search for them, and edit the information, ok
 they are edited in a form with input fields, details appear there (EditCustomer):

<td><input type"text" name="companyName"
value="<jsp:getProperty name ="customer" property="companyName"/>">
</td>

i can change them, but can not update it, I mean, UpdateCustomerServlet is reading null from the input boxes even though  i am using

HttpSession session = request.getSession(true);

Customer customer = (Customer)session.getAttribute("customer");
   
String companyName = request.getParameter("companyName");
customer.setCompanyName(companyName);

try...    
 //this method is returning true if the customer is found in db
boolean found = CustomerDB.overwriteRecord(connection, customer);
           
 if (found){
           
               
messageU = "<center><b>The customer data has been successfully placed to the database.</b></center>";
       session.setAttribute("messageU", messageU);
             
           customer = CustomerDB.readRecord(connection, companyName);    
           session.setAttribute("customer", customer);    
         
             } else {
                 
                 String address = customer.getCompanyAddress();
                 messageU = "<center><b>The customer data has not been placed to the database.</b></center>";
                session.setAttribute("messageU", messageU);
                session.setAttribute("address", address); <-- I used this bit to check if it returns null, and it does
                }}


not sure if it is clear...
0
 
LVL 7

Expert Comment

by:searlas
ID: 10900441
copyPasteGhost, yes I am sure you can access beans in servlet and JSP, you just use different code:

JSP:
<jsp:useBean id="customer" class="business.Customer" scope="session" />

equivalent servlet code (exactly equivalent - this IS what a JSP does):
business.Customer customer = (business.Customer) session.getAttribute("customer");
if (customer == null) {
  customer = new business.Customer();
  session.setAttribute("customer", customer);
}
0
 

Author Comment

by:anna_suchodolska
ID: 10900488
basically, this doesn't seem to work

HttpSession session = request.getSession(true);

Customer customer = (Customer)session.getAttribute("customer");
   
String companyName = request.getParameter("companyName");
customer.setCompanyName(companyName);

and it is in the update servlet
0
 
LVL 7

Expert Comment

by:searlas
ID: 10900509
> i can change them, but can not update it, I mean, UpdateCustomerServlet is reading null from the input boxes even though > i am using
>
> HttpSession session = request.getSession(true);
> Customer customer = (Customer)session.getAttribute("customer");  
> String companyName = request.getParameter("companyName");
> customer.setCompanyName(companyName);

So, you have a form somewhere like this?
<form name="whatever" action="/UpdateCustomerServlet" method="POST">

0
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10900832
:) sorry I meant can you do something like this..

out.println("<jsp:setproperty />");

that I know you can't do. Right?

anna...what is the purpose of the UpdateCustomerServlet
why don't you just do all that with the jsp we showed you?
Ghost
0
 

Author Comment

by:anna_suchodolska
ID: 10901214
i need to retrieve updated fields (updated -> corrected) from the form and send them back to the database

and guess what happened, searlas helped me out! I found out that the form tag was not surrounding the table form... I spent days on such a silly mistake

out.println("<jsp:setproperty />"); isn't it the same as bean.setProperty(...) ?

Anyway, thank you both.  My code is working!!!!!!!!!!!!!!!!!!!

But one more question

searlas said

The way setProperty is usually used is:
Page 1: a form; action attribute points to another JSP
Page 2: contains a jsp:setProperty tag; the browser sends all the form data to this page when you submit the form on page 1.

but you need to get each property to a variable and set each in turn by bean.setProperty(...), don't you?

you can't use set all, meaning "*" in the servlet, can you?
0
 

Author Comment

by:anna_suchodolska
ID: 10901234
I meant, it was like that:
table with fields and <from action.....></form>
0
 
LVL 7

Expert Comment

by:searlas
ID: 10901333
No, there is no (simple) equivalent to setProperty "*" in a servlet.

We/I use Struts, and that does the equivalent of a set al "*" type thing, but that's a whole new ball game that's not relevant to this question. (here I am talking about the work Struts does populating a form bean before passing control onto an Action class.)  If you want to read up on Struts the homepage is:
http://jakarta.apache.org/struts/

But, other sites are much better for learning.  Just google for "struts tutorial", possibly throwing in "action" and "formbean".






0
 
LVL 7

Expert Comment

by:searlas
ID: 10901455
To be specific (without having to adopt the entire Struts framework) the classes that do all the setXXX work are documented here:
http://jakarta.apache.org/commons/beanutils/api/

Struts has a method here:
http://jakarta.apache.org/struts/api/org/apache/struts/util/RequestUtils.html#populate(java.lang.Object, javax.servlet.http.HttpServletRequest)

Which utilises this method:
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/BeanUtils.html#populate(java.lang.Object, java.util.Map)

They appear to have written a lot of code to achieve this...
0
 

Author Comment

by:anna_suchodolska
ID: 10901544
thank youvery much

anna
0
 

Author Comment

by:anna_suchodolska
ID: 10901560
out.println("<jsp:setproperty />");  how about this?
0
 
LVL 7

Expert Comment

by:searlas
ID: 10916362
No, that does not work.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now