I have a JSP page called ftplogin.jsp
I want the jsp page to call a ftpbean using session scope.
It will pass server, username and login into the ftpbean.
It will then set the directory and finaly retrieve a a document from it.
The ftpbean works but my jsp page doesn't. Please help with compilation problem???
Please also tell me if the syntax of accessing the bean is correct?
<!-- ftplogin.jsp -->
<html>
<head>
<title> FTP Login </title>
</head>
<body>
<%@ page import= "ftp.* " %>
<jsp:useBean class="ftp.FtpBean" id="ftpbean" scope="session" />
<%
try
{
String servername = request.getParameter("serverName");
String username = request.getParameter("username");
String password = request.getParameter("password");
ftpbean.ftpConnect(servername, username, password);
}
catch(Exception e)
{
%>
Sorry but your must have entered an incorrect login ingotmation.
You are not allowed to login.
Please leave the ftp portal.
<%
}
%>
<h1> Welcome to the FTP Login. </h1>
<FORM ACTION="ftplogin.jsp" METHOD=post>
Please login
Enter name of server:
<input type="text" name="servername"><br>
Enter user name?
<input type="text" name="username"><br>
Enter password
<input type="text" name="password"><br>
<input type="submit" name="Submit info">
</FROM>
<%=
try
{
// set the directory
ftpbean.setDirectory("/home/eland/u6/k3074/w0109699/simple-bean");
}
catch(Exception e)
{
System.out.println(e);
}
%>
<%=
try
{
// Get the binary file '???' and save it to hard disk
// the name will be 'local_file_name' .
ftpbean.getBinaryFile("accessbean.jsp", "local_file_name", this);
}
catch(Exception e)
{
System.out.println(e);
}
%>
<%=
try
{
ftpbean.close();
}
catch(Exception e)
{
System.out.println(e);
}
%>
</body>
</html>
Location: /myJSPs/jsp/grid-portal-project/ftplogin.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:110: Missing term.
out.print(
^
C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:110: ')' expected.
out.print(
^
C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:120: Missing term.
}
^
C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:120: ';' expected.
}
^
C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:121: Invalid expression statement.
);
^
5 errors, 1 warning
at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)
at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)
at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)
at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Thread.java:536)