Thank you Dave. I'm afraid predefined mapping schemes like /do/admin/*/*"
and "/do/admin/*/*/* won't work for me since I want to implement a generic
file server. I cannot know the length of the URL nor its number of tokens
separated with "/". Actually, I have written such a fileserver using plain
old servlets. Since I don't want to mix servlets and Struts actions in my
Struts application, I'm looking for a way to implement this fileserver with
a DownloadAction class. But it seems to me that even if I use suffix
mapping, there is no way of getting the rest of the URL after the action's
name, in a generic manner.

---------- Forwarded message ----------
> From: Dave Newton <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <user@struts.apache.org>
> Date: Fri, 23 Sep 2005 17:53:56 -0400
> Subject: Re: user Digest 23 Sep 2005 19:04:19 -0000 Issue 6127
> emre akbas wrote:
>
> >Dave, of course I know the URL is avaliable from HttpServletRequest. I
> think
> >you didn't read my previous e-mails on the topic.
> >
> >I couldn't find a way to get the remaining part of the URL after the
> >action's name. That is, to get /chapter1/1.html in
> >http://localhost:8080/action.do/chapter1/1.html
> >
> >request.getPathInfo() always returns null.
> >
> >
> I'm actually a little surprised your Action is firing at all if you're
> doing *.do mapping and passing in something that doesn't end with *.do.
>
> If you use /do/* mapping and pass in something that isn't "actively"
> being mapped (i.e., mapping from "/do/chapter1/1.html" to an Action) I'm
> not sure I'd expect Struts to handle this.
>
> Now, if you do something like a wildcard mapping and define how you want
> that to work (i.e., mapping from "/do/download/*/*" to an Action) you'll
> probably get further--I'd look in to that.
>
> For instance, I created a generic CRUD action class that mapped
> "/do/admin/*/*" and "/do/admin/*/*/*" and stripped out chunks to get
> table names, commands, and ids.
>
> Also check out ActionMapping.getPath():
>
> "Return context-relative path of the submitted request, starting with a
> slash ("/") character, and omitting any filename extension if extension
> mapping is being used."
>
> Dave
>
>
>
>
>
> ---------- Forwarded message ----------
> From: T West <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <user@struts.apache.org>, Michael Jouravlev
> <[EMAIL PROTECTED]>
> Date: Fri, 23 Sep 2005 16:39:16 -0500
> Subject: Re: AW: [Solved]Cannot find ActionMappings or ActionFormBeans
> Okay, thanks to everyone for all of their help. My problem was my
> directory structure. I googled around to find some examples, and found
> this page: http://www.jguru.com/faq/view.jsp?EID=531027
> I had my JSP pages in the same directory as my struts-config.xml file.
> So, I made a DatabaseRetrieval directory where I could put my JSP
> pages, made a WEB-INF directory inside of the DatabaseRetrieval
> directory, modified the web.xml to reflect that it was now
> /WEB-INF/struts-config.xml and then tried recompiling. It worked!
> Thanks again.
>
> On 9/23/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote:
> > It is not important where you are. Your WAR file structure is
> > important, though.
> >
> > If you cannot explain where your struts-config.xml file is located,
> > then maybe you would prefer to search the net first. Look for
> > something like "(Java OR J2EE OR Struts) web application (directory OR
> > file) (packaging OR structure)".
> >
> > Michael.
> >
> > On 9/23/05, T West <[EMAIL PROTECTED]> wrote:
> > > I'm not sure if I explained myself correctly, but when I make my war
> > > file, I'm inside of the WEB-INF directory, so that everything that is
> > > packaged is the WEB-INF directory. When I open up the war, it's just
> > > all the files and directories that were in the WEB-INF directory.
> > >
> > > On 9/23/05, Dave Newton <[EMAIL PROTECTED]> wrote:
> > > > T West wrote:
> > > >
> > > > > I'm packaging my WEB-INF directory, so that when the war is
> expanded,
> > > > > it's opening up the WEB-INF directory.
> > > > >
> > > > >
> > > > Huh?
> > > >
> > > > So, where is your struts file? Michael's saying that you probably
> don't
> > > > have it in the right place, namely, under WEB-INF. The WEB-INF must
> be
> > > > part of the param-value.
> > > >
> > > > Dave
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> ---------- Forwarded message ----------
> From: "Murray Collingwood" <[EMAIL PROTECTED]>
> To: user@struts.apache.org
> Date: Sat, 24 Sep 2005 08:57:36 +1000
> Subject: RE: Bean association with form
> Hi Michael
>
> Okay, I'm starting to understand the problem.... let's look back at the
> JSP
>
> <html:form action="SaveMappingElement">
>
> Disclaimer: I know there are lots of variations in how you can use Struts,
> so some of
> what I'm saying is from my app that works and how the coding differs from
> yours.
> Yours may not be wrong, it maybe just different to mine, but how different
> does it need
> to be before it becomes wrong, I'm not sure about.
>
> It could be that your form is not being identified as an action in your
> struts-config.xml.
> I'm guessing your action servlet setting is something like "*.do", in
> which case your
> action on the form needs to reflect "*.do". Try:
>
> <html:form action="/SaveMappingElement.do">
>
> Also, in your struts-config.xml you have lots of actions (which is
> normal). You only
> specify the name="{form-bean}" on the action that will receive one of
> these forms. For
> example,
>
> <action path="/ShowTheAddPage" type="..." scope="request">
> <forward.../>
> </action>
>
> <action path="/ProcessTheAddPage" type="..." name="MappingElement"
> scope="request">
> <forward.../>
> </action>
>
> Kind regards
> mc
>
>
> On 23 Sep 2005 at 6:13, Michael Oliver wrote:
>
> > I guess I didn't include all from struts-config.xml that I needed to
> > include.
> >
> > Here is the full portion of the configuration for all the actions
> relating
> > to the MappingElement
> >
> > They all have the name="MappingElement"
> >
> > <action name="MappingElement" path="/EditMappingElement"
> > type="com.alariusj.verdx.actions.EditMappingElement">
> > <forward name="mappingElementForm"
> path="/pages/MappingElementForm.jsp"/>
> > </action>
> >
> > <action name="MappingElement" path="/DeleteMappingElement"
> > type="com.alarius.datasource.actions.EditMappingElement"/>
> >
> > <action name="MappingElement" path="/SaveMappingElement"
> > type="com.alariusj.verdx.actions.SaveMappingElement">
> > <forward name="showVerdXDataSourceDescriptor"
> > path="/ShowVerdXDataSourceDescriptor.do"/>
> > </action>
> >
> > So I am still at a loss as to why the bean was not getting associated
> with
> > the html:form tag.
> > Adding the name attribute to the input tags works but WOULD be redundant
> if
> > the html:form tag was working properly.
> >
> >
> >
> > Michael Oliver
> > CTO
> > Alarius Systems LLC
> > 6800 E. Lake Mead Blvd, #1096
> > Las Vegas, NV 89156
> > Phone:(702)643-7425
> > Fax:(702)974-0341
> > *Note new email changed from [EMAIL PROTECTED]
> >
> > -----Original Message-----
> > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
> > Sent: Thursday, September 22, 2005 4:40 PM
> > To: user@struts.apache.org
> > Subject: Re: Bean association with form
> >
> > As long as you have your mappings setup correctly (and use the right
> > attribute name if you push the form bean into the request/session
> yourself),
> > the <html:form> tag locates the appropriate form bean automatically and
> the
> > name attribute is redundant.
> >
> > L.
> >
> > Murray Collingwood wrote:
> > > Laurie is right, you need the extra action mapping in your config
> file.
> > >
> > > I have also been adding the attribute name to the form elements as in:
> > > <html:hidden name="MappingElement" property="actionStr"/>
> > >
> > > Is this necessary? It works but I'm wondering if it is redundant?
> > >
> > > Kind regards
> > > mc
> > >
> > >
> > > On 22 Sep 2005 at 15:44, Laurie Harper wrote:
> > >
> > >
> > >>You have your action path set to /EditMappingElement but your form
> > >>action is SaveMappingElement. There's no link between the form and the
> > >>form-bean. You need to make sure you have an action mapping for
> > >>SaveMappingElement, and that it has name="MappingElement" set.
> > >>
> > >>L.
> > >>
> > >>Michael Oliver wrote:
> > >>
> > >>>I have an Form called MappingElement,
> > >>>
> > >>>From struts-config.xml
> > >>>
> > >>><form-bean name="MappingElement"
> > >>>type="com.alarius.datasource.forms.MappingElement"/>
> > >>>
> > >>>I have an Action that opens a jsp page with a form on it and
> populates
> > the
> > >>>MappingElement bean with data.
> > >>>
> > >>>From EditMappingElement.java
> > >>>
> > >>>public ActionForward execute(ActionMapping mapping, ActionForm form,
> > >>> HttpServletRequest request, HttpServletResponse
> > >>>response)
> > >>> throws Exception {
> > >>> ActionForward forward = mapping.findForward(FORWARD_mappingElement);
> > >>> MappingElement me = (MappingElement) form;
> > >>>
> > >>> DataSourceServices dss = new DataSourceServices();
> > >>> AccessToken token = new AccessToken(ajcc);
> > >>> ServiceResponse sr = dss.RetrieveMappingElement(token, me
> > >>> .getDataElementUri());
> > >>> form = me = (MappingElement) sr.getMappingElement();
> > >>> request.setAttribute("MappingElement", me);
> > >>>
> > >>> return forward;
> > >>>}
> > >>>
> > >>>From Struts-config.xml
> > >>>
> > >>><action name="MappingElement" path="/EditMappingElement"
> > >>> type="com.alariusj.verdx.actions.EditMappingElement">
> > >>> <forward name="mappingElementForm"
> > >
> > > path="/pages/MappingElementForm.jsp"/>
> > >
> > >>></action>
> > >>>
> > >>>From MappingElementForm.jsp
> > >>>
> > >>><logic:present name="MappingElement">MappingElement present<br>
> > >>><bean:write name="MappingElement" property="dataSourceUri"/><br>
> > >>><bean:write name="MappingElement" property="dataElementName"/><br>
> > >>></logic:present>
> > >>>
> > >>> <html:form action="SaveMappingElement">
> > >>> <html:hidden property="actionStr"/>
> > >>> <html:hidden property="dataSourceUri"/>
> > >>> <html:hidden property="dataElementUri"/>
> > >>>
> > >>>When I run it the SaveMappingElement form is not populated but the
> > >>>MappingElement bean is present and the bean:writes show the data that
> is
> > >>>populated.
> > >>>
> > >>>Why doesn't the html:form tag pick up the MappingElement bean?
> > >>>
> > >>>Ollie
> > >>
> > >>
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>For additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > >>
> > >>
> > >>--
> > >>No virus found in this incoming message.
> > >>Checked by AVG Anti-Virus.
> > >>Version: 7.0.344 / Virus Database: 267.11.4/109 - Release Date:
> 21/09/2005
> > >>
> > >
> > >
> > >
> > >
> > > FOCUS Computing
> > > Mob: 0415 24 26 24
> > > [EMAIL PROTECTED]
> > > http://www.focus-computing.com.au
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.344 / Virus Database: 267.11.4/109 - Release Date:
> 21/09/2005
> >
>
>
>
> FOCUS Computing
> Mob: 0415 24 26 24
> [EMAIL PROTECTED]
> http://www.focus-computing.com.au
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.11.4/109 - Release Date: 21/09/2005
>
>
>
>
> ---------- Forwarded message ----------
> From: "Rob Turknett" <[EMAIL PROTECTED]>
> To: <user@struts.apache.org>
> Date: Fri, 23 Sep 2005 19:01:28 -0500
> Subject: Populating a select box from a database
> I want to populate a select element with items from a database. The items
> can be retrieved by making calls to an API that retrieves data from the
> database. These API methods may throw exceptions if the database is
> inaccessible, or if the user is not logged in. The items only need to be
> retrieved once per session, and should therefore be cached in the user's
> session.
>
> What is the best way to do this in Struts? Where should I make the calls
> to
> retrieve the list items? If I do this in the ActionForm, I am not sure
> what
> to do if an exception is thrown (for instance, if the user is not logged
> in,
> how to forward to the login page).
>
> I've looked around for information about how to do this, but haven't found
> much. Any help or pointers to resources would be greatly appreciated.
>
> Thanks,
> Rob
>
>
>
>
>
> ---------- Forwarded message ----------
> From: "Wendy Smoak" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Date: Fri, 23 Sep 2005 17:52:55 -0700
> Subject: Re: Populating a select box from a database
> From: "Rob Turknett" <[EMAIL PROTECTED]>
>
> >I want to populate a select element with items from a database. The items
> > can be retrieved by making calls to an API that retrieves data from the
> > database. These API methods may throw exceptions if the database is
> > inaccessible, or if the user is not logged in. The items only need to be
> > retrieved once per session, and should therefore be cached in the user's
> > session.
> >
> > What is the best way to do this in Struts? Where should I make the calls
> > to
> > retrieve the list items? If I do this in the ActionForm, I am not sure
> > what
> > to do if an exception is thrown (for instance, if the user is not logged
> > in,
> > how to forward to the login page).
>
> I have the same requirements. I use a combination of a Filter to check
> whether the user is logged in, and a Session Listener to retrieve the
> items
> and put them in session scope. (Neither of these is dependent on Struts.)
>
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/Filter.html
>
>
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionListener.html
>
> --
> Wendy Smoak
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Laurie Harper <[EMAIL PROTECTED]>
> To: user@struts.apache.org
> Date: Fri, 23 Sep 2005 21:44:45 -0400
> Subject: Re: Populating a select box from a database
> Rob Turknett wrote:
> > I want to populate a select element with items from a database. The
> items
> > can be retrieved by making calls to an API that retrieves data from the
> > database. These API methods may throw exceptions if the database is
> > inaccessible, or if the user is not logged in. The items only need to be
> > retrieved once per session, and should therefore be cached in the user's
> > session.
> >
> > What is the best way to do this in Struts? Where should I make the calls
> to
> > retrieve the list items? If I do this in the ActionForm, I am not sure
> what
> > to do if an exception is thrown (for instance, if the user is not logged
> in,
> > how to forward to the login page).
> >
> > I've looked around for information about how to do this, but haven't
> found
> > much. Any help or pointers to resources would be greatly appreciated.
>
> You want to do it in the Action instead of the ActionForm. You can
> catch/handle any exceptions you want to and forward as appropriate, or
> let the exception propogate and use declarative exception handling to
> serve the appropriate page.
>
> HTH,
>
> L.
>
>
>
>
> ---------- Forwarded message ----------
> From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <user@struts.apache.org>
> Date: Fri, 23 Sep 2005 23:27:35 -0400
> Subject: Re: Populating a select box from a database
> Another suggestion is to use the DependencyFilter in Java Web Parts:
>
>
> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/DependencyFilter.html
>
> (I seem to be offering this suggestion a lot lately!)
>
> With the DependencyFilter, you could define in an XML file what is
> essentially a "managed" object to be created and stuffed into session.
> You can do a bunch of different initializations with the object,
> including calling methods on it or passing it off to another object to
> initialize, either of which would probably fit your requirements well
> because you can do whatever you need to at that point.
>
> You *could* even create an ActionForm using this filter and populate it
> accordingly. In fact, there is some details on doing that out on the
> Wiki now:
>
> http://wiki.apache.org/struts/PreInitializeActionForm
>
> I don't know if doing the ActionForm is the best answer, but it should
> work just the same.
>
> I'm not sure how you could handle the error situations though... the
> only suggestion that comes to mind is to have a check downstream from
> this filter (either another filter or the first Action that executes as
> part of your application), and if the object isn't in session and
> initialized properly, then redirect to the logon page, or otherwise
> appropriately handle it.
>
> Frank
>
> Wendy Smoak wrote:
> > From: "Rob Turknett" <[EMAIL PROTECTED]>
> >
> >> I want to populate a select element with items from a database. The
> items
> >> can be retrieved by making calls to an API that retrieves data from the
> >> database. These API methods may throw exceptions if the database is
> >> inaccessible, or if the user is not logged in. The items only need to
> be
> >> retrieved once per session, and should therefore be cached in the
> user's
> >> session.
> >>
> >> What is the best way to do this in Struts? Where should I make the
> >> calls to
> >> retrieve the list items? If I do this in the ActionForm, I am not sure
> >> what
> >> to do if an exception is thrown (for instance, if the user is not
> >> logged in,
> >> how to forward to the login page).
> >
> >
> > I have the same requirements. I use a combination of a Filter to check
> > whether the user is logged in, and a Session Listener to retrieve the
> > items and put them in session scope. (Neither of these is dependent on
> > Struts.)
> >
> > http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/Filter.html
> >
> >
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionListener.html
> >
> >
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
>
>
>
> ---------- Forwarded message ----------
> From: Graham Reeds <[EMAIL PROTECTED]>
> To: user@struts.apache.org
> Date: Sat, 24 Sep 2005 03:17:15 +0100
> Subject: Tiles and tile definitions
> I am having a problem with the tile definitions and the paths contain
> therein.
>
> My dev directory is setup:
> web \
> + WEB-INF \
> | \ tiles-def.xml
> + _common \
> | + layouts \
> | \ mainLayout.jsp
> | + tiles \
> | \ _header.jsp
> | \ _footer.jsp
> + pages \
> \ Test.jsp
>
> I can create jsp pages which use tiles via the insert method. However
> when I try to use a definition file things fall apart.
>
> I have the tiles-def.xml in WEB-INF and in there is defined
> <tiles-definitions>
> <!-- main layout -->
> <definition name="main.layout" path="../_common/layouts/mainLayout.jsp">
> <put name="header" value="../_common/layouts/tiles/_header.jsp"/>
> <put name="footer" value="../_common/layouts/tiles/_footer.jsp" />
> </definition>
>
> <!-- test page -->
> <definition name="test.page" extends="main.layout">
> </definition>
> </tiles-definitions>
>
> So essentially when test.page is created it will create a page with the
> just header and footer. This is a test to get it working only - all the
> other stuff (body, etc.) has been stripped out.
>
> mainLayout.jsp consists of
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
> <tiles:insert attribute="header" />
> <tiles:insert attribute="footer" />
>
> and Test.jsp is only
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
> <tiles:insert definition="test.page" />
>
> Now nothing appears when I try to open Test.jsp from a page that has
> uses the <tiles:insert> method - the file is empty, no errors or
> anything. I have the feeling it is something to do with paths but
> removing ../ and various combinations doesn't seem to work.
>
>
>
>
> ---------- Forwarded message ----------
> From: James Mitchell <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <user@struts.apache.org>
> Date: Fri, 23 Sep 2005 23:30:11 -0400
> Subject: Re: MailReader demo app is rewritten with Struts Dialogs
> That's a great idea, let me know if you need any help.
>
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> Consulting / Mentoring / Freelance
> EdgeTech, Inc.
> http://www.edgetechservices.net/
> 678.910.8017
> AIM: jmitchtx
> Yahoo: jmitchtx
> MSN: [EMAIL PROTECTED]
> Skype: callto://jmitchtx
>
>
>
>
>
> On Sep 23, 2005, at 9:16 AM, Ted Husted wrote:
>
> > Maybe the best thing would be to pursue a "MailReader portal" that
> > provided system documentation, a test suite, and links to the various
> > implemenations. I'll continue work on this idea at
> >
> > * http://opensource2.atlassian.com/confluence/oss/display/STRUTS/
> > MailReader
> >
> > for now. (Watch the space if you want to follow along.)
> >
> > Better system documentation for MailReader, and a true, best-practices
> > MailReader, is definately on my list for the Struts 1.3 release
> > series.
> >
> > -Ted.
> > http://husted.com/ted/poe
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
>

Reply via email to