0

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.

lior
  • 155
  • 9
  • JSP's will run on an application server and looks like you have placed it on your webserver which actually loads your page as it is like html. So you should have a application server(tomcat,etc..) to render and load your jsp page – Pathfinder May 16 '17 at 16:55
  • 1
    Tomcat is not just a web server. It's a **servlet container**, and that's critical for running a JSP-based site. You need a host that supports the Java J2EE web server spec(s). – Pointy May 16 '17 at 16:55
  • Please refer to this [answer](http://stackoverflow.com/a/15865337/5513005) , it might help you. – Yash Karanke May 16 '17 at 16:56

2 Answers2

0

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.

Zhannur Diyas
  • 87
  • 1
  • 1
  • 10
0

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.

le3th4x0rbot
  • 2,493
  • 23
  • 32