Re: help with modules
Try adding contextRelative="true" to the forwards in your struts-config. I remember a similar problem I had a while back, but I'm not entirely sure this will solve it. Here is an example of an Action I had in a struts module I wrote: -james On Fri, 2004-03-26 at 10:08, Bruce Christie wrote: > Hello, > > I am playing around with modules and things work pretty nicely = > except > > I have a tiles template that reads in a menu.jsp from the default = > WEB-INF. The links to the actions are prepended with the module. (i.e. = > . ) > > This works fine expect that once I am in the correct module the link = > then points to module1/module1/dosomething.do. Is there a way that the = > link tag can be used so that it will drop the module prefix when I am in = > the module asscoiated with the action? > > I think I read something about adding a module @ to the link tag but DTD = > complains. > > Thanks > Bruce > > - > 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]
struts module
I've recently written a struts module that I am plugging into one of our apps. I'm getting some odd behavior when I do action forwards to jsp's. Heres the situation: in web.xml I have: param: config value: /WEB-INF/conf/struts-config.xml param: config/logging value: /WEB-INF/logging/struts-logging-module.xml In the struts-logging-module.xml I have an action defined at path listLoggers. This action forwards to /WEB-INF/logging/listLoggers.jsp. When I access CONTEXT_PATH/logging/listLiggers.do I get a 404 because struts was trying to forward to a page located at /logging/WEB-INF/logging/listLoggers.jsp. It prepends the /logging to all the pages that are included. If I place the jsp's in the directory /logging/WEB-INF/logging then I don't get the 404 errors. I need to place the JSP's in the WEB-INF directory to protect the resources. Any ideas on how to tell struts not to prepend the /logging (module name) when executing a forward would be appreciated. Thanks, JC - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles and getRequestURI
I read the section of the specification that you referring to and I think that you have it backwards. It doesn't say in the specification that when you do a requestDispatcher.include() that you should change the request.getRequestURI(). What I do see in the spec is that the request attribute of javax.servlet.include.request_uri refers to the page that was included, not the original requestURI. This behavior is already built into the RequestDispatcher.include(). Whats more, when you do the include the RequestDispatcher will overwrite any existing value that is in the request attributes for javax.servlet.include.request_uri and replace it with the path for the page that is included. So even if Struts put the original requestURI in the attributes under this key, it will get overwritten when the Tiles does the include. This is what I saw when I tested as well. Here is the scenario: 1) Browser requests resource home.do 2) home.do executes ForwardAction to tiles definition home.pg 3) Tiles definition home.pg has body.jsp as the template and overview.jsp as a put 4) From page overview.jsp, I get /plfi-struts/WEB-INF/templates/body.jsp as the value for request.getRequestURI() and /plfi-struts/WEB-INF/metrics/home/overview.jsp as the value for request.getAttribute( "javax.servlet.include.request_uri" ) >From what you describe, this should be the original requestURI, which was /home.do I don't think the writers of the servlet specification intended the consumers to change the request.getRequestURI() when ever they do an include. If struts does nothing with respect to changing the requestURI and the javax. attribute, everything will work as the specification says. Just my humble opinion. -james On Tue, 2003-11-11 at 14:27, Craig R. McClanahan wrote: > Quoting James Norman <[EMAIL PROTECTED]>: > > > I'm in the process of porting a web application from the > > Jetspeed/Turbine framework over to struts and I ran into a problem > > someone may be able to help me with. > > > > When I have a Jsp that is included by a tile, the > > httpServletRequest.getRequestURI() returns the location of the Jsp that > > the tiles included, not the resource that the browser requested. As far > > as I can tell, it is the Tiles Controller that is changing this from the > > original set by the container. This is causing some problems in the > > application I have because the requestURI becomes something like > > /WEB-INF/templates/body.jsp, which isn't terribly useful. I have found > > a few emails regarding this in the archives, but no solutions. Is there > > a configuration which will tell the controller not to mess with the > > requestURI? Any insight would be appreciated. > > > > You will see this sort of behavior in any servlet-based application that uses > RequestDispatcher.incude() -- as Tiles does -- to assemble the various > subcomponents of the page together. The servlet API requires that the request > URI (as well as the other path components like the servlet path) be adjusted in > such scenarios to point at the included resource. > > The request URI of the original request is still available to the included > resource, however -- it's stored by the container in a request attribute under > the key "javax.servlet.include.request_uri", along with the other path > components under similarly named keys. See Section 8.3.1 of the Servlet Spec > for details. > > > Thanks, > > James Norman > > > > Craig > > > - > 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]
tiles and getRequestURI
I'm in the process of porting a web application from the Jetspeed/Turbine framework over to struts and I ran into a problem someone may be able to help me with. When I have a Jsp that is included by a tile, the httpServletRequest.getRequestURI() returns the location of the Jsp that the tiles included, not the resource that the browser requested. As far as I can tell, it is the Tiles Controller that is changing this from the original set by the container. This is causing some problems in the application I have because the requestURI becomes something like /WEB-INF/templates/body.jsp, which isn't terribly useful. I have found a few emails regarding this in the archives, but no solutions. Is there a configuration which will tell the controller not to mess with the requestURI? Any insight would be appreciated. Thanks, James Norman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Friday] Quote
"There are two ways of constructing a software design; one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C. A. R. Hoare - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PHP version of Struts
The real advantage of PHP is the number of people that know PHP. The number of people that know jsp/velocity is dwarfed by those that know PHP, thus you can hire cheaper labor and the company saves money. This technology may not solve any problems for the Java programmer however it would influence a companies decision to go with a Java solution over .Net. -james - Original Message - From: "Igor Shabalov" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 8:46 PM Subject: Re: PHP version of Struts > > Why PHP when I have Java? What real advanteges PHP have compared to Java? > > On Wed, 11 Jun 2003 16:04:31 -0700, Van Riper, Mike > <[EMAIL PROTECTED]> wrote: > > > At JavaOne this week one of the announcements about future plans was for > > scripting language support, specifically in the context of web pages, > > that > > will focus initially on PHP support. It was suggested that an initial > > reference implementation of this would provide PHP support in a future > > release of Tomcat. This is at the early JSR stage now. So, it would not > > be > > of much use any time soon. Still, it seemed worth mentioning in the > > context > > of this discussion. The JSR for this is JSR-223, Scripting Pages in Java > > Web > > Applications: > > > > http://www.jcp.org/en/jsr/detail?id=223 > > > > FYI, Van > > > > Mike Van Riper > > mailto:[EMAIL PROTECTED] > > > > > >> -Original Message- > >> From: Brandon Goodin [mailto:[EMAIL PROTECTED] > >> Sent: Wednesday, June 11, 2003 3:30 PM > >> To: Struts Users Mailing List > >> Subject: RE: PHP version of Struts > >> > >> > >> It's PHP... what do you think? > >> > >> Brandon Goodin > >> > >> -Original Message- > >> From: Lai, Kenny [mailto:[EMAIL PROTECTED] > >> Sent: Wednesday, June 11, 2003 4:22 PM > >> To: 'Struts Users Mailing List' > >> Subject: RE: PHP version of Struts > >> > >> > >> the question is, is it as good as struts > >> > >> -Original Message- > >> From: Brandon Goodin [mailto:[EMAIL PROTECTED] > >> Sent: Wednesday, June 11, 2003 6:22 PM > >> To: Struts User List > >> Subject: PHP version of Struts > >> > >> > >> Would you use it? > >> > >> http://phrame.sourceforge.net/ > >> > >> Brandon Goodin > >> > >> - > >> 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] > >> > >> > >> > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > Igor Shabalov > Director of Engineering > Exadel Inc. > http://www.exadel.com > > - > 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]
Re: Contents of directory on server?
You can always call servletContext.getRealPath() then create a File and list the contents. This however would require that your war be unpacked, and is not good practice. You could maybe define the location of the war file on a init-param of web.xml, then at startup build an index of the war file with the java.util.zip classes. The easiest way would be to just unpack the war file. This does come with its consequences, you cant use the Tomcat deploy tasks if the war has to be unpacked. No easy answer. -james - Original Message - From: "Chip Paul" <[EMAIL PROTECTED]> To: "Struts User" <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 4:14 PM Subject: Contents of directory on server? > I've seen the posts on the list realted to reading in a file (usually xml) > via getResourceAsStream(), but was wondering how to iterate over the > contents of a directory located inside the war file. > > Has anyone done this without an xml/properties file to map the locations? > > The specific application is to iterate through a directory and produce links > to resources located in it. > > Chip > > > - > 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]
RE: [Tiles] Forwarding To JSP Error Page From Within Tiles (Help! )
You could write a servlet Filter that will buffer the output, and after the tiles execute the filter will determine whether to send the output to the client. If the filter determines that an error occurred then is can forward to the displaySystemError.do. You will have to write a HttpResponseWrapper and pass that through the FilterChain. This is not recommended if you have large HTML pages because every request you will have at some point the entire page in memory. -james On Fri, 2003-06-06 at 09:23, Hohlen, John C wrote: > The "clearBuffer()" method didn't affect anything. The error page was still > surrounded by all the other Tiles being rendered. I then tried "clear()" > and it caused the following exception: > > java.lang.IllegalStateException: response already committed at > weblogic.servlet.jsp.JspWriterImpl.clear(JspWriterImpl.java:35) > > That's pretty much in-line with expectations according to documentation on > "JSPInsider.com": > > clear() > This method clears the ENTIRE content of the current buffer. If the buffer > has been already been flushed then the clear operation throws an IOException > error since the page's data has already been irrevocably written to the > client response stream. Also when not using buffering calling this method > will throw an IOException error. > > clearBuffer() > Clears the current contents of the buffer. This function will not return an > exception if the buffer has already been flushed. > > So I'm still stumped. The behavior I'm looking for may not be possible. > > JOHN > > -Original Message- > From: Mike Jasnowski [mailto:[EMAIL PROTECTED] > Sent: Friday, June 06, 2003 9:56 AM > To: Struts Users Mailing List > Subject: RE: [Tiles] Forwarding To JSP Error Page From Within Tiles > (Help!) > > > You might try buffering the output of your pages, so they aren't committed. > But not sure that's the ideal solution. Another possibility is on the > error.jsp, you can programmatically clear the output writer of any content > it may have already buffered, then write out the stuff in your error.jsp you > want to display. > > out.clearBuffer(); > > There might be other solutions though. > > HTH, > Mike > > -Original Message- > From: Hohlen, John C [mailto:[EMAIL PROTECTED] > Sent: Friday, June 06, 2003 10:47 AM > To: Struts-User (E-mail) > Subject: [Tiles] Forwarding To JSP Error Page From Within Tiles (Help!) > > > This is a continuation of a post I submitted yesterday as an "off topic" > subject entiled: > > "[OT] web.xml configuration problem" (Special thanks to David > Graham for his many replies): > > Currently, this isn't showing up in the archives so I couldn't provide a > link. However, I feel this is no longer an "off topic", but rather a > Tiles/JSP topic. The issue I'm facing is how to forward to an error page > (JSP) when a runtime exception (e.g. NullPointerException) occurs within my > JSP Tile. Currently, I've added the following directive to each of my JSPs: > > <%@ page errorPage="/jsp/error.jsp" %> > > I'd prefer to only specify this information in one place, but I can't figure > out how to do that either. The "" setting in the web.xml > doesn't appear to work for JSPs, just regular Java code inside the web > container. Now, when an exception occurs in a Tile JSP, my error screen is > displayed, but it's inserted into the page with all the other Tiles > displayed as well. This can look really ugly depending on which Tile the > exception occurs in. What I would I would prefer to do is automatically > forward to a brand new screen. David Graham gave me the idea of redirecting > to a Struts action: > > <%@ page errorPage="/displaySystemError.do" %> > > But this causes the following exception: > > java.lang.IllegalStateException: Cannot forward a response that is already > committed > > I think that makes since b/c of the other Tiles (JSP Servlets) that have > already been processed and committed HTML to the output writer. So I'm > stumped at this point. Please reply if anyone has any bright ideas. > > Thanks, > > JOHN > > > - > 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] > > - > 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]
Re: [Tiles] Forwarding To JSP Error Page From Within Tiles (Help!)
It's a hack, but the action "displaySystemError.do" could send some javascript that when loaded will send the browser window to a specified error page. window.location="http://www.google.com";; On Fri, 2003-06-06 at 08:46, Hohlen, John C wrote: > This is a continuation of a post I submitted yesterday as an "off topic" > subject entiled: > > "[OT] web.xml configuration problem" (Special thanks to David > Graham for his many replies): > > Currently, this isn't showing up in the archives so I couldn't provide a > link. However, I feel this is no longer an "off topic", but rather a > Tiles/JSP topic. The issue I'm facing is how to forward to an error page > (JSP) when a runtime exception (e.g. NullPointerException) occurs within my > JSP Tile. Currently, I've added the following directive to each of my JSPs: > > <%@ page errorPage="/jsp/error.jsp" %> > > I'd prefer to only specify this information in one place, but I can't figure > out how to do that either. The "" setting in the web.xml > doesn't appear to work for JSPs, just regular Java code inside the web > container. Now, when an exception occurs in a Tile JSP, my error screen is > displayed, but it's inserted into the page with all the other Tiles > displayed as well. This can look really ugly depending on which Tile the > exception occurs in. What I would I would prefer to do is automatically > forward to a brand new screen. David Graham gave me the idea of redirecting > to a Struts action: > > <%@ page errorPage="/displaySystemError.do" %> > > But this causes the following exception: > > java.lang.IllegalStateException: Cannot forward a response that is already > committed > > I think that makes since b/c of the other Tiles (JSP Servlets) that have > already been processed and committed HTML to the output writer. So I'm > stumped at this point. Please reply if anyone has any bright ideas. > > Thanks, > > JOHN > > > - > 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]
Re: Error — [Ljava.lang.String;@d23.
You might want to take a look at the Java Code Conventions. Also, just use a String for the getters and setters, you don't need to use a String array. http://java.sun.com/docs/codeconv/ On Fri, 2003-06-06 at 08:22, Sashi Ravipati wrote: > Hi > > I get the following error when the jsp page is displayed after the > validation fails (Validation errros are all working fine) > > [Ljava.lang.String;@d23. > > This happens when I am passing values to a String Array. eg: .jsp I have > > > > > These are my set and get methods in my ActionForm > > private String [] FirstName=null; > > public String[] getfirstName(){ > return FirstName; > } > > public void setfirstName(String[] newName){ > FirstName = newName; > } > > It works fine when I use String but returns jusn when using String > array. The values are being set correctly when I ran in debug mode. > > Is this a bug?? > > Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tags to compare properties of 2 bean.
You can use the JSTL tags for this. ... On Wed, 2003-06-04 at 13:34, Zhu He wrote: > Hi > We can use struts tag to compare the property of a bean to a value, like > scope="request" value="value"> > > Are there struts tags we can use to compare the properties of 2 beans > (without using any jsp scriplet)? > > I am a newbie > thx for you patience. > > > Zhu > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Very simple and URGENT Tag question - Please Help
If you placed a Map in the context you can reference items in the Map by the key. Example would be to place a Map with a key of "ID" and some value into context. You can reference the value by calling . This is useful when you can't write a bean. On Tue, 2003-06-03 at 09:41, Chen, Gin wrote: > btw this question was answered on the JSTL (Taglibs) list. > I just gave a recap of the answer. If you want a more thorough explanation > you can find it in the archives. > -Tim > > -Original Message- > From: Chen, Gin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 03, 2003 11:35 AM > To: 'Struts Users Mailing List' > Subject: RE: Very simple and URGENT Tag question - Please Help > > > since the collection in your case is not accessible except via a method that > requires a parameter you can not do this using just jstl or even struts. > the best way to do it is to expose your collection with a getXXX method. > That way the syntax you used will work. > JSP 2.0 *should* solve your problem though. It will allow for you to invoke > methods. > -Tim > > -Original Message- > From: Renato Romano [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 03, 2003 11:33 AM > To: 'Struts Users Mailing List' > Subject: Very simple and URGENT Tag question - Please Help > > > I have a bean with an indexed property, that is myBean.getItem(int i). I > can't find a way to access that property, using struts, struts-el nor > jstl. I tried the following: > > > > Where ind is the indexId attribute of an ordinary logic:iterate struts > tag. (and c is the prefix for the core jstl tag downloaded from jakarta) > Where Am I wrong ? > Thanks > > Renato > > > Renato Romano > Sistemi e Telematica S.p.A. > Calata Grazie - Vial Al Molo Giano > 16127 - GENOVA > > e-mail: [EMAIL PROTECTED] > Tel.: 010 2712603 > _ > > > > - > 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] > > - > 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]
Re: struts tags vs jstl
I'm pretty sure that the latest release of Struts includes a subset of Struts tags that have been configured to support the EL Expression language. This is the expression language that is built into JSTL. I think that only the Struts tags that don't have equivalents in the JSTL have been ported. - Original Message - From: "Nathan Coast" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 02, 2003 9:36 PM Subject: struts tags vs jstl > Hi, > > I've used struts for a while now and figured I should probably look at > the jstl. Theres certainly plenty of common ground to do with > programatic control (decisions and looping) and with > internationalisation. I'm not sure sql tags in jsp are particularly > bright idea but anyway > > Does anyone have any thoughts on which bits are best to use from each of > the taglibs? Also, is there any plan to make the struts tags support > the definition of the corresponding jstl tags? The idea being that > you'd only have to learn one syntax to use both taglibs, whilst using > the struts tags would give you all the additional funcionality that > comes with struts. > > cheers > Nathan > > > - > 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]
Re: Collection Implementation
Vectors *are* synchronized. You will still have a problem if your code looks like if( vector.contains( someObject) ) vector.remove( anotherObject ) Any will need to synchronize on something else or on the instance itself. On Mon, 2003-06-02 at 15:05, sjones wrote: > some implemenations of collections are faster than others. > > Vectors are thought to be the slowest. > > you can run a simple test to see guage the impact of using > one -vs- the other in your application. > > > "Michael Ruppin" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Without checking the archives for specific references, > > I'm still sure I've read on multiple occasions, "Don't > > use Vectors, use ArrayLists". I was under the > > impression that this was because Vectors are not > > synchronized. After refactoring, today, I read here > > that ArrayLists are not synchronized: > > > > http://java.sun.com/j2se/1.4.1/docs/api/java/util/ArrayList.html > > > > Time to refactor again? I need to be using one of the > > static Collections.synchronized* methods, right? > > Beyond using Objects that are synchronized, what > > difference does it make which implementation of > > Collection I choose? > > > > m > > > > > > __ > > Do you Yahoo!? > > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). > > http://calendar.yahoo.com > > > > > - > 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]
Re: to forward or NOT?
>From what I understand about the question, it sounds like the user is downloading a file from the server and you want to abort the request after the action executes. It also sounds like the download is taking place in the Action. What I don't understand is how the users web page could be changed after the download is complete. Any HTML that is sent would then be in the download stream. A redirect may change the web page after the download however that is not likely. In either case I think that there is a issue in the way that you are using an Action. The executing Action should not be sending anything to the Response. I am assuming that the only reason that the Response is in the Action.execute signature is for setting/retrieving cookies. The best solution would be for the Action to forward to a Servlet that would send the resource to the client. -james - Original Message - From: "David M. Karr" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, June 01, 2003 12:11 AM Subject: Re: to forward or NOT? > > "Riyaz" == Riyaz Mansoor <[EMAIL PROTECTED]> writes: > > Riyaz> hi > > Riyaz> is it at all possible to NOT forward after executing an action? > > Riyaz> here's my situation. a link would execute a download action and the file > Riyaz> downloads fine. however, i want to keep the existing webpage displayed and > Riyaz> NOT move to a different page. > > Riyaz> is there a ActionForward directive or other that tells struts to stay put? > > Riyaz> OR would i have to construct the full url (with parameter name/values) and > Riyaz> forward there? > > Riyaz> ideas? > > Did you try returning null from the Action method? > > -- > === > David M. Karr ; Java/J2EE/XML/Unix/C++ > [EMAIL PROTECTED] ; SCJP; SCWCD > > > > > - > 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]