Re: What goes where?
Hi Eric, On Sat, 2003-12-13 at 16:16, Eric SCHULTZ wrote: As I understand struts.jar needs to remain in the WEB-INF/lib directory; I assume struts-legacy.jar should stay there too. But can all my commons jars go in the common/lib directory? Should those not already in common/lib go in shared/lib? I realise some people advocate putting everything the app needs in its WEB-INF/lib directory; and I agree with that if I have version dependancies, but I don't. And I already have to put my JDBC drivers in common/lib to use Tomcat's JNDI datasources so I've already started down that path. I'm not sure what the real answer is, but the fact that you're using JNDI apparently reduces your choices a bit. The JNDI-DataSources-Howto explicitly says to put all your commons connection pooling stuff in common/lib and not WEB-INF/lib. Where that leaves some of the other apparently common (and commons-) things isn't clear to me. HTH, Oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
getServletContext() throws null pointer
Hi, I've put an object into the ServletContext with an init servlet started on load via web.xml. Accessing it with my main Action works fine, but when I try to use another servlet (extend HttpServlet) to getServletContext() it throws a null pointer exception (doesn't just return null - goes straight to the exception). From the javadoc on ServletContext I'm led to believe that all servlets in the app share the same ServletContext, so I'm confused. I'm attempting this lookup in the constructor of the servlet - does it have to happen in a doGet or such? Any ideas? Also, is there some way of accessing the ServletContext without being a Servlet? Thanks very much, Oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: getServletContext() throws null pointer
On Wed, 2003-12-10 at 12:12, Trieu, Danny wrote: Constructor is the answer to your problem. There are no guarantee that the servlet that set the data will be loaded before the servlet that accessing it. I'm attempting to make that guarantee but I can see how the servlets might not care. Further testing reveals that the contructor is not the problem, though, since putting the lookup in a separate function called after construction also fails. Other thoughts? Thanks, Oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getServletContext() throws null pointer
On Wed, 2003-12-10 at 12:18, Richard Yee wrote: Oliver, Are you overriding init(ServletConfig config) in your init servlet? If so, did you call super.init(config) before you tried accessing the ServletContext? I'm not overriding init(config) but I am overriding init(). I hadn't been calling super.init() but gave that a shot and no change. I am able to access the ServletContext (and the init-ed object) from both my controlling Action and from a jsp - just not from another servlet. I must be missing something simple yet fundamental... Thanks, Oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getServletContext() throws null pointer
On Wed, 2003-12-10 at 12:50, Claire Wall wrote: as i understand it, in order to retrieve the servlet context, you need to use the ServletConfig to retrieve it like so: config.getServletContext() this sounds similar to a problem that i had where i was trying to log something from a servlet, just used the log() method and it through an exception pretty much like the one you are experiencing. however, by putting config.getServletContext().log() it threw no exceptions... Hmm. It appears that the ServletConfig is only accessible to the init() of a given servlet. Within the init() I can getServletConfig() and it appears not to be null, and I can getServletConfig.getServletContext() but that IS null. So no exception but a null context that leaves me in about the same boat. Calling getServletContext() directly within the init() also gives me null. This happens with and without a call to super.init(). This can't be that hard. Is there some extra step to tying an arbitrary servlet to a webapp context apart from calling it from within that context (eg Action within context calls the new servlet)? Thanks, Oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getServletContext() throws null pointer
On Wed, 2003-12-10 at 12:55, Richard Yee wrote: Oliver, In the last email I sent, I should have asked if you overrode the init(ServletConfig) method in the servlet that is having the null pointer exception, not your init servlet. Oh I see - sorry but before testing Claire's hypothesis I hadn't touched the init() methods. Thanks, Oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MySql BasicDataSource Connection
Hi All, After a similar struggle to the original poster I managed to get the BasicDataSource to work, but I wonder about the properties you're setting below - the javadoc on BasicDataSource doesn't mention maxCount or minCount (I gather maxActive and minIdle are their equivalents) so are those lines doing anything in your config? It's a bit tricky to test, but of course a useful feature. Thanks, Oliver On Mon, 2003-11-17 at 23:11, Gede Indrawan wrote: I use data-source defintion below and no problem with it data-source type=org.apache.commons.dbcp.BasicDataSource set-property property=driverClassName value=org.gjt.mm.mysql.Driver/ set-property property=url value=jdbc:mysql://localhost/telkomsel/ set-property property=maxCount value=5/ set-property property=minCount value=1/ set-property property=username value=root/ set-property property=password value=blahblah/ /data-source - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: deprecation error moving from Tomcat 4.0.4 to 4.1.18?
Thank you Michael! Of course it's something perfectly obvious that I should have tried as step one, but that would certainly have been too easy, and besides, I had too much hair anyway. *sigh* Thanks again, Oliver -Original Message- From: Michael Santos [mailto:[EMAIL PROTECTED] Sent: March 25, 2003 23:13 To: Struts Users Mailing List Subject: Re: deprecation error moving from Tomcat 4.0.4 to 4.1.18? OK, to me it seems to be something related to Tomcat. Try using jsp:include page=%= includePage.toString() % flush=true / instead. []s -- Michael Nascimento Santos Sun Certified Programmer for the Java 2 Platform Sun Certified Programmer for the Java 2 Platform 1.4 Sun Certified Web Component Developer for J2EE Moderador SouJava - www.soujava.org.br - Original Message - From: Oliver Meyn [EMAIL PROTECTED] To: STRUTS [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 6:33 PM Subject: deprecation error moving from Tomcat 4.0.4 to 4.1.18? Hi all, Code that has worked fine under Struts 1.1 rc1 in Tomcat 4.0.4 is now failing in 4.1.18 (j2sdk1.4.1_02). Other servlets made the switch ok, but when I try to jsp:include page=%= a bean value % / the page fails with a somewhat cryptic error as below: [ERROR] org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 39 in the jsp file: /data/statistics.jsp Generated servlet error: [javac] Compiling 1 source file C:\jakarta-tomcat-4.1.18\removed\data\statistics_jsp.java:136: include(javax.servlet.http.HttpServletRequest,javax.servlet.http.H ttpServlet Response,java.lang.String,javax.servlet.jsp.JspWriter,boolean) in org.apache.jasper.runtime.JspRuntimeLibrary cannot be applied to (javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServ letRespons e,java.lang.Object,javax.servlet.jsp.JspWriter,boolean) JspRuntimeLibrary.include(request, response, includePage , out, true); ^ An error occurred at line: 39 in the jsp file: /data/statistics.jsp Generated servlet error: Note: C:\jakarta-tomcat-4.1.18\removed\data\statistics_jsp.java uses or overrides a deprecated API. Note: Recompile with -deprecation for details. 1 error [/ERROR] This is the code that generates it: [CODE] logic:present name=statsNavBean bean:define id=includePage name=statsNavBean property=bodyPage / jsp:include page=%= includePage % flush=true / /logic:present [/CODE] The bean:define line is #39 referenced in the error, but I think it must be miscounting since if I remove the jsp:include line it works fine (well, compiles fine). Any ideas on what's causing this? Is there a newer version of some spec I should be writing to for 4.1.18 as opposed to 4.0.4? I know the includePage is coming back correctly because just printing it out shows that it is correct. One of the possibilities for includePage is a trivial Coming Soon page, and if I define some variable foo = comingsoon.jsp (same as passed back) and place it in the include instead of includePage, it _works fine_. This must be something in the interaction of the bean and the include, but I can't figure it out. Hoping it's something obvious, Oliver ps same error on Linux/Apache Oliver Meyn [EMAIL PROTECTED] Things should be made as simple as possible, but no simpler. - Albert Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
deprecation error moving from Tomcat 4.0.4 to 4.1.18?
Hi all, Code that has worked fine under Struts 1.1 rc1 in Tomcat 4.0.4 is now failing in 4.1.18 (j2sdk1.4.1_02). Other servlets made the switch ok, but when I try to jsp:include page=%= a bean value % / the page fails with a somewhat cryptic error as below: [ERROR] org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 39 in the jsp file: /data/statistics.jsp Generated servlet error: [javac] Compiling 1 source file C:\jakarta-tomcat-4.1.18\removed\data\statistics_jsp.java:136: include(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServlet Response,java.lang.String,javax.servlet.jsp.JspWriter,boolean) in org.apache.jasper.runtime.JspRuntimeLibrary cannot be applied to (javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletRespons e,java.lang.Object,javax.servlet.jsp.JspWriter,boolean) JspRuntimeLibrary.include(request, response, includePage , out, true); ^ An error occurred at line: 39 in the jsp file: /data/statistics.jsp Generated servlet error: Note: C:\jakarta-tomcat-4.1.18\removed\data\statistics_jsp.java uses or overrides a deprecated API. Note: Recompile with -deprecation for details. 1 error [/ERROR] This is the code that generates it: [CODE] logic:present name=statsNavBean bean:define id=includePage name=statsNavBean property=bodyPage / jsp:include page=%= includePage % flush=true / /logic:present [/CODE] The bean:define line is #39 referenced in the error, but I think it must be miscounting since if I remove the jsp:include line it works fine (well, compiles fine). Any ideas on what's causing this? Is there a newer version of some spec I should be writing to for 4.1.18 as opposed to 4.0.4? I know the includePage is coming back correctly because just printing it out shows that it is correct. One of the possibilities for includePage is a trivial Coming Soon page, and if I define some variable foo = comingsoon.jsp (same as passed back) and place it in the include instead of includePage, it _works fine_. This must be something in the interaction of the bean and the include, but I can't figure it out. Hoping it's something obvious, Oliver ps same error on Linux/Apache Oliver Meyn [EMAIL PROTECTED] Things should be made as simple as possible, but no simpler. - Albert Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Cannot find ActionMappings or ActionFormBeans collection
Hi all, Could someone please tell me what throws this exception, and why? It seems completely arbitrary - adding an action to action-mappings sometimes works and sometimes causes this to be thrown. If it's being thrown and I undo any changes to struts-config since it worked, it still gets thrown. You can guess how frustrating that is... The archives haven't been much help :( javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection struts 1.1b2, tomcat 4.0.4, j2sdk1.4.1_01, win2k, iis Thanks very much, Oliver Oliver Meyn [EMAIL PROTECTED] (416) 524-2240 Things should be made as simple as possible, but no simpler. - Albert Einstein -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
html:link and param based navigation
Hi all, My problem is that every view in my app needs to be bookmarkable and emailable. I figure that means the url needs to uniquely identify where you are in the app, and that the way to do that is with parameters (ie example.com/page.jsp?thing1=1thing2=2 etc). I'm open to other suggestions, but here's the problem with this way, as I see it: I need every click to change it's own parameter to reflect where the click came from, so if we have a page where we've navigated down to where we're looking at male population aged 40-65 for our city, then we can click on the Bar Graph link and we switch from our current text table to the graphical view. I'm imagining that as a link that changes the View param from value Table to value Bar, while leaving the others (ie Data=census, Nbhd=city, etc) alone. I think this could be done by using the forward of html:link and having some kind of fancy ActionForward to keep track of where the click came from, and the state of the rest of the params (maybe by using another bean). I could be way off, and in either case I could really use some help. Is this the best way to handle param based navigation, or more generally, this problem? Thanks very much, Oliver ps there will be forms involved as well, using get (I imagine) to identify what choices the user made, so the param line will have to be shared by both the links and the forms Oliver Meyn [EMAIL PROTECTED] (416) 524-2240 Things should be made as simple as possible, but no simpler. - Albert Einstein -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Newbie logic:iterator question
This thread existed a few weeks ago, according to the archives, where I found this suggested example for how to get iterator working (from Alexis Gallagher): jsp:useBean id=userListHelper scope=request class=com.tpc.UserListHelper / logic:iterate id=item name=userListHelper property=userList indexId=index bean:write name=item property=username/ /logic:iterate which appears to be the same idea as used in the struts-example, but I can't get this to work, as it fails with the error: Cannot find bean item in scope null Similar attempts with my own beans also fail (as does explicitly setting the scope, where the error just becomes ... item in scope application or whatever scope is specified). Any suggestions? Thanks very much, Oliver -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org