Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing one project from another  RSS feed

 
Harry Wordsworth
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers.

I have what I think is a very basic question I need help on.
I am using Eclipse to write these files and will deploy them to Tomcat 8.

Lets say that I have two dynamic web projects and the accompanying files as listed below...

Project1
* index.jsp
* blue.jsp
* red.jsp

Project2
* index.jsp
* green.jsp


I have deployed both of these projects so they are both running (in eclipse)
What I want to do is to be able to, lets say in project1/blue.jsp, have a link so that I can click on it and bring up project2/green.jsp

I asked this in another forum but I think the folks there were confused by the simplicity of the Q and thought I was really asking about something much more complex than I am. It's an embarrassingly simple Q

Actually these are the questions I have....
1) What do I have to do in eclipse to project1 so that it allows me to call a jsp page in another running project

2) What would the actually call (or link) look like in blue.jsp to call green.jsp. An example would help.

3) This is all in eclipse but I want to export both projects to war files and deploy them to a standalone tomcat server, what change is needed for that


Any help appreciated.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My advice is to concentrate on the real world -- that is, the war files outside of eclipse. Spending time figuring out stuff inside the IDE is a waste of time.

When you have war files deployed to Tomcat, you'd simple use HTTP references just like any other. So yes, this is such as simple question that it's easy to see why people would be confused.

So, if you have one project deployed via fred.war, it'd be referenced via http://your-server.com/fred/path-to-resource just like any other URL. (Or, https if running on SSL.)



 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You also mentioned referencing the JSPs directly -- not a good idea. Do you not have an MVC structure for your application? If not, you should. And in that case, you'd be addressing the page controllers, not the JSPs.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!