Dear all,
>
> I have already asked the two following questions in JSP-interest but
without any answers. I hope someone will be able to help me.
Thanks for any help
Bertrand
>
QUESTION 1 : FORWARD PROBLEM
***********************************************
> I have a default html page with a login. When submitted, the following
> servlet doPost function is in charge of
> 1) generating the Bean which will create the needed results for JSP
> 2) forward to the appropriate JSP Page.
>
> I am running on NT, JDK 1.2.2 and JSWDK 1.01
>
> The problem is :
> When doPost is called, the system crashed (Dr Watson) when it reaches
> rd.forward(req,res).
> All the code linked to the HelperBean has been tested separately and is
> ok.
> The target page ("home.jsp") is in examples/jsp/BugTrackerJSP/home.jsp
> and the url used for the request dispatcher is :
> /jsp/BugTrackerJSP/home.jsp
>
> Here is some code of the servlet and of the target jsp.
>
Servlet
--------------
> public synchronized void doPost (HttpServletRequest
> req,HttpServletResponse res) throws ServletException,IOException {
>
> res.setContentType("text/html");
>
> String command = req.getQueryString();
> Hashtable parms = new Hashtable(20);
> String parmName;
> String parmValue;
> session = req.getSession(true);
> HelperBean hb;
> Hashtable results;
>
> // get the parameters
> for (Enumeration e =
> req.getParameterNames();e.hasMoreElements();) {
> parmName = (String) e.nextElement();
> parmValue = req.getParameter(parmName);
> parms.put(parmName,parmValue);
> }
>
> //determine the command
> if (parms.get("Transaction")!=null) {
> command = (String)parms.get("Transaction");
> }
>
> //get the Helping JavaBeans
> // return the class to instantiate
> String helperBeanName =
> utilities.ResourcesManager.getResource(command);
>
> try {
> Class c = Class.forName(helperBeanName);
> hb = (HelperBean)c.newInstance();
> // send the parameter to HelperBean
> results = hb.execute(parms);
> // results should contain target(JSP) and Vector for
> target
> session.putValue("INResults",results);
> String url = (String)results.get("JSPTarget");
> System.out.println("Target received : "+url);
> ServletContext sc = getServletContext();
> System.out.println("Context get");
> RequestDispatcher rd = sc.getRequestDispatcher(url);
> System.out.println("dispatcher received");
> rd.forward(req,res);
> System.out.println("forward done");
> } catch (ClassNotFoundException cne) {
> error(cne.getMessage());
>
> } catch (InstantiationException ie) {
> error(ie.getMessage());
> } catch (IllegalAccessException iae) {
> error(iae.getMessage());
> }
> }
>
home.jsp
---------------
<%@ page session="true" import="java.util.*" errorPage="error.jsp" %>
<HTML>
<LINK rel="stylesheet" type="text/css"
href="../BugTRacker/BugTrackerStyleSheet.css"/>
<HEAD>
<TITLE>Bug Tracker Home Page </TITLE>
</HEAD>
<BODY>
<%
Hashtable in = (Hashtable)session.getValue("INResults");
session.putValue("UserID",in.get("UserID"));
%>
<DIV id=head class="header">
Welcome to bug tracker!
</DIV>
<DIV id=menu class="menu">
<A
HREF="BugTrackerServlets.SmartServlet?Transaction=REPORTBUG">Report a bug or
a proposed enhancement </A>
<BR>
<A
HREF="BugTrackerServlets.SmartServlet?Transaction=UPDATESTATUS">Update the
status of an item</A>
</DIV>
</BODY>
</HTML>
QUESTION 2 : Policy problem
************************************
I am looking to establish a rmi connection from a servlet.
A)
I launch my rmi server and the binding is just ok. I have grant the
following entries in jre/lib/security/java.policy
grant {
permission java.net.SocketPermission
"*:1024-65535","connect,accept,resolve";
permission java.net.SocketPermission "*:80","connect";
};
B) when calling my servlet from the browser, I get the following exception
from the servlet:
Error executing method java.security.AccessControlException: access denied
(java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
The jre/lib/security/java.policy is ok. I have also tried to create my own
policy file mypolicy.properties and
modifiy the startserver.bat of JSWDK so that the call is like : java
-Djava.security.manager -Djava.security.policy=mypolicy ....
My question is how to set the policy file to be used by JSWDK when running
servlets.
Thanks for giving me pointers.
Bertrand
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html