Solved

executing code in jsps

Posted on 2003-10-23
8
172 Views
Last Modified: 2010-04-01
Hi
I am trying to run some jsp pages but although the html appears the jsp code does not run

I am running both Apache and IIS - do I need to have Tomcat running as well? which version should i be downloading...there seem to be a whole raft of choices as to what to download; which one should I download and install - do I need to install more than one file?
thanks
0
Comment
Question by:lz7cjc
  • 4
  • 3
8 Comments
 
LVL 12

Expert Comment

by:ahosang
ID: 9605933
we'd have to see your jsp code. What's not running?
0
 

Author Comment

by:lz7cjc
ID: 9606779
here you go - there are two pages

first page:
<html>
<head>
<title>
Adding up two numbers - JSP Example 2
</title>
</head>
<body>
<h1>
Adding up two numbers - JSP Example 2
</h1>
<p>
<form method=GET action="http://www.scit.wlv.ac.uk/jsp/home/staff/acad/jphb/public_html/sst/jsp/ex2.jsp">
<p>
<table>
<tr><td>Enter first number<td> <input type=text name="n1">
<tr><td>Enter second number<td> <input type=text name="n2">
<tr><td> <td><input type=submit value="Calculate sum">
</table>
</body>
</html>


calls this page:
<html>
<head>
<title>
JSP Example 2
</title>
</head>
<body>
<h1>JSP Example 2</h1>
<%
      String      sn1;
      String      sn2;
      int n1,n2;
      sn1 = request.getParameter("n1");
      sn2 = request.getParameter("n2");
      n1 = Integer.parseInt(sn1);
      n2 = Integer.parseInt(sn2);
      out.println("The numbers were " + sn1 + " and " + sn2);
      out.println("<br>");
      out.println("The sum is " + (n1+n2));
%>
</body>
</html>

and only "JSP Example 2" prints out on the page
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9606865
Yes.  You do need to have a Servlet container running (eg. Tomcat).

Tomcat 4 is a good stable release (http://jakarta.apache.org/tomcat/index.html)

It's a 4.1.27 at the moment.

I've always found the Tomcat installation process quite painless, but I've not tried to link it with Apache or IIS (I currently run it standalone).

To start with, I'd recommend you do the same and simply let it run on it's default port of 8080.

Without the container, your JSP will just be displayed as HTML (as you are finding) ;-)

Your JSP page will need to appear under a directory in the Tomcat "webapps" directory in order for Tomcat to find it (and compile and run it).

Good luck ;-)

Jim.
0
 

Author Comment

by:lz7cjc
ID: 9606887
thanks I have follow up questions but will post different questions for them
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:lz7cjc
ID: 9606897
however I do need to know what I am meant to be downloading since there seem to be a whole host of options under downloads
thanks
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9606940
You are absoultely right.  They've changed the site since my last download and it's a real mess now.

Give me a few minutes and I'll get back to you with a link.

Jim.
0
 
LVL 15

Accepted Solution

by:
jimmack earned 125 total points
ID: 9606972
OK,

Go to the binaries download page:

http://jakarta.apache.org/site/binindex.cgi

I think you want the following link:

http://mirrors.ccs.neu.edu/Apache/dist/jakarta/tomcat-4/binaries/jakarta-tomcat-4.1.27.exe

This is the "4.1.27 exe" link from the following section:

Tomcat 4.1.27 KEYS

    * 4.1.27 zip PGP MD5
    * 4.1.27 tar.gz PGP MD5
    * 4.1.27 exe PGP MD5

Jim.


(I'm not very impressed with their new layout.  Surely it would make more sense to have the basic distros listed first!)
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9607011
I've sent an e-mail to the webmaster asking if they wouldn't mind changing the layout ;-)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now