RE: validator for check box

2003-10-29 Thread Jayaraman Dorai
Does any one have any ideas or have written code to validate that at least one item is 
selected on the  check box? Would be interested in the javascript code for the same. 
On the server side, I can do that validation on the action form, though doing it 
through struts validator will be the ideal. Wondering why struts doesn't have it? 
Again, am I missing something?

Thanks
Jayaraman 

 -Original Message-
 From: Jayaraman Dorai 
 Sent: Monday, October 27, 2003 2:31 PM
 To: [EMAIL PROTECTED]
 Subject: validator for check box
 
 
 Would like to validate that the user selects at least one 
 option in the check box which was created using 
 html-multibox. The struts-validator is not validating the 
 required for a check box.  Is there any code for validating 
 the check box or am I missing something?
  
 Thanks
 Jayaraman
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: validator for check box

2003-10-29 Thread Jayaraman Dorai
 isValid;
 }
 
 
 
 
 
 
 -Original Message-
 From: Jayaraman Dorai [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, October 29, 2003 12:49 PM
 To: Struts Users Mailing List
 Subject: RE: validator for check box
 
 Does any one have any ideas or have written code to validate that at
 least one item is selected on the  check box? Would be 
 interested in the
 javascript code for the same. On the server side, I can do that
 validation on the action form, though doing it through struts 
 validator
 will be the ideal. Wondering why struts doesn't have it? Again, am I
 missing something?
 
 Thanks
 Jayaraman 
 
  -Original Message-
  From: Jayaraman Dorai 
  Sent: Monday, October 27, 2003 2:31 PM
  To: [EMAIL PROTECTED]
  Subject: validator for check box
  
  
  Would like to validate that the user selects at least one 
  option in the check box which was created using 
  html-multibox. The struts-validator is not validating the 
  required for a check box.  Is there any code for validating 
  the check box or am I missing something?
   
  Thanks
  Jayaraman
  
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: validator for check box

2003-10-29 Thread Jayaraman Dorai
Yes, I agree, you are right.

 -Original Message-
 From: Saul Q Yuan [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 29, 2003 2:14 PM
 To: 'Struts Users Mailing List'
 Subject: RE: validator for check box
 
 
 This situation happens when the checkboxes and/or radio buttons are
 dynamically generated from a database or somewhere. You won't know for
 sure that there are going to be more than one checkboxes and radio
 buttons, sometimes, you just get one. But in your 
 application, you want
 to have a consistent implementation and make them required 
 regardless. I
 just ran into this situation.
 
  
 Saul 
 
 -Original Message-
 From: Jayaraman Dorai [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, October 29, 2003 2:00 PM
 To: Struts Users Mailing List
 Subject: RE: validator for check box
 
 Been using an older version of validator-rules, which I had customized
 and so the multi-check box wasn't working.
 
 Required for a single-checkbox is not need for an 
 application, since you
 are compelling the user to have that one choice selected.  If you have
 only one check box and that too is required, you need not ask 
 an user to
 enter them.
 
  -Original Message-
  From: Saul Q Yuan [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 29, 2003 1:06 PM
  To: 'Struts Users Mailing List'
  Subject: RE: validator for check box
  
  
  I just submitted a bug and submitted a patch as well for 
 this problem.
  Basically, the validator (javascript part) works fine for multiple
  checkboxes and radio buttons, but doesn't for a single checkbox or a
  single radio button. I modified the validateRequired method 
 as below,
  you'll need to replace this method in the validator-rules.xml file.
  Works fine for me.
  
  Saul
  
  
  -
  function validateRequired(form) {
  var isValid = true;
  var focusField = null;
  var i = 0;
  var fields = new Array();
  oRequired = new required();
  
  for (x in oRequired) {
  var field = form[oRequired[x][0]];
  
  if (field.type == 'text' ||
  field.type == 'textarea' ||
  field.type == 'file' ||
  field.type == 'select-one' ||
  field.type == 'radio' || // -- true 
 for single
  radio button, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03
  field.type == 'checkbox' || // -- true for
  single checkbox, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03
  field.type == 'password') {
  
  var value = '';
  // get field's value
  if (field.type == select-one) {
  var si = field.selectedIndex;
  if (si = 0) {
  value = field.options[si].value;
  }
  // -- get value for
  checked single radio button or checkbox, Saul Q Yuan
  ([EMAIL PROTECTED]) 10/28/03
  } else if (field.type ==
  radio || field.type == checkbox) {
  if
  (field.checked) {
  value =
  field.value;
  }
  } else {
  value = field.value;
  }
  
  if (trim(value).length == 0) {
  
  if (i == 0) {
  focusField = field;
  }
  fields[i++] = oRequired[x][1];
  isValid = false;
  }
  } else if (field.type == select-multiple) { 
  var numOptions = field.options.length;
  lastSelected=-1;
  for(loop=numOptions-1;loop=0;loop--) {
  if(field.options[loop].selected) {
  lastSelected = loop;
  value = field.options[loop].value;
  break;
  }
  }
  if(lastSelected  0 || 
  trim(value).length == 0)
  {
  if(i == 0) {
  focusField = field;
  }
  fields[i++] = oRequired[x][1];
  isValid=false;
  }
  } else if ((field.length  0)  
 (field[0

validator for check box

2003-10-27 Thread Jayaraman Dorai
Would like to validate that the user selects at least one option in the check box 
which was created using html-multibox. The struts-validator is not validating the 
required for a check box.  Is there any code for validating the check box or am I 
missing something?
 
Thanks
Jayaraman


RE: Tools for Testing

2003-10-10 Thread Jayaraman Dorai
If the struts example could come with examples on how test cases could be written, 
that will help novices like us. Will having test cases within struts example be beyond 
the scope?  

 -Original Message-
 From: Shane Mingins [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 09, 2003 10:29 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Tools for Testing
 
 
 Also Canoo WebTest is a free open source tool for automated 
 testing of web
 applications.
 
 http://webtest.canoo.com/webtest/manual/WebTestHome.html
 
 I am not sure how that compares with HtmlUnit?  
 
 I had a quick look at StrutsTestCase but (as a novice) could 
 not see how to
 use it to develop the Struts layer of my application test-first.
 
 Shane
 
 
  -Original Message-
  From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]
  Sent: Friday, 10 October 2003 3:22 p.m.
  To: Struts Users Mailing List
  Subject: Re: Tools for Testing
  
  Adam Hardy wrote:
  
   OH NO! Now I have no excuse to ignore testing anymore!
  
   Is anybody out there using strutstestcase in anger?
  
   So Vic, openSTA - it's for scripting HTTP tests? I read 
 the homepage
   and it looked like I'd have to do alot of digging to find 
 the basics -
   how on earth does it verify the test results? Do you scan 
 the returned
   page?
  
  If you're after validating the contents of the returned page, take a
  look at htmlunit at SourceForge.  It turns the response 
 into a sort of
  DOM that makes finding things pretty easy, and lets you modify field
  values and click the submit button, and review the 
 result, to simulate
  a multi-request user interaction.
  
  
   Adam
  
  Craig
  
  
  
   On 10/09/2003 03:58 AM Vic Cekvenich wrote:
  
   I just switched to openSTA.sf.net (on a client tip ;-)
  
   Nguyen, Hien wrote:
  
   Take a look at StrutsTestCase for Junit at www.junit.org.
  
   -Original Message-
   From: Dirk Behrendt [mailto:[EMAIL PROTECTED] Sent: 
 Tuesday, October
   07, 2003 5:07 AM
   To: [EMAIL PROTECTED]
   Subject: Tools for Testing
  
  
   Hello!
  
   There are tools for automatic testing the Struts application?
  
   Dirk
  
  
  
  
  
   
 -
   To unsubscribe, e-mail: 
 [EMAIL PROTECTED]
   For additional commands, e-mail: 
 [EMAIL PROTECTED]
  
  
  
  
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Going from https on /member.do, back to http on index.jsp?

2003-09-29 Thread Jayaraman Dorai


 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]
 Sent: Friday, September 26, 2003 9:38 PM
 To: Struts Users Mailing List
 Subject: Re: Going from https on /member.do, back to http on 
 index.jsp?
 
 
 Jayaraman Dorai wrote:
 
   
 
 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 25, 2003 10:55 PM
 To: Struts Users Mailing List
 Subject: Re: Going from https on /member.do, back to http on 
 index.jsp?
 
 
 Max Cooper wrote:
 
 
 
 Creating an index.do is one option. If it is not marked as 
   
 
 secure, sslext
 
 
 will write an absolute URL back to http:// for it. Many 
 Struts users
 advocate that all requests should be served by Actions, even 
   
 
 if the action
 
 
 merely forwards to a JSP.
  
 
   
 
 I actually have a more important concern about doing this 
 -- exposing 
 information to people who can listen in on the packets that 
 go back and 
 forth.
 
 Many people would like, for example, to have the login form 
 be secure so 
 that your password is not sent across the wire encrypted, 
 but then go 
 back to http for the rest of the session for the better 
 performance.  
 The seemingly ideal solution is to have the destination of 
 the login 
 submit require SSL, and then switch back.  Using a 
 user-transport-guarantee security constraint, you can 
 even let the 
 container worry about the http-https transition for you.  
 Or, you can 
 use things like SSLext that is nicely integrated into Struts.
 
 However, the servlet spec offers no help in switching back to http, 
 because it is not a recommended practice.  Why?  Consider the 
 fact that 
 you now trust subsequent transactions from the same user, and are 
 typically using the session that was established earlier 
 (whether the 
 session was originally created in http or https turns out not to 
 matter).  But the session id is no longer encrypted (it's 
 either in a 
 cookie or in rewritten URLs), so it can be easily forged by 
 anyone with 
 a network snooper between you and the server.  How do you 
 guarantee that 
 an after-login request on that session is not being sent by 
 someone who 
 is forging the session id because they snooped it?
 
 I'm a conservative on security issues -- if I have an app 
 that needs SSL 
 sometimes, I arrange things to never accept a non-SSL 
 request on the 
 same session again, once I've switched to SSL (easy to do 
 with a Filter, 
 for example).  If you're concerned enough to protect the 
 password, you 
 should be concerned enough to pay the CPU overhead for SSL 
 the remainder 
 of the session.  Otherwise, it's likely that encrypting the 
 login form 
 will just give you a false sense of security.
 
 
 
 I think you can also use the secure attribute in the sslext 
   
 
 tags to indicate
 
 
 whether the target of the link or form should be accessed 
   
 
 securely. In this
 
 
 case, you would add secure=false to the sslext:link tag 
   
 
 that goes back to
 
 
 /index.jsp.
 
 -Max
  
 
   
 
 Craig
 
 
 
 Will it be useful for cases like where credit card 
 information are sent through SSL and hence are secured. They 
 might snoop the session, if it is switched back to http, but 
 still the credit card information is not. Similarly, snooper 
 might steal the sessionId, but the password is not stolen and 
 is secured. Is that not better than nothing? Am I missing something?
 
 The credit card information is not going back and forth 
 across the wire 
 unencrypted, but your session identifier is (for servlet based apps, 
 it's normally in a cookie or encoded into the URLs).
 
 In at least some ecommerce apps I'm familiar with, the credit card 
 number *is* stored in an HttpSession (or something analogous for 
 non-servlet technologies), so that the customer can go back 
 and buy some 
 more stuff, and do an expedited checkout the second time.  If I know 
 that your app works that way, I can snoop the wire until the 
 user goes 
 to https (which I can't read, but can see happening) and then back to 
 http (which I can see).  Now, I've got the cleartext version of the 
 session id, assume that the user has gone through the 
 checkout, and can 
 submit false additional purchase transactions to your app 
 based on that 
 session id, without having to resubmit a credit card number.

Will adding a checkout page which uses https, displaying the order details and asking 
the user to see all his order details again and then checking out (through https), 
make it secure. Essentially, the user can search, add, update and remove the shopping 
cart in the http mode and having the checkout page(displaying all the orders and then 
submitting) alone on https not secure enough?  If it is not secure enough, will asking 
for a credit card number again through https solve it? 
 
 Protecting just the password, but not the remainder of the current 
 session

RE: Going from https on /member.do, back to http on index.jsp?

2003-09-26 Thread Jayaraman Dorai


 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 25, 2003 10:55 PM
 To: Struts Users Mailing List
 Subject: Re: Going from https on /member.do, back to http on 
 index.jsp?
 
 
 Max Cooper wrote:
 
 Creating an index.do is one option. If it is not marked as 
 secure, sslext
 will write an absolute URL back to http:// for it. Many Struts users
 advocate that all requests should be served by Actions, even 
 if the action
 merely forwards to a JSP.
   
 
 I actually have a more important concern about doing this -- exposing 
 information to people who can listen in on the packets that 
 go back and 
 forth.
 
 Many people would like, for example, to have the login form 
 be secure so 
 that your password is not sent across the wire encrypted, but then go 
 back to http for the rest of the session for the better performance.  
 The seemingly ideal solution is to have the destination of the login 
 submit require SSL, and then switch back.  Using a 
 user-transport-guarantee security constraint, you can even let the 
 container worry about the http-https transition for you.  
 Or, you can 
 use things like SSLext that is nicely integrated into Struts.
 
 However, the servlet spec offers no help in switching back to http, 
 because it is not a recommended practice.  Why?  Consider the 
 fact that 
 you now trust subsequent transactions from the same user, and are 
 typically using the session that was established earlier (whether the 
 session was originally created in http or https turns out not to 
 matter).  But the session id is no longer encrypted (it's either in a 
 cookie or in rewritten URLs), so it can be easily forged by 
 anyone with 
 a network snooper between you and the server.  How do you 
 guarantee that 
 an after-login request on that session is not being sent by 
 someone who 
 is forging the session id because they snooped it?
 
 I'm a conservative on security issues -- if I have an app 
 that needs SSL 
 sometimes, I arrange things to never accept a non-SSL request on the 
 same session again, once I've switched to SSL (easy to do 
 with a Filter, 
 for example).  If you're concerned enough to protect the 
 password, you 
 should be concerned enough to pay the CPU overhead for SSL 
 the remainder 
 of the session.  Otherwise, it's likely that encrypting the 
 login form 
 will just give you a false sense of security.
 
 I think you can also use the secure attribute in the sslext 
 tags to indicate
 whether the target of the link or form should be accessed 
 securely. In this
 case, you would add secure=false to the sslext:link tag 
 that goes back to
 /index.jsp.
 
 -Max
   
 
 Craig

Will it be useful for cases like where credit card information are sent through SSL 
and hence are secured. They might snoop the session, if it is switched back to http, 
but still the credit card information is not. Similarly, snooper might steal the 
sessionId, but the password is not stolen and is secured. Is that not better than 
nothing? Am I missing something?
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



dynamic columns for a jsp

2003-08-04 Thread Jayaraman Dorai
There are around 20 attributes for a business object. The jsp iterates over a 
collections of this business object and displays them. The user does not want to see 
all the 20 attributes. Different users may want to see different attributes. This 
requirement is similar to what outlook provides, the user can select the columns of 
his inbox. 
 
Have build a separate UI to get from the user the different columns he wants to see 
and store them in the database. The jsp which iterates over the business object, looks 
untidy now, with a lot of if/else statements.
 
If anyone else have designed something like this, please provide your suggestions.
 
Thanks
Jayaraman


RE: dynamic columns for a jsp

2003-08-04 Thread Jayaraman Dorai
Yes, doing the same thing. 

Some columns requires a different background color and most of them have something 
different. So, it results in a lot of if statements to check the column.

Looking desperately for a good solution.

Jayaraman
-Original Message-
From: Gandle, Panchasheel [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 11:04 AM
To: 'Struts Users Mailing List'
Subject: RE: dynamic columns for a jsp


We have a very similar situation, haven't done it yet, 
but planning to have two collection to iterate over.

one for the columns, that I know when the user logs in, I would get it from
his preferences of columns from DB.
other the business objects...

is this the same that you are doing or any different?
If somebody has a good solution for this, would help


Panchasheel

-Original Message-
From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 10:47 AM
To: [EMAIL PROTECTED]
Subject: dynamic columns for a jsp


There are around 20 attributes for a business object. The jsp iterates over
a collections of this business object and displays them. The user does not
want to see all the 20 attributes. Different users may want to see different
attributes. This requirement is similar to what outlook provides, the user
can select the columns of his inbox. 
 
Have build a separate UI to get from the user the different columns he wants
to see and store them in the database. The jsp which iterates over the
business object, looks untidy now, with a lot of if/else statements.
 
If anyone else have designed something like this, please provide your
suggestions.
 
Thanks
Jayaraman

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Birthdate validation ?

2003-07-23 Thread Jayaraman Dorai
I had a hidden form field, appended the month, year and date using the javascript to 
it and then validated it as usual.

The validation-rules had to be modified as it can validate only a text field and not a 
hidden field.

Would be interested in knowing of any other alternate ways of validating.

Jayaraman  

-Original Message-
From: Erez Efrati [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 23, 2003 3:25 PM
To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
Subject: RE: Birthdate validation ?


Thanks for the quick reply, seems pretty easy but a bit long for just a
date. Anyway, is there a validator I could use or do I have to write one
of my own? And I mean Struts Validator..

Erez

-Original Message-
From: Alex Shneyderman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 23, 2003 8:21 PM
To: 'Struts Users Mailing List'
Subject: RE: Birthdate validation ?

Be carefull with that because if you set Feb 29, 2003 your date is going
to be March 1, 2003 and Calendar will not say a thing. You should
probably fix a birthdate validator.

 -Original Message-
 From: Adam Levine [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 23, 2003 2:18 PM
 To: [EMAIL PROTECTED]
 Subject: Re: Birthdate validation ?
 
 
 Use Calendar, more than likely the concrete GregorianCalendar.
 
   Calendar.setField(field, field value);  x3
 
   Calendar.getTime() - Date
 
 
 From: Erez Efrati [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: 'Struts Users Mailing List' [EMAIL PROTECTED]
 Subject: Birthdate validation ?
 Date: Wed, 23 Jul 2003 21:03:53 +0200
 
 I have a birth date field composed of three different fields of day
 month and a year. Now, what is the best way to receive those three and
 combine them into a java.sql.Date class and performing validation
using
 the validator?
 
 Hope someone been there done that..
 
 Thanks,
 Erez
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 _
 Add photos to your messages with MSN 8. Get 2 months FREE*.
 http://join.msn.com/?page=features/featuredemail
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How do I implement a Master/Detail maintenance form?

2003-07-16 Thread Jayaraman Dorai
http://www.developer.com/java/ejb/article.php/2233591

Hope this helps. I haven't tried this myself yet.

Jayaraman

-Original Message-
From: Shane Mingins [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 15, 2003 5:59 PM
To: '[EMAIL PROTECTED]'
Subject: How do I implement a Master/Detail maintenance form?


Hi

Are there any *best practices* or examples around showing the best way of
implementing the maintenance of a master/detail relationship using the
Struts framework?

For example if I provide a form with a supplier and list of products where
you can edit the supplier details and/or edit the product details, to select
the product to edit I need to provide a key to identify that product.  I can
use a link but then any changes to the supplier are not kept as the link
does not submit the form.

Thanks
Shane


Shane Mingins
Analyst Programmer
Assure NZ Ltd
Ph 644 494 2522



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[OT] Concurrency handling

2003-06-05 Thread Jayaraman Dorai
Would like to know the best practice being followed on handling the concurrency issues 
in the web application. The use case we have is similar to  this.
 
One last room is available in a hotel and 2 or more users try to reserve that same 
room at the same time. Only one user gets it and the other one or more get a message 
that the room has just been occupied.
 
The application will be using  Oracle or MS-SQLServer database. 
 
Would like to know the best place and way to check. Is it purely at database or at dao 
or business object? How can this be done? Any pointer to good articles will help.
 
 
Thanks
Jayaraman


RE: one more prepopulate question

2003-02-28 Thread Jayaraman Dorai
In the home page we have, where more than one form is required, we have used frames.  
The frames src points to action which prepopulates the form and is displayed in the 
jsp. Which also means there is a separate jsp page for each form.

Jayaraman  

-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 2:56 PM
To: Struts Users Mailing List
Subject: Re: one more prepopulate question


On Fri, 28 Feb 2003 12:50:56 -0500
Sri Sankaran [EMAIL PROTECTED] wrote:
 
 Where are you running into a problem?

I think the initial problem was how you would pre-populate several
ActionForms inside of one Action and then be able to use those
ActionForms to create several forms in the resulting JSP page.

From what I can gather this is not too difficult as all you would do is
create as many ActionForm instances as you need in your SetupAction and
then put them all into request scope. You then can set up multiple forms
as you see fit on the fowarded to JSP page. 

The only thing I haven't found a nice work around for is that you can
only use one mapping.getAttribute() call in the Action for the form
associated with that Action. In example will help.

You have an Action class that you want to use to prepopulate three
Action Forms and then forward to a JSP page and set up three separate
forms. So you might have a mapping...

action path=/setupMultipleForms
type=foo.bar.SetUpFormsAction
name=form1
scope=request
validate=false

forward
name=continue
path=/severalFormsOnAPage.jsp/
/action

So now in the SetUpFormsAction you can easily put Form1 into scope by:
 
Form1 form1 = (Form1)form;
form1.setFoo(hello);
request.setAttribute(mapping.getAttribute(), form1 );

But now for another ActionForm (Form2) to put into scope you'd have
Form2 form2 = new Form2();
form2.setFooBar(BLA);
request.setAttribute( form2, form2 );

The part I don't like is you now have to remember that you need to
remember that you HAVE to refer to your Form2 object as form2 in your
mapping set up in your struts-config.xml file or else you JSP page will
not be able to find it. It's not a super big deal, but a bit annoying. 
Maybe there is another way to do it that I'm missing.


-- 
Rick Reumann

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: what does RT Expr mean

2003-01-29 Thread Jayaraman Dorai
In the custom tag I have the scriptlet is not evaluated, though I rtexprvalue set as 
true. 

mytaglib:mytag myvar=%= foo %/

the value of foo is not passed in the custom tag. But the string as such %= foo % 
gets passed.

Am I missing anything else?

-Original Message-
From: Patrice [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 9:41 AM
To: Struts Users Mailing List
Subject: Re: what does RT Expr mean


It means Run time expressions: the content is evaluated at the run time
(so, you can have a dynamic value for the tag's attribute value).
For example:
% string foo = foo; %
bean:define id=myAttribute value=%= foo %/

Hope it helps
Patrice

- Original Message -
From: Sundar Narasimhan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 29, 2003 3:26 PM
Subject: what does RT Expr mean


 In the bottom of the documentation on the attributes of several tags I
 see [RT Expr].. what does that mean? Is it documented anywhere?

 Thanks.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: what does RT Expr mean

2003-01-29 Thread Jayaraman Dorai
The jsp has this 
itogo:getProviderTypeString providerType=%= new 
Integer(currProv.getType()).toString() %/
and the tld entry is 
 tag
namegetProviderTypeString/name
tagclasscom.vwks.itogo.admin.taglib.GetProviderTypeStringTag/tagclass
bodycontentempty/bodycontent
attribute
nameproviderType/name
requiredtrue/required
rtexprvaluetrue/rtexprvalue
/attribute
  /tag

Thanks
Jayaraman


-Original Message-
From: Karr, David [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 5:11 PM
To: Struts Users Mailing List
Subject: RE: what does RT Expr mean


You'd have to show your specific code, showing your TLD entries, and
most of the JSP page.

-Original Message-
From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 29, 2003 1:51 PM
To: Struts Users Mailing List
Subject: RE: what does RT Expr mean

In the custom tag I have the scriptlet is not evaluated, though I
rtexprvalue set as true. 

mytaglib:mytag myvar=%= foo %/

the value of foo is not passed in the custom tag. But the string as such
%= foo % gets passed.

Am I missing anything else?

-Original Message-
From: Patrice [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 9:41 AM
To: Struts Users Mailing List
Subject: Re: what does RT Expr mean


It means Run time expressions: the content is evaluated at the run
time
(so, you can have a dynamic value for the tag's attribute value).
For example:
% string foo = foo; %
bean:define id=myAttribute value=%= foo %/

Hope it helps
Patrice

- Original Message -
From: Sundar Narasimhan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 29, 2003 3:26 PM
Subject: what does RT Expr mean


 In the bottom of the documentation on the attributes of several tags I
 see [RT Expr].. what does that mean? Is it documented anywhere?

 Thanks.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: what does RT Expr mean

2003-01-29 Thread Jayaraman Dorai
The value of providerType in the tag is %= new 
Integer(currProv.getType()).toString() % and the scriptlet does not get evaluated. 
The tomcat version is 3.2.4. 

The jsp has this 
itogo:getProviderTypeString providerType=%= new 
Integer(currProv.getType()).toString() %/
and the tld entry is 
 tag
namegetProviderTypeString/name
tagclasscom.vwks.itogo.admin.taglib.GetProviderTypeStringTag/tagclass
bodycontentempty/bodycontent
attribute
nameproviderType/name
requiredtrue/required
rtexprvaluetrue/rtexprvalue
/attribute
  /tag


Thanks
Jayaraman

-Original Message-
From: Jayaraman Dorai 
Sent: Wednesday, January 29, 2003 5:19 PM
To: Struts Users Mailing List
Subject: RE: what does RT Expr mean


The jsp has this 
itogo:getProviderTypeString providerType=%= new 
Integer(currProv.getType()).toString() %/
and the tld entry is 
 tag
namegetProviderTypeString/name
tagclasscom.vwks.itogo.admin.taglib.GetProviderTypeStringTag/tagclass
bodycontentempty/bodycontent
attribute
nameproviderType/name
requiredtrue/required
rtexprvaluetrue/rtexprvalue
/attribute
  /tag

Thanks
Jayaraman


-Original Message-
From: Karr, David [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 5:11 PM
To: Struts Users Mailing List
Subject: RE: what does RT Expr mean


You'd have to show your specific code, showing your TLD entries, and
most of the JSP page.

-Original Message-
From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 29, 2003 1:51 PM
To: Struts Users Mailing List
Subject: RE: what does RT Expr mean

In the custom tag I have the scriptlet is not evaluated, though I
rtexprvalue set as true. 

mytaglib:mytag myvar=%= foo %/

the value of foo is not passed in the custom tag. But the string as such
%= foo % gets passed.

Am I missing anything else?

-Original Message-
From: Patrice [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 9:41 AM
To: Struts Users Mailing List
Subject: Re: what does RT Expr mean


It means Run time expressions: the content is evaluated at the run
time
(so, you can have a dynamic value for the tag's attribute value).
For example:
% string foo = foo; %
bean:define id=myAttribute value=%= foo %/

Hope it helps
Patrice

- Original Message -
From: Sundar Narasimhan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 29, 2003 3:26 PM
Subject: what does RT Expr mean


 In the bottom of the documentation on the attributes of several tags I
 see [RT Expr].. what does that mean? Is it documented anywhere?

 Thanks.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Question for using struts as our standard MVC framework

2002-09-11 Thread Jayaraman Dorai

The following comparison is by the authors of Designing Enterprise Application by 
the J2EE blue print team, which clearly says it is the other way. You can also check 
it at 
http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/web-tier/web-tier5.html#1094743

J2EE BluePrints Web Application Framework (WAF)--The Web Application Framework forms 
the infrastructure of the sample application. This framework offers a Front Controller 
servlet, an abstract action class for Web-tier actions, a templating service, several 
generic custom tags, and internationalization support. WAF demonstrates both the 
mechanisms and effective use of a Web-tier framework layer in an application design. 
It is suitable for small, non-critical applications, and for learning the principles 
of Web-tier application framework design and usage. 

Apache Struts--Struts is a free, open-source, Web-tier application framework under 
development at the Apache Software Foundation. Struts is highly configurable, and has 
a large (and growing) feature list, including a Front Controller, action classes and 
mappings, utility classes for XML, automatic population of server-side JavaBeans, Web 
forms with validation, and some internationalization support. It also includes a set 
of custom tags for accessing server-side state, creating HTML, performing presentation 
logic, and templating. Some vendors have begun to adopt and evangelize Struts. Struts 
has a great deal of mindshare, and can be considered an industrial-strength framework 
suitable for large applications. But Struts is not yet a standard for which J2EE 
product providers can interoperably and reliably create tools. 

Jayaraman


-Original Message-
From: Khan, Manuchehar A (ACF) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 10:37 AM
To: 'Struts Users Mailing List'
Subject: Question for using struts as our standard MVC framework


Hello Folks. I work for Govt and we have major policy meeting for using
struts as our stantard framework. 
One developer in our team took the Sun pet store example and created a
framework that is basically a router/controller with xml configuration files
to define handlers and views. And that controller works fine..
He claims that strut has not followed sun standards and guidelines and
struts is not reliable. It can only support maximum 100 users and next year
struts team is coming up with new version based in JSTL and will trash all
releases.
I need some inputs from people here to make solid arguments for changing to
struts. 
Thanks...



-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 10:34 AM
To: Struts Users Mailing List; Dariusz Wojtas
Subject: RE: JDO example - rozpakowywac Commanderem


Was there a question in there I missed?

James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the Open Minded Developer Network
http://www.open-tools.org/struts-atlanta




 -Original Message-
 From: Dariusz Wojtas [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 11, 2002 3:19 AM
 To: Struts Users Mailing List
 Subject: JDO example - rozpakowywac Commanderem


 Wednesday, September 11, 2002, 6:55:25 AM, you wrote:
 JM Sorry for the delay.  I've decided to post this on our website.

 JM Please feel free to download and try it out.

 JM  http://www.open-tools.org/struts-atlanta/downloads/DBMessageResources

 JM If for some reason the site goes down, just send me an email
 and I'll get it
 JM to you.




 JM James Mitchell
 JM Software Engineer\Struts Evangelist
 JM Struts-Atlanta, the Open Minded Developer Network
 JM http://www.open-tools.org/struts-atlanta




  -Original Message-
  From: James Mitchell [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, September 10, 2002 3:06 PM
  To: Struts Users Mailing List
  Subject: [Announce] [New Extension]
 ApplicationResources.properties from
  Database
 
 
  For anyone interested, I have finished implementing DBMessageResources
  which allows you to keep the key-value pairs (from your
  ApplicationResources.properties) in a single database table.
 
  You can load your property files into a table (generic schema
 is provided)
  and with this extension, by only modifying message-resources in the
  struts-config.xml your application will run WITHOUT ANY code
 changes. (See
  the readme.txt file included)
 
  This extension uses OJB (http://jakarta.apache.org/ojb) O/R mapping for
  database configuration and connection pool management.
 
  I have included a modified version of the (1.1b2) struts-example to
  demonstrate.
 
  I have tested this with Struts 1.1b2, and I'm sure it will
 work with 1.1b1
  (If anyone requires a 1.0.x compatible, I can look at that also)
 
  I will get this project available as soon as I work through some
  cvs issues
  on sf.net:
 
  If anyone is REALLY itching to get their hands on it sooner, send me a
  email.
 
  For those who were waiting, thanks for 

RE: JBUILDER keeps deleting the directory: WEB-INF/classes

2002-08-28 Thread Jayaraman Dorai

Try unchecking the Synchronize output dir under the Project Properties--Build. 

-Original Message-
From: Darren McGuinness [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 28, 2002 10:06 AM
To: Struts Users Mailing List
Subject: Re: JBUILDER keeps deleting the directory: WEB-INF/classes


Forgot to add, this happens when I rebuild the project.

Darren McGuinness wrote:

 This is then causing problems because ApplicationResources.properties is
 gone, and I get errors because the code cannot find the keys from the
 now deleted file.

 I had it working, but now this is happening.

 Using struts 1.0, JBuilder 6 with TomCat

 Any ideas?

 Cheers.

 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Re: Nested Tags question

2002-06-13 Thread Jayaraman Dorai

When I use nested tags, I am not able to access it through java scripts since the name 
is mailingAddress.city. Does anyone have a work around or am I missing something?

Jayaraman

-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 13, 2002 12:23 PM
To: Struts Users Mailing List
Subject: Re: Re: Nested Tags question




On Thu, 13 Jun 2002 [EMAIL PROTECTED] wrote:

 Date: Thu, 13 Jun 2002 11:43:59 +0200
 From: [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: Re: Re: Nested Tags question

 So Craig,
 does the process work at submit time (when the request parameters are
 being put into the nested beans) via calls to the getter methods to get
 the beans on which the parameters have to be set?

 I can't see how else it would work.


It depends on what context you are using the expressions in.  For example:

  !-- Assume the form bean name is customerForm --
  html:form action=/editCustomer
...
html:text property=mailingAddress.city/
...
  /html:form

will, in effect, do a call to:

  customerForm.getMailingAddress().getCity()

when the page is displayed, and a call to:

  customerForm.getMailingAddress().setCity()

when the request parameters are being copied in to the form bean.


 Adam


Craig




 Craig R. McClanahan [EMAIL PROTECTED] schrieb am 13.06.2002,
 08:22:43:
 
 
  On Thu, 13 Jun 2002, Arron Bates wrote:
 
   Date: Thu, 13 Jun 2002 14:14:13 +1000
   From: Arron Bates
   Reply-To: Struts Users Mailing List
   To: Struts Users Mailing List
   Subject: Re: Nested Tags question
  
   
   
   I know JSP will automatically save parameters to a javabean with the
   correctly named getters and setters, but there's obviously a gap in my
   knowledge because all my attempts to recreate the situation above have
   failed.
   
  
   Setting form properties against beans is a Struts thing, not a JSP
   thing. The property thing is a Bean thin and can be looked up in the
   JavaBean spec.
  
   The example you quote...
  
   monkeyTeamAlpha.monkeyWorkers[0].salary
  
   ...is a nested property. An invention implemented within Struts
   (Craig?).
 
  Yep, although in Struts 1.1 it is really a commons-beanutils thing
  because we abstracted out this generally useful code into a separate
  package.
 
   What it basically is, is a string of calls rather than the
   single property method. Here, it will get a hold of the form bean, get a
   hold of the bean returned from the monkeyTeamAlphaproperty. On this
   bean, it will invoke the indexed property monkeyWorkers[0] which will
   pluck a bean from a collection or index provided, from this last bean it
   will will get a hold of its salary property, and set the value.
  
 
  At each stage, you also get the benefit of some intelligence that is built
  in to the underlying PropertyUtils class.  For example, the JavaBeans spec
  defines two ways to define an indexed property -- you can use getter and
  setter methods that take a value and a subscript, or you can use getter
  and setter methods that return the entire array.  PropertyUtils makes the
  expression listed above work for either (or even for a property whose
  value is a java.util.List, which is an extension to the JavaBeans spec).
 
   All this boils down to, is that you can compose objects a little
   cleaner, rather than have truly enormous beans for everything. Having
   the indexed properties allows for lists and whatever else.
  
   The ability for nesting beans has been in Struts for a long time. The
   nested tags just make it much easier.
  
   There's a primer and tutorial for nested beans here...
  
   http://www.keyboardmonkey.com/next
  
   ...it should take you over creating and using such a construct.
  
   Hope this gets you on th path you're after.
 
  Another area of useful learning for the future is the JSP Standard Tag
  Library (JSTL).  Although the expression language syntax supported by JSTL
  is different from the one in Struts, it is well worth learning about --
  this expression language will be supported anywhere in a JSP page in JSP
  1.3, and (in the mean time) we will likely adapt Struts tags to be able to
  use it as well.
 
  
  
   Arron.
  
 
  Craig
 
 
  --
  To unsubscribe, e-mail:
  For additional commands, e-mail:

 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Collection and form bean

2002-06-04 Thread Jayaraman Dorai

I have a collection of Value objects which I iterate through the logic iterate in JSP. 
This value object has a int. The requirement is to display a blank instead of a 0. I 
can convert this value object into a form bean which has a string equivalent for this 
int and replace a 0 with an empty string. But the idea of iterating over a collection 
of form beans doesn't sound well for me. Is that ok? 
 
In the struts example, the collection of subscription is iterated and not the 
subscriptionForm. If subscription had an int attribute would it be wise to iterate 
through the collection of subscriptionForm. Which is more MVC? The jsp page iterating 
over the model object or the form object.
 
Jayaraman



how do I check the size of the collection

2002-05-24 Thread Jayaraman Dorai

I have a collection which I want to iterate in the jsp page. If the collections size 
is 0, I want to display a message no elements in the collection. Is there any struts 
tag for this.
 
 
Thanks
Jayaraman



RE: how do I check the size of the collection

2002-05-24 Thread Jayaraman Dorai

How do I use that?

I tried it this way. But it throws a NosuchMethodError exception.
logic:equal name=logs property=size value=0
   Empty Collection
   /logic:equal

Is there any other way out.

Jayaraman

-Original Message-
From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 10:48 AM
To: 'Struts Users Mailing List'
Subject: RE: how do I check the size of the collection


Yes: logic:equals

-Original Message-
From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 10:42 AM
To: [EMAIL PROTECTED]
Subject: how do I check the size of the collection


I have a collection which I want to iterate in the jsp page. If the
collections size is 0, I want to display a message no elements in the
collection. Is there any struts tag for this.
 
 
Thanks
Jayaraman

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: how do I check the size of the collection

2002-05-24 Thread Jayaraman Dorai

thanks for the response. this worked.

-Original Message-
From: Trieu, Danny [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 11:12 AM
To: 'Struts Users Mailing List'
Subject: RE: how do I check the size of the collection


This should work:

bean:size id=size name=theCollection /

logic:equal name=size value=0   . /logic:equal

 -Original Message-
 From: Galbreath, Mark [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, May 24, 2002 7:48 AM
 To:   'Struts Users Mailing List'
 Subject:  RE: how do I check the size of the collection
 
 Yes: logic:equals
 
 -Original Message-
 From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]]
 Sent: Friday, May 24, 2002 10:42 AM
 To: [EMAIL PROTECTED]
 Subject: how do I check the size of the collection
 
 
 I have a collection which I want to iterate in the jsp page. If the
 collections size is 0, I want to display a message no elements in the
 collection. Is there any struts tag for this.
  
  
 Thanks
 Jayaraman
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Forms Beans and DAO (Best Practices)

2002-05-03 Thread Jayaraman Dorai

I use it the same way too. But had a dilemma of whether to place the Value Object as a 
data member of Business Object and set that in constructor or pass the Value Object as 
parameter for every method of create, update,  and remove. How do you do that? Any 
pros and cons.

-Original Message-
From: Pruthee, Ranjan [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 3:25 PM
To: Struts Users Mailing List
Subject: RE: Forms Beans and DAO (Best Practices)


In general, I use the Struts action classes as proxies to my business objects and my 
business objects serve as proxies to my data access objects and I pass data across 
tiers using DTO  (DataTransportObject [use to be ValueObject]).  In this fashion, I 
can keep my business logic reusable in say a Java
Swing client as well as an HTML client. IMO, I would not access DAO (data access 
objects) directly in the Struts ction classes. This means you would have to manage 
transaction boundries (getting JDBC connection or JDO PersistanceManager) in your web 
tier where as it would probably be better to isolate these details to your business 
tier. We don't use EJB, so the general data flow is as follows:

Client === Action === BusinessObject === DataAccessObject(s) === Database

This keeps BusinessObjects resuseable among Action classes and DAO objects 
reusable in BusinessObjects. The BusinessObject manages the transaction boundries and 
the DAO just uses the JDBC connection. We maintain all SQL as static final Strings in 
the DAO's. (reduces object creation) The BusinessObjects and DAO don't maintain any 
state, so they are singletons. (reduces object creation)

So for example if I wanted to retrieve and display a customer list.

1. Client sends HTTP request

2. Struts delegates request to ShowCustomersAction

3. ShowCustomersAction delegates to CustomerBO

4. CustomerBO starts a transaction

5. CustomerBO delegates to CustomerDAO

6. CustomerDAO executes the query and gets results

7. CustomerDAO maps results into a collection of CustomerDTO

(DataTransportObject)

8. CustomerDAO returns collection to CustomerBO

9. CustomerBO ends transaction

10. CustomerBO returns collection to ShowCustomerAction

11. ShowCustomersAction places the connection in the HttpServletRequest as

an attribute

12. ShowCustomersAction forwards to showCustomersView (some jsp)

13. ShowCustomersView accesses customer collection using a custom tag

14. ShowCustomersView renders customer list

 PS. If we did switch to using EJB, then the BusinessObjects become BusinessDelegates 
to actual EJBs and  nothing in the web tier has to change and both DAOs and DTOs can 
be reused.


-Original Message-
From: Chen, Dean (Zhun) [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 2:23 PM
To: 'Struts Users Mailing List'
Subject: RE: Forms Beans and DAO (Best Practices)


This might be a stupid question, but what are DAO and Value Object supposed
to be?

Does DAO encapsulate the logic to make JDBC calls?  For example, would it
contain the name of a stored procedure or would that be passed to it?

Is ValueObject a generic object that stores the result sets?  For example, a
Collection of somesort? or a Collection of Collections?

Thanks, I am also trying to figure out what the most performant way to
design this.


Dean Chen



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 1:17 PM
To: Struts Users Mailing List
Subject: Re: Forms Beans and DAO (Best Practices)





I see what you're doing and agree it seems easier.

But coupling the form beans to the DAO's so tightly I wouldn't call a best
practice. Here is another approach:


- Have the DAO's return Value Objects. But then have a setValueObject() on
the form bean so you can store the entire value object in it.

 First, in your action class, do something like:

  myFormBean1.setValueObject1(myDao1.getValueObject1());

 Then either,

 1. Have your get/set methods for the form bean properties use the
value object for storage internally, like:

  // in the form bean.java file

  private ValueObject valueObject1
  public void setValueObject1(ValueObject val1) {
   this.valueObject = val1;
  }

  // Note: no property1 field needed!
  public String getProperty1() {
   return this.valueObject.getProperty1();
  }
  public void setProperty1(String property1) {
   this.valueObject.setProperty1(property1);
  }


 - or -

 2. Have the setValueObject() in the form bean deconstruct the value
object and store its components in the form bean

  // again, in the form bean.java file

  // Note: no valueObject1 field needed!
  public void setValueObject1(ValueObject val1) {
   this.property1= val1.getProperty1();
  }

  private String property1;
  public String getProperty1() {
   

RE: Forms Beans and DAO (Best Practices)

2002-05-03 Thread Jayaraman Dorai

How do you create a customer. (i.e.) Add a new record in the database from the data 
entered in the HTML client.

The way I currently do is

1. The action form has the Value Object 
2. The action class gets the Value Object through the action form. Then Calls 
BO.create(VO)
3. The Business Object then calls the DAO.create(VO). 

The same for updating the BO in the edit mode ( through BO.update(VO) which then calls 
DAO.update(VO).

Jayaraman 



-Original Message-
From: Pruthee, Ranjan [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 4:23 PM
To: Struts Users Mailing List
Subject: RE: Forms Beans and DAO (Best Practices)


The way I do it is -

BO -- DAO ---returns the recordset and not ValueObject. This RS is passed back to 
the BO. which passes it to the ValueObject to build it.

The code will look something like this -

public class BO
{
CustomerVO custvo = new CustomerVO();
Recordset rs = dao.getCustomer(1);
custvo.buildCustomerVo(rs);
}

One should not build VO in DAO because u will create dependency on the DAO. In case u 
want to separate DAO from the BO then the DAO alone will not work as it will have 
reference to the VO. So intead of being a lightweight DAO it will be a heavyweight 
component will lot of dependencies. Reuse will take hit with this approach but that 
just me.

Ranjan.

-Original Message-
From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 3:07 PM
To: Struts Users Mailing List
Subject: RE: Forms Beans and DAO (Best Practices)


I use it the same way too. But had a dilemma of whether to place the Value Object as a 
data member of Business Object and set that in constructor or pass the Value Object as 
parameter for every method of create, update,  and remove. How do you do that? Any 
pros and cons.

-Original Message-
From: Pruthee, Ranjan [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 3:25 PM
To: Struts Users Mailing List
Subject: RE: Forms Beans and DAO (Best Practices)


In general, I use the Struts action classes as proxies to my business objects and my 
business objects serve as proxies to my data access objects and I pass data across 
tiers using DTO  (DataTransportObject [use to be ValueObject]).  In this fashion, I 
can keep my business logic reusable in say a Java
Swing client as well as an HTML client. IMO, I would not access DAO (data access 
objects) directly in the Struts ction classes. This means you would have to manage 
transaction boundries (getting JDBC connection or JDO PersistanceManager) in your web 
tier where as it would probably be better to isolate these details to your business 
tier. We don't use EJB, so the general data flow is as follows:

Client === Action === BusinessObject === DataAccessObject(s) === Database

This keeps BusinessObjects resuseable among Action classes and DAO objects 
reusable in BusinessObjects. The BusinessObject manages the transaction boundries and 
the DAO just uses the JDBC connection. We maintain all SQL as static final Strings in 
the DAO's. (reduces object creation) The BusinessObjects and DAO don't maintain any 
state, so they are singletons. (reduces object creation)

So for example if I wanted to retrieve and display a customer list.

1. Client sends HTTP request

2. Struts delegates request to ShowCustomersAction

3. ShowCustomersAction delegates to CustomerBO

4. CustomerBO starts a transaction

5. CustomerBO delegates to CustomerDAO

6. CustomerDAO executes the query and gets results

7. CustomerDAO maps results into a collection of CustomerDTO

(DataTransportObject)

8. CustomerDAO returns collection to CustomerBO

9. CustomerBO ends transaction

10. CustomerBO returns collection to ShowCustomerAction

11. ShowCustomersAction places the connection in the HttpServletRequest as

an attribute

12. ShowCustomersAction forwards to showCustomersView (some jsp)

13. ShowCustomersView accesses customer collection using a custom tag

14. ShowCustomersView renders customer list

 PS. If we did switch to using EJB, then the BusinessObjects become BusinessDelegates 
to actual EJBs and  nothing in the web tier has to change and both DAOs and DTOs can 
be reused.


-Original Message-
From: Chen, Dean (Zhun) [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 2:23 PM
To: 'Struts Users Mailing List'
Subject: RE: Forms Beans and DAO (Best Practices)


This might be a stupid question, but what are DAO and Value Object supposed
to be?

Does DAO encapsulate the logic to make JDBC calls?  For example, would it
contain the name of a stored procedure or would that be passed to it?

Is ValueObject a generic object that stores the result sets?  For example, a
Collection of somesort? or a Collection of Collections?

Thanks, I am also trying to figure out what the most performant way to
design this.


Dean Chen



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 1:17 PM
To: Struts Users

html:options

2002-05-01 Thread Jayaraman Dorai

Hi,
 
I want in my drop down a blank record. This needs to be the default. This provides the 
user an option to not select anything( It is a null field). 
 
Is it possible to do this other than putting an empty string in the collection. How to 
set this blank string as the default(not affecting the user's selected value in the 
edit mode)? 
 
I hope I am clear. 
 
Jayaraman



RE: html:options

2002-05-01 Thread Jayaraman Dorai

Thanks, it looks so trivial now.

-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 3:02 PM
To: Struts Users Mailing List
Subject: RE: html:options


  html:select property=type
  html:option value=/
html:options collection=serverTypes property=value
   labelProperty=label/
  /html:select


JM


 -Original Message-
 From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 01, 2002 2:52 PM
 To: [EMAIL PROTECTED]
 Subject: html:options
 
 
 Hi,
  
 I want in my drop down a blank record. This needs to be the 
 default. This provides the user an option to not select anything( 
 It is a null field). 
  
 Is it possible to do this other than putting an empty string in 
 the collection. How to set this blank string as the default(not 
 affecting the user's selected value in the edit mode)? 
  
 I hope I am clear. 
  
 Jayaraman
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]