Neven,
First of all, I'd like to thank you for all the help. I can say I have
learned a great deal through this experience. To clarify, the choice of
using tomcat for this was not mine. I am trying to lend a hand to a
professor of mine. This specific exercise is in his Unix class. For some
reason he thinks tomcat or at least every time he mentioned this exercise
to me he made reference to apache tomcat, is meant to be used in the
exercise. The exercise is on hosting a web page with perl scripts/cgi. So
in his instructions it's clearly using apache on Ubuntu. So he mentioned to
me that he was having trouble with the exercise and asked if I maybe I had
any idea. I'm not in his class, but I love working in linux and more
importantly helping out wherever I can. So I took it upon myself to try to
learn the material in this exercise and re-write the instructions, but now
I see there was some confusion on his part.But thank you for pointing me in
the right direction. * I did not package the cgi script in WAR file, this
is most likely the reason it is not working. If you don't mind I would like
to work on your JSP code and see if maybe I could write to separate guides
for his class, one for the cgi scipt on apache and another for tomcat using
JSP. One more thing:
"Your ProjectAnalysis.html will have the following form action URL, e.g.
<form action="http://localhost:8080/YOURAPP/cgi-bin/project.cgi";
method="post">
</form>?"
since it was an example I assume I have to list the whole path for the
project .cgi :

<FORM METHOD=POST ACTION="
http://localhost:8080/home/luis/tomcat/apache-tomcat-8.0.0-RC5/webapps/web
/WEB-INF/cgi-bin/project.cgi">


-once again thanks for all the help


On Tue, Nov 19, 2013 at 11:09 PM, Neven Cvetkovic <neven.cvetko...@gmail.com
> wrote:

> Felipe,
>
> As noted in the web.xml comments, in order to make cgi-servlet working, you
> need to package cgi scripts with your web application (e.g. yourapp.war):
>
> "Common Gateway Includes (CGI) processing servlet, which supports execution
> of external applications that conform to the CGI spec requirements.
>  Typically, this servlet is mapped to the URL pattern "/cgi-bin/*", which
> means that any CGI applications that are executed must be present within
> the web application..."
>
>
> So, if you deployed your webapp as
> /home/luis/tomcat/apache-tomcat-8.0.0-RC5/webapps/YOURAPP
>
>
> You will need the following files in your YOURAPP folder:
>
> WEB-INF/cgi/project.cgi
> WEB-INF/cgi/subparseform.lib
> ProjectAnalysis.html
>
> Your ProjectAnalysis.html will have the following form action URL, e.g.
>
> <form action="http://localhost:8080/YOURAPP/cgi-bin/project.cgi";
> method="post">
> ...
> </form>
>
>
> Make sure that both <servlet> and <servlet-mapping> are uncommented.
>
> Read more details about CGI support here:
> http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html
>
>
> Now, more important questions for you:
>
> Why are you using Tomcat and CGI support in Tomcat? If you are not
> deploying Java applications, what's the point of using Tomcat, why not just
> use Apache web server (httpd)?
>
> Why are you using subparseform.lib? It would be so much cleaner to use
> JSP+Servlet code for that ... provided you have nice JSP/Java development
> environment, etc...
>
> The easiest to develop (also "terrible" way to do it) is to use just JSPs
> and code all your logic, calculations etc... in JSP itself.
>
> For example, e.g.
>
>
> CATALINA_HOME/webapps/YOURAPP:
>
> ProjectAnalysis.html
> projects.jsp
>
>
> ----begin projects.jsp----
> <html>
> <body>
> <h1>Results</h1>
> <%
>
>   String projcost = request.getParameter("projcost");
>   String projects = request.getParameter("projects");
>   String revenue = request.getParameter("revenue");
>
>   double projcostValue = Double.parseDouble(projcost);
>   double projectsValue = Double.parseDouble(projects);
>   double revenueValue = Double.parseDouble(revenue);
>
>   double average = projcostValue / projectsValue;
>   double grossprofit = revenueValue - projcostValue;
>
> %>
>
> <p>Project Cost Last Year was $projcost dollars.</p>
>
> <p>We completed <%= projectsValue %> projects during the year.  That works
> out to an average of <%= average %> cost per project.</p>
>
> <p>Our annual Project Revenue was <%= revenueValue %> dollars. We made a
> gross profit of <%= grossprofit %> dollars</p>
> </body>
> </html>
>
> ----end projects.jsp----
>
>
> Or something like that ... now, I don't guarantee for the correctness of
> the JSP code, since I just typed it here and not actually tried it out and
> tested, but you get the idea...
>
> You really should ask yourself - why Tomcat and not some other simpler
> webserver?
>
> Good luck!
> n.
>



-- 
Luis Felipe Hernandez

Reply via email to