You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by kunjal shah <ku...@yahoo.com> on 2005/08/29 20:51:19 UTC

Struts-Layout DispatchAction problem.

Hello,
 
I am new to Struts Framework. I am developing a Struts based JSR 168 portlet on WepSphere Portal 5.1 platform. I needed some help with an error I am getting in designing a Tree based hierarchial View in the portlet. I am using Struts DispatchAction class to forward the user to the Tree based navigation. This is the jsp code fragment for this.
 
<html:form urlType="standard" action="Login.do">

Here I am calling the unspecified method in my DispatchAction class. 
This works fine and the tree is populated inside my Action class and displayed through a JSP (ActionForward). Now I am trying to associate action handling with the links within Tree View (MenuComponent)  doing something like this in my Action Class. 
 
channel.setLocation("Login.do?method=selectCMAForm&cellPointId=" + form.getChannel());
 
Here channel is my MenuComponent -- the last node within the tree..
This dosent seem to work and selectCMAForm method within the Action class is not called. I tried to call any outside link through my action class like 
channel.setLocation("http://www.google.com"); This works. 
 
I also tried to call my DispatchAction method directly through the jsp like
 
<html:form urlType="standard" action="Login.do?method=selectCMAForm&cellPointId=customer">
 
This also works and the selectCMAForm method is called. May be I am missing something here. I would appreciate any help or tips with this problem. I am using an ActionForm which is getting populated inside the Action class. 
Thanks
- Kunjal. 
 
 


		
---------------------------------
 Start your day with Yahoo! - make it your home page 

struts jsr 168 portlet URI problem WP 5.1

Posted by kunjal shah <ku...@yahoo.com>.
Hi,

I am new to the Struts Framework. I am developing a Struts based JSR 
168 portlet on WepSphere Portal 5.1 platform. I needed some help 
with an error I am getting in generating Portlet URI's within the 
struts Action class. I am using this method to generate struts 
action url mentioned in the Forwards and Redirect option of this 
page in WP 5.1 info center. 
http://publib.boulder.ibm.com/infocenter/wp51help/index.jsp?
topic=/com.ibm.wp.zos.doc/wps/wpstrsource.html#forwards 

PortletApiUtils portletUtils = PortletApiUtils.getUtilsInstance();
Object portletURI = null;
if (portletUtils != null)
{
// when run in a portlet use this execution path.
Object pResponse = portletUtils.getPortletResponse( 
(HttpServletRequest) req
uest );
try {
portletURI = portletUtils.createPortletURIWithStrutsURL(request, 
url);
// don't need to call response.encodeURL, the portletURI.toString 
takes care
 of that.
}
channel.setLocation(portletURI.toString());
Here channel is  a component within my portlet which has link to a 
struts ac
tion...

I am getting the following error when i try to run the jsr 168 
portlet within RAD WP 5.1 test environment..

[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 
java.lang.ClassCastException: 
com.ibm.wps.struts.pluto.base.WpsStrutsActionRequestWrapper
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
com.ibm.wps.standard.struts.portlet.PortletApiUtilsImpl.createPortlet
URI(PortletApiUtilsImpl.java:193)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
com.ibm.wps.standard.struts.portlet.PortletApiUtilsImpl.createPortlet
URI(PortletApiUtilsImpl.java:139)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
com.ibm.wps.standard.struts.portlet.PortletApiUtilsImpl.createPortlet
URIWithStrutsURL(PortletApiUtilsImpl.java:243)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
com.ibm.portal.struts.common.PortletApiUtils.createPortletURIWithStru
tsURL(PortletApiUtils.java:260)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
com.fmo.targetcontent.web.action.ViewCMAAction.createCMAFormTree
(ViewCMAAction.java:191)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
com.fmo.targetcontent.web.action.ViewCMAAction.execute
(ViewCMAAction.java:149)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
com.ibm.portal.struts.portlet.WpRequestProcessor.processActionPerform
(WpRequestProcessor.java:359)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
org.apache.struts.action.RequestProcessor.process
(RequestProcessor.java:274)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
com.ibm.portal.struts.portlet.StrutsPortlet.processActionPerformed
(StrutsPortlet.java:1655)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr     R 	at 
com.ibm.portal.struts.portlet.StrutsPortlet.processAction
(StrutsPortlet.java:1387)

I am getting this classCastException at this line 

portletURI = portletUtils.createPortletURIWithStrutsURL(request, 
url);

I have taken the code to creating Portlet URI straight from the 
infocenter..
 I would appreciate any help or tips with this problem...
Regards



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


Re: Struts-Layout DispatchAction problem.

Posted by kunjal shah <ku...@yahoo.com>.
I think I should try to explain my problem a little better. After
some debugging and searching I found out that my url generation
within portlet is the problem.. specifically

channel.setLocation("Login.do?method=selectCMAForm&cellPointId=" +
form.getChannel());

It just resets my TreeView but dosent call the Struts Action --
selectCMAForm()...

I found that I would need to use portlerResponse.encodeURL to
generate URL's within portlet. So I tried to do this.

channel.setLocation(response.encodeURL("/wps/myportal" +
request.getContextPath() + "/Login.do?
method=selectCMAForm&cellPointId=" + form.getChannel()));

But this also dosent seem to call the Struts Action (selectCMAForm)
from the Portlet. It does the same thing -- resets my TreeView. This
is the url generated by it in my browser window...

http://localhost:9081/wps/myportal/.CampaignManagement/Login.do?
method=selectCMAForm&cellPointId=customer

Also one thing is that when i looked in my portal logs i get this
strange error.. i hadnt noticed earlier..

2005.08.30 10:31:12.202 W com.ibm.wps.engine.Servlet doGet()
class
com.ibm.wps.state.nls.inputmediators.exceptions.NlsCannotInterpretSta
teException: Unspecified message ()

I would appreciate any help from anybody who has used Struts within 
JSR 168 portlet. I am having trouble calling Struts Actions from the 
portlet..

--- In struts@yahoogroups.com, kunjal shah <ku...@y...> wrote:
> Hello,
>  
> I am new to Struts Framework. I am developing a Struts based JSR 
168 portlet on WepSphere Portal 5.1 platform. I needed some help 
with an error I am getting in designing a Tree based hierarchial 
View in the portlet. I am using Struts DispatchAction class to 
forward the user to the Tree based navigation. This is the jsp code 
fragment for this.
>  
> <html:form urlType="standard" action="Login.do">
> 
> Here I am calling the unspecified method in my DispatchAction 
class. 
> This works fine and the tree is populated inside my Action class 
and displayed through a JSP (ActionForward). Now I am trying to 
associate action handling with the links within Tree View 
(MenuComponent)  doing something like this in my Action Class. 
>  
> channel.setLocation("Login.do?method=selectCMAForm&cellPointId=" + 
form.getChannel());
>  
> Here channel is my MenuComponent -- the last node within the tree..
> This dosent seem to work and selectCMAForm method within the 
Action class is not called. I tried to call any outside link through 
my action class like 
> channel.setLocation("http://www.google.com"); This works. 
>  
> I also tried to call my DispatchAction method directly through the 
jsp like
>  
> <html:form urlType="standard" action="Login.do?
method=selectCMAForm&cellPointId=customer">
>  
> This also works and the selectCMAForm method is called. May be I 
am missing something here. I would appreciate any help or tips with 
this problem. I am using an ActionForm which is getting populated 
inside the Action class. 
> Thanks
> - Kunjal. 
>  
>  
> 
> 
> 		
> ---------------------------------
>  Start your day with Yahoo! - make it your home page



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