Validation for anything other than html:text

2003-03-30 Thread Steven Citron-Pousty
Greetings all:
How do you validate a html:select or html:radio for required using the 
validator plugin.
All the doco deals with html:text. I found some old postings but they 
didn't really explain how to do this.
I tried it out and it doesn't seem to work. I want the form to return an 
error if the user forgets to pick something off the select list.
I printed out what was in the request for the select list and its a 
blank or null, which, according to the javaDoc should fail for a 
required field.
Thanks for your help,
Steve

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


Re: How to access the Struts ConnectionPool from an ActionForm

2002-11-21 Thread Steven Citron-Pousty
I think thats kinda it. I think whats happening is that the jsp was 
being called before the webapp had ever "touched" the servlet (i.e. the 
user could go straight to the jsp). Therefore maybe the form doesn't 
know which servlet its talking to.
Is there a way to get the context attribute without asking the servlet?
Thanks,
Steve
Jagdish Arora wrote:

Steven,

Is your form defined to be in session scope, or is it in request scope?  The
reason I ask is that the servlet is declared to be transient in the
ActionForm.  Depending on where you are in the lifecycle, it may have
"evaporated".


amrinder

- Original Message -----
From: "Steven Citron-Pousty" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Cc: "Jagdish Arora" <[EMAIL PROTECTED]>
Sent: Thursday, November 21, 2002 11:04 AM
Subject: Re: How to access the Struts ConnectionPool from an ActionForm


 

The servlet is null. So then how and what do I tell the actionform is
its servlet.

Thanks,
Steve

PS I still am interested in ppls view on whether all DB calls are model
or there is a case when you could consider the DB call view

Jagdish Arora wrote:
   




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




Re: How to access the Struts ConnectionPool from an ActionForm

2002-11-21 Thread Steven Citron-Pousty
The servlet is null. So then how and what do I tell the actionform is 
its servlet.

Thanks,
Steve

PS I still am interested in ppls view on whether all DB calls are model 
or there is a case when you could consider the DB call view

Jagdish Arora wrote:

Steven, since you are getting a NPE, could you tell us if is it the servlet
that is null, or is servlet.getServletContext() that is null?

amrinder

- Original Message -
From: "Steven Citron-Pousty" <[EMAIL PROTECTED]>
To: "struts-user" <[EMAIL PROTECTED]>
Subject: How to access the Struts ConnectionPool from an ActionForm


 

DataSource dataSource = (DataSource)
servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY);

   





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




How to access the Struts ConnectionPool from an ActionForm

2002-11-20 Thread Steven Citron-Pousty
Greetings all:
I am trying to populate the options for a select list from a DB call. 
And I am getting a null pointer exception from this line in the 
ActionForm (I copied it from my Action, where it works):

DataSource dataSource = (DataSource) 
servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY);

What I am trying to do is use the ConnectionPool provided by Struts. 
This call works great in my Action but doesn't work in my ActionForm.
On the IRC channel (irc.freenode.net #struts) we have been discussing 
the merits of putting a DB call in an ActionForm.

SOoo, my main question is,
How do I ask the context for the connection pool in an ActionForm?

But I would also love to see discussion about the merits of putting a DB 
call in an ActionForm at all. If I didn't put the call in the ActionForm 
how would I get the data from the DB call into the actionForm?

Thanks in advance for all your help,
Steve

BTW it appears as if posting from the basebeans nntp doesn't get posted 
to the list.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: