Re: Struts , hibernate, and DBCP
Erik Weber wrote: If you are using SQL Server, I would say, watch out for the drivers as much as the DataSource implementation. I have read and heard many horror stories about the Microsoft drivers and have experienced problems myself (though pinpointing them is another matter). There are third party drivers out there that claim to be much better. I could use a good one myself . . . Have you tried: http://jtds.sourceforge.net/ Erik Brian McGovern wrote: Well all the folks in the Hibernate boards seem to favor either Proxool or C3P0. I've heard about the complaints on DBCP and am using SQL Server for this implementation so i'll watch out for connection leaks. It's really not that hard to switch the pooler, I'll probably give c3p0 a shot with and without my extended base class and see what happens there. -B -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 3:46 PM To: Struts Users Mailing List Subject: Re: Struts , hibernate, and DBCP Interesting. Yeah, I was going to suggest writing some trigger code for startup, and it looks like that's what you have done. Also, you're not stuck with DBCP. There are many DataSource implementations out there, including others that are open source. I was hoping to get around to reviewing them all one day. . . I have had problems with DBCP leaking connections when used with some databases (Oracle and SQL Server 2000). It could be a vendor-specific problem though, because DBCP seems to work great with ConnectorJ/MySQL. Erik Brian McGovern wrote: Eric Thanks for response. I wrote a follow up that explained my work around. But to your points, in using commons-dbcp and specifying the initial pool size of 5, you'd think that it would fire up the pool on application start but it doesnt. In code, you have to request a connection from the JNDI resource in order for the pool to be created. -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 2:58 PM To: Struts Users Mailing List Subject: Re: Struts , hibernate, and DBCP In my opinion, the question is on topic. I'm not sure whether by instantiated you mean the pool class or the connection class. If it's the former, I'm not sure of the answer, but I would assume that the pool class typically is instantiated at server startup. If not, wouldn't the JNDI lookup fail? If it's the latter, I think specifying the minimum connection count property ( 0) in your datasource config should cause the pool to be primed right after startup. But, it's up to the pool implementation of course. But the minimum connection count is supposed to keep the pool from going dry. Erik N G wrote: This has nothing to do with Struts: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html Good luck, NG. On Tue, 29 Mar 2005 13:40:56 -0500, Brian McGovern [EMAIL PROTECTED] wrote: Im using struts, hibernate and dbcp connection pooling. Everything works fine but regarding my connection pool. It gets intantiated on the first time I request a connection from the DBCP pool. I want it to create the pool when tomcat starts. I think i can do this with struts, but im not sure how. If using struts config for htis is not the answer i;d still like to know what is. -thanks -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Interesting problem...
Will InetAddress.getLocalHost() work for you? NetworkInterface.getNetworkInterfaces() might also be of interest. Or, you might want to create yourself an instance of java.rmi.dgc.VMID... Quoting Frank W. Zammetti [EMAIL PROTECTED]: Oh boy, I got a good one! It's only related to Struts in that the application in question is Struts-based, so I hope no one minds a semi-OT question... Here's the situation... An app I wrote has a daemon thread that is spawned at startup (from a Struts plugin) that does periodic background processing tasks. This works great, never had a bit of trouble. Now though, the app is moving from a single server to a clusted environment. So, what's going to happen is that each server in the cluster will have its own instance of the thread running on it. Not a huge problem except that I have to be sure only one instance of the thread (i.e., one server in the cluster) is executing concurrently. The easy solution is just a database table that is checked when the thread wakes up. If there is no entry in it, then there is no other instance running, so it can write an entry to the table and go off and do its thing. I want to be extremely certain that no issues arise in terms of one instance of the thread reading from the database while another instance is writing, etc. So, aside from transactional database calls and row-level locking, I want to do one more thing: I want the thread to sleep a random number of seconds (1-300) at startup. This will ensure that, all the database locking and such aside, the threads should all be offset from one another in terms of when they run. So, I need a random number generated when the thread starts up. As we all know though, random number generation on most computers that don't have something like a Brownian motion sensor attached stuck in a cup of boiling coffee can't generate truly random numbers. So, in theory, what could happen is that if all the servers in the cluster come up at the same time, the threads could wind up running at the same time regardless of the random sleep at the start! It might never happen in reality, small fluctuations would probably offset them anyway, but I want to be more certain than that. So now we're at the crux of the problem... I can't just seed the random number generator with the current time because it concievably might not be random enough. So, I thought I could just tally up the octets of the server's IP address and add that to the current time. Then the seed on each server should be different enough. But, there doesn't appear to be any way to get the server IP address independant of a request, so I can't get at it in my plugin. Anyone know differently? Assuming that is the case, can anyone think of any other way to seed the generator that would ensure a different value on different machines in the cluster? There are some options like encoding the individual server names in my app's config file with a different seed value for each, but that makes maintenance a pain if a new server is added or one removed or addresses simply changed. Any ideas? Thanks! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Interesting problem...
Quoting Frank W. Zammetti [EMAIL PROTECTED]: I've wanted a nickname all my life (aside from the explicitives some would use!)... never thought it's be Radar :) Then it probably shouldn't be ;-) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Fri, March 18, 2005 1:09 pm, Dakota Jack said: The class works, but I don't think it is what you want. Maybe it is. Just don't have high expectations. I did and was disappointed. Just trying to help you out, Radar! ///;-) Jack On Fri, 18 Mar 2005 12:21:28 -0500 (EST), Frank W. Zammetti [EMAIL PROTECTED] wrote: Why do you think it wouldn't work? Does it sometimes return incorrect information in some setups? I thought of doing some kind of mini-browser-type thing, but before I go down that road I wanted to explore some simpler solutions. The Commons ID thing is very nice, but I'm not so sure I'm comfortable putting in something that isn't actually released yet. That being said, what was on the site for it got me to thinking... I think if I do a combination of the sum of the MAC address digits + the current time + the hashCode of the IP address, that is probably as random as I need. But, if you know something about InetAddress that would make this not work, I'm all ears :) Of course, I'm not sure how to get the MAC address yet, but one problem at a time... -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Fri, March 18, 2005 12:14 pm, Dakota Jack said: InetAddress might not get the answer for you, Frank. I don't know what your setup is, but you can go to any ip address service outside your system and get a unique return address for your machines with a mini-browser. Jack On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti [EMAIL PROTECTED] wrote: Yes, I think InetAddress just might do the trick. Thank you Kris! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Fri, March 18, 2005 11:24 am, Kris Schneider said: Will InetAddress.getLocalHost() work for you? NetworkInterface.getNetworkInterfaces() might also be of interest. Or, you might want to create yourself an instance of java.rmi.dgc.VMID... Quoting Frank W. Zammetti [EMAIL PROTECTED]: Oh boy, I got a good one! It's only related to Struts in that the application in question is Struts-based, so I hope no one minds a semi-OT question... Here's the situation... An app I wrote has a daemon thread that is spawned at startup (from a Struts plugin) that does periodic background processing tasks. This works great, never had a bit of trouble. Now though, the app is moving from a single server to a clusted environment. So, what's going to happen is that each server in the cluster will have its own instance of the thread running on it. Not a huge problem except that I have to be sure only one instance of the thread (i.e., one server in the cluster) is executing concurrently. The easy solution is just a database table that is checked when the thread wakes up. If there is no entry in it, then there is no other instance running, so it can write an entry to the table and go off and do its thing. I want to be extremely certain that no issues arise in terms of one instance of the thread reading from the database while another instance is writing, etc. So, aside from transactional database calls and row-level locking, I want to do one more thing: I want the thread to sleep a random number of seconds (1-300) at startup. This will ensure that, all the database locking and such aside, the threads should all be offset from one another in terms of when they run. So, I need a random number generated when the thread starts up. As we all know though, random number generation on most computers that don't have something like a Brownian motion sensor attached stuck in a cup of boiling coffee can't generate truly random numbers. So, in theory, what could happen is that if all the servers in the cluster come up at the same time, the threads could wind up running at the same time regardless of the random sleep at the start! It might never happen in reality, small fluctuations would probably offset them anyway, but I want to be more certain than that. So now we're at the crux of the problem... I can't just seed the random number generator with the current time because it concievably might not be random enough. So, I thought I could just tally up the octets of the server's IP address and add that to the current time
Re: Interesting problem...
Quoting Frank W. Zammetti [EMAIL PROTECTED]: On Fri, March 18, 2005 1:30 pm, Kris Schneider said: Quoting Frank W. Zammetti [EMAIL PROTECTED]: I've wanted a nickname all my life (aside from the explicitives some would use!)... never thought it's be Radar :) Then it probably shouldn't be ;-) Oh no, I opened my mouth with regard to my typing prowess of my own volition, and that was the catalyst for Radar so now I gotta suffer with it 'till the day I die. :) I can blame no one but myself! Actually, I was thinking more along the lines of Radar's precog abilities. So, if you weren't aware the nick was coming, then it obviously doesn't fit ;-). Anyway, for better or worse, you've already got a namesake from the show. All we can hope for you is that you've got your own real-life Hot Lips...whatever form that may take... ;-) I don't mind... the only problem is now I gotta go get all new business cards printed up :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts DB Access :: Best Practices
Along those lines, I've added an entry to the iBatis Wiki (http://wiki.apache.org/ibatis/). Select 3rd Party Contributions and review the section Convert ResultSet to JSTL Result. You can think of JSTL's Result interface as something *similar* to JDBC's CachedRowSet and BeanUtils' RowSetDynaClass. The example is slanted towards handling cursors that are output parameters from stored procedures, but the basic idea can applied anywhere you want to extract data from a ResultSet. Quoting Joe Hertz [EMAIL PROTECTED]: Vic writes: :snip: The point is... I use ArrayList of Maps now for my DTO,VO and ever as a message object for WS/SOA. Wherever I used to use a bean, now I use a collection, and I like DynaMaps. maybe one day you guys catch up;-) I think I'm buying what you say in a big kinda way. I've been there already I think, but forcing myself to use the DynaBean route and if you've read my posts here, you know I'm frustrated. I've been coming to your conclusion, and I'd love to hear more from you offline if you don't mind. I disagree vehemently that the idea of Maps in the Domain Model is a bad design. I worked for years in an architecture that eschewed many OO concepts as creating more work than they saved. Its universe was something like this- A Database contains a map of Table Objects A Table object contains an array list of Record Objects. A Record object contains a map of Field Objects. Etc Done properly, something like this could be infinitely reusable no matter what the application. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: JSTL c:if question
Make sure to put the entire test within the EL expr delimiters: c:if test=${requestScope.mode == 'a'} ... /c:if The scope attribute is used when you also provide the var attribute to store the result of the tested expression (it will be of type Boolean). Quoting Günther Wieser [EMAIL PROTECTED]: i think your test won't work as strings get compared using the equal method and not == (but i have no idea what the test attribute does in the tag class). if you use logic:equals name=mode value=awhatever needs to be done/logic:equals it should work (at least it works for me ;-) ) kr, guenther -Ursprüngliche Nachricht- Von: David Johnson [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 00:24 An: Struts Users Mailing List Betreff: JSTL c:if question a little off topic but.. I have a variable (a string named mode) in request scope and I want to display something conditionally in the JSP. Right now, I have the following, which doesnt work. The error is 2: Illegal scope attribute without var in c:if tag. What am I doing wrong? c:if test=${mode}=='a' scope=request first thing /c:if c:if test=${mode}=='b' scope=request second thing /c:if -- -Dave [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] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CSS and Tiles
Just be aware that c:url, like html:link, will encode/rewrite the URL (add session info) as needed. This may or may not cause problems when servicing the request. It should be fine to just do: link rel=stylesheet href=c:out value=${pageContext.request.contextPath}/styles/style.css}/ type=text/css media=all/ Quoting David Johnson [EMAIL PROTECTED]: My final solution looks like this: link rel=stylesheet href='c:url value='/jsp/styles/style.css'/' type=text/css media=all/ Thanks all! On Mon, 28 Feb 2005 14:04:46 -0600, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Assuming you don't map it in web.xml, the default value is : http://java.sun.com/jstl/core It's defined in the c.tld taglib descriptor itself, see the uri sub element. -Henrik David Johnson [EMAIL PROTECTED] 02/28/2005 01:53 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: Subject:Re: CSS and Tiles a follow up... what's the corresponding tablib element look like for the c.tld taglib? %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % On Mon, 28 Feb 2005 14:42:40 -0500, David Johnson [EMAIL PROTECTED] wrote: nope, that's PERFECT. Thanks. I was planning to use link rel=stylesheet ref=html:rewrite page='/jsp/styles/style.css'/ type=text/css CONTENT=no-cache but this is a better alternative. Thanks! On Mon, 28 Feb 2005 13:40:08 -0600, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Assuming I understood you correctly: I use webapplication absolute path with the JSTL core library's URL tag In my JSP: link rel=stylesheet type=text/css media=all href=c:url value=/styles/stylesheet.css// If you need to use a dynamic value for the stylesheets' name you could use the JSTL's expression language. -Henrik David Johnson [EMAIL PROTECTED] 02/28/2005 01:03 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: Subject:CSS and Tiles Hi all I have the following directory (partial shown) structure in my Struts/Tiles Web-app /webroot /webroot/jsp /webroot/layouts /webroot/styles the styles.css stylesheet is in styles and the layout is in ... not surprisingly, layouts What is the best way to get a reference for the CSS into my layout? Layout code follows - %@ page language=java% %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % %@ taglib uri=http://jakarta.apache.org/struts/tags-tiles; prefix=tiles % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN link rel=stylesheet href=styles/style.css type=text/css CONTENT=no-cache html:html locale=true head html:base / titletiles:getAsString name=title //title /head body table border=1 width=600 cellspacing=5 class=arial10 tbody tr tdtiles:insert attribute=header //td /tr tr td height=80tiles:insert attribute=nav //td /tr tr tdtiles:insert attribute=body //td /tr tr td height=80tiles:insert attribute=footer //td /tr /tbody /table /body /html:html -- -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Antwort: Clarrifications on Usage of logic tag library
] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT Friday] Re: How to pass variable from servlet to jsp?
Ah, now that's more like Friday material: arguing about whether or not an argument is a really debate. P.S. Frank, the reason you may see duplicate notes is that you've got yourself added to the Reply-to field (I removed you for this reply). So, one to you and another to the list... Quoting Frank W. Zammetti (MLists) [EMAIL PROTECTED]: It's not an argument Eric, it's a debate. Are not debates about how to approach various problems part of what this list is for? After all, you can ignore the threads you have no interest in, I do it all the time :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Fri, February 11, 2005 12:49 pm, Eric Lemle said: from Mailing LIST recipient *** If you people are going to argue, please send it to each other, some of us are glad its Friday and don't give two hoots about a scriplet debate. ** Eric D. Lemle Senior Programmer / Analyst Intermountain Health Care 36 South State Street, Suite 1100 Salt Lake City, Utah 84111 United States of America (USA) (801) 442-3688 -- e-mail: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I have a jsp. that has two included jsp's that are actually struts actions but the response only
I imagine it'll take some refactoring to get what you want. Assuming that /EventsAction.do?dispatch=display and /RelocationAction.do?dispatch=display eventually forward to JSPs that generate HTML fragments, you'll probably want your main page to end up like: tabletrtd %@ include file=displayEvents.jspf % /td/tr/table tabletrtd %@ include file=displayRelocation.jspf % /td/tr/table In other words, static includes that make use of the information provided by RelocationAction.display() and EventsAction.display(). I guess Tiles might be another option, but I don't use it so I'm not in a position to suggest exactly how it might help. As for your action code, it seems like it could be moved into a couple of helper classes that are just invoked directly by your main action (the one that forwards to the JSP with the tables). So, you might have EventsHelper and RelocationHelper classes that can be called from different actions but that perform the same sort of logic that you've currently got embedded within actions. Quoting Eric Lemle [EMAIL PROTECTED]: Thanks for the reply, so is there a solution, can I get the HTML from the actions into this jsp? -Eric Eric D. Lemle Senior Programmer / Analyst Intermountain Health Care 36 South State Street, Suite 1100 Salt Lake City, Utah 84111 United States of America (USA) (801) 442-3688 -- e-mail: [EMAIL PROTECTED] [EMAIL PROTECTED] 2/3/2005 5:28:09 PM Sort of. Remember, the normal result of a Struts action is the equivalent of RequestDispatcher.forward(). So, I imagine you're also seeing an IllegalStateException as well. You've got the equivalent of the following: includer.jsp: - @% page contentType=text/plain % Before forwarder1: jsp:include page=forwarder1.jsp/ After forwarder1: Before forwarder2: jsp:include page=forwarder2.jsp/ After forwarder2: forwarder1.jsp: --- jsp:forward page=content1.jsp/ forwarder2.jsp: --- jsp:forward page=content2.jsp/ content1.jsp: - content1.jsp content2.jsp: - content2.jsp Which should generate: content1.jsp Along with raising an IllegalStateException. Eric Lemle wrote: I have a jsp. that has two included jsp's that are actually struts actions but the response only returns the first one. I have tried flush=false (Doesn't matter) I have tried the jsp:param's for the parameters (Doesn't matter) Is there something in the framework that is preventing this? tabletrtd jsp:include page=/EventsAction.do?dispatch=display flush=true / /td/tr/table tabletrtd jsp:include page=/RelocationAction.do?dispatch=display flush=true / /td/tr/table Eric D. Lemle Senior Programmer / Analyst Intermountain Health Care 36 South State Street, Suite 1100 Salt Lake City, Utah 84111 United States of America (USA) (801) 442-3688 -- e-mail: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I have a jsp. that has two included jsp's that are actually struts actions but the response only ret
Sort of. Remember, the normal result of a Struts action is the equivalent of RequestDispatcher.forward(). So, I imagine you're also seeing an IllegalStateException as well. You've got the equivalent of the following: includer.jsp: - @% page contentType=text/plain % Before forwarder1: jsp:include page=forwarder1.jsp/ After forwarder1: Before forwarder2: jsp:include page=forwarder2.jsp/ After forwarder2: forwarder1.jsp: --- jsp:forward page=content1.jsp/ forwarder2.jsp: --- jsp:forward page=content2.jsp/ content1.jsp: - content1.jsp content2.jsp: - content2.jsp Which should generate: content1.jsp Along with raising an IllegalStateException. Eric Lemle wrote: I have a jsp. that has two included jsp's that are actually struts actions but the response only returns the first one. I have tried flush=false (Doesn't matter) I have tried the jsp:param's for the parameters (Doesn't matter) Is there something in the framework that is preventing this? tabletrtd jsp:include page=/EventsAction.do?dispatch=display flush=true / /td/tr/table tabletrtd jsp:include page=/RelocationAction.do?dispatch=display flush=true / /td/tr/table Eric D. Lemle Senior Programmer / Analyst Intermountain Health Care 36 South State Street, Suite 1100 Salt Lake City, Utah 84111 United States of America (USA) (801) 442-3688 -- e-mail: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why is JCL thread-safe in an Action?
I'll be looking into UGLI as well, but I currently code directly to the log4j API. Not that it doesn't have it's own set of issues in a J2EE environment, but my impression is that JCL can be much worse. Here's something else to chew on: http://www.qos.ch/logging/thinkAgain.jsp Vic wrote: That's great about Java. I am going the other way, from JCL to the new log4j: http://logging.apache.org/log4j/docs/ugli.html .V [EMAIL PROTECTED] wrote: Today I find myself converting an existing webapp from using Log4J directly to using JCL instead. As per the JCL User's Guide, I'm creating a private static Log variable in all my classes, Struts Actions included. My question is, why is this OK? Static variables in Actions are a Bad Thing, that's a ell-known fact, but why is a Log instance an exception to this rule? Is it only a bad thing to have static members that might be updated? Is that the difference here? Thanks all! -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why is JCL thread-safe in an Action?
In the spirit of equal time: http://wiki.apache.org/jakarta-commons/Commons_20Logging_20FUD To summarize the last paragraph (that quotes an entry from the blog of one of JCL's creators), JCL is intended to be used by *library* code so it can leverage the logging implementation used by the application it is being called from. In other words, JCL is not intended to be used by applications. Kris Schneider wrote: I'll be looking into UGLI as well, but I currently code directly to the log4j API. Not that it doesn't have it's own set of issues in a J2EE environment, but my impression is that JCL can be much worse. Here's something else to chew on: http://www.qos.ch/logging/thinkAgain.jsp Vic wrote: That's great about Java. I am going the other way, from JCL to the new log4j: http://logging.apache.org/log4j/docs/ugli.html .V [EMAIL PROTECTED] wrote: Today I find myself converting an existing webapp from using Log4J directly to using JCL instead. As per the JCL User's Guide, I'm creating a private static Log variable in all my classes, Struts Actions included. My question is, why is this OK? Static variables in Actions are a Bad Thing, that's a ell-known fact, but why is a Log instance an exception to this rule? Is it only a bad thing to have static members that might be updated? Is that the difference here? Thanks all! -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Are you using Tapestry?
Even more bizarre that it's a sibling Apache project. Along that same line, I thought this was just hilarious: http://www.lightbody.net/~plightbo/archives/000144.html Because, and I'll risk a generalization here, the WebWork devs have always been pretty public about their loathing of Struts. Now that there's a lot of buzz around Rails, Stuts seems to have magically fallen off their radar. I'll just take another quick second to use these two examples as an indirect way to compliment the Struts community (especially the devs) on how they deal with other web frameworks. There's more to a project than the code... Quoting James Mitchell [EMAIL PROTECTED]: http://howardlewisship.com/blog/2005/01/safety-first.html And I didn't even realize there was animositywhat a fool I've been :P -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT - Evaulating JSP as internal template?
For the paranoid, you probably want to be sure that the email template (EmailTestTemplate.jsp) doesn't actually produce any output. Because you're doing an include followed by a forward, there's a *possibility* that the forward will throw an IllegalStateException if the include causes the response to be committed. You can use one of the various JSP whitespace hacks to help: %@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean %%-- --%bean:define id=emailStuff toScope=request ... /bean:define Obviously, the example is unlikely to cause a problem, but a more involved page might. Another approach might be to pass an HttpServletResponseWrapper to the include method whose output stream (or writer) just buffers the entire response for later retrieval. Quoting Niall Pemberton [EMAIL PROTECTED]: You can do this easily using the bean:define tag and the RequestDispatcher. I've put a page up on my web site showing how: http://www.niallp.pwp.blueyonder.co.uk/emailTemplate.html I believe the RequestDispatcher is the magic JSP processor you're looking for. Niall - Original Message - From: William Stranathan [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, January 25, 2005 11:00 AM Subject: OT - Evaulating JSP as internal template? The subject is prolly a poor way to say what I'm trying to say Does anybody know of a simple way to use JSP as an INTERNAL templating engine. For example, if I have a struts application where I'm generating an email to send, I currently have to use Velocity on the server side to put the values into the template, then send that. Is there a simple way to do the same with JSP? Would I be best served by on the server side, constructing an HTTP request to a JSP that simply pops in the request attributes into the correc place? High-level of what I want to do: ActionForward execute(mapping, form, request, response) { MyForm myform = (MyForm)form; Hashtable vals = new Hashtable(); vals.put(user,form.getUser()); vals.put(car,form.getCar()); JSPProcessor proc = new JSPProcessor(); proc.getRequestScope().put(values,vals); StringBuffer buff = proc.evaluate(WEB-INF/templates/email.jsp); MailUtils.mail([EMAIL PROTECTED],buff); } Where JSPProcessor is the kind of magic I'm looking for. I don't really see anything built into the API spec, so I SUSPECT if there were anything available in Tomcat, for instance, it would be implementation specific. Not a HUGE deal, but it's kinda' a pain to have to train new folks on how to put together the JSP's AND how to put together the velocity templates. Thanks, Will -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: R: Session Strategy (here's a filter)
this by means of an ActionHelpers class that has two static methods, start() and finish() that are called, as I'm sure you could guess, at the start and end of all my Actions. They do some common tasks, including this check. If you want a real solution though, externalize your security using something like Netegrity Siteminder. It will deal with this situation for you, in a theoretically more secure fashion than you could probably do on your own. Yet another idea is a filter that will check if a session is alive and redirect as appropriate. This I believe can work no matter what your request is to (Action or JSP directly), or any other resource, assuming the app server serves everything. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. - 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.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j - HTMLLayout CSS
From a quick look at the source, it would appear to be pretty much hard-coded. No separate stylesheet reference. There may be other third-party formatters available that allow that sort of custimization, but I'm not aware of any off the top of my head. Of course, it doesn't seem like it would be too difficult to roll your own based on the existing code Quoting Ritchie Warsito [EMAIL PROTECTED]: This isn't really struts related, but I was wondering if maybe someone here knew something about this. Is it possible to change/replace/remove the css style that log4j generates for html output, if so, where to do that? It is interfering with my own stylesheet, thus giving a screwed up layout of my Struts application. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL import url is broken? Surely not.
No worries, the attribute in named uri and not url for a good reason: it's an identifier, not a location. It's just been standard practice to use a URL string as the value. Check out the JSP spec for the gory details on how containers resolve those identifiers. You'll notice there's no resource located at http://struts.apache.org/tags-html; either. Quoting Daffin, Miles (Company IT) [EMAIL PROTECTED]: Dear All, The JSTL documentation states: Using the Standard Taglib libraries is simple; you simply need to import them into your JSP pages using the taglib directive. For instance, to import the 'core' JSTL library into your page, you would include the following line at the top of your JSP page, as follows: %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % However, the url does not point to a file, tld or otherwise. What is going on here? This is not strictly struts problem. Who can suggest a better list for this and similar questions? -Miles Miles Daffin Morgan Stanley 20 Cabot Square | Canary Wharf | London E14 4QA | UK Tel: +44 (0) 20 767 75119 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamically adding an ActionMapping
Along those lines, you might want to check out the backport of JSR 166 (java.util.concurrent): http://www.mathcs.emory.edu/dcl/util/backport-util-concurrent/ And perhaps specifically ConcurrentHashMap: http://tinyurl.com/6c98r Craig McClanahan wrote: Cool ... this looks like a much better solution to the problem that FastHashMap tried to solve. And I trust the implementors of this library a *heck* of a lot more than I trust myself (I wrote FastHashMap originally) to get all the nitpicky details right. Craig On Mon, 20 Dec 2004 10:17:11 +1300, Jason Lea [EMAIL PROTECTED] wrote: Craig McClanahan wrote: This is *exactly* where the problem lies. If one looks inside the implementation of HashMap, one sees that there are times when the internal data structures are being modified, and are in a potentially inconsistent state that would corrupt a read operation happening on a simultaneously executing thread. If you are accessing a HashMap with read and write operations on multiple threads, the only safe thing to do is lock all the reads, as well as all the writes. If someone were to attempt a change, I imagine using something like (http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap.html) ConcurrentReaderHashMap or ConcurrentHashMap would be good starting point to avoid these locking problems. One problem would be dependency (either using java.util.concurrent for J2SE 5.0 or EDU.oswego.cs.dl.util.concurrent for earlier Java versions) -- Jason Lea -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ??? property naming convention problem
This may be of interest: http://wiki.apache.org/struts/JavaBeans Quoting Andrew Hill [EMAIL PROTECTED]: Yes, it is rather confusing. I wasted *many* hours with this issue the first time it hit me! Another poster also stated that putting the property name as ECoupon in the JSP would work - and thats because with a getter getECoupon() that IS the real property name (like your saying in the last line of your email). Iirc the bean property capitalisation rules - which also cover multiple capital letters in a row - mean there is no equivalant getter for the property eCoupon, instead its ECoupon that maps to the getter getECoupon. So the fact here is that your _not_ naming your property eCoupon - your naming it ECoupon! :-) (The internal varioable name might be eCoupon, but it could equally well be foo or bob, or anything - it doesnt matter for the determination of the property name and as far as code that works with JavaBeans is concerned that property is called ECoupon and not eCoupon. Daniel Perry wrote: This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ??? property naming convention problem
Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Actually, no. It's perfectly legal for a property name to begin with an upper case letter. Again, see: http://wiki.apache.org/struts/JavaBeans Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ??? property naming convention problem
Is that supposed to be some sort of bluff? What do variable names have to do with bean properties? By default, property names are derived from *method* names. For example, the property exposed by TimeZone.getID() is ID, but the property exposed by SSLSession.getId() is id. Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 10:45 AM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Actually, no. It's perfectly legal for a property name to begin with an upper case letter. Again, see: http://wiki.apache.org/struts/JavaBeans I see your specification and raise you the coding style: http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367 Variables Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary throwaway variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. int i; charc; float myWidth; Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ??? property naming convention problem
Jim, you're kidding, right? The original post had nothing to do with variable names and specifically related to bean property names. The key question from the original post is: Is there a property naming convention to be followed in STRUTS The answer is, yes. In general, property names follow the JavaBeans Spec. However, by leveraging Commons BeanUtils: http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.6.1/docs/api/org/apache/commons/beanutils/package-summary.html Struts is able to provide some additional functionality, like mapped properties. Jim Barrows wrote: -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 12:51 PM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Is that supposed to be some sort of bluff? What do variable names have to do with bean properties? By default, property names are derived from *method* names. For example, the property exposed by TimeZone.getID() is ID, but the property exposed by SSLSession.getId() is id. No. The original question dealt with variable names, which is what I was responding to, not a general discussion of Beans that this thread has turned into. Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 10:45 AM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Actually, no. It's perfectly legal for a property name to begin with an upper case letter. Again, see: http://wiki.apache.org/struts/JavaBeans I see your specification and raise you the coding style: http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367 Variables Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary throwaway variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. int i; charc; float myWidth; Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request.setCharacterEncoding question
If you've got a copy of Tomcat installed, look at: $CATALINA_HOME/webapps/servlets-examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.java Quoting Randy Eckhoff [EMAIL PROTECTED]: With the 2.3 servet API, there is a new method: request.setCharacterEncoding(String encoding) This lets you tell the server a request's character encoding. It is critical that setCharacterEncoding is called BEFORE any request.getParameter is called (or getReader). Otherwise, you are at the mercy of the appserver for what you get back on the getParameter call. For example, if setCharacterEncoding is not called, you could get a null value back on getParameter(foo). When you post directly to a jsp (MVC 1), the entry point for servicing the page is ultimately the page itself. So JspCompilers have request.setCharacterEncoding(whatever); in the generated java code as one of the first things that get done. But with Struts, the entry point is not the JSP but rather the action. You eventually forward to the view but by that point, you've already processed the request. So my question is this: For struts actions and forms and anything else struts, is there 1 common place where we can override something to call request.setCharacterEncoding(). Is RequestProcessor.processPreprocess the place to do it? I grepped the struts 1.2.4 source code and only found a setCharacterEncoding on upload\MultipartRequestWrapper.java. That method is a no-op. Ideally, we only want to override 1 method that will handle the request's encoding for form validation and the action handlers, etc. If processPreprocess is NOT the place to do this, where/how should we do this? The ActionServlet instance perhaps that calls RequestProcessor.process()? The action handler knows what encoding to use so somehow, I would have to tell the request processor the encoding unless I can override something in the ActionServlet before process() gets called. I did *some* searching through the struts source code and in RequestProcessor, the call to processPopulate does a getParameter: if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) || (request.getParameter(Constants.CANCEL_PROPERTY_X) != null)) { So calling setCharacterEncoding has to be done before processPopulate(). Thanks! Randy -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] [Way OT] recommended site to pick up a cheap computer and flat panel?
Depending on what cheap means, you might be interested in a brandy-new Dell Dimension 4700 with: P4 530 (3.00GHz, 800 FSB) WinXP Pro 512MB RAM 40GB SATA HD 16X DVD-ROM Integrated Video Integrated 5.1 Channel Audio Integrated 10/100 Ethernet 17 Flat Panel Display (plus other cruft) for $716 Another Dell option is to try the Dell Outlet (go to the Home Home Office area) for refurbished/rebuilt systems. It looks like they've got 4700s with 512MB starting at ~$520 (no monitor, I believe). Quoting Rick Reumann [EMAIL PROTECTED]: Vic wrote the following on 11/15/2004 1:01 PM: Don't you love her? :-) Yea, that's why I'm also suckered into getting her a new Canon digital camera and a good photo quality printer (although each credit card purchase dampens the 'love' I feel a bit:). -- Rick -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] [Way OT] recommended site to pick up a cheap computer and flat panel?
www.dell.com Home Home Office Desktops - Dimension 4700 Customize It Looks like a bunch of discounts that end Wednesday... Quoting Rick Reumann [EMAIL PROTECTED]: Kris Schneider wrote the following on 11/15/2004 1:47 PM: Depending on what cheap means, you might be interested in a brandy-new Dell Dimension 4700 with: P4 530 (3.00GHz, 800 FSB) WinXP Pro 512MB RAM 40GB SATA HD 16X DVD-ROM Integrated Video Integrated 5.1 Channel Audio Integrated 10/100 Ethernet 17 Flat Panel Display (plus other cruft) for $716 Wow? Where did you see that on Dell's site? that's 716 with a flat panel? I had looked there yesterday and didn't see that deal. That above deal sounds sweet. -- Rick -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [****] Including a Struts action in a JSP - IllegalStateException / truncated response issue
Can't really comment on Tiles since I don't use it, but this recent thread may be of interest: http://marc.theaimsgroup.com/?t=10976831933 Quoting Parke Jeff [EMAIL PROTECTED]: Thanks for the information, Jeff. Unfortunately, though the Tiles Advanced Features Guide indicates it is possible to include multiple Struts actions (using tiles:insert) on one page, I _still_ get the IllegalStateException Response has already been committed. We often need to prepare data to be shown by a JSP page. In the MVC framework, the controller prepares data (in the model) to be shown by the view. Translated to Tiles and Struts, we can use a Struts Action as a controller, a JSP page as a view, and combine both in a Tile. So, when you insert the Tile, the Action is called before the JSP page is displayed. Now, your complex web page can be made of Tiles fed by controllers (one sub-controller for each Tile). This approach is better than one single controller for all Tiles of the page, because it really allows building autonomous Tiles, without worrying about how to fed (sic) them all. - Tiles Advanced Features Guide (http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf) This is describing exactly what I want to accomplish and the reason for it but I keep running into the same committed response problem. Is it possible that this is a container issue rather than being a Struts issue? Can someone else confirm that c:import and tiles:insert both cause an IllegalStateException when including more than 1 (actually try 3 or 4) Struts action on the same JSP? Thanks again for anyone who can help, Jeff I think that it is unusual to directly include Struts actions in JSP files. When composing pages of different parts, Tiles is the much more common approach. The standard usage of Tiles is to include JSP files directly, but you can use tiles to include Struts actions in JSP files. (See Section 5.2 of the Tiles Advanced Features guide, a PDF file, at http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf.) -- Jeff Parke Jeff wrote: I'm still having trouble including a Struts action into a JSP (c:import url=/someAction.do /). I've tried using absolute URLs, passing the jsessionid to ensure that the session is not lost, but the request context is different between the JSP and the included action, so this not suitable for many situations. I've also tried upgrading to Struts 1.2.4. This does not resolve the Response has already been committed issue when including more than one Struts action in a JSP. The app server is using JRE 1.4.1_03-b02. Can anyone tell me whether they have seen this situation before? How common is it? Is it unusual to include Struts actions in JSPs? Anyone? Thanks, Jeff -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: use EL in Struts 1.1
I imagine it'll work just like TC 4.1 if his app is using a Servlet 2.3 web.xml. Quoting Karr, David [EMAIL PROTECTED]: You're using Tomcat 5 with Struts-EL? You don't need to use Struts-EL with Tomcat 5. Doing so is wasteful (and I'm surprised it works). The base Struts tag library will provide exactly the same functionality (except for perhaps the expr attribute on logic:match), without the indirection necessary in Struts-EL. -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] I use Tomcat 5.0.27, I don't use the isELIgnored attribute, and I do use the struts-el tags (Struts version 1.1), and everything works fine. Erik David G. Friedman wrote: Rajesh, If you use this syntax in your Tomcat 5.X.X (I'm on 5.0.27) JSP's: %@ page isELIgnored=false % Remember to use the standard struts tags, not the contributed struts-el tags. Regards, David -Original Message- From: Rajesh [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 27, 2004 11:41 PM To: 'Struts Users Mailing List' Subject: RE: use EL in Struts 1.1 Hai Am using Tomcat5 Its supporting JSP2 right Regards, Rajmahendra R. Hegde GK Bharani Software Pvt. Ltd. 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. -- C.A.R. Hoare -Original Message- From: Karr, David [mailto:[EMAIL PROTECTED] Sent: Thursday, October 28, 2004 12:44 AM To: Struts Users Mailing List Subject: RE: use EL in Struts 1.1 Are you using a JSP 1.2 or JSP 2.0 container? If you're using a JSP 1.2 container, you use the jars/tlds in contrib/struts-el/lib. If you're using a JSP 2.0 container, don't use Struts-EL. I didn't see in any of these notes where you said what container you're using. -Original Message- From: Rajesh [mailto:[EMAIL PROTECTED] Hai all, is it possible to use EL in Struts 1.1 ? Struts-EL how to use with Struts 1.1. Regards, Rajmahendra R. Hegde GK Bharani Software Pvt. Ltd. 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. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpServletRequest Question
As to storing the request instances, here's something of interest from the Servlet 2.3 spec: === SRV.4.10 Lifetime of the Request Object Each request object is valid only within the scpoe of a servlets service method, or within the scope of a filters doFilter method. Containers commonly recycle request objects in order to avoid the performance overhead of request object creation. The developer must be aware that maintaining references to request objects outside the scope described above may lead to non-deterministic behavior. === You can certainly pull some data out of the request (params, properties, etc.) and store that, but do not maintain a reference to the actual request object. Quoting John Fitzpatrick [EMAIL PROTECTED]: This may be slightly off-topic for this list, but here goes anyway: I'm working on a Struts site which must be i18n compatible and have a login system where some of the pages are protected. What I'm looking to accomplish is two fold: 1. When viewing any page, including query results, be able to select a language from the pull-down menu and get the page the same page back in the new language. 2. When requesting a page that is protected, have the user be prompted to authenticate and then receive the originally requested page. Or, have a login form on each page which will return the same page with just the login details changed. To accomplish this, I attempted to store each HttpServletRequest in the session and then check for a language change, or login request, in an ancestor of each action, process that change and then serve the previous request. However, when I take the stored request out of the session, it's handle to the Session is now 'null.' Has anyone had some experience attempting something like this, or am I barking up entirely the wrong tree here? FWIW, I've looked at JAAS and don't feel that it suits our needs. The role handling is simply too coarse. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot call c:import / more than once!
It's got nothing to do with JSTL and everything to do with your Struts action. The Struts controller effectively performs the forward with the result of your action's execute method. Yes, c:import can work perfectly well when used multiple times in a page. For URLs that are within the same context (same app), the semantics are pretty much the same as RequestDispatcher.include. Quoting Mick Wever [EMAIL PROTECTED]: On Wed, 13 Oct 2004 13:59:32 -0400, Kris Schneider wrote: I'm not sure he actually intended to do multiple forwards, it seems like he just wanted to reuse an action to generate some common output. The fact that Struts is performing an implicit forward in response to each of those imports can be easy to overlook. Well bugger. I would go so far as to say that struts is not honouring the contract of c:import. Nowhere (that I can find, and please quickly point it out if you can) in the JSTL documentation can I find spec or definition that c:import 'forwards'. It is clearly stated that it imports a URL and never mentions forwarding. Taking this further, examples in Sun's 'core JSTL' book actually use multiple c:import's! So there is the clear indication that the import does not forward, and struts is breaking this contract... Should I enter a bug? Mick. -- ---BR/ Everything you can imagine is real. Pablo Picasso BR/ a href=http://www.harryspractice.com.auHarry's Practice/a BR/--- -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic Fonts: Devolving to Default Dialog
Glad it's working. My initial questions were going to be centered on whether or not the fonts were specific to the app and whether the app needed to make the system fonts available as well as the custom fonts. It sounds like you've moved away from having the app set java.awt.fonts, which I think is a good choice. One thing that immediately comes to mind for apps that are handling image output is to stay away from ImageIO for now, especially for JPEG images. I know, sounds kooky, but there are some bugs that really make it suspect for long-lived processes. Some of the problems are actually caused by the way Java handles temporary files, but the use of ImageIO can exacerbate the symptoms. If you are using it, make sure to issue: ImageIO.setUseCache(false) so that disk-based caching is not used. By default, this is set to true. Here are some bugs to ponder: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4513817 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4827358 Quoting Michael McGrady [EMAIL PROTECTED]: Hello, Kris, Thanks or responding. I solved the problem. Instead of relying up System, I just created my own independent font application. I use a doubled HashMap to get the physical font files location from the font FONT name and the font FAMILY name from a constants class (actually two constants classes, because the VM would not hand the file size). Then I just use TextAttributes put into a may after the Font object is created with a FileInputStream. Works like a charm. All my buttons are created on the fly and Internationalized, so this was essential. If you have anything to add, given this, I would be more than interested. Always looking to make things better. Michael McGrady Kris Schneider wrote: Michael, If you're still looking for input, post back, I've got some follow-up questions. Michael McGrady wrote: I use a Struts PlugIn to set System.setProperty(java.awt.fonts, MyApp.FONTS_LOCATION) to set the dynamic option for awt fonts. This works. Then I put a variety of open source fonts in the MyApp.FONTS_LOCATION directory. new File(MyApp.FONTS_:LOCATION).exists() return true. When I set in a Struts custom taglib for a subclass of ImageTag as TextAttribute.NAME with the value of a .ttf file, it also shows up as the name of the Font object, e.g. java.awt.Font[family=dialog,name=wds011402,style=plain,size=36]. However, as you can see, the family name always returns to a default, and the True Type Font in my custom fonts file is not used. Does anyone have experience with this? Is there a recommended different way of dealing with setting Fonts in Struts. Michael McGrady -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot call c:import / more than once!
I'm not sure he actually intended to do multiple forwards, it seems like he just wanted to reuse an action to generate some common output. The fact that Struts is performing an implicit forward in response to each of those imports can be easy to overlook. Mick, if you want a lower-level analogy, this is sort of equivalent to using RequestDispatcher.include on a resource that performs a RequestDispatcher.forward. If you check out the docs, you'll see that forward should be called before the response is committed. If the response is already committed, an exception will be thrown. Even if you had few enough numbers in your list to avoid the exception (output still buffered), you probably won't get the results you're looking for. As part of the processing of a forward, the container will automatically discard any currently buffered output. As Rick also points out, you'll have to rethink how you have things architected. You may be able to get away with just including a JSP fragment to handle some common formatting tasks: c:forEach var=number items=${listOfNumbers} %-- static inclusion of a fragment, can access ${number} directly --% %@ include file=processNumber.jspf %br/ /c:forEach Quoting Rick Reumann [EMAIL PROTECTED]: Mick Wever wrote the following on 10/13/2004 11:53 AM: c:import url=/customAction.do?number=${number}/ I guess this would be like doing the equivalent of trying to do a forward. On your second loop you'll have already wrote stuff out to the JSP so I don't think you could then do any forwarding. Any reason why you are trying to do fowards within a forEach loop? I can't imagine what good that could accomplish? If there was a bunch of different processing you needed to do, do that in one action business method (do the looping there, not in the JSP). -- Rick -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic Fonts: Devolving to Default Dialog
Michael, If you're still looking for input, post back, I've got some follow-up questions. Michael McGrady wrote: I use a Struts PlugIn to set System.setProperty(java.awt.fonts, MyApp.FONTS_LOCATION) to set the dynamic option for awt fonts. This works. Then I put a variety of open source fonts in the MyApp.FONTS_LOCATION directory. new File(MyApp.FONTS_:LOCATION).exists() return true. When I set in a Struts custom taglib for a subclass of ImageTag as TextAttribute.NAME with the value of a .ttf file, it also shows up as the name of the Font object, e.g. java.awt.Font[family=dialog,name=wds011402,style=plain,size=36]. However, as you can see, the family name always returns to a default, and the True Type Font in my custom fonts file is not used. Does anyone have experience with this? Is there a recommended different way of dealing with setting Fonts in Struts. Michael McGrady -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: An Eclipse Like WebApp Framework? -- a proposal
Just to make sure the bases are covered, have you investigated JSF and found it lacking? Quoting Rob Evans [EMAIL PROTECTED]: Comments inline On Wed, 06 Oct 2004 08:26:20 -0700, Michael McGrady [EMAIL PROTECTED] wrote: I have a proposal at the bottom of this email. I know exactly what you want. Struts is a wonderful potential base for this. I have been crying for this in Struts, but have only gotten resistence from the more vocal committers and, I think, a failure to see what the problem is. Right now Struts includes way too much application specific coding in the core. With a pretty concerted team effort it could be cleaned up, but with 1.3 on the way, that does not seem to be wise at the moment. With Struts 1.2 the problem seems to be increasing rather than decreasing. I really think there is a failure to understand the problem. Could be. I for one am still trying to nail down the issues. Why is having a single WebApp that utilizes Inversion of Control and plugins better than just having several webapps that use the same UI libraries and abide by the same standards? From experience, I know that this has not worked well for large teams, but I'm not I can clearly articulate why, yet. I am not too effective at advocating this, because I don't have the time to assuage feelings around these issues. When it comes to architecture and design, feelings suck. ;-) With Struts 1.3 coming along, I have just bided my time and kept a copy of Struts to consider starting an offshoot that makes the core the core and the rest modular with plugins and extensibility. This might not be too hard, because the main thing is removing dependencies. PROPOSAL/SUGGESTION If you were interested, we might try doing this as a Struts Branch, maybe calling it Branch or Struts Branch, with a really up-to-date modular structure along the lines indicated in Stuart Dabbs Halloway's Component Development for the Java Program, keeping only a real kernel as the base. We could pop it up on SourceForge. I bet we could even recruit The Halloway Himself, even though he has gone elsewhere for the majority of his time right now. I don't think this presently exists. I do think that it would sell like wildfire to users. This would allow the user, in effect, to become automatic developers through their plugins and extensions. This would build a framework without ego in the core. I appreciate your interest and I'm flattered that you think this is a good idea. Before we get to far down the road I'd like to surface more of the problems and understand what it is we're talking about a little more. Michael McGrady James Mitchell wrote: Apache Struts provides just what you want ;) That's about as generic as you can get. - Original Message - From: Rob Evans [EMAIL PROTECTED] Folks, I'm wondering if anyone has thought about developing an Eclipse like WebApp framework. The idea is to provide an application shell and a contribution (think plugin) mechanism. Contributions could include, tabs, navigation, help, etc.. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: An Eclipse Like WebApp Framework? -- a proposal
I certainly don't know enough about it to point you at its various pieces and say, here's just what you need (partly because I'm not crystal clear on what your requirements are). It was mainly just a Pavlovian reaction to discussions about web component frameworks and designing with IDEs in mind, etc. http://java.sun.com/j2ee/javaserverfaces/ Based on what it sounds like you're asking for, I'd say it's worth your time to investigate the space of Java standards to make sure something useful doesn't already exist. Quoting Rob Evans [EMAIL PROTECTED]: On Wed, 6 Oct 2004 12:01:15 -0400, Kris Schneider [EMAIL PROTECTED] wrote: Just to make sure the bases are covered, have you investigated JSF and found it lacking? I've not. Do you know much about it? I was under the impression that its purpose in life was to provided support for UI widget development. [snip] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:out question
Well, content-type should be a non-factor. If the value of escapeXml is true, then the following conversions take place regardless: - amp; - lt; - gt; - #034; ' - #039; What does the actual HTML source look like? Quoting Bill Siggelkow [EMAIL PROTECTED]: Hmmm use c:out value=${foo.bar} escapeXml=true/ to filter c:out value=${foo.bar} escapeXml=false/ to not filter If the filtering is not working then something else has already filtered the content; or the content-type on the page is set to plain text instead of text/html maybe? AFAIK the escapeXml attribute works as touted. -Bill Siggelkow Sergey Livanov wrote: When data output with html elements is used c:out value=... escapeXml='false/true' / the html text is loaded as plain text. table width=99% border=0 cellspacing=0 cellpadding=3 class=t11ver tr align=left valign=top td width=100% class=t10verfont color=#697A94b I have been changing escapeXml but I havent had any results. Is there any analogues bean-write filter? Please help me to find an error. Sergey mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL String concatenation
c:out value=/${path}${sound.fileName}/ Quoting andy wix [EMAIL PROTECTED]: Hi, I have been trying for about 4 hours to get something to work that would take about 4 minutes using scriplets! (and I can find no reference to this in my Core Jstl book). Basically, I have an arraylist of sound objects in the session and when the user clicks one - it should play. The object only contains the filename so I need to prepend the path which is defined as a static variable in a class. So I have: % String path = UploadAction.PATH; pageContext.setAttribute(path, path); % c:forEach var=sound items=${Sounds} varStatus=status tr tda href= XX c:out value=${sound.fileName}//a/td /tr /c:forEach where XX is the problem bit. I want to concatenate / + path + ${sound.fileName} so that the href gets the full path and but only the filename is displayed. Cheers, Andy -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL String concatenation
For reference, here's a snippet from the JSTL 1.0 Spec., Section 3.1 Expressions and Attribute Values: It is also possible for an attribute to contain more than one EL expression, mixed with static text. For example, the following would display Price of productName is productPrice for a list of products. c:forEach var=product items=${products} c:out value=Price of ${product.name} is ${product.price}/ /c:forEach Quoting Kris Schneider [EMAIL PROTECTED]: c:out value=/${path}${sound.fileName}/ Quoting andy wix [EMAIL PROTECTED]: Hi, I have been trying for about 4 hours to get something to work that would take about 4 minutes using scriplets! (and I can find no reference to this in my Core Jstl book). Basically, I have an arraylist of sound objects in the session and when the user clicks one - it should play. The object only contains the filename so I need to prepend the path which is defined as a static variable in a class. So I have: % String path = UploadAction.PATH; pageContext.setAttribute(path, path); % c:forEach var=sound items=${Sounds} varStatus=status tr tda href= XX c:out value=${sound.fileName}//a/td /tr /c:forEach where XX is the problem bit. I want to concatenate / + path + ${sound.fileName} so that the href gets the full path and but only the filename is displayed. Cheers, Andy -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how about some clarification vs saying things are ludicrous [partially OT]
Yeah, it's fine. For posterity, I didn't look closely enough at the quoting in the statement. The JSTL equivalent would be: function swapAction(formName, action) { formAction = document.getElementById(formName).action; newAction = 'c:url value=/'+action+'.do/'; document.getElementById(formName).action = newAction; } Quoting Rick Reumann [EMAIL PROTECTED]: Durham David R Jr Contr 805 CSPTS/SCE wrote the following on 9/15/2004 2:00 PM: See, that's not what I get when I run it. Are you sure you have that javascript snippet on a JSP with the import of the html taglib declared correctly on the top of the page (ie %@ taglib prefix=html uri=http://struts.apache.org/tags-html; % ) ? -- Rick -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trying to come up with a Mapping-Dispatch combo Action
I'm guessing David's getting at how to properly construct a request-time value for a tag attribute. If you're using a scripting expression, everything must be contained within %= and %. If you're using an EL-enabled tag, then you can do something like: /${action}.do (assuming action is a scoped variable). Quoting Michael McGrady [EMAIL PROTECTED]: Rick and David, DAVID I cannot see what you are getting at, David. What is the problem? I ran your code without incident. I assume that the result is what Rick wants. Please state what you think the problem is. Apparently you don't think the problem is JavaScript will have to run taglib code, because there is none of that there. Are you just dissatisfied with what the value of the html:rewrite is? RICK Any way, I have something else on this. Rick, I have written a class I call SimpleDispatchAction which allows you to use links, submits, and images with the same code without involving struts-config.xml in the process. I put it up at http://wiki.apache.org/struts/StrutsCatalogSimpleDispatchAction if you want to see it. All you have to do is to make sure that the name in your name value pair ends with .x. So *LINKS:* a href='update.do?update.x=update'UPDATE/a a href='update.do?update.x=delete'DELETE/a *FORM SUBMITS:* input type='submit' name='update.x' value='update'UPDATE input type='submit' name='delete.x' value='delete'DELETE *IMAGES:*input type='image' name='update' src='update.gif' input type='image' name='delete' src='update.gif' all work in this case without any value for the parameter attribute in DispatchAction or LookupDispatchAction. Does this do the job for you? Notice that you can change the update.x, for example, to method.update.x if you want to do the localization thing as in LookupDispatchAction. I probabley should do that next, if you don't find something amiss here. Michael McGrady -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trying to come up with a Mapping-Dispatch combo Action
You mean the thing that starts html:rewrite is actually JavaScript? Could've fooled me! ;-) Tags like html:rewrite and c:url are great for generating URLs to be used by JavaScript code that needs to interact with web apps. One of the reasons they're so useful is that they have built-in support for URL rewriting (encoding of session info). BTW, in an earlier note, Rick was thinking of changing to: newAction = '${pageContext.request.contextPath}/'+action+'.do'; Which seems like a bad idea since it skips URL rewriting. Quoting Michael McGrady [EMAIL PROTECTED]: Kris Schneider wrote: I'm guessing David's getting at how to properly construct a request-time value for a tag attribute. If you're using a scripting expression, everything must be contained within %= and %. If you're using an EL-enabled tag, then you can do something like: /${action}.do (assuming action is a scoped variable). But this is not a tag attribute. The JavaScript is not a tag. Michael McGrady -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: C:out and LazyValidatorActionForm
It's not a DynaActionForm, so it doesn't inherit the map property, and it doesn't appear to define one of its own: ActionForm ^ __|__ | | ValidatorForm DynaActionForm (map property defined here) ^ | BeanValidatorForm ^ | LazyValidatorForm ^ | LazyValidatorActionForm Quoting Seaman, Sloan [EMAIL PROTECTED]: I'm trying to use c:out to display the contents of a form bean that is of type: form-bean name=form_DetailSheet type=org.apache.struts.validator.LazyValidatorActionForm/ I set a form value like so: DynaBean df = (DynaBean)_form; df.set(accessionDate, new java.util.Date()); I thought that doing a c:out value=form_DetailSheet.map.accessionDate/ would do it but I keep getting an error that it can't find .map How do I go about getting the value? Thanks! -- Sloan -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: C:out and LazyValidatorActionForm
The Struts tags are BeanUtils-enabled, so bean:write should work... Quoting Seaman, Sloan [EMAIL PROTECTED]: That's what I thought. I even tried LazyValidatorActionMap but that didn't seem to do it either... Ah well... -- Sloan -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 3:53 PM To: Struts Users Mailing List Subject: Re: C:out and LazyValidatorActionForm It's not a DynaActionForm, so it doesn't inherit the map property, and it doesn't appear to define one of its own: ActionForm ^ __|__ | | ValidatorForm DynaActionForm (map property defined here) ^ | BeanValidatorForm ^ | LazyValidatorForm ^ | LazyValidatorActionForm Quoting Seaman, Sloan [EMAIL PROTECTED]: I'm trying to use c:out to display the contents of a form bean that is of type: form-bean name=form_DetailSheet type=org.apache.struts.validator.LazyValidatorActionForm/ I set a form value like so: DynaBean df = (DynaBean)_form; df.set(accessionDate, new java.util.Date()); I thought that doing a c:out value=form_DetailSheet.map.accessionDate/ would do it but I keep getting an error that it can't find .map How do I go about getting the value? Thanks! -- Sloan -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how about some clarification vs saying things are ludicrous- Re: Trying to come up with a Mapping-Dispatch combo Action
Oh I definitely think it's more than okay to use tags to help generate JavaScript. In fact, using server-side code to generate client-side code is a telltale sign of a very seasoned and very respected developer ;-). The only reason I jumped in at all (and yes, it was late, sorry if I missed some of the back-story) was to help clarify that this: html:rewrite page=/'+action+'.do/ is busted as far as tag syntax goes. Other than that... Rick Reumann wrote: Durham David Contr 805 CSPTS/SCE wrote the following on 9/14/2004 1:31 PM: I tested the code -- not that I needed to do so, but still. I'm sure you didn't need to test it Oh almighty coding God. Just throw it into a JSP and look at the resulting HTML. Here's an index.jsp that I've ran in Tomcat 5.x: html head script function swapAction( formName, action) { formAction = document.getElementById( formName ).action; newAction = 'html:rewrite page=/'+action+'.do/'; document.getElementById( formName ).action = newAction; } /script body /body /html Are you saying that's how the resulting HTML looked? If so then you don't have a clue what the javascript was attempting to do because that's not what the resulting HTML will look like if you are correctly using the Struts html tag. Sorry for sounding harsh but I've been nothing but patient and instead all you've said, as of late, is stuff like That no one sees it is blowing my mind or This is ludicrous yet you haven't explained what part you are seeing as ludicrous. On top of that I've clearly showed what the html:rewrite tag will display as HTML and showed how I could swap out using the html:rewrite tag if I wanted (but would lose the nice URL encoding and sessionid stuff). I really hope that I don't need to go further with this. In the words of Mike Tyson, This is ludicrous! Your initial comment in this thread was: It looks like JavaScript is being used to generate an html:rewrite/. and as Michael pointed out JavasScript isn't 'generating' anything and as I've mentioned a bunch of times now all that the html:rewrite does is write to the page encoding the URL and appending jsessionid if necessary. And I'm sure Kris jumped in the thread late or else he would have seen my post about I knew there was a reason I used html:rewrite verses using the ${pageContext.request.contextPath} stuff. (Which I mentioned that later was a wrong approach). David, Kris is actually clarifing EXACTLY what we are talking about when he mentions: Tags like html:rewrite and c:url are great for generating URLs to be used by JavaScript code that needs to interact with web apps. One of the reasons they're so useful is that they have built-in support for URL rewriting (encoding of session info). and Michael... I think Kris is saying it is ok.. since above he mentions how they are great for generating.. The problem David is you keep complaining how we don't see what you're talking about yet I haven't seen an explanation of what we aren't seeing. If by what we are not seeing you mean the generated HTML you mention above... what you are displaying as generated HTML is not the same generated HTML that I see when I run the same code. Does this whole problem revolve around you not importing the struts html tag on the page? Besides just saying how things are ludicrous, or how blind we must be, and acting all arrogant with comments like I tested the code -- not that I needed to do so, instead why don't you be more specific about what the problem is? And if we are wrong about something have a bit of humility. Nobody in this industry knows it all. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] How to sort with c:forEach?
The newer versions of the Display taglib (http://displaytag.sourceforge.net/) appear to be EL-enabled, so perhaps it could help with a taglib-only sorting solution. Quoting Craig Dickson [EMAIL PROTECTED]: I understand this suggestion. However, in the particular scenario I am dealing with, the Collection is not part of the business layer. For example, we want to print out the request headers on an error page for debugging purposes. We want the headers to print out in name order for ease of reading and finding specific headers in what is sometimes a long list. Using JSTL with the built in EL, we could do something like this: c:forEach items=${headers} var=current tr tdc:out value=${current.name}//td tdc:out value=${current.value}//td /tr /c:forEach In this case the value of headers is made available through the EL (obviously I could grab the headers in a servlet prior to the JSP and sort them and put them in the request, but we are trying to avoid all of that hassle if possible). This is just one example where having the tag itself to the sorting would be advantageous. Bill Siggelkow wrote on 9/8/2004, 10:23 AM: Do it in the business layer that fetches the collection -- or in the database -- or store the data in a sorted collection (like SortedTreeMap or some similar animal). Craig Dickson wrote: Hi, Is there an easy way to have the JSTL forEach tag sort the collection of items before looping through them? Currently I have a scriptlet doing it before the loop tag, but this is pretty ugly. Thanks -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ARRRGGGGHHHH!!! I'm being stupid again....
Not sure if it's *explicitly* part of any official docs, but it can be inferred from the struts-config DTD. The comment for action includes: The action element describes an ActionMapping object... The comment for set-property includes: When the object representing the surrounding element is instantiated, the accessor for the indicated property is called and passed the indicated value. Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Bill Siggelkow Sent: Friday, September 03, 2004 10:08 AM To: [EMAIL PROTECTED] Subject: Re: ARRR!!! I'm being stupid again The set-property in nested action applies to the ActionMapping object not the Action. Oh that makes sense in a SCO kind of way... Just so I can bookmark that info... where did you find it? Jim Barrows wrote: I'm trying to use the set-property tag in the struts-config file. I know I'm being stupid, but what exactly is it? It's not finding the property to set. Okay if I have in my struts-config.xml: action name=loanForm path=/loanAppWizard type=com.sssc.shtuff.actions.LoanAppWizardAction scope=session set-property property=maxNumberOfPages value=2 / forward name=page1 path=/demographics.jsp/forward forward name=page2 path=/references.jsp/forward forward name=done path=/done.jsp/forward /action and this in my action class: public class LoanAppWizardAction extends Action { blah /**Read only property from inside this action that indicates what number is * the last page. */ private int maxNumberOfPages = 0; Lots o' blah /** * @return */ public int getMaxNumberOfPages() { return maxNumberOfPages; } public void setMaxNumberOfPages(int i) { maxNumberOfPages = i; } } Then I should end up with maxNumberOfPages set to 2, and not: The following exception was logged java.lang.NoSuchMethodException: Bean has no property named maxNumberOfPages -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 1.2.2 validator problem in websphere
) at com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1455) at com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1414) at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker .java:197) at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(C achedInvocation.java:71) at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletReq uestProcessor.java:182) at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListene r.java:334) at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.jav a:56) at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610) at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593) Thanks, -Andre Andre Mermegas Java Developer Muze Inc. 304 Hudson Street New York, NY 10013-1015 USA 212.824.0333 -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classloading problem
Hang on, my bad - it should be /META-INF/context.xml. So, rename Foo.xml to be context.xml and place it in *META-INF*. Quoting Erik Weber [EMAIL PROTECTED]: Kris, this is from context.html in the Tomcat 5 docs:* Please note that for tomcat 5.x, unlike tomcat 4.x, it is NOT recommended to place Context elements directly in the server.xml file.* Instead, put them in the META-INF/context.xml directory of your WAR file or the conf directory as described above. So here I am, stupidly trying to put my Foo.xml file within /META-INF/context.xml/ (and various variations of that) of my web app. So should I rename Foo.xml to context.xml (I ask because in the conf directory I have been naming it Foo.xml, not context.xml), and put it in *WEB-INF*? Could you show me where you found how to do this in the docs? Am I just completely misreading the above sentence? Thanks for your help, Erik Kris Schneider wrote: Can you provide some more detail on the problems you're running into with using WEB-INF? I've got a simple one lying around here somewhere... WEB-INF/context.xml: Context path=/init Loader delegate=false/ Manager pathname=/ /Context Seems to work fine with TC 5... Quoting Erik Weber [EMAIL PROTECTED]: Also, since you appear to be trying to follow the documenation, have you ever gotten a Context XML file placed within the META-INF directory of your web app to work? I can't get this to work (I have gotten them to work when placed in the conf directory -- though I had to learn the hard way to take write permissions away from Tomcat after it very rudely deleted one). The documentation is confusing, and the example web app mysteriously does not include a Context XML file at all, despite that pretty much any serious web app is going to need one (unless you declare everything in server.xml). If you have an example of this working, please share it with me. Erik Ivan Vasquez wrote: Sure, in common/lib it works well. But from Tomcat docs: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html The following rules cover about 95% of the decisions that application developers and deployers must make about where to place class and resource files to make them available to web applications: * For classes and resources specific to a particular web application, place unpacked classes and resources under /WEB-INF/classes of your web application archive, or place JAR files containing those classes and resources under /WEB-INF/lib of your web application archive. * For classes and resources that must be shared across all web applications, place unpacked classes and resources under $CATALINA_BASE/shared/classes, or place JAR files containing those classes and resources under $CATALINA_BASE/shared/lib. --Then goes on...--- Common - This class loader contains additional classes that are made visible to both Tomcat internal classes and to all web applications. Normally, application classes should NOT be placed here. All unpacked classes and resources in $CATALINA_HOME/common/classes, as well as classes and resources in JAR files under the $CATALINA_HOME/commons/endorsed and $CATALINA_HOME/common/lib directories, are made visible through this class loader. Shared - This class loader is the place to put classes and resources that you wish to share across ALL web applications (unless Tomcat internal classes also need access, in which case you should put them in the Common class loader instead). All unpacked classes and resources in $CATALINA_BASE/shared/classes, as well as classes and resources in JAR files under $CATALINA_BASE/shared/lib, are made visible through this class loader. In our case we want to share jars common to all applications, but none of them are required by Tomcat. Ivan. -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 31, 2004 12:52 PM To: Struts Users Mailing List Subject: Re: Classloading problem I have been using 5.0.27, putting my JDBC drivers in common/lib, and my struts jars in WEB-INF/lib of each application, and haven't had any problems. Why do you say incorrectly? Erik Ivan Vasquez wrote: We have Tomcat 5.0.16 and were incorrectly placing common jars (such as JDBC drivers) in /common/lib. Now we just moved them to /shared/lib (for truly common stuff) and WEB-INF/lib, but now all applications complain giving a java.lang.ClassNotFoundException, just like if things weren't in Tomcat's classpath anymore. Apps and Tomcat restarts have been done several times. Is there anything in web.xml, server.xml, etc that needs to be set? What are we possibly missing? Tomcat docs are pretty straightforward about it and everything seems right. Once
Re: Struts + Tomcat 5.0/ JSP 2.0+ JSTL
What do you mean by, over the net? Even though the uri attribute of a taglib directive usually looks like a net location, it's really just a unique identifier for the taglib. If you try hitting http://jakarta.apache.org/struts/tags-html, all you'll get is a 404 error. To me, the simplest thing to do for JSP 1.2+ is to use the taglib's well-known URI (the value of the uri element in the TLD file) and keep all the extra crud out of WEB-INF (no TLD files) and web.xml (no taglib elements). Quoting Vic Cekvenich [EMAIL PROTECTED]: Good point. 2.0 mens everyting is el. Also, I declare tld to pont to /WEB-INF and not over the net. .V Jason Lea wrote: I also changed to tomcat 5.0 + JSP 2.0. You can stop using the struts-el tags and just use the normal struts tags. Erez Efrati wrote: Hi, I am working with Struts 1.1 + JST 1.0 tags. I wish to use some of the fine features of JSP 2.0 like EL expression everywhere I like instead of always putting c:out ... JSTL 1.0 tag. I would also like to continue working with Struts tags such as html:hidden value=${EL-expression} / I tried changing the header of the WEB.XML to web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; But it wasn't enough I guess. I still got the following error: According to TLD or attribute directive in tag file, attribute value does not accept any expressions for using the html:hidden value=${some-el-expression} / Just to note that the html:hidden refers actually the html-el:hidden. What am I missing? Do I need another version of JSTL, Struts or what? Thanks in advance, --Erez -- Please post on Rich Internet Applications User Interface (RiA/SoA) http://www.portalvu.com -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts + Tomcat 5.0/ JSP 2.0+ JSTL
;-) So, just to clarify, Struts-EL is really only useful with JSP 1.2. It doesn't allow request-time expressions for tag attributes since the EL evaluation is done by the taglib, not the container. In JSP 2.0, however, EL evaluation has been incorporated into the container so that any taglib whose tag attributes can take request-time expressions (like normal Struts html) is magically endowed with the powers of EL. Quoting Rick Reumann [EMAIL PROTECTED]: Rick Reumann wrote: This is why in my example I was pointing out to Erez that, even though he's in a 1.2 container, I meant JSP 2.0 ... gets confusing when talking about Struts1.1, 1.2 and then JSP2.0:) -- Rick -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's happening with include tags?
True. But even if you use the include directive, you can't split your tags. For example, try: split.jsp: -- %@ page contentType=text/plain % %@ include file=splitHeader.jspf % Body %@ include file=splitFooter.jspf % splitHeader.jspf: - jsp:useBean id=now class=java.util.Date Header splitFooter.jspf: - Footer /jsp:useBean Results in the following with TC 5.0.27: org.apache.jasper.JasperException: /split.jsp(3,0) /splitHeader.jspf(1,46) Unterminated lt;jsp:useBean tag ... Quoting Erik Weber [EMAIL PROTECTED]: There are two types of JSP includes, static and dynamic. You appear to be using the dynamic variety. A statically included JSP (using jsp:directive.include) becomes part of the same Servlet as the including JSP at JSP compilation/Servlet generation time. A dynamically included JSP's output is pumped to the response output stream on the fly at request time -- therefore the pages are separate entities and would each need their own tag declarations, if I'm not mistaken. Slattery, Tim - BLS wrote: This isn't strictly a Struts question, but it involves struts tags, and it's driving me NUTS! My page looks something like this: %@ page language=java % %@ page session=false% %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % %@ taglib uri=/WEB-INF/c.tld prefix=c % %@ taglib uri=/WEB-INF/fmt.tld prefix=fmt % jsp:include page=/include/header.jsp flush=true jsp:param name=title value=Credentials - Main / /jsp:include Page text jsp:include page=/include/footer.jsp/ Header,jsp and footer.jsp both include Struts html-el:... tags, and header also includes the JSTL fmt:dateFormat... tags. As you can see, there are taglib tags defining the needed prefixes in the main page. I've found that I seem to need to also put them in the included files, otherwise the tags there won't be resolved. Right now the fmt:dateFormat... tag is working fine. The header.jsp file also contains an html-el:html... tag that is *not* getting translated. Footer.jsp has the matching /html-el:html... tag. And I'm getting an error message about weblogic.utils.ParsingException: Could not complete parsing, unmatched tags: html What the [EMAIL PROTECTED] Is going on? Why do I need to put taglib tags in the included files? And why does the parser complain about an unmatched html tag? -- Tim Slattery [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's happening with include tags?
Quoting David Durham [EMAIL PROTECTED]: Kris Schneider wrote: Which may, in fact, be a TC bug. Just tried it on WLS 8.1 SP3 and it worked I don't think it's a bug. %@ include file=splitHeader.jspf % Body %@ include file=splitFooter.jspf % This is a static include -- meaning that the contents splitHeader, body, and splitFooter are all going to end up being part of the same servlet. Yup, I know it's a static include. Erik already covered the issue about needing taglib directives in a page that's included via the include action. A key quote from the spec is: An include directive regards a resource like a JSP page as a static object; i.e. the bytes in the JSP page are included. An include action regards a resource like a JSP page as a dynamic object; i.e. the request is sent to that object and the result of processing it is included. My original intent with the example was to show that even if Tim switched to using the include directive, it wouldn't solve the problem of splitting the open and close tags of html-el:html across the included files. However, although it failed on TC, it actually worked on WLS. The dynamic include, jsp:include page=foo.jsp/, gets compiled into the original JSP's servlet (the one invoking jsp:include) as a call to RequestDispatcher.include(foo.jsp). This means that you are dealing with 2 distinct servlets -- as opposed to it all getting put into the same servlet. This should explain why you need to TLD's in header.jsp. BTW, it seems like you should be using %@ include % or am I missing something? - Dave -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: format date using a bean:write
See the JavaDoc for java.text.SimpleDateFormat. One possibility: bean:write name=product property=creationDate format=MM-dd- / Quoting Jean-Michel Robinet [EMAIL PROTECTED]: Hello, Is it possible to format a date stored in a Date object using a bean: write tag? I use the following but it's not working: bean:write name=product property=creationDate format=##-##- / Thanks in advance. /jm -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still need help with layered Map iteration in JSP
I guess the first thing to make sure you understand is that, when iterating over a Map, the object exposed by JSTL via the var attribute is of type Map.Entry. It's equivalent to doing a map.entrySet().iterator(). As for getting the size of an array, Collection, or Map, use the bean:size tag. Quoting Erik Weber [EMAIL PROTECTED]: OK, I'll take ANY WAY TO DO THIS AT ALL. I have a c:forEach over a Map. The value for each key in the Map can be an array of objects, or I can make it a List. I don't care at this point. All I want to do is get the length of this array or List, before I start iterating over *it*, during the current iteration of the Map. I am told that I access the array or List like this: 1) Given this Map iteration: c:forEach items=myMap var=currentMapEntryWhichIsBothAKeyAndAValueTogether 2) access the value of the current Map entry (which will be either an array or a List) like this: ${currentMapEntryWhichIsBothAKeyAndAValueTogether.value} But I have tried all of these, none of them work: c:when test=${currentMapEntryWhichIsBothAKeyAndAValueTogether.value.length 0}!-- where the value of the Map entry is an array -- c:when test=${currentMapEntryWhichIsBothAKeyAndAValueTogether.value.size 0}!-- where the value of the Map entry is a List -- c-rt:when test=${fn:length(currentMapEntryWhichIsBothAKeyAndAValueTogether.value) 0}!-- where the value of the Map entry is either an array or a List -- Not that they would have worked, because I was merely guessing in every case. This is the type of thing that makes me sorry I ever got involved with tag libraries. I have a Map of Lists. I didn't invent this. This is a common structure to use in Java. So someone please show me a single document that tells you how to work with JSTL tags (or any other tags) to do such a simple thing as to do a nested iteration of a Map of Lists or a Map of arrays! Here is the Java equivalent of what I need to do: //Map, stored as request attribute, has String keys, MyClass[] values Map map = getMapWhichIsARequestAttribute(); Iterator i = map.keySet().iterator(); while (i.hasNext()) { String key = (String) i.next(); MyClass[] values = (MyClass[]) map.get(key); int size = values.length; // *HOW DO I GET THIS VALUE USING TAGS?* if (size 0) { // *HOW DO I IMPLEMENT THIS TEST USING TAGS?* if (size 5) { //do setup for a big array for (int x = 0; x size; x++) { //do output for each item in array } } else { //do setup for a small array for (int x = 0; x size; x++) { //do output for each item in array } } } else { //no records found for this key } } Failing that, I would appreciate it if someone could show me how to do this using Struts tags. If I had used scriptlets, I would have been done hours ago. Thanks, Erik Erik Weber wrote: I have a c:forEach where items refers to a Map, and var refers to the current Map entry. c:forEach items=myMap var=currentEntry The value for each Map entry is an array. How do I switch on the length of this array? I tried this: c:when test=${currentEntry.value.length 5} But I get a syntax error; it says I supplied the . operator with an index value of type java.lang.String to be applied to an array, but that the value cannot be converted to an integer. Is there some sort of way I can use items.length or items.size or something similar? More importantly, WHERE IS THIS DOCUMENTED? I have searched the Internet for decent documents on JSTL and cannot find a simple complete guide to tag usage -- something similar to what Struts has for its tags. For example, where is a document that explains what you can do with var, varStatus, items, etc. on a c:forEach tag, and covers all the tags? The Sun web services tutorial does not do this, it only gives examples. Thank you, Erik Erik Weber wrote: Thanks again. Erik Kris Schneider wrote: c:forEach supports a varStatus attribute. The value of that atrribute is a String that names an instance of javax.servlet.jsp.jstl.core.LoopTagStatus. The LoopTagStatus instance has nested visibility so that it's only available within the enclosing c:forEach tag. LoopTagStatus exposes a number of properties, but the one you're probably interested in is index: .. c:forEach var=bean varStatus=status items=${entry.value} %-- ${status.index} is the current index --% ... /c:forEach .. Quoting Erik Weber [EMAIL PROTECTED]: How can I refer to the index of the current iteration with c:forEach (analogous to the indexId attribute to logic:iterate)? Thanks, Erik Kris Schneider wrote: %@ taglib
Re: Still need help with layered Map iteration in JSP
It's certainly not a bad idea to grab a JSTL book, but the spec itself is quite readable and full of good information: http://jcp.org/aboutJava/communityprocess/final/jsr052/ The only JSTL book I've even partially read is JSTL in Action by Shawn Bayern and I have no reservations recommending it. There are also plenty of web resources available: http://www.javaworld.com/javaworld/jw-02-2003/jw-0228-jstl.html http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html http://www.onjava.com/pub/a/onjava/2002/09/11/jstl2.html http://www.onjava.com/pub/a/onjava/2002/03/13/jsp.html http://www.onjava.com/pub/a/pub/a/onjava/2002/05/08/jstl.html http://java.sun.com/developer/technicalArticles/javaserverpages/faster/ http://java.sun.com/developer/technicalArticles/Intl/MultilingualJSP/ etc. Quoting Erik Weber [EMAIL PROTECTED]: Kris, once again you have helped me get my work done. bean:size did the trick. I was looking over and over again for a JSTL tag or expression to do this; I probably never would have thought of bean:size. To complete the post for any other reader who is as suicidal as I am after trying to figure this out: c:forEach items=myMap var=currentEntry!-- where Map has String keys and array or List values -- bean-el:size collection=${currentEntry.value} id=size/!-- page scope variable size (of type java.lang.Integer) will now contain the size of the array or list associated with the current Map key -- . . . c:when test=${size 5}!-- how to test how big the current array or List is -- . . . c:forEach items=currentEntry.value var=currentItemInArrayOrList varStatus=iteratorStatus!--- how to iterate the current array or List -- . . . c:out value=${currentItemInArrayOrList.someProperty}/!-- how to print some property of the current item in the current array or List -- . . . c:when test=${iteratorStatus.index % 2 == 0}!-- how to tell if you are on an even-numbered row in your iteration -- and so on . . . Thank you, Erik P.S. I would love to know how you learned all this (I suppose I must buy a JSTL book). Erik -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL duplication of tag content
Sure, but then he'd probably be seeing a translation error instead, right? Note that the inner fmt:message isn't closed either. Seems to work fine for me (using proper syntax) on TC 5.0.27 with Standard 1.0.6 (JSTL 1.0): %@ page contentType=text/plain % %@ taglib prefix=fmt uri=http://java.sun.com/jstl/fmt; % fmt:message key=form.title fmt:param fmt:message key=person.form.name/ /fmt:param /fmt:message Quoting Niall Pemberton [EMAIL PROTECTED]: Looks like you're not closing the fmt:param tag: Instead of ... fmt:param fmt:message key=person.form.name fmt:param Shouldn't it be: fmt:param fmt:message key=person.form.name /fmt:param Niall - Original Message - From: Johan Wasserman - BCX - Infrastructure Services [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 16, 2004 3:20 PM Subject: JSTL duplication of tag content Anyone else experiencing duplication of tag contents with JSTL? e.g. TITLE fmt:message key=form.title fmt:param fmt:message key=person.form.name fmt:param /fmt:message /TITLE where: form.title=Log new {0} person.form.name=Person Results in Log new Person the first time you open the form and Log new PersonPerson the second time and Log new PersonPersonPersonPersonPerson the n'th time. Any suggestions? -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need help with layered Map iteration in JSP
%@ taglib prefix=c uri=http://java.sun.com/jstl/core; % c:forEach var=entry items=${map} %-- ${entry.key} is the current key --% %-- ${entry.value} is the associated bean array --% c:forEach var=bean items=${entry.value} ... /c:forEach /c:forEach Quoting Erik Weber [EMAIL PROTECTED]: I could use some Struts-EL/JSTL tag help, please. I have a Map with each entry having a String as the key and a bean array as the value. I need two iterations, one nested inside the other. For the outer iteration, I want to iterate the keySet of the Map. I don't know what the keys are going to be or how many there will be. Within that iteration, for each key in the keySet, I need to iterate over the buckets of the array that is the value for that key. To make this more clear, let's say I will produce a table of tables, somewhat like this: table !-- start outer iteration here; iterate over the keySet of the Map -- !-- Map key #0 -- tr td table !-- start inner iteration #1 here; iterate over the Object[] that is the value for key #1 in the Map -- !-- Object[bucket #0] -- tr td!-- Object[bucket #0].property A --/td td!-- Object[bucket #0].property B --/td /tr !-- end Object[bucket #0] -- !-- Object[bucket #1] -- tr td!-- Object[bucket #1].property A --/td td!-- Object[bucket #1].property B --/td /tr !-- end Object[bucket #1] -- /table /td /tr !-- end Map key #0 -- !-- Map key #1 -- tr td table !-- start inner iteration #2 here; iterate over the Object[] that is the value for key #2 in the Map -- !-- Object[bucket #0] -- tr td!-- Object[bucket #0].property A --/td td!-- Object[bucket #0].property B --/td /tr !-- end Object[bucket #0] -- !-- Object[bucket #1] -- tr td!-- Object[bucket #1].property A --/td td!-- Object[bucket #1].property B --/td /tr !-- end Object[bucket #1] -- /table /td /tr !-- end Map key #1 -- !-- end outer iteration -- /table Could someone show me some skeleton JSTL or Struts-el code? I would appreciate it very much, Erik -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need help with layered Map iteration in JSP
c:forEach supports a varStatus attribute. The value of that atrribute is a String that names an instance of javax.servlet.jsp.jstl.core.LoopTagStatus. The LoopTagStatus instance has nested visibility so that it's only available within the enclosing c:forEach tag. LoopTagStatus exposes a number of properties, but the one you're probably interested in is index: .. c:forEach var=bean varStatus=status items=${entry.value} %-- ${status.index} is the current index --% ... /c:forEach .. Quoting Erik Weber [EMAIL PROTECTED]: How can I refer to the index of the current iteration with c:forEach (analogous to the indexId attribute to logic:iterate)? Thanks, Erik Kris Schneider wrote: %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % c:forEach var=entry items=${map} %-- ${entry.key} is the current key --% %-- ${entry.value} is the associated bean array --% c:forEach var=bean items=${entry.value} ... /c:forEach /c:forEach Quoting Erik Weber [EMAIL PROTECTED]: I could use some Struts-EL/JSTL tag help, please. I have a Map with each entry having a String as the key and a bean array as the value. I need two iterations, one nested inside the other. For the outer iteration, I want to iterate the keySet of the Map. I don't know what the keys are going to be or how many there will be. Within that iteration, for each key in the keySet, I need to iterate over the buckets of the array that is the value for that key. To make this more clear, let's say I will produce a table of tables, somewhat like this: table !-- start outer iteration here; iterate over the keySet of the Map -- !-- Map key #0 -- tr td table !-- start inner iteration #1 here; iterate over the Object[] that is the value for key #1 in the Map -- !-- Object[bucket #0] -- tr td!-- Object[bucket #0].property A --/td td!-- Object[bucket #0].property B --/td /tr !-- end Object[bucket #0] -- !-- Object[bucket #1] -- tr td!-- Object[bucket #1].property A --/td td!-- Object[bucket #1].property B --/td /tr !-- end Object[bucket #1] -- /table /td /tr !-- end Map key #0 -- !-- Map key #1 -- tr td table !-- start inner iteration #2 here; iterate over the Object[] that is the value for key #2 in the Map -- !-- Object[bucket #0] -- tr td!-- Object[bucket #0].property A --/td td!-- Object[bucket #0].property B --/td /tr !-- end Object[bucket #0] -- !-- Object[bucket #1] -- tr td!-- Object[bucket #1].property A --/td td!-- Object[bucket #1].property B --/td /tr !-- end Object[bucket #1] -- /table /td /tr !-- end Map key #1 -- !-- end outer iteration -- /table Could someone show me some skeleton JSTL or Struts-el code? I would appreciate it very much, Erik -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: taglibs: how can i rewrite an action uri without rendering a html link tag?
Or, add it yourself: package com.dotech.servlet.taglibs; import java.net.MalformedURLException; import java.util.Map; import javax.servlet.jsp.JspException; import org.apache.struts.util.RequestUtils; import org.apache.struts.util.ResponseUtils; public class RewriteTag extends org.apache.struts.taglib.html.RewriteTag { public int doStartTag() throws JspException { // Generate the hyperlink URL Map params = RequestUtils.computeParameters(pageContext, paramId, paramName, paramProperty, paramScope, name, property, scope, transaction); String url = null; try { // Note that we're encoding the character to amp; in XHTML mode only, // otherwise the is written as is to work in javascripts. url = RequestUtils.computeURL(pageContext, forward, href, page, action, // The Struts 1.1 version explicitly passes null for action params, anchor, false, isXhtml()); } catch (MalformedURLException e) { RequestUtils.saveException(pageContext, e); throw new JspException(messages.getMessage(rewrite.url, e.toString())); } ResponseUtils.write(pageContext, url); return (SKIP_BODY); } } Then, a TLD dumped somewhere under WEB-INF in your app: taglib tlib-version1.0/tlib-version jsp-version1.2/jsp-version short-namedot-html/short-name urihttp://dotech.com/taglibs/html/uri tag namerewrite/name tag-classcom.dotech.servlet.taglibs.RewriteTag/tag-class /tag /taglib And finally use in your JSPs: %@ taglib prefix=dot-html uri=http://dotech.com/taglibs/html; % .. dot-html:rewrite ... .. Quoting Ruth, Brice [EMAIL PROTECTED]: hallelujah! Now I just need to migrate ... ugh Erik Weber wrote: If I'm not mistaken, the action attribute to html:rewrite is supported in 1.2. Erik -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: not quite struts: handling Images
One thing to keep in mind with ImageIO and a long-running process, like an app server, is its potential use of a disk-based cache. You may end up with lots of temporary files that will only be removed if the VM exits normally. See: http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#deleteOnExit() There's also this interesting bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4513817 To disable the disk-based cache in favor of a memory-based cache, use ImageIO.setUseCache(false). Once you have a BufferedImage, one way to resize it is with AffineTransformOp: http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/AffineTransformOp.html http://javaalmanac.com/egs/java.awt.image/CreateTxImage.html As for saving with custom compression, here's something I've used before: protected void writeImage(RenderedImage image, OutputStream out) throws IOException { ImageOutputStream imageOut = ImageIO.createImageOutputStream(out); ImageWriter imageWriter = (ImageWriter)ImageIO.getImageWritersByFormatName(jpeg).next(); imageWriter.setOutput(imageOut); ImageWriteParam writeParam = imageWriter.getDefaultWriteParam(); writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); writeParam.setCompressionType(JPEG); writeParam.setCompressionQuality(1); imageWriter.write(null, new IIOImage(image, null, null), writeParam); } Quoting Mark Lowe [EMAIL PROTECTED]: Not sure about the resize and save (3-4) but the rest i use for ensuring users dont upload any old sizes.. java.io.ByteArrayInputStream; java.awt.image.BufferedImage; javax.imageio.ImageIO; byte[] image = form.getImage().getFileData(); ByteArrayInputStream stream = new ByteArrayInputStream(image); BufferedImage img = ImageIO.read(stream); BufferedImage has getWidth and getHeight Perhaps also better not to use getFileData on the formFile, and use the getInputStream method instead as its less heavy.. Mark On 27 Jul 2004, at 10:28, ron1 wrote: Hi - after spending much time wondring through the JAI API I thought maybe one of you guys can help me: I need a very simple: 1. upload-image (jpg/gif) 2. getProps (size, width) 3. resize 4. save JPG with custom compression. The upload is done via FormFile, so I have the InputStream - all the rest via Java API - and I have no clue of where to get started :-( Cheers, Ron -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: OT: Problems with classpath under tomcat 5
.. String fileName = target.getConfigurationName() + .properties; ClassLoader cl = Thread.currentThread().getContextClassLoader(); InputStream in = cl.getResourceAsStream(fileName); Properties props = new Properties(); props.load(in); .. Quoting Rosenberg, Leon [EMAIL PROTECTED]: -Ursprüngliche Nachricht- Von: Peng Tuck Kwok [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 21. Juli 2004 16:10 An: Struts Users Mailing List Betreff: Re: OT: Problems with classpath under tomcat 5 Are you sure if it is not looking your properties file in the classpath of the webapp ? Yes, because it would find them there. When you say everything works fine until tomcat 5 is used , does the console print out any error ? Also how do you know it is searching in shared classes ? Yes, the console prints out our debug output: xyz.properties doesn't exist, skipping update for [EMAIL PROTECTED] if you read the code, you'll find that it's also trying to locate the '.' directory. In all other environments it's webapps/mywebapp/WEB-INF/classes in tomcat5 it's .../common/classes (which is one of the pathes according to tomcat5 class loader faq). (Sorry, I wrote shared/classes in my first mail, it was common/classes, but it doesn't really matter, because both aren't the right ones :-) Regards Leon On Wed, 21 Jul 2004 15:45:01 +0200, Rosenberg, Leon [EMAIL PROTECTED] wrote: Hi, it's a bit OT but maybe some of you had a similar problem shortly and can help. We have a configuration component which configures other components of the application out of property files. The property files lies in the 'classes' directory of the application. Everything works fine until we use tomcat 5 (5.0.19). In tomcat 5 the ClassLoader doesn't search for our property files in webapps/mywebapp/WEB-INF/classes. Instead it seems to search in shared/classes which imho should be done after the private webapp classpath has bin searched through. As I said before it works fine with standalone applications and with resin. Any ideas? Regards Leon P.S. The files are there and we have the rights to read them. P. P.S. the code: private void updateConfigurable(IConfigurable target, boolean dontcheck){ String fileName = target.getConfigurationName()+.properties; log.debug(Checking for +/+fileName); log.debug(Approx. checking in +target.getClass().getResource(/.)); URL u = target.getClass().getResource(/+fileName); if (u==null){ log.error(fileName+ doesn't exist, skipping update for +target); return; } if (!dontcheck){ log.debug(Checking +target); File f = new File(u.getFile()); long lastModified = f.lastModified(); long timestamp = getTimestamp(target); if (lastModifiedtimestamp) return; log.debug(filename has been updated.); } log.debug(updating +target); try{ Properties p = new Properties(); p.load(target.getClass().getResourceAsStream(/+fileName)); target.notifyConfigurationStarted(); Enumeration keys = p.keys(); while(keys.hasMoreElements()){ String key = (String)keys.nextElement(); String value = p.getProperty(key); target.setProperty(key, value); } target.notifyConfigurationFinished(); setTimestamp(target); }catch(Exception e){ log.error(updateConfigurable, e); } } -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: AW: OT: Problems with classpath under tomcat 5
Does filename evaluate to something like foo.properties (no other path info) and is that file located in WEB-INF/classes? Quoting Rosenberg, Leon [EMAIL PROTECTED]: Thanx, but it doesn't work either. -Ursprüngliche Nachricht- Von: Kris Schneider [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 21. Juli 2004 16:54 An: Struts Users Mailing List Betreff: Re: AW: OT: Problems with classpath under tomcat 5 .. String fileName = target.getConfigurationName() + .properties; ClassLoader cl = Thread.currentThread().getContextClassLoader(); InputStream in = cl.getResourceAsStream(fileName); Properties props = new Properties(); props.load(in); .. Quoting Rosenberg, Leon [EMAIL PROTECTED]: -Ursprüngliche Nachricht- Von: Peng Tuck Kwok [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 21. Juli 2004 16:10 An: Struts Users Mailing List Betreff: Re: OT: Problems with classpath under tomcat 5 Are you sure if it is not looking your properties file in the classpath of the webapp ? Yes, because it would find them there. When you say everything works fine until tomcat 5 is used , does the console print out any error ? Also how do you know it is searching in shared classes ? Yes, the console prints out our debug output: xyz.properties doesn't exist, skipping update for [EMAIL PROTECTED] if you read the code, you'll find that it's also trying to locate the '.' directory. In all other environments it's webapps/mywebapp/WEB- INF/classes in tomcat5 it's .../common/classes (which is one of the pathes according to tomcat5 class loader faq). (Sorry, I wrote shared/classes in my first mail, it was common/classes, but it doesn't really matter, because both aren't the right ones :-) Regards Leon On Wed, 21 Jul 2004 15:45:01 +0200, Rosenberg, Leon [EMAIL PROTECTED] wrote: Hi, it's a bit OT but maybe some of you had a similar problem shortly and can help. We have a configuration component which configures other components of the application out of property files. The property files lies in the 'classes' directory of the application. Everything works fine until we use tomcat 5 (5.0.19). In tomcat 5 the ClassLoader doesn't search for our property files in webapps/mywebapp/WEB-INF/classes. Instead it seems to search in shared/classes which imho should be done after the private webapp classpath has bin searched through. As I said before it works fine with standalone applications and with resin. Any ideas? Regards Leon P.S. The files are there and we have the rights to read them. P. P.S. the code: private void updateConfigurable(IConfigurable target, boolean dontcheck){ String fileName = target.getConfigurationName()+.properties; log.debug(Checking for +/+fileName); log.debug(Approx. checking in +target.getClass().getResource(/.)); URL u = target.getClass().getResource(/+fileName); if (u==null){ log.error(fileName+ doesn't exist, skipping update for +target); return; } if (!dontcheck){ log.debug(Checking +target); File f = new File(u.getFile()); long lastModified = f.lastModified(); long timestamp = getTimestamp(target); if (lastModifiedtimestamp) return; log.debug(filename has been updated.); } log.debug(updating +target); try{ Properties p = new Properties(); p.load(target.getClass().getResourceAsStream(/+fileName)); target.notifyConfigurationStarted(); Enumeration keys = p.keys(); while(keys.hasMoreElements()){ String key = (String)keys.nextElement(); String value = p.getProperty(key); target.setProperty(key, value); } target.notifyConfigurationFinished(); setTimestamp(target); }catch(Exception e){ log.error(updateConfigurable, e); } } -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com
Re: OT: Problems with classpath under tomcat 5
Huh. Here's a test with TC 5.0.27, JDK 1.4.2_05, and WinXP: loadProps.jsp: -- %@ page contentType=text/plain % %@ page import=java.io.* % %@ page import=java.util.* % % String fileName = foo.properties; ClassLoader cl = Thread.currentThread().getContextClassLoader(); InputStream in = cl.getResourceAsStream(fileName); Properties props = new Properties(); props.load(in); out.print(props); % With foo.properties located in WEB-INF/classes, the page outputs: {A=1, C=3, B=2} Have you done anything to TC like create a custom Context for the app? Are you sure target.getConfigurationName() is really returning what you expect (e.g. no leading spaces, etc.)? Quoting Rosenberg, Leon [EMAIL PROTECTED]: Yep, exactly -Ursprüngliche Nachricht- Von: Kris Schneider [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 21. Juli 2004 17:30 An: Struts Users Mailing List Betreff: Re: AW: AW: OT: Problems with classpath under tomcat 5 Does filename evaluate to something like foo.properties (no other path info) and is that file located in WEB-INF/classes? Quoting Rosenberg, Leon [EMAIL PROTECTED]: Thanx, but it doesn't work either. -Ursprüngliche Nachricht- Von: Kris Schneider [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 21. Juli 2004 16:54 An: Struts Users Mailing List Betreff: Re: AW: OT: Problems with classpath under tomcat 5 .. String fileName = target.getConfigurationName() + .properties; ClassLoader cl = Thread.currentThread().getContextClassLoader(); InputStream in = cl.getResourceAsStream(fileName); Properties props = new Properties(); props.load(in); .. Quoting Rosenberg, Leon [EMAIL PROTECTED]: -Ursprüngliche Nachricht- Von: Peng Tuck Kwok [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 21. Juli 2004 16:10 An: Struts Users Mailing List Betreff: Re: OT: Problems with classpath under tomcat 5 Are you sure if it is not looking your properties file in the classpath of the webapp ? Yes, because it would find them there. When you say everything works fine until tomcat 5 is used , does the console print out any error ? Also how do you know it is searching in shared classes ? Yes, the console prints out our debug output: xyz.properties doesn't exist, skipping update for [EMAIL PROTECTED] if you read the code, you'll find that it's also trying to locate the '.' directory. In all other environments it's webapps/mywebapp/WEB- INF/classes in tomcat5 it's .../common/classes (which is one of the pathes according to tomcat5 class loader faq). (Sorry, I wrote shared/classes in my first mail, it was common/classes, but it doesn't really matter, because both aren't the right ones :-) Regards Leon On Wed, 21 Jul 2004 15:45:01 +0200, Rosenberg, Leon [EMAIL PROTECTED] wrote: Hi, it's a bit OT but maybe some of you had a similar problem shortly and can help. We have a configuration component which configures other components of the application out of property files. The property files lies in the 'classes' directory of the application. Everything works fine until we use tomcat 5 (5.0.19). In tomcat 5 the ClassLoader doesn't search for our property files in webapps/mywebapp/WEB-INF/classes. Instead it seems to search in shared/classes which imho should be done after the private webapp classpath has bin searched through. As I said before it works fine with standalone applications and with resin. Any ideas? Regards Leon P.S. The files are there and we have the rights to read them. P. P.S. the code: private void updateConfigurable(IConfigurable target, boolean dontcheck){ String fileName = target.getConfigurationName()+.properties; log.debug(Checking for +/+fileName); log.debug(Approx. checking in +target.getClass().getResource(/.)); URL u = target.getClass().getResource(/+fileName); if (u==null){ log.error(fileName+ doesn't exist, skipping update for +target); return; } if (!dontcheck){ log.debug(Checking +target); File f = new File(u.getFile()); long lastModified = f.lastModified(); long timestamp = getTimestamp(target
Re: [OT] how to calculate the size of an object
Here's a concrete example. First, the Java class: public class JvmtiSize { public static native long getObjectSize(Object o); public static void main(String[] args) { String s = Hello, world!; String[] sa = { s }; System.out.printf(s: %6d bytes\n, getObjectSize(s)); System.out.printf( sa: %6d bytes\n, getObjectSize(sa)); System.out.printf(class: %6d bytes\n, getObjectSize(JvmtiSize.class)); } } Then, run javah to generate JvmtiSize.h (omitted). Next, the C code (jvmti_size.c): #include jvmti.h #include JvmtiSize.h JavaVM *global_jvm = NULL; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { global_jvm = jvm; return 0; } JNIEXPORT jlong JNICALL Java_JvmtiSize_getObjectSize(JNIEnv *env, jclass class, jobject object) { jint status; jvmtiEnv *jvmti; jvmtiError err; jlong object_size; status = (*global_jvm)-GetEnv(global_jvm, (void **)jvmti, JVMTI_VERSION); if (status != JNI_OK) { fprintf(stderr, ERROR: Unable to create jvmtiEnv (GetEnv failed), error=%d\n, status); exit(1); } err = (*jvmti)-GetObjectSize(jvmti, object, object_size); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, ERROR: GetObjectSize failed, error=%d\n, err); exit(1); } return object_size; } Then, generate the shared lib (Solaris SPARC): cc -G -I${JAVA_HOME}/include -Isrc -I${JAVA_HOME}/include/solaris src/jvmti_size.c -o libjvmti_size.so Finally, give it a run: java -agentlib:jvmti_size -cp classes JvmtiSize s: 24 bytes sa: 16 bytes class:288 bytes Quoting Kris Schneider [EMAIL PROTECTED]: Not too surprising that it's available through a native programming interface (JVMTI) since it's really an implementation-dependent metric: http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html#GetObjectSize Quoting Brian Lee [EMAIL PROTECTED]: If you run this from a simple console test app, the JVM won't allocate any extra objects between 2 and 4. Unfortunatly, this is the most exact way to find out memory usage (serialization size doesn't necessarily mean in memory size). Just wait til those slackers at Sun at a Object.sizeof() method in jdk1.9 or something lame. BAL From: Navjot Singh [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: [OT] how to calculate the size of an object Date: Thu, 08 Jul 2004 22:16:12 +0530 hi, Thanks for the link but this is very naive way of doing it. I am leaving it to the mercy of gc. What this method is doing 1. run gc() manually (AND hope it wont run automatically again soon.) 2. free memory 3. create and object. 4. free memory and now just wish that JVM wont allocate any memory in it's heap between steps 2 4. so that one can assume that whatsoever output comes belongs to my object. I am at something better. Jim you are absolutely right, this technique may return a negative number. navjot singh [EMAIL PROTECTED] wrote: http://www.google.com/search?hl=enlr=ie=UTF-8q=size+java+object The first one looks promising. Dennis *Navjot Singh [EMAIL PROTECTED]* 07/08/2004 11:57 AM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To Struts Users Mailing List [EMAIL PROTECTED] cc Subject [OT] how to calculate the size of an object hi, I use SAX parser to load an LDIF file into memory. Whatsoever data i read, i fill into an object. I need to know *the size of LDIFData object* at runtime. How to do that? Well the class structure is something like this public class LDIFData{ ArrayList cards; // collection of Card String filename; long lastLoadedTime; } public class Card{ String name; String email String mobile; } -- regards Navjot Singh When you jump for joy, beware that no-one moves the ground from beneath your feet. -- Stanislaw Lem, Unkempt Thoughts - 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] -- regards Navjot Singh When you jump for joy, beware that no-one moves the ground from beneath your feet. -- Stanislaw Lem, Unkempt Thoughts -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com
Re: using Constants from JSTL .....
It's not so bad, really ;-). For some additional background, here are a few older messages from struts-user and taglibs-user: http://marc.theaimsgroup.com/?l=struts-userm=103790677413408w=2 http://marc.theaimsgroup.com/?l=struts-userm=105777660215673w=2 http://marc.theaimsgroup.com/?l=taglibs-userm=105889207116316w=2 Here's a slightly different approach: package com.dotech.util; import java.io.Serializable; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class ConstantBean implements Serializable { private Map constants; public ConstantBean() { super(); } public void setClassName(String className) throws ClassNotFoundException, IllegalAccessException { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { loader = getClass().getClassLoader(); if (loader == null) { loader = ClassLoader.getSystemClassLoader(); } } Class clazz = loader.loadClass(className); Field[] allFields = clazz.getDeclaredFields(); int numFields = allFields.length; Map propMap = new HashMap(numFields); for (int i = 0; i numFields; i++) { Field f = allFields[i]; int mods = f.getModifiers(); if (Modifier.isPublic(mods) Modifier.isStatic(mods) Modifier.isFinal(mods)) { String name = f.getName(); Object value = f.get(null); propMap.put(name, value); } } this.constants = Collections.unmodifiableMap(propMap); } public Map getConstants() { return this.constants; } } Which can be used in a page like this: %@ page contentType=text/plain % %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % jsp:useBean id=responseConstants class=com.dotech.util.ConstantBean jsp:setProperty name=responseConstants property=className value=javax.servlet.http.HttpServletResponse/ /jsp:useBean SC_INTERNAL_SERVER_ERROR: c:out value=${responseConstants.constants.SC_INTERNAL_SERVER_ERROR}/ Quoting Bryan Hunt [EMAIL PROTECTED]: Uh oh, I just realised that is the exact same as mine just implimented differently. c:out value=${CONSTANTS.WHATEVER)/ Will output the string value but will not be able to be used to resolve the bean by that name. I'm giving up on JSTL constants. Nice idea ... but too expensive on my hairline. --b Rick Reumann wrote: On Wed, 07 Jul 2004 20:12:02 +0200, Bryan Hunt [EMAIL PROTECTED] wrote: And it works fine, but really what I am trying to get here is the value of using Constants in both my Actions and my ( JSTL based ) jsp's. You need to have all your Constants in a Map that is in application scope. Kris Schneider posted this great piece of code to add to your Constants file to return all your constants as a Map. At app start up I have a servlet that does several things, one of which call the properties method to put all the stuff in a Map and then you can just put that in scope: //in some servlet at startup: ServletContext context = contextEvent.getServletContext(); context.setAttribute(CONSTANTS, UIConstants.getConstantsMap()); (Below you don't need to do like I have. I had other reasons to do it this way at the time. But just provide the getConstantFieldsAsMap() method ) //example class: UIConstants private static Map constantsMap; static { constantsMap = getConstantFieldsAsMap(UIConstants.class); } public static Map getConstantsMap() { return constantsMap; } //all your constants: public final static String WHATEVER = whatever; //this does the work.. thanks Kris private static Map getConstantFieldsAsMap(Class cls) { Map propMap = null; try { Field[] allFields = cls.getDeclaredFields(); int numFields = allFields.length; propMap = new HashMap(numFields); for(int i = 0; i numFields; i++) { Field f = allFields[i]; int mods = f.getModifiers(); if(Modifier.isPublic(mods) Modifier.isStatic(mods) Modifier.isFinal(mods)) { String name = f.getName(); Object value = f.get(null); log.debug(Putting name = + name + and value= + value + into propMap); propMap.put(name, value); } } } catch(IllegalAccessException ie) { log.error(Problem loading constantFieldsAsMap + ie); } return Collections.unmodifiableMap(propMap); } //end class Now in JSP you can just do: c:out value=${CONSTANTS.WHATEVER)/ -- Kris Schneider mailto:[EMAIL
Re: [OT] how to calculate the size of an object
Not too surprising that it's available through a native programming interface (JVMTI) since it's really an implementation-dependent metric: http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html#GetObjectSize Quoting Brian Lee [EMAIL PROTECTED]: If you run this from a simple console test app, the JVM won't allocate any extra objects between 2 and 4. Unfortunatly, this is the most exact way to find out memory usage (serialization size doesn't necessarily mean in memory size). Just wait til those slackers at Sun at a Object.sizeof() method in jdk1.9 or something lame. BAL From: Navjot Singh [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: [OT] how to calculate the size of an object Date: Thu, 08 Jul 2004 22:16:12 +0530 hi, Thanks for the link but this is very naive way of doing it. I am leaving it to the mercy of gc. What this method is doing 1. run gc() manually (AND hope it wont run automatically again soon.) 2. free memory 3. create and object. 4. free memory and now just wish that JVM wont allocate any memory in it's heap between steps 2 4. so that one can assume that whatsoever output comes belongs to my object. I am at something better. Jim you are absolutely right, this technique may return a negative number. navjot singh [EMAIL PROTECTED] wrote: http://www.google.com/search?hl=enlr=ie=UTF-8q=size+java+object The first one looks promising. Dennis *Navjot Singh [EMAIL PROTECTED]* 07/08/2004 11:57 AM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To Struts Users Mailing List [EMAIL PROTECTED] cc Subject [OT] how to calculate the size of an object hi, I use SAX parser to load an LDIF file into memory. Whatsoever data i read, i fill into an object. I need to know *the size of LDIFData object* at runtime. How to do that? Well the class structure is something like this public class LDIFData{ ArrayList cards; // collection of Card String filename; long lastLoadedTime; } public class Card{ String name; String email String mobile; } -- regards Navjot Singh When you jump for joy, beware that no-one moves the ground from beneath your feet. -- Stanislaw Lem, Unkempt Thoughts - 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] -- regards Navjot Singh When you jump for joy, beware that no-one moves the ground from beneath your feet. -- Stanislaw Lem, Unkempt Thoughts -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Not possible to attach 2 (or more) parameters from 2 different beans to an html:link?
If you want to add multiple params to link, drop them in a Map. Here's an example that also uses JSTL: %@ taglib prefix=curi=http://java.sun.com/jstl/core; % %@ taglib prefix=html uri=http://jakarta.apache.org/struts/tags-html; % jsp:useBean id=params class=java.util.HashMap/ c:set target=${params} property=userProp value=${user.userProp}/ c:set target=${params} property=moduleProp value=${module.moduleProp}/ html:link action=... name=params ...Hit me/html:link Quoting Robert Bowen [EMAIL PROTECTED]: Hello listers. I sent an email about a week ago and haven't heard a blip. So I guess this simply isn't possible? If I have a bean user and another module and want to attach a property from each to an html:link tag, how do I do it? As I understand it if I simply put paramName it will include ALL properties for that bean, which I don't need. But if I put paramName, paramProperty and paramId twice, once for each bean/property, it only attaches one! Is there some way I can create a custom bean ... in the page, put the two properties I need inside it, and pass *it* to the html:link with paramName ? Sounds kind a less-than.perfect solution. Any takers? Thanks, syg -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why html:select ... doesn support readonly attribute?
If it's not in the HTML 4 spec (which, in this case, it isn't), it's not supported by the Struts taglibs: http://www.w3.org/TR/html4/interact/forms.html#h-17.6 Quoting Zsolt Koppany [EMAIL PROTECTED]: Hi, I would like to use html:select for a readonly property but cannot find the readonly property. What can I do? I use struts-1.1. Zsolt -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why html:select ... doesn support readonly attribute?
Just a note that there are some significant differences between disabled and read-only controls, even if a browser renders them with the same visual appearance. For example, disabled controls are never included in form submissions. Quoting Henrique VIECILI [EMAIL PROTECTED]: I think it will work: select id=xxx name=xxx disabled option value=XX selected XX /option /select or in javascript: document.getElementById(xxx).disabled = 'true'; Henrique Viecili - Original Message - From: Kris Schneider To: Struts Users Mailing List Sent: Friday, July 02, 2004 1:16 PM Subject: Re: Why html:select ... doesn support readonly attribute? If it's not in the HTML 4 spec (which, in this case, it isn't), it's not supported by the Struts taglibs: http://www.w3.org/TR/html4/interact/forms.html#h-17.6 Quoting Zsolt Koppany [EMAIL PROTECTED]: Hi, I would like to use html:select for a readonly property but cannot find the readonly property. What can I do? I use struts-1.1. Zsolt -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] How to do Xalan parsing of XML file retrieved with HTTP?
For JSTL 1.0 JSP 1.2, the general idea would be: %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=x uri=http://java.sun.com/jstl/xml; % c:import var=xml url=xmlOutput.jsp/ c:import var=xslt url=stylesheet.xsl/ x:transform xml=${xml} xslt=${xslt}/ Check out the JSTL spec for more details. You can also find some info here: http://www-106.ibm.com/developerworks/java/library/j-jstl0520/ http://www.informit.com/articles/article.asp?p=30933 http://java.sun.com/developer/technicalArticles/javaserverpages/faster/ Apache provides JSTL 1.0 and JSTL 1.1 (for JSP 2.0) implementations under the Jakarta Taglibs project. The Standard 1.0 taglib implements JSTL 1.0 while the Standard 1.1 taglib implements JSTL 1.1. Feel free to post questions related to JSTL and Standard to the taglibs-user list. Quoting Robert Taylor [EMAIL PROTECTED]: Have you looked into using the JSTL XML core and transform tag libraries? I haven't used them yet, but they have tags which allow you to parse and transform. robert -Original Message- From: Kransen, J. [mailto:[EMAIL PROTECTED] Sent: Thursday, July 01, 2004 4:47 AM To: 'Struts Users Mailing List' Subject: [OT] How to do Xalan parsing of XML file retrieved with HTTP? Hello, I have a .jsp that outputs a XML file. I have another .jsp in which I want to parse the XML file using an XSL file. So in the latter .jsp I want to do something like this: textarea% String xslFile = getServletContext().getRealPath(/xml/risc2cvs.xsl); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile)); // write the content of the parsed XML file transformer.transform(new StreamSource(http://localhost/risc/readonly.jsp;), new StreamResult(out)); %/textarea However, when I do this, I get the following error message: The element type base must be terminated by the matching end-tag . With this stack trace: javax.xml.transform.TransformerException: The element type base must be terminated by the matching end-tag . at org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerImpl.java :744) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java: 720) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java: 1192) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java: 1170) at org.apache.jsp.cvs_005fuittreksel_jsp._jspService(cvs_005fuittreksel_jsp.jav a:109) ... When instead I try to parse a local XML file, there are no problems: String xmlFile = getServletContext().getRealPath(/xml/temp.xml); transformer.transform(new StreamSource(xmlFile), new StreamResult(out)); But then, when I try to parse the very same file as accessed through HTTP, I get the very same error: transformer.transform(new StreamSource(http://localhost/risc/xml/temp.xml;), new StreamResult(out)); I was thinking that maybe the HTTP headers aren't stripped before the parsing. Does anybody know what to do here? Thanks in advance! Jeroen -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP:include page + Resource bundle
Or do the lookup in CommandSaveIncludeHeader.jsp. Whatever.jsp: - jsp:include page=CommandSaveIncludeHeader.jsp jsp:param name=headerKey value=global.commandinformation.title/ /jsp:include CommandSaveIncludeHeader.jsp: - bean:parameter id=headerKey name=headerKey/ bean:message name=headerKey/ Quoting Bill Siggelkow [EMAIL PROTECTED]: Perhaps this would work: bean:define id=title bean:message key=global.commandinformation.title/ /bean:define jsp:include page=CommandSaveIncludeHeader.jsp jsp:param name=header value=%= title % / /jsp:include Naresh Sharma wrote: HI, Please suggest, I wish to pass header parameter to CommandSaveIncludeHeader.jsp, the value inside header parameter is actually a key in Resource bundle. See ex. jsp:include page=CommandSaveIncludeHeader.jsp jsp:param name=header value=global.commandinformation.title / /jsp:include I am not sure if any Struts tag is there for above statement. But this scheme is also not working, on CommandSaveIncludeHeader.jsp page I am getting header as global.commandinformation.title1, not from the resource bundle. Please suggest. Regards Naresh -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Setting html:hidden property using JSTL
Small clarification that the Servlet 2.4/JSP 2.0 specs don't include/require JSTL. Although a given container may include a JSTL implementation (like Resin, I believe), it's not a requirement. For example, Tomcat 5.0 does not include a JSTL implementation. For JSP 1.2, use JSTL 1.0. For JSP 2.0, use JSTL 1.1. As Robert illustrated, the taglib URIs are not the same for the two JSTL versions. Quoting Robert Taylor [EMAIL PROTECTED]: I'm sorry, I've missed parts of this thread, but this last message caught my eye when you said it's printing ${contentId} to the screen instead of the value of contentId. Which servlet spec. does your container support? I've seen this type of behavior when the container supports Servlet Spec. 2.4 but the web.xml file is referring to the 2.3 dtd. If your container does support the 2.4 spec, then make sure your web.xml file has web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; in its root element. Again, if your container does support the 2.4 spec, then you shouldn't need any .tld files or even jar files for JSTL. All you should have to do is add (or include) something like this to the top of your .jsp page. %-- JSTL Standard Tags --% %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % %@ taglib uri=http://java.sun.com/jsp/jstl/fmt; prefix=fmt % If your container does not support the 2.4 spec, then you will need to include the appropriate .tld and .jar files and update your web.xml file to reference the appropriate .tld file(s). robert -Original Message- From: klute [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 10:01 AM To: Struts Users Mailing List Subject: Re: Setting html:hidden property using JSTL Hello All, I *really* appreciate your help. Because of a hard-pressing work deadline, i actually gave up on getting that to work using JSTL and ended up using the ugly input type=hidden name=contentId value=%=request.getAttribute(contentId)%/ instead. I'll definitely come back to JSTL at a later time since i consider that to be a proper way of doing this sort of things. Robert, if ${contentId} is available as an attribute (which it was) and not as a parameter, i would expect it to produce null or something instead of literally printing out ${contentId} string... Rick, i tried creating a var in the jsp and the result would still be the same: the value of the hidden property was printed out as {$myVar}. And, if i do c:out in the begging of the jsp, i do get an actual int value printed. weird... i definitely need to spend more time doing my homework to understand how it works... All the best, James --- Rick Reumann [EMAIL PROTECTED] wrote: klute wrote: Yes, the struts-el.jar is in WEB-INF/lib --- Rick Reumann [EMAIL PROTECTED] wrote: klute wrote: input type=hidden name=contentId value=${contentId} This are the tagligs i am importing on this page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % What am i doing wrong? Not sure. If you have - struts-el jar included - proper definition of the tld in web.xml - proper declaration for the tld on top of the page then using it as: html-el:hidden property=contentId value=${contentId}/ should be fine. The only thing I'm still concerned about and maybe somehow it's related is that contentId has to be a property of your ActionForm or else Struts would complain that it couldn't find the property 'contentId' Are you maybe creating the contentId var dynamically first in the JSP page and then trying to set as above? Usually you don't need to do like you are doing (setting the value) since that value can be set before you get to the page and thus just doing html:hidden property=contentId would be fine. What does c:out value=${contentId}/ produce on the page (or in source) when placed right before the html-el hidden tag? -- Rick -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Arraylists/Collections
If by proper, you mean a standard approach that works for all JDBC-compliant drivers, I'm guessing you're out of luck. It will depend on your specific combination of driver and database. For example, to use an array as an IN param with Oracle I believe you have to use their ArrayDescriptor and ARRAY classes. You also have to be able to treat your statement instance as an OraclePreparedStatement. Who knows, maybe there's a driver out there that can handle: stmt.setObject(i, theJavaArray, Types.ARRAY); The problem with PreparedStatement.setArray is getting an instance of java.sql.Array that represents the array you want to use as input. Although, I haven't necessarily spent a lot of time investigating this sort of thing so I could be way off base. Quoting CRANFORD, CHRIS [EMAIL PROTECTED]: Is there a proper way to pass an arraylist/collection to a pl/sql procedure besides turning it into a string on the java-side and passing it then as a VARCHAR parameter? ___ Chris Cranford Programmer/Developer SETECH Inc. Companies 6302 Fairview Rd, Suite 201 Charlotte, NC 28210 Phone: (704) 362-9423, Fax: (704) 362-9409, Mobile: (704) 650-1042 Email: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Setting html:hidden property using JSTL
: klute wrote: Yes, the struts-el.jar is in WEB-INF/lib --- Rick Reumann [EMAIL PROTECTED] wrote: klute wrote: input type=hidden name=contentId value=${contentId} This are the tagligs i am importing on this page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % What am i doing wrong? Not sure. If you have - struts-el jar included - proper definition of the tld in web.xml - proper declaration for the tld on top of the === message truncated === -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to use dynamically generated CSS style with Struts tags
: Hi everybody, Can you please help with the following question: What are the possible ways (and best) to modify the style sheet at run time using Struts framework? Our application is using Struts tags which refer to a static style sheet elements as presented below: html-el:link styleClass=%=style% We need at run time to extract user settings from DB (fonts, colors) and generate a style sheet accordingly . We could generate the style sheet text file for the user and store it somewhere on the disk and then refer to it, but then we may have too many files (for all active users). There must be a more dynamic and elegant soultion... Can we use the Struts html:link and pass a String to the style attribute of the html:link of the tag ? (It would be good for this string to be extracted from a bean prepared by an action). Any example of XSL taglib and Struts tag integration ? This is a very important element for trully dynamic pages ... Any good experience that we can learn from? Thank you very much, Marina -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Accessing Http Request with Groovy
How is classLoader obtained? Is it set to Thread.currentThread().getContextClassLoader()? Quoting Jerry Jalenak [EMAIL PROTECTED]: Hi Guys - I know this is a little off topic, but the groovy mailing list doesn't seem to be very active, and I need to track down an answer on this. What I'm trying to do is call a groovy script from a java class (an Action) and pass over the current Http Request object. Here's the calling Java code : snip GroovyClassLoader groovyClassLoader = new GroovyClassLoader(classLoader); Class groovyClass = groovyClassLoader.parseClass(form.getValidationScript()); GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance(); Object[] args = {_request}; validated = ((Boolean) groovyObject.invokeMethod(run, args)).booleanValue(); /snip And here's the (very basic) groovy script : snip import javax.servlet.http.HttpServletRequest; public class Validate { public Boolean run(HttpServletRequest request) { println(queryString is + request.getQueryString()); return new Boolean(true); } } /snip When I run this I'm getting the following error : java.lang.NoClassDefFoundError: org/apache/coyote/tomcat5/CoyoteRequestFacade gjdk.org.apache.coyote.tomcat5.CoyoteRequestFacade_GroovyReflector.invoke(Co yoteRequestFacade_GroovyReflector.java) groovy.lang.MetaMethod.invoke(MetaMethod.java:110) groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1020) groovy.lang.MetaClass.invokeMethod(MetaClass.java:314) org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:139) org.codehaus.groovy.runtime.InvokerHelper.invokeNoArgumentsMethod(InvokerHel per.java:102) Validate.run(script1087827061572.groovy:4) gjdk.Validate_GroovyReflector.invoke(Validate_GroovyReflector.java) groovy.lang.MetaMethod.invoke(MetaMethod.java:110) groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1020) groovy.lang.MetaClass.invokeMethod(MetaClass.java:314) gjdk.groovy.lang.MetaClass_GroovyReflector.invoke(MetaClass_GroovyReflector. java) groovy.lang.MetaMethod.invoke(MetaMethod.java:110) groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1020) groovy.lang.MetaClass.invokeMethod(MetaClass.java:314) org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:139) org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:10 6) Validate.invokeMethod(script1087827061572.groovy) org.appframework.controller.Controller.process(Controller.java:213) org.appframework.controller.Controller.doGet(Controller.java:104) javax.servlet.http.HttpServlet.service(HttpServlet.java:697) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) For some reason groovy is looking for the CoyoteRequestFacade, not the normal javax.servlet.http.HttpServletRequest. So, for all of you groovy guru's out there, how can I do this? Thanks! Jerry Jalenak Development Manager, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RowSetDynaClass
with and I see my self coding the same thing again and again over a period of time. I would really appreciate your time and effort. Thanks in adv. rajat -Original Message- From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 15, 2004 11:17 AM To: 'Struts Users Mailing List' Subject: RE: RowSetDynaClass Found the answer ;-) ... Avoid the c:... tags all together and stick with the standard struts tags. The following worked: logic:iterate id=row name=results property=rows scope=request indexId=rowid bean:write name=row property=item_id / - bean:write name=row property=item_product_number/ /logic:iterate Now have a fast, efficient paging mechanism that permits me to pass in a database connection object, the sql query to execute, starting page # and size and it handles the rest by populating itself from the database, closing the resultset when finished and leaves the presentation part up to my JSP as above! Gotta love struts! Chris -Original Message- From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 15, 2004 12:35 AM To: '[EMAIL PROTECTED]' Subject: RowSetDynaClass I am storing a RowSetDynaClass property in my java class and I have implemented a method on my class as follows: public Collection getRows() { return((Collection)rsdc.getRows()); } In my action, I store my custom class object reference as follows: request.setAttribute(results, myResultsObj); Then in my jsp, I do the following: bean:define scope=request id=data name=results property=rows / c:forEach var=row items=${data} varStatus=rowid c:out value=${rowid.count}/. c:out value=${row.item_id} / - c:out value=${row.item_product_number} / /c:forEach I get the following error: [ServletException in:/pages/test-body.jsp] An error occurred while evaluating custom action attribute value with value ${row.item_id}: Unable to find a value for item_id in object of class org.apache.commons.beanutils.BasicDynaBean using operator . (null) Can someone tell me what I am doing wrong here and how I can do this properly to get it to work? ___ Chris Cranford Programmer/Developer SETECH Inc. Companies 6302 Fairview Rd, Suite 201 Charlotte, NC 28210 Phone: (704) 362-9423, Fax: (704) 362-9409, Mobile: (704) 650-1042 Email: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:link and map of request parameters
There's really not much difference between using: Map results = new HashMap(map); and: Map results = new HashMap(); results.putAll(map); Maybe I'm missing the point you're trying to make, but I don't see how that would solve the problem. Quoting Ron Grabowski [EMAIL PROTECTED]: Date: Tue, 8 Jun 2004 15:42:58 -0400 From: Kris Schneider [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: html:link and map of request parameters I believe the base requirement for Struts 1.1 is JDK 1.2 or later. Since LinkedHashMap was introduced in JDK 1.4, it really can't be used in the Struts codebase. I suppose org.apache.commons.collections.SequencedHashMap could be used in its place. However, the problem is really more general than that. What if someone was using a SortedMap? Or a WeakHashMap? Or SomeOtherSpecialMap? The process of doing: results = new HashMap(map); blows away any special functionality that might impact how the original map makes entries available. I'm not exactly sure why the entries are copied out of the original map, but it may have something to do with trying to avoid raising a ConcurrentModificationException. The java.util.Map interface has a putAll(Map m) method. If that were called instead of new Hashmap(): results.putAll(map); results would still get populated. SortedMap, WeakHashMap, SomeOtherSpecialMap, etc. all implement the Map interface so those should continue to work. The documentation calls for a java.util.Map object, why not call a java.util.Map method? - Ron -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:link and map of request parameters
I believe the base requirement for Struts 1.1 is JDK 1.2 or later. Since LinkedHashMap was introduced in JDK 1.4, it really can't be used in the Struts codebase. I suppose org.apache.commons.collections.SequencedHashMap could be used in its place. However, the problem is really more general than that. What if someone was using a SortedMap? Or a WeakHashMap? Or SomeOtherSpecialMap? The process of doing: results = new HashMap(map); blows away any special functionality that might impact how the original map makes entries available. I'm not exactly sure why the entries are copied out of the original map, but it may have something to do with trying to avoid raising a ConcurrentModificationException. Quoting Ron Grabowski [EMAIL PROTECTED]: From: James Mitchell [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: html:link and map of request parameters Date: Mon, 7 Jun 2004 12:23:33 -0400 Here's how I do it: (This demonstrates both static and dynamic values for use with the html:link) ... ... jsp:useBean id=myLinkParams class=java.util.HashMap/ c:set target=${myLinkParams} property=id value=${dto.id}/ c:set target=${myLinkParams} property=type value=edit/ ...later down the page... html:link action=/manageUserAccount name=myLinkParams bean:message key=edit.user.link.text/ /html:link http://jakarta.apache.org/struts/userGuide/struts-html.html#link Specify only the name attribute - The named JSP bean (optionally scoped by the value of the scope attribute) must identify a java.util.Map containing the parameters I looked at jakarta-struts-1.1-src's RequestUtils.computeParameters and saw that it uses a HashMap: // Create a Map to contain our results from the multi-value parameters Map results = null; if (map != null) { results = new HashMap(map); } else { results = new HashMap(); } I wish I was able to use a LinkedHaspMap in my useBean: jsp:useBean id=myLinkParams class=java.util.LinkedHaspMap/ so the items I add to the Map appear in the same order in the rendered HTML. Is there anyway to have Struts adhere to the Map interface instead of forcing the object into a HashMap? - Ron -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: converting bean:write to c:out
Well, sort of. In the typical example of a mapped property (like the one Richard provided), the map itself isn't exposed as a JavaBean property, so JSTL can't get at the information it contains: private final Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } So, in order for JSTL to get at that information, you have to expose the map as a JavaBean property. For example, by adding a method like: public Map getValues() { return values; } Then JSTL can be used like: c:out value=${info.values.email}/ Quoting Bill Siggelkow [EMAIL PROTECTED]: c:out value=${info.value.email}/ -- or -- c:out value=${info.value['email']}/ Richard Raquepo wrote: hi, i am converting some of the jsp's to jstl. how do i convert this line to jstl: bean:write name=info property=value(email)/ where getValue is defined as HashMap values = new HashMap(); . public String get(String name){ String value = (String) values.get(name); return value; } hoping for your immediate response. thanks a lot. -richard -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's best practice to determine correct jsp buffer size?
Couple of comments that don't directly answer the question ;-). The buffers for ServletResponse and JspWriter are independent entities. So, even if you set your JSP page to be unbuffered: %@ page buffer=none % it won't change the buffer size of your response. Also, the spec language for setting the size of the buffers is, at least as large as the size requested and not less than that specified. So, in theory, these two directives: %@ page buffer=1kb % %@ page buffer=100kb % could result in the same size buffer. I don't have any data on how different containers behave in practice. Quoting Mick Wever [EMAIL PROTECTED]: Read in a couple of places setting the jsp buffer size helps performance.. atleast you can tweak between performance and memory usage... Anyone know how to determine what is the best size for setting the jsp buffer size [response.setBufferSize(..)] ? I'm using tiles, and when I use: LOG.info(Buffer size: +response.getBufferSize()); in a filter after struts action has performed, I always get 40960. Seems a little big for me, and I thought the value would change for each different page? Mick -- -- BR/ One of the easiest ways to avoid many common problems is to stop using Microsoft software. Mark Ward, BBC BR/ --- a href=http://www.harryspractice.com.auHarry's Practice/a --- -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to renderize a image?
It's an error to call getWriter after getOutputStream (or vice versa), but I don't think it's an issue to call getOutputStream multiple times. Although, even if it were, I really don't think Struts ever calls getOutputStream. At least not in 1.1. Quoting Bill Schneider [EMAIL PROTECTED]: I have a image in Oracle Blob field and i want to renderize it my jsp. Do I need to use hmtl:image or html:img or this is not the way? My form property is a Blob, but i guess that this tags dont support this Hi, First remember how images work in HTML. the img src=... attribute is treated as an href, so there are actually two separate HTTP requests: one to render the JSP and one to fetch and display the image. The only thing that changes if your image is stored in an Oracle BLOB is, instead of html:image pointing to a file resource, it has to point to a servlet that you write yourself. The servlet fetches the BLOB from your table, sets the Content-Type properly (image/gif, image/jpeg) and writes the bytes to response.getOutputStream. One thing to remember is, you _can't_ retrieve images from within an Action because you are only allowed to call response.getOutputStream once during the request and Struts' ActionServlet already appears to do that. So you have to write an actual servlet. Hope this helps, Bill -- Bill Schneider Chief Architect Vecna Technologies 5004 Lehigh Rd., Suite B College Park, MD 20740 [EMAIL PROTECTED] t: 301-864-7594 f: 301-699-3180 -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL 1.1 EL not working :(
Remove the TLD files from WEB-INF, remove the taglib elements from web.xml, make sure you're using a JSP 2.0 container (like Tomcat 5), and make sure you're using a Servlet 2.4 web.xml. Quoting Daniel Perry [EMAIL PROTECTED]: I've tried to use JSTL with my web app, and it's not working! I downloaded jstl 1.1, and copied jstl.jar, and standard.jar to WEB-INF/lib. I put the f.tld, fmt.tld, fn.tld in WEB-INF/. In my web.xml i've got: taglib taglib-uri/WEB-INF/c.tld/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/fn.tld/taglib-uri taglib-location/WEB-INF/fn.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/fmt.tld/taglib-uri taglib-location/WEB-INF/fmt.tld/taglib-location /taglib If i try and use c:out, it doesnt work! %@ page contentType=text/html;charset=UTF-8 language=java % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % c:out value=${1+1}/ gives: ${1+1} Any idea what's going on? It looks like the taglib is working fine, but not using el! Any ideas? Daniel. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: java.lang.OutOfMemoryError after server app start/stop cyclin g
Haven't done it myself but I thought you had to edit the registry to modify VM settings for a TC service. See if there's a TC entry at: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services Quoting Daniel Perry [EMAIL PROTECTED]: eh? i thought ANT_OPTS was for ant, not tomcat. I dont have any trouble with ant using default memory allowance. Its tomcat that is running out of memory, and is ignoring the CATALINA_OPTS. Daniel. -Original Message- From: Jignesh Patel [mailto:[EMAIL PROTECTED] Sent: 14 May 2004 12:14 To: Struts Users Mailing List; Daniel Perry Subject: Re: java.lang.OutOfMemoryError after server app start/stop cyclin g Daniel, For your problem 3 you must have to set ANT_OPTS=-Xmx512m in your dos prompt as mentioned by Chris. -Jignesh On Friday 14 May 2004 15:49, Daniel Perry wrote: I have JAVA_OPTS and CATALINA_OPTS set to -Xmx1024M as system environment variables. If i start tomcat using startup.bat it uses these. If i start tomcat using as a windows service, it doesnt use these. Daniel. -Original Message- From: McCormack, Chris [mailto:[EMAIL PROTECTED] Sent: 14 May 2004 11:09 To: Struts Users Mailing List Subject: RE: java.lang.OutOfMemoryError after server app start/stop cyclin g Type java -X in a windows shell and look at setting some of the below options in your environment using JAVA_OPTS -Xmssizeset initial Java heap size -Xmxsizeset maximum Java heap size -Xsssizeset java thread stack size I alse use this to allocate more memory to ant at build time for a large application. 'set ANT_OPTS=-Xmx512m' (in a .bat) or pop it in your environment profile. Chris McCormack -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: 14 May 2004 10:54 To: Struts Users Mailing List Subject: RE: java.lang.OutOfMemoryError after server app start/stop cyclin g I'm using jdk1.4.2_04, and it still happens! Here are some of my observations on the issue: 1. I did once develop some software using servlets/jsps. I never came accross this problem. However, as jsps are automatically releaded, and this app was mainly jsp based, i dont remeber doing any restarting :) 2. running a memory intensive / complex app, it runs out of memory a lot quicker :) 3. If i run the stopapp and startapp ant tasks in a loop it runs out of memory with my struts app pretty quickly. Doing the same thing to axis takes a lot longer. So, i figure its not restricted to struts. Anyway, still cant figure out how to increase max memory if it's running as a windows service? Daniel. -Original Message- From: Jignesh Patel [mailto:[EMAIL PROTECTED] Sent: 14 May 2004 04:45 To: Struts Users Mailing List; Heinle, Chuck Subject: Re: java.lang.OutOfMemoryError after server app start/stop cyclin g As per my knowledge the bug of OutOfMemory is related to version less then jdk1.4. It has been solved in the 1.4. -Jignesh On Thursday 13 May 2004 23:30, Heinle, Chuck wrote: We have a similar problem with WebLogic 8.1 SP2...I was told by an associate that there is a 1.4.2_02 bug related class loading that might associated with the OutOfMemory. -Original Message- From: Joe Germuska [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 1:52 PM To: Struts Users Mailing List Subject: RE: java.lang.OutOfMemoryError after server app start/stop cycling At 6:07 PM +0100 5/13/04, Daniel Perry wrote: Putting up the maximum memory Xmx does help as it gives it more memory to use up, but only delays the inevitable :) Is this a struts issue? or does it happen with all tomcat apps? It happens with every servlet container I've used. My understanding is that to redeploy a webapp, app servers generally discard the classloader they have been using and make a new one. For various reasons, this can leave orphan objects which are never garbage collected. If enough of these accumulate, you run out of memory. Admittedly, I use Struts in all these cases, you might argue that it's a Struts issue, since that's the common feature, but I can't think of anyways Struts is being particularly careless in a way that would aggravate this problem. I may have a completely wrong understanding of the problem too, but this is how we explain it to ourselves around here! Joe -- Jignesh Patel Project Leader Bang Software Technolgy Pvt. Ltd. (E) [EMAIL PROTECTED] (T) 091 484 3942132 B-4, Smart Business Centre, Infopark, SDF IT Building, Kusumagiri P.O.,Kakkanad, Kochi - 682030, Kerala, India. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com
RE: JSTL 1.1 + HTML-EL Problem
;-) Assuming this is some sort of communication breakdown, what I meant was that the phrase accept runtime expressions should actually be accept request-time expressions. There's no such thing as a JSP runtime expression... Quoting Zsolt Koppany [EMAIL PROTECTED]: What are runtime and request-time? Where can I change runtime? Zsolt -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 7:41 PM To: Struts Users Mailing List Subject: Re: JSTL 1.1 + HTML-EL Problem Ugh. Change runtime to request-time... Quoting Kris Schneider [EMAIL PROTECTED]: The Struts-EL tags are essentially useless in JSP 2.0. Use the standard Struts tags and JSP 2.0 will automatically allow EL expressions for attribute values. At least for those that would normally accept runtime expressions... Quoting Ricardo Cortes [EMAIL PROTECTED]: Hey guys, I've been banging my head with this for sometime so I'm hoping someone has an answer. We are running JBoss 3.2.3 and have successfully replaced Tomcat 4 with Tomcat 5 so we can use the JSP 2.0 and Servlet 2.4 specifications. I decided to download Standard 1.1 which has support for JSTL 1.1 (including the JSTL functions) and I'm having problems getting the html-el tags to properly work with JSTL 1.1. Everything works fine if I don't use the html-el tags but once I introduce html-el tags into my JSPs/Tiles I get an error stating the property attribute can't accept expressions. I might also add that I've modified our web.xml to point to the Servlet 2.4 XML schema rather than the Servlet 2.3 DTD. I tried switching back to the Servlet 2.3 DTD and using the isELEnabled directive but I kept getting the following error: Page directive has invalid attribute: isELEnabled Am I correct in saying the html-el tags don't work with the Servlet 2.4 specification? Thanks, Ricardo -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL 1.1 + HTML-EL Problem
The Struts-EL tags are essentially useless in JSP 2.0. Use the standard Struts tags and JSP 2.0 will automatically allow EL expressions for attribute values. At least for those that would normally accept runtime expressions... Quoting Ricardo Cortes [EMAIL PROTECTED]: Hey guys, I've been banging my head with this for sometime so I'm hoping someone has an answer. We are running JBoss 3.2.3 and have successfully replaced Tomcat 4 with Tomcat 5 so we can use the JSP 2.0 and Servlet 2.4 specifications. I decided to download Standard 1.1 which has support for JSTL 1.1 (including the JSTL functions) and I'm having problems getting the html-el tags to properly work with JSTL 1.1. Everything works fine if I don't use the html-el tags but once I introduce html-el tags into my JSPs/Tiles I get an error stating the property attribute can't accept expressions. I might also add that I've modified our web.xml to point to the Servlet 2.4 XML schema rather than the Servlet 2.3 DTD. I tried switching back to the Servlet 2.3 DTD and using the isELEnabled directive but I kept getting the following error: Page directive has invalid attribute: isELEnabled Am I correct in saying the html-el tags don't work with the Servlet 2.4 specification? Thanks, Ricardo -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tools for check struts-config.xml parse exception
Ant's optional xmlvalidate task. Quoting Kelvin wu [EMAIL PROTECTED]: Dear all, Which tools you are using for check parse exception for struts-config.xml? Kelvinwu -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts with Cocoon
I hear this sort of thing a lot and just want to add that JSP and XML/XSL(T) are not mutually exclusive. JSP can be quite effective at generating not only your XML content, but also your XSLT stylesheets (it is XML after all). JSP has it's flaws but it doesn't require you to make a choice between it and XML/XSLT. Quoting MARU, SOHIL (SBCSI) [EMAIL PROTECTED]: Hello All, We are in process of designing a framework using struts. I am looking to get rid of JSPs and replace the View with just XSLs. I was wondering if anyone has done the following: 1) Extending struts so that each action tag forwards the request to an XSL servlet which using an XSL to transform XML into HTML. OR 2) Using Cocoon with struts. If you have, what kind of results have you seen as far as performance is concerned? Also which one is easier to pull off, I am well versed with XSL so to me option 1 is easier to do but if someone has taken the option 2 approach, I would like their opinion on level of difficulty and time it took to develop that. Thanks, Sohil -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]