www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > Java
    (NOT JavaScript!)

    Java
    (NOT JavaScript!)
    For discussion of the Java programming language as it applies to the Web ( Not JavaScript ).

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 09-25-2004, 04:46 PM
    Frank1984 Frank1984 is offline
    User
     
    Join Date: Sep 2004
    Posts: 85
    Java redirect script

    Hi

    I found this script:


    <script language='JAVASCRIPT' type='TEXT/JAVASCRIPT'>
    <!--
    if ((navigator.appName=="Microsoft Internet Explorer") || (navigator.appName=="Netscape"))
    {
    if (navigator.appName=="Microsoft Internet Explorer")
    window.location = "pc/index.htm";
    else
    window.location = "pc/index.htm";
    }
    else
    window.location = "phone/index.htm";
    //--></script>


    Unfortunately, it's in Javascript and I need it in Java.

    Does anybody know the Java code for this Javascript code?

    Thanks
    Reply With Quote
      #2  
    Old 09-25-2004, 07:06 PM
    ray326's Avatar
    ray326 ray326 is offline
    Got Link?
     
    Join Date: Nov 2003
    Location: Jerryville, Tejas
    Posts: 11,741
    It would look something like this:
    Code:
    <%
    if (request.getHeader("user-agent").indexOf("MSIE") > -1)
        response.sendRedirect("pc/index.htm");
    else if (request.getHeader("user-agent").indexOf("Firefox") > -1)
        response.sendRedirect("pc/index.htm");
    else
        response.sendRedirect("phone/index.htm");
    %>
    Reply With Quote
      #3  
    Old 09-26-2004, 04:51 AM
    Frank1984 Frank1984 is offline
    User
     
    Join Date: Sep 2004
    Posts: 85
    It doesn't seem to work, look:

    http://www.voordeligewebsites.com/mpoints/

    Does anybody know what I am doing wrong?

    Thanks!
    Reply With Quote
      #4  
    Old 09-26-2004, 09:21 AM
    Khalid Ali's Avatar
    Khalid Ali Khalid Ali is offline
    Super Moderator
     
    Join Date: Dec 2002
    Location: Calgary, Canada
    Posts: 8,948
    rays suggestion above presumes that you have a server that understands jsp tags and is a servlet container...the above code should work from any web server that supports jsp/servlet technologies.
    __________________
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources
    Reply With Quote
      #5  
    Old 09-26-2004, 11:59 AM
    Frank1984 Frank1984 is offline
    User
     
    Join Date: Sep 2004
    Posts: 85
    Quote:
    Originally posted by Khalid Ali
    rays suggestion above presumes that you have a server that understands jsp tags and is a servlet container...the above code should work from any web server that supports jsp/servlet technologies.
    Well, it looks like my server doesn't support this. Do you guys know any other code that would work?

    Thanks in advance for your efforts!
    Reply With Quote
      #6  
    Old 09-26-2004, 01:11 PM
    Khalid Ali's Avatar
    Khalid Ali Khalid Ali is offline
    Super Moderator
     
    Join Date: Dec 2002
    Location: Calgary, Canada
    Posts: 8,948
    try finding out that if your server supports PHP(Iam guessing it does).If it does then post your question in PHP and you will be all set.
    __________________
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources
    Reply With Quote
      #7  
    Old 09-26-2004, 01:59 PM
    Frank1984 Frank1984 is offline
    User
     
    Join Date: Sep 2004
    Posts: 85
    Well, the problem is it has to be Java. This is why:

    I'm working with a client who's in the UMTS business. I have to create for him two different sites that will be accesible on one domainname. So I have to use a redirect script.

    The problem is these UMTS phones only support Java and HTML. So I have to use Java to redirect the user to the right website.

    So, when a PC is visiting the website he will be directed to the big website and when a UMTS phone is visiting the website he will be directed to the small website.

    So I need a Java applet that sais that when you are visiting the site with the IE or with Netscape you'll go to the big site, otherwise you'll go to the other site. What also would be good is that when you are visiting with a screen resolution less than 640 x 480 you go to the small site and otherwise you go to the bg site.

    Several days now I'm looking on the internet for the right applet and I could not find it. I promised my client that I would implement such a Java redirect script so I really hope you guys can help me out.

    Thanks!
    Reply With Quote
      #8  
    Old 09-26-2004, 02:01 PM
    IncaWarrior's Avatar
    IncaWarrior IncaWarrior is offline
    God
     
    Join Date: Jul 2003
    Posts: 728
    you have something against opera?
    __________________
    - God
    Reply With Quote
      #9  
    Old 09-26-2004, 02:12 PM
    JPnyc's Avatar
    JPnyc JPnyc is offline
    Administrator
     
    Join Date: May 2004
    Location: Manhattan NY
    Posts: 5,818
    Yep. Most of em are in Italian. I'm not fluent in Italian.
    Reply With Quote
      #10  
    Old 09-26-2004, 02:48 PM
    ray326's Avatar
    ray326 ray326 is offline
    Got Link?
     
    Join Date: Nov 2003
    Location: Jerryville, Tejas
    Posts: 11,741
    Quote:
    Originally posted by Frank1984
    Well, the problem is it has to be Java. This is why:

    I'm working with a client who's in the UMTS business. I have to create for him two different sites that will be accesible on one domainname. So I have to use a redirect script.

    The problem is these UMTS phones only support Java and HTML. So I have to use Java to redirect the user to the right website.

    So, when a PC is visiting the website he will be directed to the big website and when a UMTS phone is visiting the website he will be directed to the small website.

    So I need a Java applet that sais that when you are visiting the site with the IE or with Netscape you'll go to the big site, otherwise you'll go to the other site. What also would be good is that when you are visiting with a screen resolution less than 640 x 480 you go to the small site and otherwise you go to the bg site.

    Several days now I'm looking on the internet for the right applet and I could not find it. I promised my client that I would implement such a Java redirect script so I really hope you guys can help me out.

    Thanks!
    One way or the other the client hits this web site with a web browser. This detection and redirection must be done on the server side in order to eliminate the need for Javascript or Java applet capabilities on the browser. If your client brings this page up as a JSP running on Tomcat then my solution will work and it will be the cheapest, most robust way to satisfy your stated requirement. It will also keep them in their Java comfort zone although exactly the same thing could be accomplished by ANY server-side technology; PHP, ASP, CGI, etc.
    Reply With Quote
      #11  
    Old 09-28-2004, 12:15 PM
    Frank1984 Frank1984 is offline
    User
     
    Join Date: Sep 2004
    Posts: 85
    Quote:
    Originally posted by ray326
    It would look something like this:
    Code:
    <%
    if (request.getHeader("user-agent").indexOf("MSIE") > -1)
        response.sendRedirect("pc/index.htm");
    else if (request.getHeader("user-agent").indexOf("Firefox") > -1)
        response.sendRedirect("pc/index.htm");
    else
        response.sendRedirect("phone/index.htm");
    %>
    So if my server support the stuff you mentioned above, then all I have to do is put the script above in the header of an html document and it should work.
    Reply With Quote
      #12  
    Old 09-29-2004, 01:03 AM
    ray326's Avatar
    ray326 ray326 is offline
    Got Link?
     
    Join Date: Nov 2003
    Location: Jerryville, Tejas
    Posts: 11,741
    Yea, any JSP should do for that. You can do it with any server-side technology; the ASP or PHP versions would look very little different. It just depends what you've got available on that particular server. Since we're talking Java here that's why I did it with JSP.

    Last edited by ray326; 09-29-2004 at 01:07 AM.
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:20 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.