Re: Validation Random Failures

2007-04-14 Thread Adam Ruggles
I haven't tracked it down yet, but I think it is in the type 
converters.  Are you using dates or decimal values on your forms?


Zach Calvert wrote:

Has anyone figured out why Validation randomly fails???

On 4/14/07, Adam Ruggles <[EMAIL PROTECTED]> wrote:

I'm having a similar problem.  I'm extending the ActionSupport object
and I have no validation specified and I'm experiencing the same issue.
I did enable validation and the results didn't change.  The application
was previously built on webwork2 where I didn't experience these issues
at all.

I don't know if it has been logged as a bug. Because it happens randomly
I haven't been able to find out where it's dying.

Zach Calvert wrote:
> I'm receiving random/spontaneous failures of validation on valid
> entries.  I can use the browser back button, re-submit the same data,
> and sometimes get it accepted.  I'm using simple Required strings:
> @Validations(
> requiredStrings = {
> @RequiredStringValidator(type =
> ValidatorType.SIMPLE, fieldName =
> "company", message = "You must enter a value for company.",
> shortCircuit = true, trim = true)}
> )
>
> I'm curious if there is a bug logged that I haven't found, a patch, or
> a new jar I need to download.  I'm using struts2-core-2.0.6.jar and
> freemarker-2.3.8.jar
>
>
> Anyone have any input?
>
>
>
> Thanks,
> Zach Calvert
>
> -
> 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: [OT] [RANT] Re: Preparable or interceptors - is there a better mailing list than this ? some thing for total newbies.

2007-04-14 Thread Adam Ruggles
Based on your posts I get the idea you don't understand how the MVC 
pattern works.  I'll try to describe what should be happening.


On the browser a user submits the data he/she wishes to update.  That 
information is then passed to the action, I prefer to do this with an 
object.  So in your action you would have a public void 
setAccount(Account account); method.  On your form you would have fields 
with names like account.id, account.description, ...


Now for this example I'm going to use the default execute method.  So in 
the public String execute() throws Exception {...} method your going to 
have an account object.  Now if you want to update this account you pass 
it to your service layer which might have a method that looks like 
this.  accountService.update(account);


Inside the account service you'll be talking to your DAOs.  So you might 
have an update method in your DAO.  accountDAO.update(account).  Now 
since your using JDBC you have control of the sql statement.  So one 
method of building the sql statement without having to load the account 
object from the database would be to check for nulls.  So say I only 
wanted to update the description.  Everything else is unchanged.  So in 
my DAO update method I would check for non-null fields and add the ones 
that are not null to the sql statement.  Then execute the statement.


Mansour wrote:

Adam Ruggles wrote:
Then why don't you simply pass the id of the account you want to 
update and the fields you want to update to the action.


Then create an update SQL statement like "update account set 
field1='data_from_form', field2='data2_from_form' where 
id='id_from_form';"
This is a way, but not what I am looking to do. what about the 
business logic layer. If I create an update statement in the Action 
then no point in having an Account object.  So, I created an update 
statement in the business logic (Account) and passed it the new 
values. The problem is, how do I get my hand on the object that I need 
to update. Store it in a session ?  I can not pass it back to the 
action as it doesn't take any thing but string.




Why do you need to reload the account to update it?  If You don't 
pass an id in then you know its a new record and can issue an insert 
statement instead.
I don't need to reload the Account every time I do an update, and 
that's my problem in the first place.
So you mean, if the action doesn't receive an id then it must be a new 
record. Right ? back again to the MVC, I need to put the logic in it's 
place. I will do my best not to put any data access code in the action.




The only things you should put into a session are thing that usually 
don't change very often and are session specific.

How do I resolve this then ?



Mansour wrote:

I am accessing the DB using JDBC.


Adam Ruggles wrote:
How are you accessing the database? JDBC, Hibernate, Another ORM 
solution?


Mansour wrote:

Ok Dave:
you are really helping me a lot. I think I'll have to explain to 
you exactly what I am doing, and you give me an advice about how 
to do it. Okay?


I 've been trying to learn struts 2 for a week but not doing any 
significant progress. I need an program that stores accounts and 
services with invoices. All I need is to be able to retrieve an 
account view/add invoices , and services to each invoice.
When ever, I retrieve an account I want to perform the operations 
of adding or updating invoices.
Now I am able to get an account (from the DB) and to view all the 
invoices, but nothing more. How do I go around this?


I have tried retrieving the account again (by its id) form the DB 
but this is not what I want as it keeps on openning connection and 
get every single from the DB every time I need to update. That's 
why I asked if I have to use interceptors or implement Preparable 
and sessionAware.


By the way, I really appreciate your help, and in many cases you 
may find my post lacks some info. The reason of this is because I 
am still LEARNING and I don't know what info you need to be able 
to help. So if I miss some thing, just ask.



Dave Newton wrote:

--- Mansour <[EMAIL PROTECTED]> wrote:
 

I thought there's a way like .net of jsf to store


the

object in the session and retrieve when needed.



Of course you can store an object in the session. You
didn't say you wanted to.

As I said, without any information about what you're
attempting to do or if you're experiencing any
specific issues it's pretty difficult to be helpful.

d.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com
- 


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 Random Failures

2007-04-14 Thread Zach Calvert

Has anyone figured out why Validation randomly fails???

On 4/14/07, Adam Ruggles <[EMAIL PROTECTED]> wrote:

I'm having a similar problem.  I'm extending the ActionSupport object
and I have no validation specified and I'm experiencing the same issue.
I did enable validation and the results didn't change.  The application
was previously built on webwork2 where I didn't experience these issues
at all.

I don't know if it has been logged as a bug. Because it happens randomly
I haven't been able to find out where it's dying.

Zach Calvert wrote:
> I'm receiving random/spontaneous failures of validation on valid
> entries.  I can use the browser back button, re-submit the same data,
> and sometimes get it accepted.  I'm using simple Required strings:
> @Validations(
> requiredStrings = {
> @RequiredStringValidator(type =
> ValidatorType.SIMPLE, fieldName =
> "company", message = "You must enter a value for company.",
> shortCircuit = true, trim = true)}
> )
>
> I'm curious if there is a bug logged that I haven't found, a patch, or
> a new jar I need to download.  I'm using struts2-core-2.0.6.jar and
> freemarker-2.3.8.jar
>
>
> Anyone have any input?
>
>
>
> Thanks,
> Zach Calvert
>
> -
> 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: [OT] [RANT] Re: Preparable or interceptors - is there a better mailing list than this ? some thing for total newbies.

2007-04-14 Thread Mansour

Adam Ruggles wrote:
Then why don't you simply pass the id of the account you want to 
update and the fields you want to update to the action.


Then create an update SQL statement like "update account set 
field1='data_from_form', field2='data2_from_form' where 
id='id_from_form';"
This is a way, but not what I am looking to do. what about the business 
logic layer. If I create an update statement in the Action then no point 
in having an Account object.  So, I created an update statement in the 
business logic (Account) and passed it the new values. The problem is, 
how do I get my hand on the object that I need to update. Store it in a 
session ?  I can not pass it back to the action as it doesn't take any 
thing but string.




Why do you need to reload the account to update it?  If You don't pass 
an id in then you know its a new record and can issue an insert 
statement instead.
I don't need to reload the Account every time I do an update, and that's 
my problem in the first place.
So you mean, if the action doesn't receive an id then it must be a new 
record. Right ? back again to the MVC, I need to put the logic in it's 
place. I will do my best not to put any data access code in the action.




The only things you should put into a session are thing that usually 
don't change very often and are session specific.

How do I resolve this then ?



Mansour wrote:

I am accessing the DB using JDBC.


Adam Ruggles wrote:
How are you accessing the database? JDBC, Hibernate, Another ORM 
solution?


Mansour wrote:

Ok Dave:
you are really helping me a lot. I think I'll have to explain to 
you exactly what I am doing, and you give me an advice about how to 
do it. Okay?


I 've been trying to learn struts 2 for a week but not doing any 
significant progress. I need an program that stores accounts and 
services with invoices. All I need is to be able to retrieve an 
account view/add invoices , and services to each invoice.
When ever, I retrieve an account I want to perform the operations 
of adding or updating invoices.
Now I am able to get an account (from the DB) and to view all the 
invoices, but nothing more. How do I go around this?


I have tried retrieving the account again (by its id) form the DB 
but this is not what I want as it keeps on openning connection and 
get every single from the DB every time I need to update. That's 
why I asked if I have to use interceptors or implement Preparable 
and sessionAware.


By the way, I really appreciate your help, and in many cases you 
may find my post lacks some info. The reason of this is because I 
am still LEARNING and I don't know what info you need to be able to 
help. So if I miss some thing, just ask.



Dave Newton wrote:

--- Mansour <[EMAIL PROTECTED]> wrote:
 

I thought there's a way like .net of jsf to store


the

object in the session and retrieve when needed.



Of course you can store an object in the session. You
didn't say you wanted to.

As I said, without any information about what you're
attempting to do or if you're experiencing any
specific issues it's pretty difficult to be helpful.

d.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

-
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: tks for help, but more question for html:javascript

2007-04-14 Thread Frank W. Zammetti
Hmm, I've never actually used the html:javascript tag, so I'm not sure 
what its intended purpose is, or how it works... seems like the docs is 
talking about validation, so yeah, maybe it's not applicable... 
although, one thing I notice here... let's assume it DOES work just like 
a plain old  tag does... om that case, the contents of your .js 
file might cause a problem because it's not Javascript really, it's 
HTML... If you make source.js just the following:

  function showme() {
  alert("pls try");
  return false;
  }

...then it MAY work... if it still doesn't, I'd not use the html:javascript tag at all, just use a plain