Solved

executing code in jsps

Posted on 2003-10-23
8
175 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:lz7cjc
ID: 9606887
thanks I have follow up questions but will post different questions for them
0
 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 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