Solved

executing code in jsps

Posted on 2003-10-23
8
174 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Google always has something new and amazing up its sleeve, and the most current thing that they have been working on is another step in the evolution of Google Search, from machine learning to its brilliant successor, deep learning.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

778 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