If this has been covered, my apologies. I get the following errors during execution:
[24/Apr/2002:18:39:31] failure (11000): Internal error: servlet service function had thrown ServletException (uri=/sentinel/myReportStats.do): javax.servlet.ServletException: No parameter qResults was included in this request, stack: javax.servlet.ServletException: No parameter qResults was included in this request I've attached my action servlet, the relevant jsp file and my struts-config file. Can someone tell me why the "qResults" parameter does not exist when the jsp is executed? Thanks, ajTreece
package com.sun.sentinel.action; import com.sun.eras.common.dice.*; import com.sun.eras.common.logging.LogManager; import com.sun.eras.common.logging.Logger; import com.sun.sentinel.dice.GetMyReportStats; import com.sun.sentinel.form.MyReportStatsForm; import java.io.IOException; import java.sql.Connection; import java.util.ArrayList; import java.util.Hashtable; import java.util.Locale; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; public final class MyReportStatsAction extends Action { private static Logger logger = LogManager.getLogger(); public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { /* Extract attributes we will need */ Locale locale = getLocale(request); MessageResources messages = getResources(); HttpSession session = request.getSession(); /* Validate the request parameters specified by the user */ ActionErrors errors = new ActionErrors(); /* Execute query via Dice Engine */ try { DiceEngine engine = DiceManager.getEngine(); GetMyReportStats cmd; cmd = new GetMyReportStats((String)session.getAttribute("UserID")); engine.executeCommand(cmd); MyReportStatsForm[] lst = cmd.getRequests(); logger.trace("length="+lst.length); request.setAttribute("qResults", lst); } catch(Exception ex) { System.out.println("Item was not found"); } return (mapping.findForward("myReportStats")); } }
<%@ page language="java" %> <%@ taglib uri="/WEB-INF/tlds/tiles.tld" prefix="tiles" %> <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> <bean:parameter id="results" name="qResults"/> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"> <logic:iterate id="myReports" name="qResults"> <TR> <TD ALIGN="left"> <bean:write name="myReports" property="customerName"/> ( <bean:write name="myReports" property="totalReports"/> ) </TD> </TR> </logic:iterate> </TABLE>
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <!-- This is the Struts configuration file for the example application, using the proposed new syntax. NOTE: You would only flesh out the details in the "form-bean" declarations if you had a generator tool that used them to create the corresponding Java classes for you. Otherwise, you would need only the "form-bean" element itself, with the corresponding "name" and "type" attributes. --> <struts-config> <!-- ========== Data Source Configuration =============================== --> <!-- <data-sources> <data-source> <set-property property="autoCommit" value="false"/> <set-property property="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <set-property property="maxCount" value="5"/> <set-property property="password" value="l8ngu8ge"/> <set-property property="url" value="jdbc:oracle:thin:@mcnealy.central.sun.com:1521:DEV"/> <set-property property="user" value="www"/> </data-source> </data-sources> --> <!-- ========== Form Bean Definitions =================================== --> <form-beans> <!-- Logon form bean --> <form-bean name="logonForm" type="com.sun.sentinel.form.LogonForm"/> </form-beans> <!-- ========== Global Forward Definitions ============================== --> <global-forwards> <forward name="logoff" path="/logoff.do"/> <forward name="logon" path="logon.page"/> <forward name="createReport" path="create.report.page"/> <forward name="myReportStats" path="/home/myReportStats.jsp"/> <forward name="failure" path="forward.example.failure.page"/> </global-forwards> <!-- ========== Action Mapping Definitions ============================== --> <action-mappings> <!-- Process a user logoff --> <action path="/logoff" type="com.sun.sentinel.action.LogoffAction"> <forward name="success" path="/index.jsp"/> </action> <!-- Process a user logon --> <action path="/logon" type="com.sun.sentinel.action.LogonAction" name="logonForm" scope="request" input="logon.page"> </action> <!-- Create a new report --> <action path="/createReport" type="com.sun.sentinel.action.LogonAction" name="logonForm" scope="request" input="createReport.page"> </action> <!-- Process a user logoff --> <action path="/myReportStats" type="com.sun.sentinel.action.MyReportStatsAction" scope="request"> <forward name="success" path="/home/myReportStats.jsp"/> </action> </action-mappings> <!-- ========== Associated Request Processor settings =================== --> <!-- Here we specified the tiles processor --> <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" /> <!-- ========== Associated Message Resources settings =================== --> <!-- Not used by tiles or this website, but needed due to a bug in actual Struts version --> <message-resources parameter="org.apache.struts.example.tiles.dev1-1.ApplicationResources" null="false" /> </struts-config>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>