RE: JSP question

2003-10-21 Thread Matt Raible
A better solution for what you're doing is to leave the button as
type=submit and remove its onclick event.  Instead, add an onsubmit
handler to form that calls return validateForm() - return false in your
function when validation fails.

HTH,

Matt

-Original Message-
From: epyonne [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 9:35 AM
To: Tomcat Users List
Subject: JSP question


Hello All,

I am pulling my hair on this problem, and since there are many Java experts
on this mailing list, I hope someone can help me on this.

I have a simple servlet that calls a JSP page where the user can enter a
search value.  When the user clicks on the submit button, the search value
will be passed back to the servlet for processing and display.  All these
are running on Tomcat 4.1.24.

Everything works fine until I added the form validation routine in the JSP
page.  Initially, my input button type was submit.  I changed it to
button and leave the submission to the form validation routine which is in
JavaScript.  Now, when I click on the button, I get the error message of:
Object doesn't support this property or method
at the line of code:
document.form1.submit();

Does anyone know why?  The following is code of the JSP page:
//code begin--
html
head
titleblah blah blah/title
link rel=stylesheet href=css/standard.css type=text/css
/head

body
form name=form1 method=POST action=
center
bPlease enter ANI for query:/bbrbr
table
tr
 tdANI/td
 tdinput type=text name=ani/TD
/tr
tr
 td/td
 td COLSPAN=2
 input type=button name=submit value=Submit
onclick=javascript:validateForm();
 input type=Reset name=cmdReset value=Reset/td
/tr
/table
/center

 script LANGUAGE=JavaScript
  function validateForm(){
   if(document.form1.ani.value == ){
alert(Please enter an ANI);
return;
   }
   document.form1.submit();//This line generated error.  The
.submit() method is not supported.
  }
 /script
/form
nbsp;
%@ include file=footer.jsp%
/body
/html
//code end

Any help will be very much appreciated.

-
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: JSP question

2003-10-21 Thread Peter Guyatt
Hi There,

Why dont you change the button back to a submit and then add a
onSubmit='return validation();' to you form ?

Thats what we do

Eg.
Script
function valid () {
if (document.form.val.value.length  1) {
alert(Please enter a value);
return false;
}
return true;
}
/Script

form onSubmit=return valid();
table
tr
td
input type=text name=val
/td
td
input type=submit
/td
/tr
/table
/form

Thanks

Pete

-Original Message-
From: epyonne [mailto:[EMAIL PROTECTED]
Sent: 21 October 2003 16:35
To: Tomcat Users List
Subject: JSP question


Hello All,

I am pulling my hair on this problem, and since there are many Java experts
on this mailing list, I hope someone can help me on this.

I have a simple servlet that calls a JSP page where the user can enter a
search value.  When the user clicks on the submit button, the search value
will be passed back to the servlet for processing and display.  All these
are running on Tomcat 4.1.24.

Everything works fine until I added the form validation routine in the JSP
page.  Initially, my input button type was submit.  I changed it to
button and leave the submission to the form validation routine which is in
JavaScript.  Now, when I click on the button, I get the error message of:
Object doesn't support this property or method
at the line of code:
document.form1.submit();

Does anyone know why?  The following is code of the JSP page:
//code begin--
html
head
titleblah blah blah/title
link rel=stylesheet href=css/standard.css type=text/css
/head

body
form name=form1 method=POST action=
center
bPlease enter ANI for query:/bbrbr
table
tr
 tdANI/td
 tdinput type=text name=ani/TD
/tr
tr
 td/td
 td COLSPAN=2
 input type=button name=submit value=Submit
onclick=javascript:validateForm();
 input type=Reset name=cmdReset value=Reset/td
/tr
/table
/center

 script LANGUAGE=JavaScript
  function validateForm(){
   if(document.form1.ani.value == ){
alert(Please enter an ANI);
return;
   }
   document.form1.submit();//This line generated error.  The
.submit() method is not supported.
  }
 /script
/form
nbsp;
%@ include file=footer.jsp%
/body
/html
//code end

Any help will be very much appreciated.

-
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: JSP question

2003-10-21 Thread Walker Chris
Most likely document.form1 is not visible in the browser object model.
There are various ways to address the form, but the most portable in this
case is probably document.forms[0].

Chris

-Original Message-
From: epyonne [mailto:[EMAIL PROTECTED]
Sent: 21 October 2003 16:35
To: Tomcat Users List
Subject: JSP question


Hello All,

I am pulling my hair on this problem, and since there are many Java experts
on this mailing list, I hope someone can help me on this.

I have a simple servlet that calls a JSP page where the user can enter a
search value.  When the user clicks on the submit button, the search value
will be passed back to the servlet for processing and display.  All these
are running on Tomcat 4.1.24.

Everything works fine until I added the form validation routine in the JSP
page.  Initially, my input button type was submit.  I changed it to
button and leave the submission to the form validation routine which is in
JavaScript.  Now, when I click on the button, I get the error message of:
Object doesn't support this property or method
at the line of code:
document.form1.submit();

Does anyone know why?  The following is code of the JSP page:
//code begin--
html
head
titleblah blah blah/title
link rel=stylesheet href=css/standard.css type=text/css
/head

body
form name=form1 method=POST action=
center
bPlease enter ANI for query:/bbrbr
table
tr
 tdANI/td
 tdinput type=text name=ani/TD
/tr
tr
 td/td
 td COLSPAN=2
 input type=button name=submit value=Submit
onclick=javascript:validateForm();
 input type=Reset name=cmdReset value=Reset/td
/tr
/table
/center

 script LANGUAGE=JavaScript
  function validateForm(){
   if(document.form1.ani.value == ){
alert(Please enter an ANI);
return;
   }
   document.form1.submit();//This line generated error.  The
.submit() method is not supported.
  }
 /script
/form
nbsp;
%@ include file=footer.jsp%
/body
/html
//code end

Any help will be very much appreciated.

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


The information in this e:mail and any attachments or any 
reproduction of this e:mail in whatever manner is confidential 
and for the use of the addressee(s) only.  If you are not the 
addressee then the distribution, use or reproduction of this 
e:mail or the information within it is strictly prohibited and 
may be unlawful.  If received in error please advise the 
sender and delete all record of it from your system.  
Although believed to be virus free, accurate and complete,  
responsibility for any loss or cost arising from its receipt or 
use or its incomplete or inaccurate transmission is hereby 
excluded to the fullest extent possible.


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



Re: JSP question

2003-10-21 Thread epyonne
Thanks for the reply.  But this cannot be true.  If I leave the textbox
blank, I got the alert.  That means it is seeing the document.form1
object.  It just does not like the .submit() method which I can't understand
why.

Thanks.


- Original Message -
From: Walker Chris [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 10:45 AM
Subject: RE: JSP question


 Most likely document.form1 is not visible in the browser object model.
 There are various ways to address the form, but the most portable in this
 case is probably document.forms[0].

 Chris

 -Original Message-
 From: epyonne [mailto:[EMAIL PROTECTED]
 Sent: 21 October 2003 16:35
 To: Tomcat Users List
 Subject: JSP question


 Hello All,

 I am pulling my hair on this problem, and since there are many Java
experts
 on this mailing list, I hope someone can help me on this.

 I have a simple servlet that calls a JSP page where the user can enter a
 search value.  When the user clicks on the submit button, the search value
 will be passed back to the servlet for processing and display.  All these
 are running on Tomcat 4.1.24.

 Everything works fine until I added the form validation routine in the JSP
 page.  Initially, my input button type was submit.  I changed it to
 button and leave the submission to the form validation routine which is
in
 JavaScript.  Now, when I click on the button, I get the error message of:
 Object doesn't support this property or method
 at the line of code:
 document.form1.submit();

 Does anyone know why?  The following is code of the JSP page:
 //code begin--
 html
 head
 titleblah blah blah/title
 link rel=stylesheet href=css/standard.css type=text/css
 /head

 body
 form name=form1 method=POST action=
 center
 bPlease enter ANI for query:/bbrbr
 table
 tr
  tdANI/td
  tdinput type=text name=ani/TD
 /tr
 tr
  td/td
  td COLSPAN=2
  input type=button name=submit value=Submit
 onclick=javascript:validateForm();
  input type=Reset name=cmdReset value=Reset/td
 /tr
 /table
 /center

  script LANGUAGE=JavaScript
   function validateForm(){
if(document.form1.ani.value == ){
 alert(Please enter an ANI);
 return;
}
document.form1.submit();//This line generated error.  The
 .submit() method is not supported.
   }
  /script
 /form
 nbsp;
 %@ include file=footer.jsp%
 /body
 /html
 //code end

 Any help will be very much appreciated.


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



Re: JSP question

2003-10-21 Thread epyonne
Thank you Matt and Peter for the suggestion.  It works!!!


- Original Message -
From: Peter Guyatt [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 10:42 AM
Subject: RE: JSP question


 Hi There,

 Why dont you change the button back to a submit and then add a
 onSubmit='return validation();' to you form ?

 Thats what we do

 Eg.
 Script
 function valid () {
 if (document.form.val.value.length  1) {
 alert(Please enter a value);
 return false;
 }
 return true;
 }
 /Script

 form onSubmit=return valid();
 table
 tr
 td
 input type=text name=val
 /td
 td
 input type=submit
 /td
 /tr
 /table
 /form

 Thanks

 Pete

 -Original Message-
 From: epyonne [mailto:[EMAIL PROTECTED]
 Sent: 21 October 2003 16:35
 To: Tomcat Users List
 Subject: JSP question


 Hello All,

 I am pulling my hair on this problem, and since there are many Java
experts
 on this mailing list, I hope someone can help me on this.

 I have a simple servlet that calls a JSP page where the user can enter a
 search value.  When the user clicks on the submit button, the search value
 will be passed back to the servlet for processing and display.  All these
 are running on Tomcat 4.1.24.

 Everything works fine until I added the form validation routine in the JSP
 page.  Initially, my input button type was submit.  I changed it to
 button and leave the submission to the form validation routine which is
in
 JavaScript.  Now, when I click on the button, I get the error message of:
 Object doesn't support this property or method
 at the line of code:
 document.form1.submit();

 Does anyone know why?  The following is code of the JSP page:
 //code begin--
 html
 head
 titleblah blah blah/title
 link rel=stylesheet href=css/standard.css type=text/css
 /head

 body
 form name=form1 method=POST action=
 center
 bPlease enter ANI for query:/bbrbr
 table
 tr
  tdANI/td
  tdinput type=text name=ani/TD
 /tr
 tr
  td/td
  td COLSPAN=2
  input type=button name=submit value=Submit
 onclick=javascript:validateForm();
  input type=Reset name=cmdReset value=Reset/td
 /tr
 /table
 /center

  script LANGUAGE=JavaScript
   function validateForm(){
if(document.form1.ani.value == ){
 alert(Please enter an ANI);
 return;
}
document.form1.submit();//This line generated error.  The
 .submit() method is not supported.
   }
  /script
 /form
 nbsp;
 %@ include file=footer.jsp%
 /body
 /html
 //code end

 Any help will be very much appreciated.

 -
 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: JSP question [solved]

2003-10-21 Thread laurent marot
works fine written this way :

html
head
titleblah blah blah/title
link rel=stylesheet href=css/standard.css type=text/css
/head
body
script LANGUAGE=JavaScript
 function validateForm(){
  if(document.form1.ani.value == ){
   alert(Please enter an ANI);
   return;
  }
  document.form1.submit();
 }
/script
center
bPlease enter ANI for query:/bbrbr
form name=form1 method=POST action=
table
 tr
  tdANI/td
  tdinput type=text name=ani/td
 /tr
 tr
  td COLSPAN=2
   input type=button value=Send onclick=javascript:validateForm()
  /td
 /tr
table
/form
/body
/html
- Original Message - 
From: epyonne [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 5:35 PM
Subject: JSP question


 Hello All,

 I am pulling my hair on this problem, and since there are many Java
experts
 on this mailing list, I hope someone can help me on this.

 I have a simple servlet that calls a JSP page where the user can enter a
 search value.  When the user clicks on the submit button, the search value
 will be passed back to the servlet for processing and display.  All these
 are running on Tomcat 4.1.24.

 Everything works fine until I added the form validation routine in the JSP
 page.  Initially, my input button type was submit.  I changed it to
 button and leave the submission to the form validation routine which is
in
 JavaScript.  Now, when I click on the button, I get the error message of:
 Object doesn't support this property or method
 at the line of code:
 document.form1.submit();

 Does anyone know why?  The following is code of the JSP page:
 //code begin--
 html
 head
 titleblah blah blah/title
 link rel=stylesheet href=css/standard.css type=text/css
 /head

 body
 form name=form1 method=POST action=
 center
 bPlease enter ANI for query:/bbrbr
 table
 tr
  tdANI/td
  tdinput type=text name=ani/TD
 /tr
 tr
  td/td
  td COLSPAN=2
  input type=button name=submit value=Submit
 onclick=javascript:validateForm();
  input type=Reset name=cmdReset value=Reset/td
 /tr
 /table
 /center

  script LANGUAGE=JavaScript
   function validateForm(){
if(document.form1.ani.value == ){
 alert(Please enter an ANI);
 return;
}
document.form1.submit();//This line generated error.  The
 .submit() method is not supported.
   }
  /script
 /form
 nbsp;
 %@ include file=footer.jsp%
 /body
 /html
 //code end

 Any help will be very much appreciated.

 -
 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: JSP Question

2003-01-08 Thread Tim Moore
 -Original Message-
 From: Luc Foisy [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, January 08, 2003 1:54 PM
 To: Tomcat User List (E-mail)
 Subject: JSP Question
 
 
 
 I am trying to use %@ include file=filename %
 
 I am sending to the page that has this with the line: 
 response.sendRedirect(main.jsp?p=+applicationJar.getPageName());
 
 So in main.jsp I would like to include an external file to 
 insert into a default page, something like:
 
 SOME DEFAULT PAGE STUFF HERE
 %@ include file=filename %
 SOME DEFAULT PAGE STUFF HERE
 
 but I would like to replace filename with request.getParameter(p)
 
 Any one have any idea how to do this?

The %@ include % syntax is a static inclusion that happens at
translation time, so it can't depend on runtime parameters.

You want to use:
jsp:include page='%= request.getParameter(p) %'/
(see the JSP spec for details)

Be forewarned that you won't be able to access the enclosing page's
local variables from within the included page (as you can with static
includes), but if you add those variables to the request context you'll
be able to access them that way.

-- 
Tim Moore / Blackboard Inc. / Software Engineer
1899 L Street, NW / 5th Floor / Washington, DC 20036
Phone 202-463-4860 ext. 258 / Fax 202-463-4863


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




RE: JSP Question

2003-01-08 Thread Ricardo_Bosch
I may be referring to an oldschool version of tomcat but the include
directive occurs during compilation, not execution.  So to do what you want
you'd have to say
%  if(goo){%
%@ include file=filenameA %
%  }else{  %
%@ include file=filenameB %
%  }   %

or

do your thing the other way around and redirect to different pages with
SOME DEFAULT PAGE STUFF HERE incuded instead.

-rick

-Original Message-
From: Luc Foisy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 1:54 PM
To: Tomcat User List (E-mail)
Subject: JSP Question



I am trying to use %@ include file=filename %

I am sending to the page that has this with the line:
response.sendRedirect(main.jsp?p=+applicationJar.getPageName());

So in main.jsp I would like to include an external file to insert into a
default page, something like:

SOME DEFAULT PAGE STUFF HERE
%@ include file=filename %
SOME DEFAULT PAGE STUFF HERE

but I would like to replace filename with request.getParameter(p)

Any one have any idea how to do this?

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

application/ms-tnef--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


RE: JSP Question

2003-01-08 Thread Luc Foisy
Actually, after the post I figure using the %@ include filefilename % would be 
useless because it was static
So I started to look at %jsp:include ... \ for dynamic includes, and then soon 
realized it was more trouble that it was worth :)

So I have decided just to redirect to individual jsp pages based on 
applicationJar.getPageName() instead of including dynamic content in a common page

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 08, 2003 3:16 PM
 To: [EMAIL PROTECTED]
 Subject: RE: JSP Question
 
 
 I may be referring to an oldschool version of tomcat but the 
 include directive occurs during compilation, not execution.  
 So to do what you want you'd have to say
 %if(goo){%
 %@ include file=filenameA %
 %}else{  %
 %@ include file=filenameB %
 %}   %
 
 or
 
 do your thing the other way around and redirect to different 
 pages with SOME DEFAULT PAGE STUFF HERE incuded instead.
 
 -rick
 
 -Original Message-
 From: Luc Foisy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 08, 2003 1:54 PM
 To: Tomcat User List (E-mail)
 Subject: JSP Question
 
 
 
 I am trying to use %@ include file=filename %
 
 I am sending to the page that has this with the line:
 response.sendRedirect(main.jsp?p=+applicationJar.getPageName());
 
 So in main.jsp I would like to include an external file to 
 insert into a default page, something like:
 
 SOME DEFAULT PAGE STUFF HERE
 %@ include file=filename %
 SOME DEFAULT PAGE STUFF HERE
 
 but I would like to replace filename with request.getParameter(p)
 
 Any one have any idea how to do this?
 
 --
 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: JSP question

2002-03-28 Thread Jeff Larsen

Assuming you have a controller servlet that could load
the hint text from the database, why not have a static
hashtable in your servlet code that is initialized with
the values from the database in the init() method. Then
as each session is initialized, you could put a reference
to the hashtable in each session with

session.setAttribute(hints, hintTable);

Then you have access to the hints wherever you need them.

jsp:useBean name=hints class=java.util.Hashtable scope=session
...
input type=text name=myField onMouseOver=self.status='%=
(String)hints.get(myField) %'


Or better yet you could write a custom taglib...

mytags:textWithHint name=myField

and then do the hint lookup in the custom tag code. You could even have your
hashtable stored and initialized in the taglib code. Then your pages would
never need to know about it.

I hope these ideas help...

Jeff



- Original Message -
From: Michael Molloy [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, March 28, 2002 9:11 AM
Subject: JSP question


I'm working on a web application that will be used by about 150 people concurrently. 
One
of the requirements is to show text field hints in the status bar whenever the mouse
passes over a text field. All of the hints are stored in the database.

I need to write a class that will be available at the application level that returns 
some
javascript along with the correct hint for whatever field the mouse is currently over.
Since there are over 1000 fields in this web application, I'm looking for alternatives 
to
writing a class with a get method for each field.

What would work very well is if I could pass an argument in a getProperty call. For
example,

jsp:getProperty name=testBean property=hintText value=firstName /

That way, I could store the values in a hashtable and just get whatever one was 
requested.
Of course, I can't do that. I also can't set a property  then immediately call get
property to get the one I just requested in the set since the class is going to be 
shared
by all users.

Can anyone suggest a way to do this? I feel sure there must be a way, but I can't 
think of
it.

Thanks
--Michael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: jsp question about uploading images to a database

2002-02-01 Thread Marc Ostrow

http://www.servlets.com/cos/index.html

These classes will get you the upload part.

-Original Message-
From: Magnus Jansson [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 9:20 AM
To: [EMAIL PROTECTED]
Subject: OT: jsp question about uploading images to a database

I want to insert images into a database via http and jsp pages. Does anyone
have any experience or tips how to do that


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Jsp question

2001-06-28 Thread Matt Christensen

Two quick ideas:

1. Include in each of your forms a html hidden tag that has a name value
that will be common for each form, and a value dependent on the identity of
the form.  Then you can get from the request object the expected key value
and find the form.
input type=hidden name=FormVariable value=FormNumber2

2.  If every one of your forms has some sort of submit button, you can give
that button a common name for all forms, and a value dependent on the form
its a part of.
input type=submit name=FormVariable value=FormNumber1

Hope that helps,
Matt
- Original Message -
From: Fredrik Liden [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 28, 2001 1:44 PM
Subject: Jsp question


 Let's say I have multiple forms on a page.

 Does anyone know if I can retrive the name of the form that was submitted
 using the request object? or if there is any other way to find out.

 Thanks!

 Fredrik