aspose file tools*
The moose likes Struts and the fly likes  No bean found under attribute key currentMessage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark " No bean found under attribute key currentMessage" Watch " No bean found under attribute key currentMessage" New topic
Author

No bean found under attribute key currentMessage

Sumanth Singh
Greenhorn

Joined: Oct 12, 2011
Posts: 10
HI,

I am getting this Application raised following Error: "No bean found under attribute key currentMessage" error when I click on hyperlink below while iterating through a list in SentMessages.jsp

SentMessages.jsp:
<logic:iterate name="searchMessagesForm" property="pagingOptions.pageObjectsList" id="currentMessage" length="10">
<td>
<a href="searchMessages.do?operation=viewSentMessage&messageId=${currentMessage.messageId}">
<bean:write name="currentMessage" property="subject"/>
</a>

</td>

The data for the row appears. But when i click the hyperlink that is the anchor tag. The control goes into searchMessages action mapping defined in struts-config.xml which directs to SearchMessagesAction class and to the method viewSentMessages() which retrives a list of values from Database based on messageID provided in the anchor tag.

struts-config.xml

<action path="/searchMessages"
type="messages.SearchMessagesAction"
name="searchMessagesForm"
scope="request"
parameter="operation"
validate="false"
>
<forward name="sentMessage" path="/WEB-INF/jsp/SentMessage.jsp"/>
</action>

SearchMessagesAction.java

public ActionForward viewSentMessage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
try
{
logger.info("Entering 'Sent Messages View' action method");
SearchMessagesForm searchMessagesForm = (SearchMessagesForm) form;

Messages message = MessagesBD.getInstance().findMessagesById(searchMessagesForm.getMessageId());

User currentUser = (User) request.getSession().getAttribute(EdrsConstants.USER);
request.getSession().setAttribute(EdrsConstants.DISPLAY_MODE, "VIEW_SEARCHED_MESSAGE");

logger.info("Exiting 'Sent View Message' action method");
return mapping.findForward("sentMessage");
}
catch (Exception e)
{

ActionMessages errors = new ActionMessages();
errors.add(Globals.ERROR_KEY, new ActionMessage("error.detail", e.getMessage()));
saveErrors(request, errors);
return mapping.findForward("ErrorPage");
}
}


As per the mapping in method viewSentMessage should take me to SentMessage.jsp But it takes to Global Error.jsp stating

Application raised following Error: "No bean found under attribute key currentMessage"

Can anyone help me find the solution?

Thanks,
Sumanth
Sumanth Singh
Greenhorn

Joined: Oct 12, 2011
Posts: 10
Solved this problem.

I guess i made it really complicated. It happened because of JSP Syntax errors in SentMessage.jsp hence when trying to open this it was unable to hence it threw this error.

Thanks,
Sumanth
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No bean found under attribute key currentMessage