Hi,

why does your forward "ShowList" forward to an action url? In good old Struts1 manner, this should not be necessary. Instead, i would implement place-list.jsp in such a way that it extracts all necessary information from the user's session. Your action PlaceAction should then prepare everything correctly so that place-list.jsp finds it. The same thing holds for place-details.jsp (and the forward named "Edit"): It should rely on the session state and that PlaceDetailsAction has prepared everything correctly. You only need to find a good way to maintain the correct information in the session. In Struts1, i would traditionally use a class extending ActionForm to accomplish this.

Unrelated to your problems but still relevant to Struts in general: If you are starting with Struts freshly anyway, why not use Struts2 instead? I would suggest to talk to your superiours and/or your customer to use Struts2. If you need to use it side-by-side with Struts1, this is also possible and you will find a lot of resources about how to do this in the net (or come back to this list anyway, the folks here usually are happy to help).

Robert

Peter Schmitt schrieb:
Hi,

I'm new to Struts, using version 1.2.4, so this might in fact be a
configuration problem...

Here's an extract from my struts-config.xml first:
    <action    path      = "/place"
                   type      = "de.isogmbh.srp.strutstest.client.PlaceAction"
               name      = "PlaceForm"
               scope     = "request"
               validate  = "true"
               input     = "/place.jsp"
               parameter = "do"
     >
        <forward name="ShowList" path="/place-list.do" />
    </action>
<action path = "/place-list"
                   type      = 
"de.isogmbh.srp.strutstest.client.PlaceDetailAction"
               name      = "PlaceForm"
               scope     = "request"
               validate  = "true"
               input     = "/place-list.jsp"
               parameter = "do"
     >
        <forward name="Edit" path="/place-details.do" />
    </action>

    <action   path      = "/place-details"
                  forward   = "/place-details.jsp" />

On the page place.jsp, the user can enter a place name. PlaceAction will
then load a list of all places with that name, to be displayed on
place-list.jsp. place-list.jsp has links to place-details.jsp, which shows
more information about one particular place. There is no JavaScript in my
JSP and no empty img tags.

PlaceAction and PlaceDetailAction are both subclasses of DispatchAction.
PlaceAction has a method showList, and PlaceDetailAction has a method
getPlace. Here's an extract of place.jsp:

                <html:form action="/place?do=showList">
                        <bean:message key="place.jsp.question"/>
                        <html:text property="name" size="30" />
                        <html:submit property="submit"><bean:message
key="place.jsp.search"/></html:submit>
                </html:form>

And here's an extract of place-list.jsp:
                                                        <html:link 
module="/place-details"
action="/place-details?do=getPlace" paramName="entry" paramProperty="id" paramId="placeId" >
                                                                <bean:write property="name" 
name="entry"/>
                                                        </html:link>

My Struts application is in a .war file running on Tomcat 5.0. When I
entered a place name on place.do (using Internet Explorer 6), I got a
NoSuchMethodException because PlaceDetailAction does not define a method
showList.

When I debugged the whole thing, I saw what happened: At the end of
PlaceAction.showList, I return mapping.findForward("ShowList"). That method
performs a kind of lookup in struts-config, where I said ShowList is a
forward to place-list.do. Now place-list calls PlaceDetailAction, where it
expects a method showList...

What am I doing wrong?



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

Reply via email to