struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kalcevich" <DKalcev...@mercuryinsurance.com>
Subject RE: NEWBIE: difficulties getting simple no bean page working...
Date Thu, 12 Feb 2004 18:45:10 GMT

I was thinking more of something like this:

<action    path="/webAppDev/actions/search1"
    	       type="org.apache.struts.actions.ForwardAction"
    	       parameter="/webAppDev/strutsSearch.jsp">
</action>

But hey, whatever works. :-)

Daniel



-----Original Message-----
From: Timothy Stone [mailto:citylists@petmystone.com] 
Sent: Thursday, February 12, 2004 10:22 AM
To: Struts Users Mailing List
Subject: Re: NEWBIE: difficulties getting simple no bean page working...

Daniel Kalcevich wrote:

> If you do not want to use a FormBean and your action solely calls a
> success page, maybe you could use the Forward Action build into
Struts.
> Then it would do a forward directly to the JSP page.
> 

Daniel,

Thanks. So I edited my struts-config.xml:

 > Step 4. Update struts-config.xml
 >
 >      <action-mappings>
 >          <action path="/webAppDev/actions/search1"
 >                  type="webAppDev.SearchAction1"
 >                  name="noBean"
 >                  scope="request"
 >                  input="/webAppDev/strutsSearch.jsp"
 >		   forward="/webAppDev/SearchEngines">
 >              <!-- <forward name="success"
 >        	             path="/webAppDev/SearchEngines"/> -->
 >          </action>
 >      </action-mappings>
 >

And it started working. I assume this is what you described.

However, what's wrong with the first attempt? I have been pouring over 
the archives, the how-tos, and the documentation. My syntax appears 
correct, it is even shown in examples as a working action-mappings
element.

I really would like to understand this. Blindly leaving the problem 
means I may face it again without the context, of "why?".

Many thanks,
Tim



> 
> -----Original Message-----
> From: Timothy Stone [mailto:citylists@petmystone.com] 
> Sent: Thursday, February 12, 2004 9:15 AM
> To: struts-user@jakarta.apache.org
> Subject: NEWBIE: difficulties getting simple no bean page working...
> 
> List,
> 
> I'm a Struts newbie with a lot of general hours in Tomcat. I want to 
> advance my development with Struts 1.1 and Model 2.
> 
> In an applied Struts scenario I have performed the following:
> 
> Followed closely the suggestions for integrating Struts into an
existing
> 
> web application. I did do one thing that deviated, I moved all of the 
> Struts TLDs into a subdirectory of WEB-INF (tlds/) per my usual 
> development/deployment practice (I did correct the web.xml to reflect 
> this move.)
> 
> However, I'm having a helluva time getting a very simple application
to 
> use Struts (I applying the Struts model to a development sandbox I
use).
> 
> Step 1. Add servlet and servlet-mapping to web app web.xml
> 
>      <servlet>
>          <servlet-name>action</servlet-name>
>          <servlet-class>
>              org.apache.struts.action.ActionServlet
>          </servlet-class>
>          <init-param>
>              <param-name>config</param-name>
>              <param-value>
>                /WEB-INF/struts-config.xml
>              </param-value>
>          </init-param>
>          <load-on-startup>1</load-on-startup>
>      </servlet>
>      ...
> 
> 
>      <servlet-mapping>
>          <servlet-name>action</servlet-name>
>          <url-pattern>*.do</url-pattern>
>      </servlet-mapping>
> 
>      ...
> 
> Step 2. Create the form for input
> 
> strutsSearch.html:
> 
> ...
> <form action="/webAppDev/actions/search.do" method="get">
>      ...
> </form>
> ...
> 
> Step 3. Create the Action subclass
> 
> package webAppDev;
> 
> import javax.servlet.http.*;
> import org.apache.struts.action.*;
> 
> public class SearchAction1 extends Action {
>      public ActionForward execute( ActionMapping mapping, Action form,
>                                    HttpServletRequest request,
>                                    HttpServletResponse response )
>      throws Exception {
>          return( mapping.findForward( "success" ) );
>      }
> }
> 
> Step 4. Update struts-config.xml
> 
>      <action-mappings>
>          <action path="/webAppDev/actions/search1"
>                  type="webAppDev.SearchAction1"
>                  name="noBean"
>                  scope="request"
>                  input="/webAppDev/strutsSearch.jsp">
>              <forward name="success" path="/webAppDev/SearchEngines"/>
>          </action>
>      </action-mappings>
> 
> Step 5. Test
> 
> http://localhost:8080/webAppDev/strutsSearch.jsp
> 
> [click submit]
> 
> http://localhost:8080/webAppDev/action/search1.do loads but returns an

> empty page.
> 
> My success mapping "/webAppDev/SearchEngines" should read some request

> parameters and further redirect to a Search Engine, i.e. Google. It 
> works otherwise without Struts.
> 
> What am I doing wrong? I must be too close. Everything seems to be 
> configured correctly. A typo? A config?
> 
> Many thanks in advance for any suggestions,
> Tim
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


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


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


Mime
View raw message