check out struts-wildcard project!
Hello all. I've created a few struts applications with struts1.0 and struts 1.1rc. I've often found a need to update content on my applications. As in updating or adding new URLs. However, I could not execute live updates -- meaning I had to bring my application down, edit the struts-config.xml file, and restart. For most people, this might be fine. For me it was not. I would like to encourage people to take a look at http://www.twdata.org/struts-wildcard/ . It basically allows you to enable regular expressions in your action mappings. Plus, this is _really_ easy to use. I have a few actions defined in my struts application, but one really stands out: Any content request goes through this action mapping. So basically any relative URL within my context, "mycontext" that begins with "/view" will go to my ContentAction. So h**p://mydomian/mycontext/view/whatever.do will be sent to this action. Note, that I store my URLs and associated data in my own tailor made XML configuration file. This allows me to update and add new URLs without bringing my server down. I don't even have to edit my struts-config.xml. This project provided very key functionality to my application. I encourage you all to take a look at this project. - Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo.
RE: struts-config.xml question
Hey, talk about exactly what I was looking for. Thanks, Jerry. I'm perusing the download right now. Anyone in this community using the Wildcard-Matched Actions project? Wildcard-Matched Actions Project: http://www.twdata.org/struts-wildcard/ It seems to be just 2 new classes with code pulled from the Cocoon project, and is dependent upon using Struts 1.1. I think upgrading to Struts 1.1 shouldn't be too hard. I've read some about this in the Struts in Action book -- great resource by the way. It would be somewhat comforting to hear from people who are utilizing this. Jerry Jalenak <[EMAIL PROTECTED]> wrote: Look at the following : http://www.mail-archive.com/[EMAIL PROTECTED]/msg68361.html Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Dan Tarkenton [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 10:59 AM To: [EMAIL PROTECTED] Subject: struts-config.xml question When defining an action element in the struts-config.xml file, we always utilize the path attribute. For example, I have two actions defined in my struts-config.xml *snippet* type="foo.strutsApp.ContentAction" name="contentForm"> type="ginsu.strutsApp.LoginAction" name="loginForm"> */snippet* Say I want to make the first action element be invoked by any path that starts with "/home" (like "/homeshop" or "/homes"). Basically, can I define a wildcard in the path attribute? I would like to have the ability to have a few different URLs mapped to the same action WITHOUT having to define all of those relative URLs in more action elements. In essence I would like to have something along the lines of: type="foo.strutsApp.ContentAction" name="contentForm"> So that the path attribute is mapping potentially any number of relative URLs that begin with "/home" to this action. This would allow me some great flexibility for real time content updating. Is this possible? TIA. - Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo.
struts-config.xml question
When defining an action element in the struts-config.xml file, we always utilize the path attribute. For example, I have two actions defined in my struts-config.xml *snippet* */snippet* Say I want to make the first action element be invoked by any path that starts with "/home" (like "/homeshop" or "/homes"). Basically, can I define a wildcard in the path attribute? I would like to have the ability to have a few different URLs mapped to the same action WITHOUT having to define all of those relative URLs in more action elements. In essence I would like to have something along the lines of: So that the path attribute is mapping potentially any number of relative URLs that begin with "/home" to this action. This would allow me some great flexibility for real time content updating. Is this possible? TIA. - Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo.
Can we 'hot swap' the struts-config.xml?
Is it possible, with an instance of a struts 1.0 webapp running in tomcat, to re-initialize the struts-config.xml while the application is still up? I say this because it would be great if I could edit the struts-config.xml as an admin of my site without disrupting the webapp and any potential end users of the webapp. I worry about synchronization issues. Thoughts? - Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo.
Re: No action instance for path could be created
Hey, thanks Gareth. I was using netbeans as my IDE and it must have automatically put my src directory as part of my package. I appreciate the look at my message. Sometimes you can just stare and stare at code and not see the obvious. My app works now. Thanks for the time. --- Gareth Andrew <[EMAIL PROTECTED]> wrote: > Could it be that your action class is in package: > > package src.ginsu.strutsApp; > > and in your struts-config.xml you are trying to load > > type="ginsu.strutsApp.AddFileAction" > > ie. package ginsu.strutsApp > > > > > Dan Tarkenton wrote: > > >Hello all. I apologize for the size of this > message, > >but I thought it necessary to include some of my > >source. > > > >I am trying to do a very basic thing here. I > trying > >to pass form data to an Action object. However i > am > >getting the following tomcat error, when I submit > from > >http://localhost:8080/ginsu/test/addFile.jsp : > > > >*** Begin My Error > *** > > > >HTTP Status 500 - No action instance for path > /addFile > >could be created > > > >type Status report > > > >message No action instance for path /addFile could > be > >created > > > >description The server encountered an internal > error > >(No action instance for path /addFile could be > >created) that prevented it from fulfilling this > >request. > > > >*** End My error ** > > > >I have consulted both the Struts in Action book as > >well as the struts-example web app. I just don't > see > >where my problem resides. So I thought it best to > >consult you more experienced struts users. My > first > >guess is that I have configured struts-config.xml > >incorrectly. > > > >I will first list my struts-config.xml file (which > is > >where I _think_ my error may be), my addFile.jsp (a > >simple form), my AddFileForm (struts FormBean), and > my > >AddFileAction class (Struts Action). > > > >I hope you guys can see something obvious. Here's > >hoping. > > > >* struts-config.xml *** > > > > > > > > > "-//Apache Software Foundation//DTD > Struts > >Configuration 1.0//EN" > > > >"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";> > > > > > > > > > > > > > > > > >type="ginsu.strutsApp.ContentForm" /> > > >type="ginsu.strutsApp.AddFileForm" /> > > > > > > > > > > > > > > > > /> > > > > > > > > > > > > > > > type="ginsu.strutsApp.ContentAction" > > name="contentForm"> > > > > > > > type="ginsu.strutsApp.AddFileAction" > > name="addFileForm" > > input="/test/addFile.jsp"> > > > > > > > > >type="org.apache.struts.actions.AddFormBeanAction"/> > > > > > > >type="org.apache.struts.actions.AddForwardAction"/> > > > > > > >type="org.apache.struts.actions.AddMappingAction"/> > > > > > > >type="org.apache.struts.actions.ReloadAction"/> > > > > > > >type="org.apache.struts.actions.RemoveFormBeanAction"/> > > > > > > >type="org.apache.struts.actions.RemoveForwardAction"/> > > > > > > >type="org.apache.struts.actions.RemoveMappingAction"/> > > > > > > > > > > > >*** end struts-config.xml *** > > > >And now my jsp form: > > > >*** Begin addFile.jsp *** > > > > > > > > > > Add an XML File to Slide > > > > > > > > > > > > > > > > > > > > > > > > Filename: > > > > > > > > value=""> > > > > > > > > > > > > > > > > value="Submit > >filename"> > > > > > > value="Reset"> > > > > > > > > > > > > > > > > > > > === message truncated === __ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: No action instance for path could be created
Yes I am sure everything is compiling. I use ant to take care of my build and creation of my ginsu.war (ginsu = my web app name). In my build process, after a compile, I basically jar all of my class files into ginsu.jar, and this jar file winds up in my WEB-INF/lib directory. I basically deploy my application by dropping the ginsu.war into %CATALINA_HOME%/webapps, and restart my server. So I am sure the class is being created. --- "Vivian, Nigel (N.)" <[EMAIL PROTECTED]> wrote: > Are you sure that you have a compilied Action class > where the webserver can > find it e.g > ...webapp/web-inf/classes/.../AddFileAction.class it > could be > that your Action class is not compiling > > Nigel Vivian > __ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
No action instance for path could be created
Hello all. I apologize for the size of this message, but I thought it necessary to include some of my source. I am trying to do a very basic thing here. I trying to pass form data to an Action object. However i am getting the following tomcat error, when I submit from http://localhost:8080/ginsu/test/addFile.jsp : *** Begin My Error *** HTTP Status 500 - No action instance for path /addFile could be created type Status report message No action instance for path /addFile could be created description The server encountered an internal error (No action instance for path /addFile could be created) that prevented it from fulfilling this request. *** End My error ** I have consulted both the Struts in Action book as well as the struts-example web app. I just don't see where my problem resides. So I thought it best to consult you more experienced struts users. My first guess is that I have configured struts-config.xml incorrectly. I will first list my struts-config.xml file (which is where I _think_ my error may be), my addFile.jsp (a simple form), my AddFileForm (struts FormBean), and my AddFileAction class (Struts Action). I hope you guys can see something obvious. Here's hoping. * struts-config.xml *** http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";> *** end struts-config.xml *** And now my jsp form: *** Begin addFile.jsp *** Add an XML File to Slide Filename: ** End addFile.jsp My FormBean: ** Begin AddFileForm.java * package src.ginsu.strutsApp; import org.apache.struts.action.*; public class AddFileForm extends ActionForm { protected String filename = null; public String getFilename() { return this.filename; } public void setFilename(String filename) { this.filename = filename; } } ** End AddFileForm.java And finally, My AddFileAction class: ** Begin AddFileAction.java package src.ginsu.strutsApp; import ginsu.content.adapter.*; import org.apache.struts.action.*; import javax.servlet.http.*; import java.io.*; import java.util.StringTokenizer; import java.util.Vector; import javax.xml.transform.dom.DOMSource; /** * * @author tarkentond */ public class AddFileAction extends Action { public ActionForward perform (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { AddFileForm addForm = (AddFileForm)form; String fullPath = addForm.getFilename(); StringTokenizer tokenizer = new StringTokenizer(fullPath, "/"); Vector temp = new Vector(); while (tokenizer.hasMoreTokens()) { temp.addElement(tokenizer.nextToken()); } String slideFileName = (String)temp.lastElement(); String slideUri = "/files/" + slideFileName; try { ContentAdapterImpl adapter = new ContentAdapterImpl(); adapter.initDomain("ginsunamespace", "root"); adapter.createFile(new FileInputStream(fullPath), slideUri); DOMSource dom = adapter.retrieveXml(slideUri); request.setAttribute("dom", dom); } catch (Exception e) { request.setAttribute("exception", e.toString()); } return mapping.findForward("xslServlet"); } } *** End AddFileAction.java Thanks in advance for your time and effort looking over this long email. -Dan __ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to invoke the action servlet?
Heh, I must be getting tired. I did mean struts-config.xml. The slide thing was a slip (I'm also using jakarta slide as a content management system). The struts-example.war file works fine when placed into tomcat. So tomcat and a well configured struts instance seems to work on my machine...which means something is wrong with my implementation. I will take a look at the source for this example. I appreciate your help and advice. You'll hear back from me soon enough ;) --- "Hajratwala, Nayan (N.)" <[EMAIL PROTECTED]> wrote: > You are correct about the file location... I'm > assuming you meant struts-config.xml and not > slide-config.xml .. I'm not sure if it matters, but > be sure the directory is WEB-INF, not web-inf. > > My suggestion to you would be to try and get the > struts-example.war running ... > > Just put the war file in your webapps directory (or > unjar it there), then try to run the example. If > that works, you can slowly integrate your code into > that webapp. Surely you will find the point at > which it starts failing. > > Good luck! > > --- > - Nayan Hajratwala > - Chikli Consulting LLC > - http://www.chikli.com > > > -Original Message- > From: Dan Tarkenton [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 4:06 PM > To: Struts Users Mailing List > Subject: Re: how to invoke the action servlet? > > > Ah, I am sorry. I forgot to mention that I had > tried > different combinations of URLs. I did try > http://localhost:8080/ginsu/ginsu.do and I get the > same tomcat error as when I enter > http://localhost:8080/ginsu . > > I also realize how vague I was. I'll try to be more > specific: I am using Tomcat 4.1.18, and I get a 404 > with a description of "The requested resource is not > available" when I try these different URLs. > > I went back to my %CATALINA_HOME%/webapp/ginsu > directory and discovered that my struts-config.xml > file was there. I think this is incorrect. > > The web.xml file and the struts-config.xml file both > need to reside in my > %CATALINA_HOME%/webapps/ginsu/WEB-INF directory, > correct? > > So I moved the slide-config.xml to the web-inf > directory and restarted tomcat and received the same > results. > > Any further thought? > > Thanks again, and I appreciate the fast responses. > --- "Craig R. McClanahan" <[EMAIL PROTECTED]> > wrote: > > > > > > On Thu, 27 Mar 2003, Dan Tarkenton wrote: > > > > > Date: Thu, 27 Mar 2003 12:32:09 -0800 (PST) > > > From: Dan Tarkenton <[EMAIL PROTECTED]> > > > Reply-To: Struts Users Mailing List > > <[EMAIL PROTECTED]> > > > To: [EMAIL PROTECTED] > > > Subject: how to invoke the action servlet? > > > > > > > > > I have been referencing the book Struts in > Action > > by Ted Husted as well > > > as the struts site. I cannot figure out what to > > point my browser to in > > > order to invoke struts. I have zero JSPs in my > > struts application -- I > > > have no need for them because I am utilizing > Model > > X where I have one > > > XSLT servlet that represents my entire view > layer. > > I thought I could > > > just point my browser to > > http://localhost:8080/ginsu (ginsu being the > > > name of my web app). I realize I have no > > index.html or index.jsp, but > > > I'm just trying to go directly to the action > > servlet from the browser. > > > > > > Is this not possible in struts? > > > > > > > The URL of an action is composed like this: > > > > > > > http://${hostname}:${portnumber}${contextpath}${actionpath} > > > > So, if you install your webapp at context path > > "/ginsu", and you want to > > invoke the action with a path of "/ginsu" (which > > appears to be the only > > one you've defined), the URL would be: > > > > http://localhost:8080/ginsu/ginsu.do > > > > since you are using extension mapping. The first > > part ("/ginsu") selects > > which web application, while the rest > ("/ginsu.do") > > selects the action. > > > > Craig > > > > > - > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > __ > Do you Yahoo!? > Yahoo! Platinum - Watch CBS'
Re: how to invoke the action servlet?
Ah, I am sorry. I forgot to mention that I had tried different combinations of URLs. I did try http://localhost:8080/ginsu/ginsu.do and I get the same tomcat error as when I enter http://localhost:8080/ginsu . I also realize how vague I was. I'll try to be more specific: I am using Tomcat 4.1.18, and I get a 404 with a description of "The requested resource is not available" when I try these different URLs. I went back to my %CATALINA_HOME%/webapp/ginsu directory and discovered that my struts-config.xml file was there. I think this is incorrect. The web.xml file and the struts-config.xml file both need to reside in my %CATALINA_HOME%/webapps/ginsu/WEB-INF directory, correct? So I moved the slide-config.xml to the web-inf directory and restarted tomcat and received the same results. Any further thought? Thanks again, and I appreciate the fast responses. --- "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote: > > > On Thu, 27 Mar 2003, Dan Tarkenton wrote: > > > Date: Thu, 27 Mar 2003 12:32:09 -0800 (PST) > > From: Dan Tarkenton <[EMAIL PROTECTED]> > > Reply-To: Struts Users Mailing List > <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Subject: how to invoke the action servlet? > > > > > > I have been referencing the book Struts in Action > by Ted Husted as well > > as the struts site. I cannot figure out what to > point my browser to in > > order to invoke struts. I have zero JSPs in my > struts application -- I > > have no need for them because I am utilizing Model > X where I have one > > XSLT servlet that represents my entire view layer. > I thought I could > > just point my browser to > http://localhost:8080/ginsu (ginsu being the > > name of my web app). I realize I have no > index.html or index.jsp, but > > I'm just trying to go directly to the action > servlet from the browser. > > > > Is this not possible in struts? > > > > The URL of an action is composed like this: > > > http://${hostname}:${portnumber}${contextpath}${actionpath} > > So, if you install your webapp at context path > "/ginsu", and you want to > invoke the action with a path of "/ginsu" (which > appears to be the only > one you've defined), the URL would be: > > http://localhost:8080/ginsu/ginsu.do > > since you are using extension mapping. The first > part ("/ginsu") selects > which web application, while the rest ("/ginsu.do") > selects the action. > > Craig > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to invoke the action servlet?
I have been referencing the book Struts in Action by Ted Husted as well as the struts site. I cannot figure out what to point my browser to in order to invoke struts. I have zero JSPs in my struts application -- I have no need for them because I am utilizing Model X where I have one XSLT servlet that represents my entire view layer. I thought I could just point my browser to http://localhost:8080/ginsu (ginsu being the name of my web app). I realize I have no index.html or index.jsp, but I'm just trying to go directly to the action servlet from the browser. Is this not possible in struts? Here is my struts-config file: http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";> And here is my web.xml file: http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";> action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml debug 2 detail 2 2 XSLServlet ginsu.XSLServlet XSLServlet /XSLServlet action *.do index.jsp /tags/struts-bean /WEB-INF/struts-bean.tld /tags/struts-html /WEB-INF/struts-html.tld /tags/struts-logic /WEB-INF/struts-logic.tld /tags/struts-nested /WEB-INF/struts-nested.tld /tags/struts-tiles /WEB-INF/struts-logic.tld I noticed that there is an element: index.jsp Is this an absolutely necessary element in the web.xml file? I figure the index.jsp would just contain a redirect to the action servlet. Any help is appreciated. Thanks! - Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!