To All in the group:
Please Help. I have spent 8 hours but to no success in trying to make a
servlet call a JSP.
I was able to call the JSP but there was no answer ..
Help
class Foo
{
String s[];
public Foo(String s[])
{
this.s=s;
}
public String [] getList()
{
return s;
}
}
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Serve extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
String s[]=new String[]{"blue","red","green"};
Foo f=new Foo(s);
request.setAttribute("foo",f);
getServletContext().getRequestDispatcher("/web-inf/servlets/hello/foo.jsp").
forward (request, response);
}
}
<html>
<jsp:usebean name=foo type=Foo lifespan=page>
</usebean>
<ul>
<loop property=foo:list propertyelement=x>
<li>My name is <display property=x>
</loop>
</ul>
</html>
all these 3 files are in the same directory .
The Serve servlet is in examples web-inf/servlets
while the Foo.java and foo.jsp is in web-inf/servlets/hello/
When the servlet calls the JSP , it is succesfull(no error) but nothing is
display
why????
I have followed everything as the JSP FAQ of esperanto ?
Question 2) How do u set the path for servlet. Eg if I tried to put
Foo.java and foo.jsp in
examples/ directory then when i execute the servlet it will report
that
no class
def found hello/Foo. How can I set classpath for startserver.
Thanks for all your help.
rowan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html