skip to Main Content

I have a website which most of it is written in .jsp .
It runs very well on eclipse(using apache tomcat),but when I uploaded the website to my rented server,it’s just showing me the html code and prints the javascript as text.The server runs windows and uses plesk web host 12.5.
I have defined the MIME type for jsp,yet i don’t know how to run the javascript code,or how to enable tomcat.

for example: logout.jsp

<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>MySite</title>
</head>
<body>
<%
    session.setAttribute("Status",null);
    session.setAttribute("Name", null);
    session.setAttribute("mail", null);
    response.sendRedirect("home.jsp");
%>
</body>
</html>

this is what it is showing me,instead of redirecting me to the homepage.

any help would be welcome

btw,if you haven’t noticed,i am pretty new to the idea of actually uploading websites,until now i ran the websites i wrote in the IDE.

2

Answers


  1. Most of the website hosting services don’t support Java related technologies (such as JSP). This is the most obvious reason why you get your scriptlet back as piece of HTML code.

    Check your web-hosting info. The Java code support is sometimes provided as an additional functionality for a separate surcharge.

    Login or Signup to reply.
  2. JSP is not like PHP. The code needs to be loaded into a special archive called a WAR file, and specifically loaded using the management interface or configuration file of your servlet container (ie. Tomcat, Glassfish, etc…)

    Also, JSP is a program that generates HTML, so the MIME type your server produces is HTML.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search