Hi,
I have linux based hosting. I need to upload and work the jsp/servlet pages. after i uploaded the files into the hosting, when i checked the files , it shows the code itslef. How to fix this. Please help me. Thanks in advance.
Hi,
I have linux based hosting. I need to upload and work the jsp/servlet pages. after i uploaded the files into the hosting, when i checked the files , it shows the code itslef. How to fix this. Please help me. Thanks in advance.
Short diagnosis and what likely happened: the server is sending the JSP/servlet source as plain text because no Java servlet container is processing the request (or the files were uploaded to a location served directly by Apache/nginx). As noted, a servlet container is required; as pointed out, web applications are normally packaged and deployed rather than just copied as loose files. The gap many hosts have is that shared Linux hosting often does not run a JVM or servlet container by default.
Quick checklist (practical next steps):
Confirm whether the hosting plan explicitly supports Java/servlets or offers a servlet container. If not, options are: get a Java-enabled plan, move to VPS/container hosting, or run a standalone Java process (embedded server) if the host allows background processes.
If a servlet container exists, deploy the app as a proper webapp. Typical layout:
myapp/
index.jsp
WEB-INF/
web.xml
classes/com/example/HelloServlet.class
lib/*.jar Create a WAR with Maven/Ant/IDE (example: mvn package) or jar -cvf myapp.war * and drop it in the container's deployment directory or use its manager.
Troubleshooting tips:
Put a tiny test JSP in the application, for example:
<%@ page contentType="text/html" %>
<% out.println("JSP OK"); %> If this still shows source, the request is not reaching a servlet container. Check HTTP headers (Content-Type), server logs (Tomcat/Jetty logs, e.g., catalina.out), and file permissions. Look for Java version mismatch errors ("Unsupported major.minor") if compiled classes were uploaded.
Security and final notes: avoid uploading code with secrets. If the current host cannot run a JVM, switching to a Java-capable host or a small VPS is the simplest, guaranteed fix.
Jump to Post— peter_budo 2,532You need to install one of the Java container or as they often called Java servers. Most common Tomcat,
by just uploading a source code file, it won't become anything else but a source code file. what you want to do is build your application into a war and deploy it on one of the Java containers Peter mentioned.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.