>I am new to Java and am trying to figure out how to run a servlet
> without the need for a user to click a submit button. I have a web
> service that converts a file to PDF and then a servlet that displays
> the PDF file in the browser. Here is the code I have in the JSP:
[most of the code snipped]
> <FORM action="/IgRetConvClient/PDFDisplay" method="post">
> <INPUT type="submit" name="Submit" value="Display Image">
> </FORM>
[...]
> How can I run "/IgRetConvClient/PDFDisplay" without using "submit"?
The user has to somehow navigate to that URL. There are many ways to
this that don't involve clicking on a button labelled "Submit". One of them
is to type in the URL directly into the browser's address bar, for example.
- Oliver
dmckeon@ameritas.com - 14 Jun 2006 15:34 GMT
> >I am new to Java and am trying to figure out how to run a servlet
> > without the need for a user to click a submit button. I have a web
[quoted text clipped - 14 lines]
>
> - Oliver
All of the code I supplied is in a JSP. If the user navigates to the
JSP I need a way to run the servlet without them clicking "submit".
Can you give me some specific examples of how to do that?
Oliver Wong - 14 Jun 2006 15:58 GMT
>> >I am new to Java and am trying to figure out how to run a servlet
>> > without the need for a user to click a submit button. I have a web
[quoted text clipped - 18 lines]
> JSP I need a way to run the servlet without them clicking "submit".
> Can you give me some specific examples of how to do that?
Doesn't the user navigating directly to
http://[yourserver]/IgRetConvClient/PDFDisplay cause the servlet to run?
- Oliver
dmckeon@ameritas.com - 14 Jun 2006 16:02 GMT
> >> >I am new to Java and am trying to figure out how to run a servlet
> >> > without the need for a user to click a submit button. I have a web
[quoted text clipped - 23 lines]
>
> - Oliver
That's not the way it's structured or the way we need it to work.
dmckeon@ameritas.com - 14 Jun 2006 16:06 GMT
> >> >I am new to Java and am trying to figure out how to run a servlet
> >> > without the need for a user to click a submit button. I have a web
[quoted text clipped - 23 lines]
>
> - Oliver
I'm sorry -- I think I know what you mean. Are you suggesting I use a
redirect???
Oliver Wong - 14 Jun 2006 16:54 GMT
>> >> >I am new to Java and am trying to figure out how to run a servlet
>> >> > without the need for a user to click a submit button. I have a web
[quoted text clipped - 27 lines]
> I'm sorry -- I think I know what you mean. Are you suggesting I use a
> redirect???
Well, I wanted to get a yes-or-no answer to my question to check if my
assumptions were correct. Assuming they ARE correct, what I'm basically
saying is that there is virtually an infinite number of ways to get the
servelet to run, depending on what you want. All that needs to be done is to
ensure that the client eventually navigates to that link.
So you could use a form, or an <a href="/path/to/your/servlet"> link, or
a redirect, or javascript, or an applet, or a ShockWave flash animation, or
a Windows .url shortcut, etc.
- Oliver
christopher@dailycrossword.com - 15 Jun 2006 01:01 GMT
Google sometimes does it by having an <img> tag href to a servlet that
returns something unimportant to the browser. the <img> tag can have a
size 0 so it does not interrupt the page.
steen - 15 Jun 2006 10:28 GMT
> > >I am new to Java and am trying to figure out how to run a servlet
> > > without the need for a user to click a submit button. I have a web
[quoted text clipped - 18 lines]
> JSP I need a way to run the servlet without them clicking "submit".
> Can you give me some specific examples of how to do that?
Well if I understand you correctly, just make the following change to
your jsp :
<BODY onLoad="document.forms[0].submit();">
that will cause the form to auto-submit when your jsp is called. No
need for the user to hit a submit button.
(btw. this is more a javascript question)
/Steen
dmckeon@ameritas.com - 15 Jun 2006 15:23 GMT
> > > >I am new to Java and am trying to figure out how to run a servlet
> > > > without the need for a user to click a submit button. I have a web
[quoted text clipped - 29 lines]
>
> /Steen
<BODY onLoad="document.forms[0].submit();"> works like a charm!!!
Thanks so much (and sorry for posting in the wrong group)!