[OT] Create/Edit Form

2005-07-27 Thread Andrew Tomaka
Hey all,

The following is pretty hard to understand.  I'm no good at describing
my problems and wasn't sure how to explain it.  Hopefully, someone
will get what I'm attempting to say

I'm working on a screen that allows a user to dynamically add rows via
Javascript. I then have have a form that contains a list of beans that
stores the data (but that's really beside the point).

My issue comes with the storage of this information.  The form can
either be a blank form or it can be preloaded with other information
depending on whether the record exists or not.  If it is preloaded,
the user can edit the existing rows or add new rows.  The problem
comes when I need to update the database.  When the user hits the save
button, it submits all the information, but I have no way of telling
if a specific row was edited or created. Because of this, I don't know
whether to make an UPDATE query or an INSERT query.  Can anyone think
of a creative way to do this without adding an extra query for each
row?

Any insight would be greatly appreciated!

Thanks,
~ Andrew Tomaka

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



Re: [OT] Create/Edit Form

2005-07-27 Thread Andrew Tomaka
I really like your Javascript solution, Kevin. However, I realized the
problem was actually a bit more complex than I was making it.  The
database table I am editing requires two primary keys to make an entry
unique (I'm a firm believer in a single PRImary key, but it wasn't my
choice).  One of the two keys can be changed by this form, so it
causes problems. I came up with a few solutions, but in the end, we
decided it would be easist (quick but dirty) to go ahead and just
delete all rows associated with the document and then reinsert them.
This way, we are sure to get the exact information that we want from
the users.

Thanks a lot for the quick responses guys.  I'll definitely keep the
JS flag tucked away in the back of my mind.

~ Andrew Tomaka

On 7/27/05, Andrew Tomaka [EMAIL PROTECTED] wrote:
 Hey all,
 
 The following is pretty hard to understand.  I'm no good at describing
 my problems and wasn't sure how to explain it.  Hopefully, someone
 will get what I'm attempting to say
 
 I'm working on a screen that allows a user to dynamically add rows via
 Javascript. I then have have a form that contains a list of beans that
 stores the data (but that's really beside the point).
 
 My issue comes with the storage of this information.  The form can
 either be a blank form or it can be preloaded with other information
 depending on whether the record exists or not.  If it is preloaded,
 the user can edit the existing rows or add new rows.  The problem
 comes when I need to update the database.  When the user hits the save
 button, it submits all the information, but I have no way of telling
 if a specific row was edited or created. Because of this, I don't know
 whether to make an UPDATE query or an INSERT query.  Can anyone think
 of a creative way to do this without adding an extra query for each
 row?
 
 Any insight would be greatly appreciated!
 
 Thanks,
 ~ Andrew Tomaka


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



Re: [OT] Create/Edit Form

2005-07-27 Thread Andrew Tomaka
I agree fully, but, unfortunately, I can't do a whole lot about it. 
The databases were set up before I started on the project and I guess
the DBA was pretty hard nosed about changing from how he wanted it. 
Oh well.

~ Andrew Tomaka



On 7/27/05, Michael Jouravlev [EMAIL PROTECTED] wrote:
 On 7/27/05, Andrew Tomaka [EMAIL PROTECTED] wrote:
  I realized the
  problem was actually a bit more complex than I was making it.  The
  database table I am editing requires two primary keys to make an entry
  unique (I'm a firm believer in a single PRImary key, but it wasn't my
  choice).
 
 Are you are talking about a composite PK?
 
  One of the two keys can be changed by this form, so it
  causes problems.
 
 It is usually a bad idea to use domain data as PK. Having modifiable
 PKs is [generally] one of the worst ideas.
 
 Michael.
 
 -
 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: Iterate over list in in list in form bean.

2005-07-18 Thread Andrew Tomaka
I've stumbled across a similar problem that I'm trying to find the
Struts solution for.

I have a form which allows users to add a dynamic amount of rows (via
a button that says Add Row) and then submit the form with as little
or many rows as they wish.  Can a form bean be setup using collections
instead of other object types?  What is the proper way to handle a
dynamic amount of the same data coming in to a Action?

~ Andrew Tomaka

On 7/18/05, Rick Reumann [EMAIL PROTECTED] wrote:
 Mike Elliott wrote the following on 7/18/2005 10:55 AM:
 
  I've been beating my head against this all weekend to no avail.  I
  understand how to do this in session scope, but don't know if it's
  even possible in request scope.
 
  As I understand things (which may be wrong), when the form is
  submitted (in request scope) a new form bean is created and populated
  with the values in the collection from the HTML form.  But, of course,
  a newly created form won't know how many elements are in the form so
  it can't pre-populate the collection with beans to be filled in.
  Right?
 
 I'm still not totally clear where the problem is, since I'm not sure
 what Session has to do with the initial setup of the form. It might help
 if you let us know what the exact problem is when using request scope...
 
 1) A problem when you submit the form and getting 'index' problems
 showing up in the logs?
 
 2) Is it making sure the nested structure is still there when validation
 fails?
 
 I'm confused because you mention But, of course, a newly created form
 won't know how many elements are in the form so it can't pre-populate
 the collection with beans to be filled in. This statement confused me
 because you seem to be implying it works when it's in Session which
 doesn't make sense since even with a Session scoped form you still need
 to some initial population somewhere.
 
 Typically I feel you should always go to some sort of setUp action or
 dispatch method BEFORE you ever forward to a form. Initially you can
 often skip this step but later on there will be something you want to
 'do' before you get to the form anyway so I find it good practice to go
 to a 'set up' first.
 
 For the two problems listed above the link Naill posted is good
 http://wiki.apache.org/struts/StrutsCatalogLazyList (and I just recently
 added to that link the way I like to do it).
 
 Let us know if you can't get it to work. I have to use Nested stuff all
 the time, so I'll be able to help.
 
 --
 Rick
 
 -
 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: [OT] Re: Fired???? was...Re: Struts Books Recommendations [OT]

2005-07-08 Thread Andrew Tomaka
I was trying to avoid jumping in here, but I couldn't hold out.

How about we all grow up and act like adults?  Never in my life have I
seen such a childish display.  I think Rick's My mom can beat up your
mom. made the same point I'm making here.  And Yan, you may have
given it a hahaha +1, but that was directed at you just as much as
it was directed at anyone else.

This is supposed to be a list of professionals.  We are all here
trying to help one another through our Struts issues.  I fail to see
how making fun of some for using or not using an IDE or discussing
anti-discrimination laws or most everything that has been written in
the last two weeks applies to the goals of this list.  And I certainly
don't see how saying things like Can you even reason logically? Ha
you can not since you do not have a brain. helps anyone in anyway.

When I joined the Struts list in May, it was an invaluable resource. 
I was able to quickly learn the framework through the questions others
were asking.  But in the past few weeks, it's all gone downhill.  A
good percentage of threads are now off-topic; not off topic like
discussing the pros and cons of using an IDE, but off topic like what
an H1B is and personal thoughts on outsourcing.

Why don't we get back to the reason this list exists and the purpose
of Sturts: making our lives easier.

~ Andrew Tomaka


On 7/8/05, Yan Hu [EMAIL PROTECTED] wrote:
 
 
 --- James Mitchell [EMAIL PROTECTED] wrote:
 
  ROFL
 
  Oh ya!  My mom can beat up your dad!
 
 hahaha +1
 
 -
 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: Two Forms, Two Form Beans, One JSP

2005-07-07 Thread Andrew Tomaka
I imagine I've over complicated the problem, so I've taken a step back
and am looking at it from the beginning again.  The following are my
basic requirements:

When the user makes the first request, they are taken to a page with a
drop down menu.  This drop down menu is built from information stored
in a database so I need to do some pre-processing.

After that, the user chooses an option from the drop down menu and
chooses to search.  This returns a page that has the same form that
was built in the first request on top and then a second form that
lists the results of their drop down.  This allows users to choose
which of the results to edit.

At this point the user can either use the drop down menu and have the
bottom list rebuilt or choose a result to edit and proceed.

My problem is that I have a PreAction to do the processing on the
form.  This requires the page to have the form bean assigned to it. 
Since I have two different forms doing two different things, I should
have two different form beans, but I don't see how I can accomplish
that.

This is going to be a common thing to do throughout my entire
application so I am hoping a simple design solution will pop up.

Let me know if you need any other clarifications.

I appreciate the help so far!
~ Andrew Tomaka

On 7/7/05, Rick Reumann [EMAIL PROTECTED] wrote:
 Andrew Tomaka wrote the following on 7/7/2005 10:26 AM:
 
  I'm attempting to create a JSP that is made up of two forms.  Each
  form needs a different form bean and is processed by a different
  action.  The catch is that the first form returns back to the JSP and
  the action responsible for this needs the name attribute set to the
  Form Bean of the first form.  When the JSP is loaded after the
  processing of the first form, both the form tags are assigned the name
  of the first Form Bean.
 
 I'm confused what you are trying to do. Possibly you can describe the
 user requirements?
 
 
 --
 Rick
 
 -
 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: Two Forms, Two Form Beans, One JSP

2005-07-07 Thread Andrew Tomaka
I did consider using a single form bean for both forms, but it didn't
really sit well with me from a design stand point.  We have two
different forms doing two different things so there should be two
different beans.  Heck, if I had it my way, the two forms would be on
separate pages (wizard style), but the customer says otherwise.

I do have an issue with using a single form.  The top list is a list
of program ids.  When a program id is selected, it brings up all the
different sheets for that program id.  The user can then select a
sheet to edit, via radio button, and submit that request.  With this
request, I need to pass the program id that was selected (via hidden
field).  I can't rely on the program id in the drop down box because
if a user performs a search, changes the drop down box and then
selects a sheet to edit, we have a mismatch between the intended
program id to edit and the actual program id to edit (if that makes
any sense).

~ Andrew Tomaka

On 7/7/05, Wendy Smoak [EMAIL PROTECTED] wrote:
 From: Andrew Tomaka [EMAIL PROTECTED]
 
  My problem is that I have a PreAction to do the processing on the
  form.  This requires the page to have the form bean assigned to it.
  Since I have two different forms doing two different things, I should
  have two different form beans, but I don't see how I can accomplish
  that.
 
 There's nothing wrong with sharing one form across multiple Actions.  I do
 it for an accounting reporting webapp.  All of the forms ask for similar
 things, such as account numbers and dates, and this makes it simple for all
 the HTML forms to remember their selections.  (The form is in session
 scope, so it happens naturally.)
 
 Just wanted to point out that there is no ironclad one-to-one relationship
 between HTML forms and form beans.
 
 --
 Wendy Smoak
 
 
 -
 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: Two Forms, Two Form Beans, One JSP

2005-07-07 Thread Andrew Tomaka
Using a nested form bean may actually be a viable solution that I'll
have to look in to. Ideally though, I'd be able to treat the two
different forms as two separate pages that just happen to share the
same screen space.  I guess that's the downside to using a framework:
you can't always get what you want.

Anyway, I have a drawing of the flow that I'll upload when I am at
home. Unfortunately, the proxy here doesn't allow me to write to any
FTP space.

~ Andrew Tomaka

On 7/7/05, Adam Hardy [EMAIL PROTECTED] wrote:
 Andrew,
 if the data being edited in the two forms are related, then for the
 child data you could use a nested bean as an attribute on the form.
 
 The parent data would remain as usual directly in the form.
 
 
 Adam
 
 Andrew Tomaka on 07/07/05 17:46, wrote:
  I did consider using a single form bean for both forms, but it didn't
  really sit well with me from a design stand point.  We have two
  different forms doing two different things so there should be two
  different beans.  Heck, if I had it my way, the two forms would be on
  separate pages (wizard style), but the customer says otherwise.
 
  I do have an issue with using a single form.  The top list is a list
  of program ids.  When a program id is selected, it brings up all the
  different sheets for that program id.  The user can then select a
  sheet to edit, via radio button, and submit that request.  With this
  request, I need to pass the program id that was selected (via hidden
  field).  I can't rely on the program id in the drop down box because
  if a user performs a search, changes the drop down box and then
  selects a sheet to edit, we have a mismatch between the intended
  program id to edit and the actual program id to edit (if that makes
  any sense).
 
  ~ Andrew Tomaka
 
  On 7/7/05, Wendy Smoak [EMAIL PROTECTED] wrote:
 
 From: Andrew Tomaka [EMAIL PROTECTED]
 
 My problem is that I have a PreAction to do the processing on the
 form.  This requires the page to have the form bean assigned to it.
 Since I have two different forms doing two different things, I should
 have two different form beans, but I don't see how I can accomplish
 that.
 
 There's nothing wrong with sharing one form across multiple Actions.  I do
 it for an accounting reporting webapp.  All of the forms ask for similar
 things, such as account numbers and dates, and this makes it simple for all
 the HTML forms to remember their selections.  (The form is in session
 scope, so it happens naturally.)
 
 Just wanted to point out that there is no ironclad one-to-one relationship
 between HTML forms and form beans.
 
 --
 Wendy Smoak
 
 
 -
 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: Two Forms, Two Form Beans, One JSP

2005-07-07 Thread Andrew Tomaka
This is what I've ended up doing for now.  I have my one form bean for
both forms since the data is related.

What if the data isn't related though?  Does Struts provide a simple
solution or is just an area to hack around? I can accept the latter
since it's expected when using a framework.

Either way, thanks for all the help guys.  I've gotten my forms in
working condition with a design that I can put up with!

~ Andrew Tomaka

On 7/7/05, Rick Reumann [EMAIL PROTECTED] wrote:
 Andrew Tomaka wrote the following on 7/7/2005 12:00 PM:
  I imagine I've over complicated the problem,
 
 Yes, I think you are:)
 
  My problem is that I have a PreAction to do the processing on the
  form.  This requires the page to have the form bean assigned to it.
  Since I have two different forms doing two different things, I should
  have two different form beans, but I don't see how I can accomplish
  that.
 
 Here is a case where I don't believe you need to have these different
 ActionForms.  If you just need an id from one drop down list, simply
 sumbit to the Action and pull that id out of the request. Nothing
 forcing you to have to have ActionForm's hold everything. If you want an
 ActionForm, make just one and provide...
 
 Integer searchID;
 Integer programID;
 
 I don't feel this breaks desing principals since the intended use of the
 ActionForm is to collect user input data from a page - in this case
 you do have user data (in two lists) on one page.
 
 --
 Rick
 
 -
 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: Is there any Jsp template like Smarty template ?

2005-06-29 Thread Andrew Tomaka
Maybe IDEs are helpful, but if you can't do your programming in a
straight text editor, you shouldn't be programming at all.  The
biggest problem with programmers today is that they don't actually
know how to program.  They know how to click some buttons and
auto-generate some code (mostly awful code) but that's about it.  Grab
a text editor, learn to program, then, and only then, if you feel the
need, you can pick up an IDE.

~ Andrew Tomaka

On 6/29/05, Yan Hu [EMAIL PROTECTED] wrote:
   http://uab.blogspot.com/2005/06/ides-we-dont-need-no-stinking-ides.html
 
 It is the most stupid blog I have ever seen. Go back to the cave where you 
 belong to. Maybe we
 should ask MS guys to use vi and Emacs too. Why do some people call them 
 real programmers just
 because they do not like IDEs?  Why 85% of the Java developers use Eclipse?  
 You think they are
 all wrong and you are right?  You should be thankful since Eclipse is such a 
 good IDE and it is
 free. Haa. I know when you get too old, you tend to hate anything new due to 
 uncertainty that the
 new technologies might bring to you Hey that is understable that you 
 might still want to
 use Cobol or even assembly.. Why do you want to program in java anyway?  You 
 could do a lot
 more(control) using assembly than Java as you could program in the stinking 
 text editors such as
 vi and Emacs. They suck big time.
 
 -
 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: Validation while using LookupDispatchAction

2005-06-23 Thread Andrew Tomaka
You might be interested in checking out ValidatorLookupDispatchAction
(http://struts.whoisandy.com/archives/2005/05/27/validatorlookupdispatchaction.php).
 I stumbled across, but never actually used it.

~ Andrew Tomaka

On 6/23/05, Wendy Smoak [EMAIL PROTECTED] wrote:
 From: Vicky [EMAIL PROTECTED]
 
  But having different actions in struts-config. how
  would I call them in my jsp html:form ? because right
  now I have only one action in jsp html:form
  action=myAction and then for each button i have
  property=method.. in jsp
 
  in struts-config for this action mapping I have
  parameter=method
 
  Did I miss anything in here?
 
 DynaValidatorActionForm wants to validate based on the path, so you have to
 give it different paths to work with.  If you can't or don't want to have
 different paths mapped to the same action and form, then a different
 solution is in order.
 
 I doubt you are alone... I wonder if someone has written a flavor of
 ValidatorForm that uses the dispatch parameter to switch validation.  None
 comes to mind, but search the list archives and the Wiki to see if there is
 already something out there.
 
 And of course you're always free to override 'validate' in your form bean
 and make it do exactly what you want, or to turn off automatic validation
 altogether and call it from your Action when and where you want it to
 happen.
 
 If you're having trouble deciding what the best approach would be, tell us
 more about your project and I'm sure there will be no shortage of opinions.
 (Hey, Mark, welcome back! So, tell us how you REALLY feel about Validator...
 ;) )
 
 --
 Wendy Smoak
 
 
 -
 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: html:errors does not display

2005-06-13 Thread Andrew Tomaka
Song,

I was having a similar problem using WSAD 5.0.0.  Client side
validation using the Validator component worked, but server side
validation did not.  Since WSAD included Struts 1.1(beta 2), I decided
to update struts to the newest version.  This seemed to correct the
problem.  If you need further instructions on updating Struts to the
most recent version using WSAD, please refer to
http://struts.whoisandy.com/archives/2005/05/26/validator_serverside_validation.php.

~ Andrew Tomaka

On 6/13/05, Song Wang [EMAIL PROTECTED] wrote:
 Hello everyone,
 
 I cannot display html:errors property=blah/, but if I add
 
 %
 ActionErrors ae = ( ActionErrors) request.getAttribute( Action.ERROR_KEY);
 boolean err = false;
 if( ae != null) {
  Iterator iter = ae.properties();
  while(iter.hasNext()){
   System.out.println((String)iter.next());
  }
 }
 %
 
 I can see that blah is printed out. That being said, the errors does hold 
 the value. Does anyone know where I should configure? Or how to check if the 
 value is an empty string? I'm using WSAD 5.1.
 
 Thanks.
 Song
 
 
 -
 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]