Hi all,
thank you very much for the help. I have imported the jst.jar into VAJ 3.
However I am a little uncertain about how I should use sun's callPage()
method as I have been using javax etc... Please forgive me but could you
possibly look at my code attached and see how I could implement the callPage
functionality into my existing class? The method I want to use the callPage
method is in the performTask() method.
Thanks in advance
Marc
~~~~CODE BLOCK~~~~~~~~~~~~~~~~~~~~~
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import lotus.domino.*;
import com.sun.server.*;
/**
* Insert the type's description here.
* Creation date: (09/03/2000 16:56:11)
* @author:
*/
public class NelsonEmailException extends HttpServlet{
private static java.util.ResourceBundle resEmailException =
java.util.ResourceBundle.getBundle("EmailException"); //$NON-NLS-1$
/**
* MarcsMail constructor comment.
*/
public NelsonEmailException() {
super();
}
/***************************************************************************
**
* Process incoming HTTP GET requests
*
* @param request Object that encapsulates the request to the servlet
* @param response Object that encapsulates the response from the
servlet
*/
public void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)throws ServletException,
IOException
{
performTask(request, response);
}
/***************************************************************************
**
* Process incoming HTTP POST requests
*
* @param request Object that encapsulates the request to the servlet
* @param response Object that encapsulates the response from the
servlet
*/
public void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)throws ServletException,
IOException
{
performTask(request, response);
}
/***************************************************************************
**
* Returns the requested parameter
*
* @param request Object that encapsulates the request to the servlet
* @param parameterName The name of the parameter value to return
* @param checkRequestParameters when true, the request parameters are
searched
* @param checkInitParameters when true, the servlet init parameters are
searched
* @param isParameterRequired when true, an exception is thrown when the
parameter cannot be found
* @param defaultValue The default value to return when the parameter is not
found
* @return The parameter value
* @exception java.lang.Exception Thrown when the parameter is not found
*/
public java.lang.String getParameter(javax.servlet.http.HttpServletRequest
request, java.lang.String parameterName, boolean checkRequestParameters,
boolean checkInitParameters, boolean isParameterRequired, java.lang.String
defaultValue) throws java.lang.Exception
{
java.lang.String[] parameterValues = null;
java.lang.String paramValue = null;
// Get the parameter from the request object if necessary.
if (checkRequestParameters)
{
parameterValues = request.getParameterValues(parameterName);
if (parameterValues != null)
paramValue = parameterValues[0];
}
// Get the parameter from the servlet init parameters if
// it was not in the request parameter.
if ( (checkInitParameters) && (paramValue == null) )
paramValue =
getServletConfig().getInitParameter(parameterName);
// Throw an exception if the parameter was not found and it was
required.
// The exception will be caught by error processing and can be
// displayed in the error page.
if ( (isParameterRequired) && (paramValue == null) )
throw new Exception(parameterName + " parameter was not
specified.");//$NON-NLS-1$
// Set the return to the default value if the parameter was not
found
if (paramValue == null)
paramValue = defaultValue;
return paramValue;
}
public void performTask(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse res)throws ServletException,
IOException
{
try
{
javax.servlet.http.HttpSession session =
request.getSession(true);
String to = getParameter(request, "to", true, true,
true, null);//$NON-NLS-1$
String message = getParameter(request, "message",
true, true, true, null);//$NON-NLS-1$
Session s =
NotesFactory.createSession(resEmailException.getString("host"),resEmailExcep
tion.getString("userName"),resEmailException.getString("password"));
//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
DbDirectory dir = s.getDbDirectory(null);
Database db = dir.openMailDatabase();
DocumentCollection dc = db.getAllDocuments();
res.setContentType("text/html");//$NON-NLS-1$
ServletOutputStream out = res.getOutputStream();
out.println("<html>");//$NON-NLS-1$
out.println("<head><title>Nelson eBusiness Email
Exception Servlet</title></head>");//$NON-NLS-1$
out.println("<body>");//$NON-NLS-1$
out.println("<h1>Mail Database
Stats</H1>");//$NON-NLS-1$
out.println("<P>The Host is: " +
resEmailException.getString("host") + "</P>");
out.println("<P>The User Name is of "+
resEmailException.getString("userName") + "</P>");
out.println("<P>The Password is : " +
resEmailException.getString("password") + "</P>");
out.println("<P>Mail database : " +
db.getTitle() + " is " + ((int)(db.getSize()/1024)) + "KB long
</P>");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
out.println("<P>The Mail database has " +
dc.getCount() + " documents</P>");//$NON-NLS-2$//$NON-NLS-1$
out.println("</body></html>");//$NON-NLS-1$
//HELP!!!
//callPage("/MyJSP.jsp",res);
Document memo = db.createDocument();
memo.appendItemValue("Form",
"Memo");//$NON-NLS-2$//$NON-NLS-1$
memo.appendItemValue("Subject", "Test - please reply
if you get this");//$NON-NLS-2$//$NON-NLS-1$
RichTextItem rti =
memo.createRichTextItem("Body");//$NON-NLS-1$
rti.appendText(message);
memo.setSignOnSend(true);
memo.sign();
memo.send(true, to);
s.recycle();
s = null;
}
catch (NotesException ex)
{
ex.printStackTrace();
}
catch (Exception theException)
{
theException.printStackTrace();
}
}
}
~~~END CODEBLOCK
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 24 March 2000 02:40
To: Marc Krisjanous
Subject: Re: WebSphere and the callPage method
Hi Marc,
Try to retrieve and import the com.sun.server;http package the
HttpServiceResponse class belongs to, which implements the callPage() method
You should find this package in the lib/jst.jar file of your WebSphere
installation
Best whishes
===========================================================================
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