How can I send a parameter from my Action to my jsp?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, August 11, 2005 11:04 AM

Hello, I am having problems in sending a parameter from my action to my jsp. I want to know what I gotta do to get the parameter in the jsp. My action is the following: public class ListaColecaoAction extends Action{ public ActionForward execute ( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { List lista = ColecaoService.getInstance().getColecaoList(); request.setAttribute("col", lista); return mapping.findForward("ok"); } } As you see, I did a "request.setAttribute("col", lista   More>>

Hello,

I am having problems in sending a parameter from my action to my jsp. I want to know what I gotta do to get the parameter in the jsp.

My action is the following:


public class ListaColecaoAction extends Action{
public ActionForward execute (
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {

List lista = ColecaoService.getInstance().getColecaoList();
request.setAttribute("col", lista);
return mapping.findForward("ok");

}
}


As you see, I did a "request.setAttribute("col", lista);", but it doesn't seem enough.

I am trying to get it in my jsp with a logic:iterate like this:










but it gives me the error "cannot find bean col in scope request". I know the problem is only regarding the parameter, because when I put a scriplet to call the method in the jsp, is worked perfectly. But I don't wanna use the scriplet.

What do I gotta do to make ir work? What if I want to use JSTL (c:forEach)?

Thank you all

   <<Less

Re: How can I send a parameter from my Action to my jsp?

Posted By:   alan_do  
Posted On:   Thursday, August 11, 2005 01:38 PM

add this to the top of your jsp:


About | Sitemap | Contact