RE: Extra Lines in Compiled JSP
Good afternoon... I had a similar issue generating XML files. I realise white-space shouldn't be an issue in XML but it was for our browser. Perhaps you are having a similar issue in your case, so this might help. When I followed convention and put the %@ ... % directives first, and then my ? xml ... ? line the browser couldn't validate the XML because it didn't start on the first character of the first line (i.e.: because of all the blank lines). The solution was to ignore the convention and start my file with ? xml ... ? and then put my %@ ... % directives and then put the rest of my JSP. Perhaps you could start your JSP page with html and the put the page and taglib directives? In what way is your HTML code being screwed up? Eric Schultz Technical Leader Conseiller Technique Elix Specialist in interactive business solutions Specialiste en solutions d'affaires interactives 14 Commerce Place, 5th floor Nun's Island, QC H4E 1T5 t: 514 768-1000 f: 514 768-7680 -Original Message- From: Jerry Jalenak [mailto:[EMAIL PROTECTED] Sent: February 20, 2004 11:07 To: '[EMAIL PROTECTED]' Subject: Extra Lines in Compiled JSP Hi All, I should know how to fix this, but am at a loss. At the top of my JSP I have the following lines: %@ taglib uri=http://jakarta.apache.org/struts/tags-bean; prefix=bean % %@ taglib uri=/display prefix=display % %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % %@ taglib uri=http://jakarta.apache.org/struts/tags-nested; prefix=nested % %@ taglib uri=http://jakarta.apache.org/struts/tags-tiles; prefix=tiles % %@ page language=java % %@ page contentType=text/html; charset=UTF-8 % When I look at the compiled JSP, there are seven blank lines (i.e. out.write(\r\n); ). Is there anyway to have the JSP compiler (were running Tomcat 5.0.18 Stable) NOT generate these lines? I guess they come from the % % sources lines, but it really screws up my generated HTML code Thanks! Jerry Jalenak Development Manager, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Basic question on /lib/*.jar files
Good afternoon... From: Claire Wall Date: Tue, 03 Feb 2004 04:25:29 -0800 we store them in the common/lib folder. Then all applications running on that web server have access to the jars and negates the need for them to go into the separate WEB-INF/lib folders for each application. please review section 5.6 of the struts user's guide: http://jakarta.apache.org/struts/userGuide/configuration.html struts jar files should go with your application. also, in order to be able to reproduce exact environments at certain points in time it is necessary to store the libraries with the code that depends on them. Eric Schultz. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to set properties on actions?
Good evening... i'm trying to use set-property on my action, in struts-config.xml i have: action path=/BillPayment type=com.elixonline.TECO.ivr.CustomerInformation.BillPayment set-property property=noTransferDays value=MONDAY/ /action and my class defines public void setNoTransferDays(String string) { noTransferDays = string; } but i always get the following error in Tomcat 4.1.27 when i start the application: javax.servlet.UnavailableException: Parsing error processing resource path if i comment out just the set-property then the application starts no problem. any ideas? i couldn't find anything in the mail archive or the Struts site (all the set-property references were for plug-ins and datasources). Eric Schultz. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reloading of application resources
Good morning... I need to do something similar with additional configuration properties for a particular action. I figure I need to write a plug-in that creates a thread that checks the properties file every x seconds and if changed reloads it into a context attribute. My problem is I've never done thread-safe programming before and I figure I need to handle the possibility that the plug-in's thread could be writing a new version while several actions are reading from the existing one. Does anyone have any pointers to some information on how to do this properly? Much appreciated. Thanks Eric Schultz Technical Leader Conseiller Technique Elix Telephony Web convergence at its best: http://www.talktosantaclaus.com La convergence téléphonie-web à son meilleur: http://www.parleauperenoel.com Specialist in interactive business solutions Specialiste en solutions d'affaires interactives 14 Commerce Place, 5th floor Nun's Island, QC H4E 1T5 t: 514 768-1000 f: 514 768-7680 -Original Message- From: Joe Germuska [mailto:[EMAIL PROTECTED] Sent: December 15, 2003 11:14 To: Struts Users Mailing List Subject: RE: Reloading of application resources At 11:42 AM +0200 12/15/03, Nicklas Karlsson wrote: On Mon, 15 Dec 2003, Yves Sy wrote: Create a thread in your cache manager that polls for changes in the timestamp of the properties file, say, every 5000 ms and reloads it when a new one is detected. Yes, but the problem is not at the cache end, the issues are how to trigger the components (the ActionServlet in this case) into refreshing their data from the cache. Do I have to extends the ActionServlet and manually pop in refreshed data (based on some trigger) in the message key in the ServletContext? And how does locale affect the configured key Note that although the message data is read in from Properties files, the objects in the ServletContext which resolve references to properties keys are instances of a specific Struts class, MessageResources. If you dynamically reloadable messages (which would be useful to many people), you'll want to look at the MessageResources and MessageResourcesFactory abstract classes and extend them (or their Property oriented subclasses) in order to add in your functionality... http://jakarta.apache.org/struts/api/org/apache/struts/util/MessageResources .html http://jakarta.apache.org/struts/api/org/apache/struts/util/MessageResources Factory.html There's an ongoing process to factor these classes out of Struts and into a commons library, and to have Struts use that library (on the roadmap, that's slated for Struts 1.3.x). http://jakarta.apache.org/commons/sandbox/resources/ http://jakarta.apache.org/struts/status.html Hope that helps. I know I'd find a dynamically reloadable messages bundle useful! Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com We want beef in dessert if we can get it there. -- Betty Hogan, Director of New Product Development, National Cattlemen's Beef Association - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reloading of application resources
Good afternoon... This sounds pretty good. The synchronized modifier, I've seen it around but we've never really gotten to know each other. I'll look into it. Eric Schultz Technical Leader Conseiller Technique Elix Telephony Web convergence at its best: http://www.talktosantaclaus.com La convergence téléphonie-web à son meilleur: http://www.parleauperenoel.com Specialist in interactive business solutions Specialiste en solutions d'affaires interactives 14 Commerce Place, 5th floor Nun's Island, QC H4E 1T5 t: 514 768-1000 f: 514 768-7680 -Original Message- From: Joe Germuska [mailto:[EMAIL PROTECTED] Sent: December 16, 2003 14:53 To: Struts Users Mailing List Subject: RE: Reloading of application resources I'd suggest that if you can achieve the same goals by writing a PlugIn implementation that you might achieve by extending the ActionServlet, you're probably better off writing the PlugIn. You could avoid creating a thread by implementing a freshness check at an access point. That is, rather than having your action get its config out of the servletcontext, have it get a plug-in instance out of the servlet context, and have it ask the plug-in for the config. At that time, the plug-in can decide whether it needs to reload the config or not before returning it to the action, perhaps by comparing the last modified timestamp on the config file to a value stored the last time the file was read. Then you could just add a synchronized modifier to the plug-in method that the action classes call and achieve pretty simple thread safety. It's not the fanciest, but if you're not comfortable writing concurrent code, better safe than fancy! Joe I need to do something similar with additional configuration properties for a particular action. I figure I need to write a plug-in that creates a thread that checks the properties file every x seconds and if changed reloads it into a context attribute. My problem is I've never done thread-safe programming before and I figure I need to handle the possibility that the plug-in's thread could be writing a new version while several actions are reading from the existing one. Does anyone have any pointers to some information on how to do this properly? Much appreciated. Just a thought: How about extending the ActionServlet and maintain an expire-variable that is set at init-time. Then every time after a request is processed the expire variable is checked. If expired, calls the same method for loading the resources as init() does (think it's initModuleMessageResources)? -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com We want beef in dessert if we can get it there. -- Betty Hogan, Director of New Product Development, National Cattlemen's Beef Association - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
What goes where?
Good afternoon... I've looked around this list a bit and read the web sites (Tomcat, Struts) and I know a bit about class loaders, but I'm still perplexed. The blank Struts 1.1 app WEB-INF/lib has a bunch of jar files in, some overlap with Tomcat 4.1.27's common/lib directory (namely the commons libraries collections, dbcp, logging, and pool). This leaves commons digester, fileupload, lang, and validator uniquely in the WEB-INF/lib, along with struts.jar, struts-legacy.jar, and jakarta-oro.jar. 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. Thanks. Eric Schultz. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RT expr value in custom tag
Good morning... I'm trying to write my own custom tag library for Struts. I've had some initial success, but now I'm having some trouble. I want to set an attribute value from the value of a bean get. But what I end up with in my tag is JSP code, not the value in the bean. I.e.: v:properties template=inputmode parameter=%= UserSessionBean.getInputMode() %/ is not translated. How do I get the result of UserSessionBean.getInputMode() in my tag? Do I need to implement Expression Language? Is there already a utility class somewhere in Struts 1.1 that would evaluate something like ${UserSessionBean.inputMode} for me? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RT expr value in custom tag
Good evening... Thanks for the reponse, I realised this shortly after I posted my question and figured asbestos underpants would soon be required. Shame on me not carrying my research just a little further. Although your final note on RT expression evaluation is something I had not yet realised. As for the EL evaluation mechanism, check out the class org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager in the Jakarta Standard Taglib (I'm looking at v1.0.4). Thanks again. Eric Schultz. -Original Message- From: Van Riper, Mike To: '[EMAIL PROTECTED]' Cc: 'Eric SCHULTZ' Sent: 05/12/03 5:00 PM Subject: RE: RT expr value in custom tag Eric, What you are trying to do doesn't really require the JSTL expression language. All you need to do is specify that runtime expressions are to be evaluated for the parameter attribute of your custom tag in your TLD file. If you were to look at any of the TLD files that come with Struts, you would see plenty of examples of this. For example, here is the html:base tag TLD definition that enables runtime expression evaluation for both the target and the server optional attributes for the tag: tag namebase/name tagclassorg.apache.struts.taglib.html.BaseTag/tagclass bodycontentempty/bodycontent attribute nametarget/name requiredfalse/required rtexprvaluetrue/rtexprvalue !-- This is what I think is needed! -- /attribute attribute nameserver/name requiredfalse/required rtexprvaluetrue/rtexprvalue /attribute /tag Runtime expression evaluation is what allows you to evaluate Java expressions inside of %= ...% for your custom tag parameters. If you use the JSTL expression language (EL), you don't use the Java expression tag. They are two separate ways to refer to dynamic content for custom tag attributes. To use the JSTL EL, you have to build your custom tag such that it has EL support in it. If you really want to go that route, I haven't done that yet myself. So, I can't help you with that. However, you can look at how the contributed taglib (html-el) that extends the HTML taglib of Struts 1.1 to add EL support for the parameters of the Struts HTML custom tags does just that. Also, your example used the %= ...% tag correctly for a custom tag parameter. However, many people initially stumble on getting this to work correctly even when runtime expression evaluation is enabled because they try to define only part of the custome tag attribute with the tag. For it to work even when properly enabled for the attribute in the TLD, you have to define the entire contents of the custom tag attribute value to be the %= ...% Java expression. If there is static content you want to include as part of the attribute value, you typically use string operations inside the JSP expression to concatenate and build up the final attribute value merging your dynamic and static data. Hope this helps, Van Mike Van Riper Silicon Valley Struts User Group mail: mike.vanriper at baychi.org http://www.baychi.org/bof/struts/ -Original Message- From: Eric SCHULTZ [mailto:[EMAIL PROTECTED] Sent: Friday, December 05, 2003 7:54 AM To: '[EMAIL PROTECTED]' Subject: RT expr value in custom tag Good morning... I'm trying to write my own custom tag library for Struts. I've had some initial success, but now I'm having some trouble. I want to set an attribute value from the value of a bean get. But what I end up with in my tag is JSP code, not the value in the bean. I.e.: v:properties template=inputmode parameter=%= UserSessionBean.getInputMode() %/ is not translated. How do I get the result of UserSessionBean.getInputMode() in my tag? Do I need to implement Expression Language? Is there already a utility class somewhere in Struts 1.1 that would evaluate something like ${UserSessionBean.inputMode} for me? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Change default forward class
Good afternoon... I realise I can change the class of my forward using className=... but is there a way I can change the default from org.apache.struts.action.ActionForward in parameter (ie.: without extending anything in the servlet)? I like my worms tightly canned. I need to do this because all (or almost all) of my forwards will have a property called pegList. Schultz. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Dealing with Initializaing data source exception
Good evening... I was afraid you were going to say that. I was so happy to see data-sources in Struts 'cuz I've been having so much trouble with JNDI in Tomcat. Other than the Tomcat docs, did you find any other reference that was really worthwhile? Guess I'm headed back to Google and the archives. Thanks. Eric Schultz Technical Leader Conseiller Technique Elix Specialist in interactive business solutions Specialiste en solutions d'affaires interactives 14 Commerce Place, 5th floor Nun's Island, QC H4E 1T5 t: 514 768-1000 f: 514 768-7680 -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: November 21, 2003 12:25 To: Struts Users Mailing List Subject: Re: Dealing with Initializaing data source exception If you've been looking through the archives you'll know that datasource in struts config is considered the devil's spawn and its use isn't recommended. Have a look at you TC docs as configuring a JNDI datasource is web xml. You could botch a try catch statement that forwards to your error page. Cheers Mark On 21 Nov 2003, at 15:56, Eric SCHULTZ wrote: Good morning.. I'm running a little Struts Application on Tomcat 4.1.27 and occassionly the application won't start because of problems connecting to the database. Is there someway I can I can avoid having this stop my app from running and just catch the error deal with it in the application (like by telling the user we are technical difficulties, please try again later)? Here's the portion of the Tomcat log that shows the error: 2003-11-21 10:28:11 StandardWrapper[/DB2StrutsDemo:action]: Marking servlet action as unavailable 2003-11-21 10:28:11 StandardContext[/DB2StrutsDemo]: Servlet /DB2StrutsDemo threw load() exception javax.servlet.UnavailableException: Initializing application data source org.apache.struts.action.DATA_SOURCE Googling reveals a lot of people have this problem, and there's a lot of help on solving it. But what if you can't solve it and you just want to deal with it? And I guess the corollary to all this is whether there's some way to re-start the datasources later? Just by calling DataSource.getConnection()? Schultz. - 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]
Dealing with Initializaing data source exception
Good morning.. I'm running a little Struts Application on Tomcat 4.1.27 and occassionly the application won't start because of problems connecting to the database. Is there someway I can I can avoid having this stop my app from running and just catch the error deal with it in the application (like by telling the user we are technical difficulties, please try again later)? Here's the portion of the Tomcat log that shows the error: 2003-11-21 10:28:11 StandardWrapper[/DB2StrutsDemo:action]: Marking servlet action as unavailable 2003-11-21 10:28:11 StandardContext[/DB2StrutsDemo]: Servlet /DB2StrutsDemo threw load() exception javax.servlet.UnavailableException: Initializing application data source org.apache.struts.action.DATA_SOURCE Googling reveals a lot of people have this problem, and there's a lot of help on solving it. But what if you can't solve it and you just want to deal with it? And I guess the corollary to all this is whether there's some way to re-start the datasources later? Just by calling DataSource.getConnection()? Schultz. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DB2 Pooled connection from Struts
Good morning... I'm having an impossible time getting a pool of connections to a DB2 database going. I've gotten a single connection to work using the old method (DriverManager.register, DriverManager.getConnection, ...) but I can't seem to do it by describing the datasource in struts-config.xml and calling getDataSource(). Here's the code that works (in a bean): DriverManager.registerDriver(new COM.ibm.db2.jdbc.app.DB2Driver()); Connection conn = DriverManager.getConnection(jdbc:db2:DB2Test, user, password); I've tried a whole bunch configurations in struts-config.xml, for example: data-source key=CIS type=COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource set-property property=driverClass value=COM.ibm.db2.jdbc.app.DB2Driver / set-property property=url value=jdbc:db2:DB2Test / set-property property=user value=user / set-property property=password value=password / set-property property=maxActive value=10 / set-property property=maxWait value=5000 / set-property property=defaultAutoCommit value=false / /data-source and then in my Action I call: CISCustomerLookup ccl = new CISCustomerLookup(getDataSource(req, CIS).getConnection()); Where ccl is my bean and to shield it from the Struts layer I pass the connection it should use for the lookup. But it doesn't work. The latest error I recieved is the following: javax.servlet.ServletException: [IBM][JDBC Drvier] CLI0615E Error receiving from... I've also recieved messages alluding to no suitable driver available. And when I check the Tomcat log I have often had a situation where the ActionServlet was marked unavailable due to a problem creating the datasource when I deployed the war. I've also tried the net driver (COM.ibm.db2.jdbc.net.DB2Driver) with similar results. Help me please!!! Any working examples would be most apprciated. Eric Schultz Technical Leader Conseiller Technique Elix Specialist in interactive business solutions Specialiste en solutions d'affaires interactives 14 Commerce Place, 5th floor Nun's Island, QC H4E 1T5 t: 514 768-1000 f: 514 768-7680 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: new to struts
Good evening... -Original Message- From: Saravanakumar P [mailto:[EMAIL PROTECTED] Sent: November 11, 2003 4:38 AM To: Struts Users Mailing List Subject: RE: new to struts Programming Jakarta Struts By Chuck Cavaness -O'Reilly publication is a good book to start. that's the book i bought after reading (quickly) through Struts in Action (which we have two of at the office). The sales guy said Programming Jakarta Struts was the more advanced of the two (and Kickstart was the least advanced) but I have to say i found Struts in Action more informative; and now that i'm away from the office i'm kind of regretting not buying it instead. Schultz. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Dynamic page contentType
Good evening... Thanks, exactly what I needed. Schultz. -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: November 10, 2003 7:18 AM To: Struts Users Mailing List Subject: Re: Dynamic page contentType On 11/10/2003 04:48 AM Eric SCHULTZ wrote: Do use the method below in my Action object? And then use different Forwards depending on whether the result is to be in HTML or XML? Or do I check in the JSP what my content-type is set to and output the correct output? Hi Eric, yes, exactly. I would execute a block of code conditionally in my Action depending on whether you want HTML or XML. In that block you can set the content type via the snippet I gave you below and fetch the appropriate forward. I wouldn't use the content-type setting as a switch signal to the JSP, since it's possible to set it in other ways, e.g. in the config, so you may get unpredicted results. Adam -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: November 8, 2003 9:15 AM To: Struts Users Mailing List Subject: Re: Dynamic page contentType On 11/07/2003 10:16 PM Eric SCHULTZ wrote: I'm developing an application in Struts that outputs primarily XML; but in some instances I need it to output HTML of the same ActionForms and Actions. Is there a way I can change the page forwarded in the Forward depending on some flag or property?! Or is there someway I can set the JSP to output text/html or text/xml depending on some flag or property (and obviously generate the correct section based on the flag)? response.setHeader(Content-type, text/xml); Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can't undeploy struts.jar in Tomcat 4.1.27
Good evening... Using Tomcat 4.1.27 (and JVM 1.4.2_02-b03 on Win2k) when I Remove my Struts application in the Manager the /myApp/WEB-INF/lib/struts.jar file doesn't get deleted. The original WAR file is deleted and the expanded directory contents are deleted, except the struts.jar file. If I try to delete it manually I'm told there's a sharing violation and the file is in-use. Once I stop the Tomcat service I can delete the jar file file though. If I don't delete the jar whenI try to re-install the WAR it copies the war doesn't expand it!? Any ideas on why or how to fix? This even happens when the web-app is running without errors. Is there something I need to do to close a session? Eric Schultz. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Dynamic page contentType
Good afternoon... Sorry, I'm new to Struts so I need a bit more context than that. Do use the method below in my Action object? And then use different Forwards depending on whether the result is to be in HTML or XML? Or do I check in the JSP what my content-type is set to and output the correct output? Schultz. -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: November 8, 2003 9:15 AM To: Struts Users Mailing List Subject: Re: Dynamic page contentType On 11/07/2003 10:16 PM Eric SCHULTZ wrote: I'm developing an application in Struts that outputs primarily XML; but in some instances I need it to output HTML of the same ActionForms and Actions. Is there a way I can change the page forwarded in the Forward depending on some flag or property?! Or is there someway I can set the JSP to output text/html or text/xml depending on some flag or property (and obviously generate the correct section based on the flag)? response.setHeader(Content-type, text/xml); Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dynamic page contentType
Good afternoon... I'm new to Struts so I hope I'm not asking something that has already been asked or is documented somewhere - though I haven't been able to find it. I'm developing an application in Struts that outputs primarily XML; but in some instances I need it to output HTML of the same ActionForms and Actions. Is there a way I can change the page forwarded in the Forward depending on some flag or property?! Or is there someway I can set the JSP to output text/html or text/xml depending on some flag or property (and obviously generate the correct section based on the flag)? Thanks. Eric Schultz Technical Leader Elix - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]