This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes integrating servlet application into a website Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "integrating servlet application into a website" Watch "integrating servlet application into a website" New topic
Author

integrating servlet application into a website

Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
I have finished my servlet application, and now all that remains is to link it with my friends website, because we developed them independently of each other. How do i integrate the two?
Thanks.


"Human beings can alter their lives by altering their state of mind" William James
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

Adewale,
It's just an HTML link, right? Or are you trying to integrate the two more tightly?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
Jeanne that's the problem, i'm not sure how to link the two. I don't know whether i should bring my friends HTML pages into my own platform(tomcat) or if a simple HTML link would work.
How do you think i can integrate the two?
Rajesh Agarwal
Ranch Hand

Joined: Aug 01, 2005
Posts: 79
Is your friends application also a servlet based application... or just a static html site.

If it is servlet based, then you can build the war file again, including his files.
Ola Daniel
Ranch Hand

Joined: Jul 27, 2005
Posts: 105
Yu donot necesarily need to rebuild your web archive to include his pages. A simple HTML link will do the trick of shooting you from one web context to the other. On the other hand if you intend to share some variables like user names, database names, connections etc... then its another matter entirely and you will need another approach...

State your problem clearly let us know exactly what yu are thinking and what the challenge is...


SCJP 1.4, SCWCD 1.4
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler et al, Refactoring: Improving the Design of Existing Code, 1999
Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
My friends website is simply made up of static HTML pages and his resources .I'm not sure whether to copy all his files into my WAR and then build.It's basically an online database system i wrote using jbuilder.
Users are meant to be able to access my servlet application from my webmasters site, via a link, but since this is a servlet application and not static HTML pages, im not sure if a simple hyperlink would do the trick,since there's a server(tomcat) involved and tomcat has to start to run the application....so is there any special way of linking so that everything runs seamlessly, or do i just use hyperlinks?
Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
Hello all, this is just to let you guys know that i just tried a hyperlink from my webmasters page to the index page of my servlet. The index page of my servlet showed, but after logging in, and pressing submit, the following happened:
1. i got a page not found error
2. in the address bar, the address there started from c:\ and had no reference to tomcat or any port 8080//localhost.

I hope this will give you all an idea of what i'm up against
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

Adewale,
Since your friend's page is on the Internet, you can use a URL that begins with "http://". That way it will be obvious you want a web page and not a local file.
Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
Jeanne, its not on the internet, it's on a local system.Both of them must be uploaded together. i have compiled the servlet into a WAR file, it's just to establish a link so that when i click on a button in the webmasters page, it launches my servlet.
Thats all.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
I am assuming your server can host servlets/JSP. i.e. Do you have tomcat or another similar container up and running? What is the URL associated with the submit button in your form?


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
and tomcat has to start to run the application...

I am a little confused... But it is almost lunch time, and I am occasionally prone to simple confusion this time of day. Are you saying that you want some type of link that will actually start the tomcat server and then link to your application?

If tomcat is already running, you should be able to link to it just fine with hyperlonks from the static HTML pages that your colleague has created. If tomcat is not yet running, you will get the 404 file not found error.


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
My tomcat is running, but anytime i type http://localhost:8080/notapWebModule/loginservlet.html in IE where notapWebModule
is a WAR file containing everything pertaining to my application under the webapps directory , i get a connection failed error. I can't even view it in a browser, much less link to it.
Funnily i dont have this problem in jbuilder.
And yes, is it possible to have a link from a static HTML page to a servlet such that it actually starts the server and loads my application, or must tomcat be running in the background for a hyperlink to work?
Thankx.
Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
Sounds like you need to integrate functionalities developed by 2 independent developers (Am i correct?)

If the functinalities should be logically together, you better merge the artifacts into one war file. No point separating stuffs that should be go together.

Would it be possible if you post the actual stack trace or error message because i'm not sure of what you mentioned by "connection failed error"?

And yes, is it possible to have a link from a static HTML page to a servlet such that it actually starts the server and loads my application, or must tomcat be running in the background for a hyperlink to work?


This is a very confusing question. If you have a hyperlink that point to a servlet, and you expected the servlet to actually response to your request, then the servlet container (web container) of course need to be started and listen to a particular port. So, ya, you need the tomcat be running for the hyperlink to work.


SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
 
GeeCON Prague 2014
 
subject: integrating servlet application into a website