File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes dynamic link for internet and intranet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "dynamic link for internet and intranet" Watch "dynamic link for internet and intranet" New topic

dynamic link for internet and intranet

mark fritschen

Joined: Jul 26, 2001
Posts: 2
Hi I use a dynamic include for my top "header" (by header I mean many urls that pertain to either internal or external users) of my web page, and I use
String agent = request.getRemoteAddr();
to get either a intranet header or internet header,
but, if inside the body I have a link that I want to go to either internet or genet users when it is clicked.
What would be the best way to do this?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Well, there's no absolute answer for that, since your "intranet" can be implemented as a WAN over the Internet. In practice, depending on how things are mapped, you might be able to test the incoming ip address, or failing that, the domain name of the incoming request.

An IDE is no substitute for an Intelligent Developer.
Sam Dalton
Ranch Hand

Joined: Jul 26, 2001
Posts: 170
Create a custom tag that you pass the URLs to (to intranet URL and the internet URL).
This URL can test the ip address and output the correct URL for the user. Better still put the URL in a scripting variable and use that on the page.
For more help on Tags and Scripting variables, check ot the JavaOne presentations on my website (

<a href="" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of []Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
I agree. Here's the link:
subject: dynamic link for internet and intranet
It's not a secret anymore!