Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot find bean in any scope

843838Nov 26 2006 — edited Jul 21 2008
Hi,

I am getting the following error
Cannot find bean allJobsForm in any scope. I need some help in trying to identify the problem. I have attached the strust action mapping, the JSP, and the action and form classes. Please have a look and assist me in solving this problem as it I am becoming really frustrated.

Warm Regards
Denzil



Action Mapping
<action
path="/secure/moshomo/search/GetAllJobsAction"
type="za.co.mpilo.moshomo.web.action.GetAllJobsAction"
name="allJobsForm"
scope="session"
input="/secure/CVHomeHR.do?p_content=/jsp/secure/moshomo/ms_recruiter_jobs.jsp"
unknown="false"
validate="true"
>
<forward
name="success"
path="/secure/CVHomeHR.do?p_content=/jsp/secure/moshomo/ms_recruiter_jobs.jsp"
redirect="false"
/>

JSP
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-nested" prefix="nested" %>
<%@ taglib uri="/tags/war-extranet" prefix="extranet" %>
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html-el" %>

<nested:root name="allJobsForm">
<div align="center">
<table width="80%" class="mstable" >
<thead>
<td>Posted Jobs</td>
</thead>
<tr>
<td>

<table width="100%" >
<tr class="mssubhead">
<td width="60%" ><font color="#160866">
Job Title
</font></td>
<td width="22%" align="center" ><font color="#160866">
Posted Date
</font></td>
<td width="18%" align="center" ><font color="#160866">
Expiration Date
</font></td>
</tr>
<tr>
<td width="80%" ><font color="#160866">
Job Description
</font></td>
</tr>


<nested:iterate property="all" id="ref" type="za.co.mpilo.moshomo.vo.JobVO">
<tr>
<td width="60%"><font color="#160866">
<nested:write name="ref" property="jobTitle"/>
</font></td>
<td width="22%"><font color="#160866">
<nested:write name="ref" property="postedDate"/>
</font></td>
<td width="18%"><font color="#160866">
<nested:write name="ref" property="expirationDate"/>
</font></td>
</tr>
<tr>
<td width="80%" align="center"><font color="#160866">
<nested:write name="ref" property="jobDescription"/>
</td>
</tr>
</nested:iterate>

<nested:empty property="all">
<tr>
<td colspan="3"><font color="#160866"> No results found. </font></td>

</tr>
</nested:empty>

</table>

</td>
</tr>

</table>
</div>
</nested:root>

Action Class
package za.co.mpilo.moshomo.web.action;

import java.util.HashMap;
import java.util.logging.Level;

import javax.ejb.FinderException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

import za.co.mpilo.common.web.action.CommonAction;
import za.co.mpilo.moshomo.interfaces.CVRepositoryManager;
import za.co.mpilo.moshomo.util.CVRepositoryManagerUtil;
import za.co.mpilo.moshomo.vo.CVVO;
import za.co.mpilo.moshomo.vo.SearchVO;
import za.co.mpilo.moshomo.vo.JobVO;
import za.co.mpilo.moshomo.web.form.AllJobsForm;
import za.co.mpilo.moshomo.web.form.AllTertiaryEducationForm;
import za.co.mpilo.moshomo.web.form.JobSearchForm;

/**
* @struts.action
* name="allJobsForm"
* path="/secure/moshomo/search/GetAllJobsAction"
* input="/secure/CVHomeHR.do?p_content=/jsp/secure/moshomo/ms_recruiter_jobs.jsp"
* scope="session"
* validate="true"
* redirect="false"
*
* @struts.action-forward
* name="success"
* path="/secure/CVHomeHR.do?p_content=/jsp/secure/moshomo/ms_recruiter_jobs.jsp"
*
*
* @version $Revision: 1.4 $
* @author $Author: denzilf $
* @date $Date: 2006/11/02 11:03:10 $
*
*/

public class GetAllJobsAction extends CommonAction{

public ActionForward execute(ActionMapping mapping, ActionForm f, HttpServletRequest request, HttpServletResponse response) throws Exception {

if ( getLogger().isLoggable(Level.INFO) )
getLogger().info( "execute" );

ActionForward result = mapping.getInputForward();
ActionMessages errors = new ActionMessages ();
AllJobsForm form = (AllJobsForm) f;

try {
//vo.setAllORany( form.getAllORany());
//vo.setMatch( form.getMatch());
//vo.setSearchText(form.getSearchText());
String uid = request.getUserPrincipal().getName(); //logged in user
CVRepositoryManager manager = CVRepositoryManagerUtil.getHome( getIntialProperies() ).create();
HashMap jobs = manager.findAllJobsPerUserId(uid);
form.setAll( jobs.values() );
result = mapping.findForward( "success" );
}
catch (Exception xe) {
if ( getLogger().isLoggable(Level.WARNING) )
getLogger().log( Level.WARNING , xe.getMessage() , xe );
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general" ) );
}
if ( !errors.isEmpty() )
saveErrors( request , errors );

return result;
}

}


Form
package za.co.mpilo.moshomo.web.form;

import java.util.Collection;

import org.apache.struts.validator.ValidatorForm;

import za.co.mpilo.moshomo.vo.JobVO;

/**
* @struts.form
* name="allJobsForm"
*/

public class AllJobsForm extends ValidatorForm {

private int selection;
private Collection all;

public JobVO[] getAll() {
JobVO[] array = new JobVO[all.size()];
all.toArray( array );
return array;
}
public void setAll(Collection all) {
this.all = all;
}
public int getSelection() {
return selection;
}
public void setSelection(int selection) {
this.selection = selection;
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2008
Added on Nov 26 2006
9 comments
2,061 views