You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by santhosh <sa...@eximsoft.com> on 2003/03/14 08:06:02 UTC

forwarding to servlet

Hello everybody,

In struts i want to forward to a servlet than a jsp.  So in struts-config.xml how to configure it.  if it is jsp we configure like following for e.g 
 <forward name="list" path="/list.jsp"/>   lik this i want to forward to a servlet.  how to give the path.  i have a servlet which i can call from the browser like the following.

http://127.0.0.1:8080/dvdapp2/action      .  and i have configured in web.xml like the following.  

<servlet>
      <servlet-name>error</servlet-name>
      <servlet-class>hansen.playground.error</servlet-class>
  </servlet>
  
  <servlet-mapping>
      <servlet-name>error</servlet-name>
      <url-pattern>/action</url-pattern>
  </servlet-mapping>


Now if i configure like this  <forward name="error" path="/dvdapp2/action"/>       exception if  FileNotFoundException.  



please help me out in this.


Thanx with regds
santhosh hegde A

ServletException: Cannot find bean element in scope null

Posted by Karl <ka...@webartjapan.com>.
I'm getting an exception [ServletException: Cannot find bean element in scope 
null] when I try to access form data from a jsp page.

I've got the following code in my action class:

public final class ContractsSearchAction extends ContractBaseAction {

    public ActionForward perform(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

        ContractForm workForm = (ContractForm)form;

        ContractsSearchCommand cmd = new ContractsSearchCommand();
        // Would do some setting here for criteria from workForm
        cmd.execute();

        ContractListForm outForm = new ContractListForm();
        outForm.setContracts(cmd.getContracts());

        request.setAttribute("contractListForm", outForm);
		
        return (mapping.findForward("results"));
    }
}


The JSP page it goes to has the following:

                <logic:iterate id="element" name="contractListForm" 
property="contracts" type="data.ContractBDO">
                    <tr>
                        <td>
                            <bean:write name="element" property="fullName"/>
                        </td>
                        <td class="button">
                            <html:form action="contract_select.do" 
name="contractForm" type="view.ContractForm">
                                <html:hidden name="element" property="id"/>
                                <html:submit value="Edit"/>
                            </html:form>
                        </td>
                    </tr>
                </logic:iterate>


The exception is:

javax.servlet.ServletException: Cannot find bean element in scope null
        at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:530)
        at 
org.apache.jsp.contracts_list_jsp._jspService(contracts_list_jsp.java:71)
... and so on


What am I doing wrong here?


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org