RE: Form name from JSP page

2004-03-03 Thread Stuart . Jameson
Hi,

My JSP page has some javascript that need to references the html:form by
name but how elegently get the form name and input field name to achieve the
following without harcoding?

Document.forms['my_form'].elements['my_element_1']

Thanks

Stu

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



RE:Form creation

2004-02-23 Thread Stuart . Jameson
Hi,

Got a  query about when ActionForm is created.

In struts config I map appname/MyQueries.do URL to MyQueryAction class via
struts config.  In execute method I expected the form to exist but it is
null (I haven't submitted the form yet I know but I thought the MyQueries.do
GET would act like I'd submitted the form).  

How do I force creation of the session scoped form? Do I have to set this up
myself first time I use it? I want to do this because I have select boxes
that have default values that the form knows about and I need to get these
default values out of the form in order to run my query the 1st time.

Am I making an complete architectural howler by wanting a form to exist so I
can set up the page before I use it?  

TIA

Stu

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



RE: RE: Validator won't kick-in

2003-02-05 Thread Stuart Jameson
In web xml there is the following is it set for you?


   validate
   true



> -Original Message-
> From: otisg [mailto:[EMAIL PROTECTED]] 
> Sent: 04 February 2003 23:00
> To: Tennent, Erik
> Subject: Re: RE: Validator won't kick-in
> 
> 
> Yes I did :)
> My original email actually shows that my
> 'loginForm' is of type org.apache.struts.validator.DynaValidatorForm
> 
> I am also using input="..." in the action
> mapping.
> 
> Here is the action mapping in question:
> 
>  type= 
> "com.example.action.LoginAction"
> scope= "request"
> validate=  "true"
> name=  "loginForm"
> input=
> "/WEB-INF/shell/login.jsp">
>  path="/WEB-INF/shell/home.jsp"/>
>  path="/WEB-INF/shell/login.jsp"/>
> 
> 
> 
> Thanks,
> Otis
> 
> 
>  On Tue, 4 Feb 2003, Tennent, Erik
> ([EMAIL PROTECTED]) wrote:
> 
> > Did you remember to extend ValidatorForm
> or ValidatorActionForm? 
> > 
> > On a side note, with the ValidatorForm,
> you also have to define an
> > input="/SomeAction.do" inside of your
>  tag so struts knows where
> > to forward to if there is an error. The
> input can also refer to a jsp page
> > or a tiles def.
> > 
> >  type="hotel.HotelSaveAction" name="HotelForm"
> > validate="true" scope="request"
> input="hotelEdit">
> >   path="hotelDisplay" redirect="false" />
> > 
> > 
> > -ET
> > 
> > > -Original Message-
> > > From: otisg [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, February 04, 2003 3:16 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Validator won't kick-in
> > > 
> > > 
> > > Hello,
> > > 
> > > I am trying to use Commons Validator with
> > > Struts, but I can't get it to 'kick in'.  I
> > > am using the CVS HEAD version of Struts and
> > > Taglibs, and Validator I just built from CVS
> > > the other day.
> > > 
> > > My Struts config has a 'loginForm'
> defined as:
> > > 
> > >  > >   
> > >
> type="org.apache.struts.validator.DynaValidatorForm">
> > >  > > type="java.lang.String"/>
> > >  > > type="java.lang.String"/>
> > > 
> > > 
> > > 
> > > The 2 Validator's files are defined properly
> > > in Struts config via .
> > > 
> > > IN Struts config I have /Login action tied
> > > to the loginForm form.  I also have
> > > validate="true" set in the action mapping
> > > (is this needed?).
> > > 
> > > 
> > > In my JSP that contains this loginForm I
> > > have action=/Login in the HTML form.  Fields
> > > are 'username' and 'password'.
> > > 
> > > 
> > > My validation.xml contains:
> > > 
> > > 
> > >  > > depends="required">
> > >  > > key="Required Called" resource="false"/>
> > > 
> > >  > > depends="required">
> > > 
> > > 
> > > 
> > > 
> > > My Action class does not contain any code
> > > that calls form.validate(mapping, request).
> > >  I don't think this is needed - I think
> > > everything should work as defined
> > > declaratively in these
> filesautomagically :)
> > > ...
> > > ...but it does not do that (for me) :(
> > > 
> > > 
> > > I've read Chapter 11 of Cavaness' book a few
> > > times and according to him what I described
> > > above should suffice.
> > > 
> > > When I go to my login page with the login
> > > form and leave the username completely blank
> > > I expect to get an error...but I don't
> get it.
> > > 
> > > One more thing that may be worth mentioning,
> > > my Action class has:
> > > 
> > > return
> mapping.findForward("success");
> > > 
> > > And the JSP defined for this "success"
> contains:
> > > 
> > > 
> > > 
> > > I expect this to show me Validator's errors.
> > > I get no application errors, all looks good,
> > > too good - I want to see that error about a
> > > missing required username field :)
> > > 
> > > Thanks,
> > > Otis
> > > 
> > > 
> > >
> 
> > > Get your own "800" number
> > > Voicemail, fax, email, and a lot more 
> http://www.ureach.com/reg/tag
> > > 
> > >
> 
> -
> > > 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]
> > 
> > 
> > 
> 
> 
> 
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
Fo

RE: [OT] Programming Challenge

2003-01-24 Thread Stuart Jameson
Not sure that the algorithm 'randomly' calculates the date but here you
go

http://www.dennisglass.com/javascript02.html



> -Original Message-
> From: Mark Galbreath [mailto:[EMAIL PROTECTED]] 
> Sent: 24 January 2003 15:16
> To: struts
> Subject: [OT] Programming Challenge
> 
> 
> Anybody know the algorithm for randomly calculating the day 
> of the week, given a particular date?  E.g., July 4, 2006 = 
> Wednesday.  I need to do this in JavaScript and for some 
> reason (too much wine last night?) I can't get brain engaged.
> 
> Mark
> 
> 
> 
> --
> To unsubscribe, e-mail:   
>  [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: 
> 
> 

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




RE:options

2002-05-21 Thread Stuart Jameson

Having trouble using

I have a container, MyTypesList to store a list of MyType beans

beanList contains the following.

private Vector myTypes;  (of type MyType)

MyBean has properties  ID and typeName.

I'm trying to output a select box that displays the possible typeNames and submits the 
value of ID in order to populate the typeID property of another bean.  

I don't quite understand how to reference the properites in the bean in my list.
I seem to have to do the following








 
** How do I reference the properties in myTypes from here?

Thanx  Stu


 






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




RE: File upload

2002-04-23 Thread Stuart Jameson

Thanks Rob,

Problem was I hadn't found the struts docs for FormFile. 

  public void setMyFile(FormFile file) {
myFile = file;
  }
  public FormFile getMyFile() {
return myFile;
  }

 Struts deals with file upload for you.  Suspected it might but I didn;t rtfm 
sufficiently before posting a question.


-Original Message-
From: Robert Taylor [mailto:[EMAIL PROTECTED]]
Sent: 23 April 2002 13:30
To: Struts Users Mailing List
Subject: RE: File upload


Try flushing the buffer before closing.

pw.flush();

or create the PrintWriter using the output stream and the autoflush flag set
to true.

PrintWriter pw = new PrintWriter(new BufferedWriter( new
FileWriter("C:\\Demo.out"), true);

HTH,

robert

> -Original Message-----
> From: Stuart Jameson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 23, 2002 8:26 AM
> To: Struts Users Mailing List
> Subject: RE: File upload
>
>
> Hi,
>
> Got a problem with uploading files to the server.
>
> I don't get any errors but the files I try and upload are always empty
>
> Code I'm using in the Action::perform() method looks like this
>
>
>
> PrintWriter pw = new PrintWriter(
>
> )
> );
> int i = in.read();
> while (i != -1) {
> pw.print((char) i);
> i = in.read();
> }
> pw.close();
>
>
> Demo.out is created but empty.
>
> Any pointers of what I need to add to my jsp page or to my Action
> servlet greatly appreciateed.
>
> --
> 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: File upload

2002-04-23 Thread Stuart Jameson

Hi,

Got a problem with uploading files to the server.

I don't get any errors but the files I try and upload are always empty

Code I'm using in the Action::perform() method looks like this



PrintWriter pw = new PrintWriter(

new BufferedWriter( new FileWriter("C:\\Demo.out") ) ); 
int i = in.read();
while (i != -1) {
pw.print((char) i);
i = in.read();
}
pw.close();


Demo.out is created but empty.

Any pointers of what I need to add to my jsp page or to my Action servlet greatly 
appreciateed.

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




losing checkbox info between pages

2002-04-12 Thread Stuart Jameson

Hi,

I have 1 form split over 2 pages.  Page 1 has a checkboxA page 2 has checkboxB

Unless I put a hidden field A in page 2 and a hidden field B in page 1 the checkboxes 
aren't set correctly (because reset() is called each the page is submitted).  

I assume there is a better way to do this.  Anyone tell me how I should write it so 
that HTML people can just move the checkboxes between pages without having to worry 
about moving a hidden field as well?

Hope someone can enlighten me, 
 


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