Hi Eduardo,
Thanks for replying
But since JSWDK1.0.1 is a reference implementation of JSP, there is no harm
in testing the JSP codes in it.
Kindly try to provide an answer to my problem.
sunil roy
----- Original Message -----
From: "Eduardo Pelegri--Llopart" <[EMAIL PROTECTED]>
To: "Sunil Roy" <[EMAIL PROTECTED]>
Sent: Thursday, September 14, 2000 1:10 AM
Subject: Re: jsp tags ( useBean & include)
> JSWDK is an old product. You should be using one of the newer
> containers, like tomcat's 3.1 (@ jakarta.apache.org)
>
> - eduard/o
>
>
> > Sunil Roy wrote:
> >
> > 1) <jsp:useBean ...... > tag
> > **************************
> > I have tried to use this tag in JSP (using JSWDK .0.1)
> > & getting an error message that the Bean class is not found.
> >
> > The code that I have used is as follows:
> > a) for the JSP page
> >
> > <jsp:useBean id="stat" class="StatBean">
> > <%
> > double[] mynums = {100, 250, 150, 50, 450};
> > stat.setNumbers(mynums);
> > %>
> > </jsp:useBean>
> > <HTML>
> > <BODY>
> > The average of
> > <%
> > double[] numbers = stat.getNumbers();
> > for (int i=0; i < numbers.length; i++) {
> > if (i != numbers.length)
> > out.print(numbers[i] + ",");
> > else
> > out.println("" + numbers[i]);
> > }
> > %>
> > is equal to <jsp:getProperty name="stat" property="average"
> > />
> > </BODY>
> > </HTML>
> >
> > b) for the Bean ( StatBean), the code is as follows :
> >
> >
> > import java.util.*;
> >
> > public class StatBean {
> > private double[] numbers;
> >
> > public StatBean() {
> > numbers = new double[0];
> > }
> >
> > public double getAverage() {
> > double sum = this.getSum();
> > if (sum == 0)
> > return 0;
> > else
> > return sum/numbers.length;
> > }
> >
> > public double getSum() {
> > double sum = 0;
> > for (int i=0; i < numbers.length; i++)
> > sum += numbers[i];
> > return sum;
> > }
> >
> > public double[] getNumbers() {
> > return numbers;
> > }
> >
> > public double getNumbers(int index) {
> > return numbers[index];
> > }
> >
> > public void setNumbers(double[] numbers) {
> > this.numbers = numbers;
> > }
> >
> > public void setNumbers(int index, double value) {
> > numbers[index] = value;
> > }
> >
> > public int getNumbersSize() {
> > return numbers.length;
> > }
> > }
> >
> > *******************************************************************
> > 2) <jsp:include .... > tag
> > *************************
> >
> > With JSWDK 1.0.1, I am getting an error message(against the first line
> > of the following code) that the include tag is unterminated & the code
> > does not get compiled.
> >
> > <jsp:include page="two.jsp" flush="true">
> > <jap:param name="attribute1" value="value1"/>
> > <jap:param name="attribute2" value="value2"/>
> > </jsp:include>
> >
> >
> > Instead of the above code, if I replace the first line by
> >
> > <jsp:include page="two.jsp" flush="true"/>
> >
> > then the code does get compiled but there is no use since the
> > parameters do not get passed.
> >
> > Pl. inform if it is due to a bug in JSWDK 1.0.1 or some other reason.
> > Pl. inform the remedy urgently.
> >
> > Also, pl. inform if there are any more such problems while using
> > syntacticaly correct codes or if there are any bugs in JSWDK 1.0.1
> >
> > Also, pl. inform if there are any problems faced if I use JSP instead
> > of Servlets for Server side Programming.
> >
> > Thanks.
> >
> > sunil roy
> >
> >
> >
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets