This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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

Win a copy of Head First Android this week in the Android forum!
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: 16901

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.

Customer surveys are for companies who didn't pay proper attention to begin with.
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!