You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeroen Breedveld <je...@x-hive.com> on 2004/09/29 14:40:56 UTC

ServletException using html:link tag

Hi all,

I'm trying to create a link to an action using the Struts' html:link tag
like this:

<html:link action="getSearchResults" name="SearchActionForm"
scope="request">test2</html:link>

However when I load the jsp containing this l get the following
exception:

[ServletException
in:/WEB-INF/jsp/repository/collection-resource-search-results.jsp]
Cannot cast to Map for name=SearchActionForm property=null
scope=request' 

When I disable the link and print some debug output from the
requestscope I get this:

request:
SearchActionForm=DynaActionForm[dynaClass=SearchActionForm,formFilledOut
=true,ftsQuery=,typeMappingId=,metadataFields={docato-title=,docato-modi
fier=},includeSchemaMappings={IModule},id=0,collectionUri=]

So there is a bean called SearchActionForm in the requestscope from the
class DynaActionForm which has a getMap() method returning a
java.util.Map.

Can someone please tell me what's causing this ServletException? I'm
using Struts 1.1 on Tomcat 5.0.19

Thanks in advance,

Jeroen

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


RE: ServletException using html:link tag

Posted by Jeroen Breedveld <je...@x-hive.com>.
Hi, 

 || -----Original Message-----
 || From: bmf5@daimlerchrysler.com [mailto:bmf5@daimlerchrysler.com] 
 || Sent: woensdag 29 september 2004 15:10
 || To: Struts Users Mailing List
 || Subject: Re: ServletException using html:link tag
 || 
 || 
 || 
 || If I'm understanding your problem and if you have a 
 || getMap() method in SearchActionForm I think you need to add 
 || property="map" to your html:link

I think the html:link looks for the getter of the property 'map' (getMap())
by default so this shouldn't be necessary, but if I do it anyway like this:

  <html:link action="getSearchResults" name="SearchActionForm"
scope="request" property="map">test2</html:link>

I get the following exception: 

[ServletException
in:/WEB-INF/jsp/repository/collection-resource-search-results.jsp] No getter
method for property map of bean SearchActionForm

Now I don't understand this as well because SearchActionForm is a
DynaValidatorForm which extends from DynaActionForm which has a getMap()
method, so that should be the getter for the property 'map', right?

regards,

Jeroen


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


Re: ServletException using html:link tag

Posted by bm...@daimlerchrysler.com.






"Jeroen Breedveld" <je...@x-hive.com> wrote on 09/29/2004 08:40:56 AM:

> Hi all,
>
> I'm trying to create a link to an action using the Struts' html:link tag
> like this:
>
> <html:link action="getSearchResults" name="SearchActionForm"
> scope="request">test2</html:link>
>
> However when I load the jsp containing this l get the following
> exception:
>
> [ServletException
> in:/WEB-INF/jsp/repository/collection-resource-search-results.jsp]
> Cannot cast to Map for name=SearchActionForm property=null
> scope=request'

If I'm understanding your problem and if you have a getMap() method in
SearchActionForm I think you need to add
property="map" to your html:link


>
> When I disable the link and print some debug output from the
> requestscope I get this:
>
> request:
> SearchActionForm=DynaActionForm[dynaClass=SearchActionForm,formFilledOut
> =true,ftsQuery=,typeMappingId=,metadataFields={docato-title=,docato-modi
> fier=},includeSchemaMappings={IModule},id=0,collectionUri=]
>
> So there is a bean called SearchActionForm in the requestscope from the
> class DynaActionForm which has a getMap() method returning a
> java.util.Map.
>
> Can someone please tell me what's causing this ServletException? I'm
> using Struts 1.1 on Tomcat 5.0.19
>
> Thanks in advance,
>
> Jeroen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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