RE: template and I18N
look at the bean:message tag: bean:message key=title/ johan -Original Message- From: Gregor Rayman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 30, 2001 2:12 PM To: [EMAIL PROTECTED] Subject: template and I18N Hi all, I've just started to use Struts and I have some questions: 1. How can I use the I18N features in the template tags? In my template.jsp I've got the following tag: titletemplate:get name='title'//title In the page using this teplate the following: template:put name='title' content='Kalkulation' direct='true'/ I'd like to replace the German text 'Kalkulation' with its key e.g. 'app.title.calculation' Is there a nice way to do this? 2. How can I use use the I18N features in Struts directly in Java Scriplets? Sometimes I need the translated texts in scriplets. What is the best way to access them? Now I am using this aproach: % MessageResources resources = (MessageResources) pageContext.getAttribute( Action.MESSAGES_KEY, PageContext.APPLICATION_SCOPE); Locale locale = (Locale) pageContext.getAttribute( Action.LOCALE_KEY, PageContext.SESSION_SCOPE); if (null == locale) { locale = request.getLocale(); } String myText = resources.getMessage(locale, app.the.text,key); % Thanks for an answer -- gR
RE: connection pool problem (with Beta release)
Debug through it and look what kind of rows are really selected from the db the first time. I have seen this behaviour many times but it was always a caching problem at the browser site. Because the selected data was right the first time. johan -Original Message- From: Gogineni, Pratima [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 16, 2001 2:11 AM To: '[EMAIL PROTECTED]' Subject: RE: connection pool problem (with Beta release) Okay another symptom - the problem persists even when i set the isolation to read_uncommitted. -Original Message- From: Gogineni, Pratima Sent: Tuesday, May 15, 2001 3:35 PM To: '[EMAIL PROTECTED]' Subject: connection pool problem (with Beta release) I have a very odd problem - I was hoping the symptoms sound familiar to someone on the list... I display a database table to the user in the jsp page the user can insert/delete or update into this table - this is sent to an action class that uses the struts connection pool and executes the appropriate sql statement After executing the sql statement I go back to jsp page that displays the data in the table. my problem is that I need to query the database twice before the new data is shown (for example if I add row#11). I see only 10 rows the first time I query the database after the insert statemetn is executed. The second time I query the database I get all 11 rows. I have autoCommit set to false. I call the commit() method on the connection after the insert statement is executed and I have the transaction isolation set to TRANSACTION_READ_COMMITTED. Another symptom is that I dont always see this problem - only in some runs, which leads me to suspect that this is a threading issue? Does anyone know what the problem could be / what I should check/lookout for? Thanks Pratima -Original Message- From: Roy Truelove [mailto:[EMAIL PROTECTED]] Sent: Monday, May 14, 2001 7:51 PM To: [EMAIL PROTECTED] Subject: Web design forum / listserv Hey guys, I'd like to know if anyone knows of a listserv / forum / newsgroup that deals solely with web application design philosophies, and not necessarily with their implementations. I read several lists (this one, Turbine, JSP, barracuda,) and most of the traffic is geared toward problems *using* the framework. A place where people could go and discuss things like MVCm2, push/pull etc. I believe would be very beneficial. If someone knows of a forum like this, please let me know. Thanks! -Roy
Re: Where are the TLD's?
hmmm that's why i don't get them, i don't use the build process. I use VAJ so i just import all the java files to get a complete build. I shall download the binary and src then johan - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, May 13, 2001 11:13 PM Subject: Re: Where are the TLD's? The tlds are generated during the build process. For example, struts-bean.xml is processed with tld.xsl to create struts-bean.tld. The same XML document is processed with a different stylesheet to generate the taglib documentation. This means that only the one XML file has to be updated when a tag is added or changed. -- Martin Cooper - Original Message - From: Johan Compagner [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] Sent: Saturday, May 12, 2001 1:24 AM Subject: Where are the TLD's? Now the sources are not in the binary's anymore (i didn't check this but i think it is true) I download only the sources, because that is what i really need. But i see that the sources don't contain the tld's! Now i still have to download the binary's also, of course you can say, why do you care? But if the binary's don't contain the sources anymore, i would love to have the sources contain all the resources files that is needed for struts. johan
Constants.TOKEN_KEY value proposed change (doesn't work with javascript!!)
Hi, I use the token_key for transaction support. But the value of the TOKEN_KEY = org.apache.struts.taglib.html.TOKEN This is a very odd value to have as a hidden input field on your form. Which is generated by the FormTag: input type=hidden name=org.apache.struts.taglib.html.TOKEN value= Because you want to use that hidden field in some javascript: function submitNextpage(themakey) { document.nextpage.org.apache.struts.taglib.html.TOKEN.value=themakey; document.nextpage.submit(); } You get a javascript error! Because javascript sees all names between points as an object. Please change the TOKEN_KEY value in TOKEN_KEY or something like that!! Johan Compagner
Re: Constants.TOKEN_KEY value proposed change (doesn't work with javascript!!)
It would be nicer to have a name for this that is a bit better suited for javascript! johan - Original Message - From: David Winterfeldt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 11, 2001 5:56 PM Subject: Re: Constants.TOKEN_KEY value proposed change (doesn't work with javascript!!) You can do this. document.nextpage[org.apache.struts.taglib.html.TOKEN].value=themakey; David --- Johan Compagner [EMAIL PROTECTED] wrote: Hi, I use the token_key for transaction support. But the value of the TOKEN_KEY = org.apache.struts.taglib.html.TOKEN This is a very odd value to have as a hidden input field on your form. Which is generated by the FormTag: input type=hidden name=org.apache.struts.taglib.html.TOKEN value= Because you want to use that hidden field in some javascript: function submitNextpage(themakey) { document.nextpage.org.apache.struts.taglib.html.TOKEN.value=themakey; document.nextpage.submit(); } You get a javascript error! Because javascript sees all names between points as an object. Please change the TOKEN_KEY value in TOKEN_KEY or something like that!! Johan Compagner __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: Constants.TOKEN_KEY value proposed change (doesn't work with javascript!!)
That i already have of course! but it would be nice to have this in the basic. without altering Struts all the time when a new version arrives. johan - Original Message - From: Nanduri, Amarnath [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 11, 2001 8:14 PM Subject: RE: Constants.TOKEN_KEY value proposed change (doesn't work with javascript!!) Its opensource. you can always modify it for your needs. cheers, Amar.. -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:45 PM To: [EMAIL PROTECTED] Subject: Re: Constants.TOKEN_KEY value proposed change (doesn't work with javascript!!) It would be nicer to have a name for this that is a bit better suited for javascript! johan - Original Message - From: David Winterfeldt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 11, 2001 5:56 PM Subject: Re: Constants.TOKEN_KEY value proposed change (doesn't work with javascript!!) You can do this. document.nextpage[org.apache.struts.taglib.html.TOKEN].value=themakey; David --- Johan Compagner [EMAIL PROTECTED] wrote: Hi, I use the token_key for transaction support. But the value of the TOKEN_KEY = org.apache.struts.taglib.html.TOKEN This is a very odd value to have as a hidden input field on your form. Which is generated by the FormTag: input type=hidden name=org.apache.struts.taglib.html.TOKEN value= Because you want to use that hidden field in some javascript: function submitNextpage(themakey) { document.nextpage.org.apache.struts.taglib.html.TOKEN.value=themakey; document.nextpage.submit(); } You get a javascript error! Because javascript sees all names between points as an object. Please change the TOKEN_KEY value in TOKEN_KEY or something like that!! Johan Compagner __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: please help...this doesn't want to display the exception, is this correct?
ActionError constructor wants a message key. not just a string. you could do: errors.add(beanErr,new ActionError(general.exception,ex.toString())); and then have a general.exception in youre resouce bundle: general.exception=An exception occured: {0} johan - Original Message - From: Dudley Butt@i-Commerce [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 10:55 AM Subject: please help...this doesn't want to display the exception, is this correct? } catch (Exception ex) { ex.printStackTrace(); errors = new ActionErrors(); errors.add(beanErr,new ActionError(ex.toString())); }
Re: Antwort: RE: Visual Age 3.5.3 Tomcat with Struts
Here you have 2 versions of Tomcat 3.2.2b3 Test Environments one one stripped version: www.techfo.nl/jcom/tomcatstripped.zip and full src version: www.techfo.nl/jcom/tomcatfullsrc.zip (for the full src you need JAXP/Parser also in the workspace) Johan Compagner - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 01, 2001 5:14 AM Subject: Re: Antwort: RE: Visual Age 3.5.3 Tomcat with Struts 1.) Install Tomcat 3.1 Test Environment look into /path/to/vaj35/ide/features/com.ibm.ivj.tomcat/... to find IVJJavaCompiler.java Tomcat Test Environment won't install on top of VA 3.5.3. It says that the correct version of VisualAge is not installed, and exits the installer application. Any ideas on how to trick the Tomcat Test Environment installer? It says it expects VisualAge 3.5, but apparently doesn't recognize 3.5.3 : - Darren P.S. Thanks for the very detailed message on how to get things going with VA and Tomcat. Juergen.Walter @hrmcon.deTo: [EMAIL PROTECTED] cc: 04/27/01 04:49Subject: Antwort: RE: Visual Age 3.5.3 Tomcat with Struts AM Please respond to struts-user Hi Darren, we're using VAJ 3.5.2 Enterprise with Tomcat and Struts. First we tried to run Struts 1.0b1 with Tomcat Test Env 3.1 but unfortunately Struts does not work with Tomcat 3.1's XML-Parser. If you want you can make a XML (javax.xml.*) SQL (javax.sql.*) package and put it into Tomcats ./lib directory and add it to VAJ's classpath. But if you use Tomcat 3.2.1, struts works out of the box - but not that comfortable as the Tomcat Test Env does, e.g. you can't debug JSP and Servlet Code anymore :((( I did a hack (in Tomcats WebReaderXML.java to enable "jspPageCompiler" again) and added "com.ibm.ivj.tomcat.IJVJavaCompiler" again to re-enable in-workspace JSP and Servlet Debugging. Running Tomcat 3.2.1 in VAJ 3.5.x ~~~ In short: 0.) Prerequisites: * latest jakarta-servlet-api _source_ * tomcat 3.2.1 binary distribution (includes ./src already) * Tomcat 3.1 Test Environment from www.ibm.com/vadd (to get "com.ibm.ivj.tomcat.IVJJavaCompiler.java") * struts 1.0b1 source distribution 1.) Install Tomcat 3.1 Test Environment look into /path/to/vaj35/ide/features/com.ibm.ivj.tomcat/... to find IVJJavaCompiler.java 2.) Start VAJ, do _not_ "Add feature Apache Test Env 3.1"!!! 3.) Create new Package, e.g. Apache_Tomcat_321 4.) Import all source from jakarta-servlet-api (do _not_ use servlet-api from VAJ or other precompiled javax.servlet.* - classes; they _must_ be compiled within VAJ Workspace to enable debugging of your own servlets and JSPs) into your Project 5.) import following -- compiled classes (not source!) - from jasper.jar and webserver.jar (both in tomcat-3.2.1/lib/) jasper: all .class webserver: org.apache.tomcat.logging.Logger, org.apache.tomcat.logging.LogHelper, org.apache.tomcat.util.SimplePool If VAJ still complains about missing classes (you see this in "All Problems" - Tab) import compiled .class files from ./lib/*.jar until VAJ is happy. 6.) create two classes: StartTomcat StopTomcat (code is the same for both!) public class StartTomcat { /** * StartTomcat constructor comment. */ public StartTomcat() { super(); } /** * Starts the application. * @param args an array of command-line arguments */ public static void main(java.lang.String[] args) { // Insert code to start the application here. try { Class aClass = Class.forName("org.apache.tomcat.startup.Tomcat"); java.lang.reflect.Method method = null; Class[] argsClass = new Class[] { String[].class }; method = aClass.getMethod("main", argsClass); Object object = null; Object[] arguments = new Object[] { args }; method.invoke(object, arguments); } catch (Exception e) { System.out.println("Exception occured: " + e.getMessage()); e.printStackTrace(); } } } Right click StartTomcat in VAJ and goto "Properties-Classpath": have follwing files and dirs in classpath: .; ..\Apache_Struts; ..\IBM IDE Utility class libraries; ..\JSP Page Compile Generated Code; .\; .\conf\; .\src\; .\lib\jaxp.jar; .\lib\parser.jar; .\lib\webserver.jar; .\lib\jasper.jar; .\webapps\; .\webapps\admin\; .\webapps\admin\WEB-INF\classes\; .\webapps\examples\; .\webapps\examples\WEB-INF\classes\; ..\IBM IDE Utility local implementation\; And in Properties-Programm have no arguments for StartTomcat and "-stop" for StopTomcat. Also have "tomcat.home=." in "(java)Properties window" 7.) make new package and import all struts sources (org.apache.struts.*) into new package. Struts comp
i want the jsp pages to be updateable (from internet,browser)
Hi, When i include my jsp inside a war file i really don't know where those files are unpacked (if they are unpacked) But if i want my jsp's to be updateable from the internet (uploading) where must i put my jsp's? Can i for example put my jsp's inside a DB and then have some common class that will supply a jsp pages for a Container (like tomcat but others must also be possible) I don't think this is caputered in an interface of jsp/servlet isn't it? This is left to the container builder? How do you guy's do it? Don't use a war file? But a normal directory so that i know where everything is and i know where to save the uploaded jsp's? any idee's? johan
Re: Data Connection Pool, solution?
there should be another attribute in the datasource like this: testSql="select * from test" and GenericConnection has a setTestSql(String) method and that test method is executed right before the connections is given to the request in getConnection() When it fails it closed and tries another one (or opens another one) So anyone can decide there own test method/sql statement, because i don't think there is a common one. Only some rules must be set: Must the testSQL string return a result set and must it have one result if not it is the same as failing? This would be a nice addition to struts 1.0! Johan Compagner data-sources data-source autoCommit="false" description="Interbase Data Source" driverClass="interbase.interclient.Driver" maxCount="4" minCount="0" url="jdbc:interbase://path/to/database" user="username" password="password" / /data-sources Anthony It is by caffeine alone I set my mind in motion. It is by the Beans of Java that thoughts acquire speed, the hands acquire shaking, the shaking becomes a warning. It is by caffeine alone I set my mind in motion.
Re: form:form vs. html:form
form taglib is depricated everthing is in the html package now. - Original Message - From: "Stanley Tan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 13, 2001 9:33 AM Subject: form:form vs. html:form What's the difference between form:form and html:form ? The documentation does not even mention of a "form" taglib!
Re: html:option
Now i think of it is it possible to supply only a hashmap to html:options and that the key's are the property (the keys) and the value the labels? now i always have 3 methods to fill in a combo: getXxxxId getXxxxIds getXxxxLabels johan - Original Message - From: "Jim Crossley" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 12, 2001 7:03 AM Subject: Re: html:option If you change staffIds to a Collection, i.e. staffIds.entrySet(), I *think* this will work: % Set set = staffIds.entrySet(); % html:select property="staffId" html:options collection="set" property="key" labelProperty="value"/ /html:select Anthony Martin wrote: I can't figure out the struts way to do this: html:select property="staffId" logic:iterate id="staffId" name="breakForm" property="staffIds" scope="request" OPTION value="bean:write name="staffId" property="key" /"bean:write name="staffId" property="value" //OPTION /logic:iterate /html:select The staffIds bean property is a hashtable. I wanted to use html:option or even html:options but the syntax eludes me. I can change the hashtable to some type of collection, but this way the screen looks right. The functionality of repopulate is missing, though because I'm not allowing struts to render the OPTION. Any ideas? Anthony It is by caffeine alone I set my mind in motion. It is by the Beans of Java that thoughts acquire speed, the hands acquire shaking, the shaking becomes a warning. It is by caffeine alone I set my mind in motion.
RE: Is Struts with Websphere that slow ? - any other problems?
3.5.2 is not the right version i believe (maybe it works maybe it doesnt) because websphere only supports jsp1.1/servlet2.2 with 3.5.3 (tag support) johan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, April 09, 2001 4:48 PM To: [EMAIL PROTECTED] Subject: RE: Is Struts with Websphere that slow ? - any other problems? hi, are there any major problems with websphere and struts? I am especially interested in known problems with WAS AE 3.5.2 on Solaris. Thanks, -hendrik
Re: troubles with Tomcat
Seet mod_jk many articles on the jakarata site johan - Original Message - From: "ntrgiang" [EMAIL PROTECTED] To: "Struts-User" [EMAIL PROTECTED] Sent: Friday, April 06, 2001 5:17 PM Subject: troubles with Tomcat Hi, thanks for reading my message When I test some JSP pages, I use Tomcat as my JSP container (without Apache)and everything is OK. But in the real world if I want to deploy my application on the web, how can I use Tomcat with Apache? Are there any differences between Tomcat Standalone version and Tomcat runs with Apache? Thanks for your guides Giang Nguyen
Bug in tomcat or the JDK (testing it on 1.2.2)
Hi, If i use Tomcat as a static (gifs) and dynamic (jsp) server, that is mostly used inside a debugging evironment or maybe if it is specified that everything in the webapp\app dir must be served by tomcat (still find this a very bad idee), then i noticed that i get socket exceptions on specifiek files those files have something in common they are the larger files in my app: 31290 and 23281 bytes this is the error: 2001-03-28 04:40:07 - Ctx( /financialtools ): IOException in: R( /financialtools + /overlib.js + null) socket write error (code=10053) Then i went testing in the source code of org.apache.tomcat.request.FileHandler where it is thrown. And after sometesting i found out that a picture can't be larger then 16383 because if it is 16384 then an exception will be thrown. I tested this with the read in buffer: byte[] buf = new byte[16383]; if that number is larger then 16383 i wil get a exception when i write it. so if i keept it 16383 then the first write to out.write(buf, 0, read); will pass but the next bloc will fail. And if i make it 16384, out.write(buf, 0, read); will fail the first time! As far as i can see now it comes from the jdk it self: java.net.SocketException: socket write error (code=10053) java.lang.Throwable(java.lang.String) java.lang.Exception(java.lang.String) java.io.IOException(java.lang.String) java.net.SocketException(java.lang.String) void java.net.SocketOutputStream.socketWrite(byte [], int, int, java.io.FileDescriptor) --- void java.net.SocketOutputStream.write(byte [], int, int) void org.apache.tomcat.service.http.HttpResponseAdapter.doWrite(byte [], int, int) void org.apache.tomcat.core.BufferedServletOutputStream.doWrite(byte [], int, int) void org.apache.tomcat.core.BufferedServletOutputStream.reallyFlush() void org.apache.tomcat.core.BufferedServletOutputStream.write(byte [], int, int) void org.apache.tomcat.request.FileHandler.doService(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) So is this a bug of Tomcat or the JDK it self? But can't send more then 16K? that is a bit strange. I know this is not a tomcat list but when developing with struts i came accross this and i don't want to have another list that i have to monitor and i know there are a few tomcat developers here. Johan
Re: Bug in tomcat or the JDK (testing it on 1.2.2)
ahh but if that is the case. how much data must be send to the client before it does noticed it? Because at this time the it is bufferd to a 8Kb buffer before it sends out but if the client can figure it out with say 1Kb then why wait for a buffer of 8KB to be read before sending it? I tracked it already down to the BufferedServletOutputStream.write(byte[],int,int) and the the reallyFlush() method can't be called twice. now i know why Johan - Original Message - From: "Szlapa, Michael" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2001 4:51 PM Subject: RE: Bug in tomcat or the JDK (testing it on 1.2.2) That is not the bug. It's a feature ;-). When your browser realizes that it already has a copy of given file in browser cache, it abruptly closes the connection in order not to waste time and bandwidth. This causes exception on the server (tomcat) side of the connection. It is plainly cosmetic nuisance. There is plenty of information on this on the web if you run the search on "tomcat socket write error" Hope it helps, Michael Szlapa [EMAIL PROTECTED] -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 9:49 AM To: Struts Subject: Bug in tomcat or the JDK (testing it on 1.2.2) Hi, If i use Tomcat as a static (gifs) and dynamic (jsp) server, that is mostly used inside a debugging evironment or maybe if it is specified that everything in the webapp\app dir must be served by tomcat (still find this a very bad idee), then i noticed that i get socket exceptions on specifiek files those files have something in common they are the larger files in my app: 31290 and 23281 bytes this is the error: 2001-03-28 04:40:07 - Ctx( /financialtools ): IOException in: R( /financialtools + /overlib.js + null) socket write error (code=10053) Then i went testing in the source code of org.apache.tomcat.request.FileHandler where it is thrown. And after sometesting i found out that a picture can't be larger then 16383 because if it is 16384 then an exception will be thrown. I tested this with the read in buffer: byte[] buf = new byte[16383]; if that number is larger then 16383 i wil get a exception when i write it. so if i keept it 16383 then the first write to out.write(buf, 0, read); will pass but the next bloc will fail. And if i make it 16384, out.write(buf, 0, read); will fail the first time! As far as i can see now it comes from the jdk it self: java.net.SocketException: socket write error (code=10053) java.lang.Throwable(java.lang.String) java.lang.Exception(java.lang.String) java.io.IOException(java.lang.String) java.net.SocketException(java.lang.String) void java.net.SocketOutputStream.socketWrite(byte [], int, int, java.io.FileDescriptor) --- void java.net.SocketOutputStream.write(byte [], int, int) void org.apache.tomcat.service.http.HttpResponseAdapter.doWrite(byte [], int, int) void org.apache.tomcat.core.BufferedServletOutputStream.doWrite(byte [], int, int) void org.apache.tomcat.core.BufferedServletOutputStream.reallyFlush() void org.apache.tomcat.core.BufferedServletOutputStream.write(byte [], int, int) void org.apache.tomcat.request.FileHandler.doService(org.apache.tomcat.core.Reque st, org.apache.tomcat.core.Response) So is this a bug of Tomcat or the JDK it self? But can't send more then 16K? that is a bit strange. I know this is not a tomcat list but when developing with struts i came accross this and i don't want to have another list that i have to monitor and i know there are a few tomcat developers here. Johan
Tomcat question
Hi, One tomcat question for this list (i know there are some tomcat developers here) Why can't i find changes.html or something like that for the tomcat versions? You got now a 3.1.x branch (doesn't seem to be in development anymore) 3.2.x branch (still development 3.2.2 beta 1 as latest mile stonde) 3.3.x branch (the latest in 3.x) And you got 4.0 I know the differences between 3.x (servlet 2.2 / jsp 1.1) and 4.x (servlet 2.3 / jsp 1.2) But why all those 3.x branches and why are there even 2 in development? Johan
BeanMessage Tag proposal
Hi, When setting the args (arg0,arg1,arg2,arg3,arg4) you must do this: bean:message key="foo.foo.foo" arg0="foo1" arg1="foo2"/ But i think it is very rare that you know exactly at design time of the jsp what value there must be. Because if you do then why not set it directly in the message it self? So it is almost any time a runtime expression. But then i must do things like this: bean:define id="argstring1" value="totalautotheft"/ bean:define id="argstring2" value="autotheft"/ bean:define id="insurance" name="carinsurance" scope="session" type="nl.topicus.thema.DynamicForm"/ bean:message key="prompt.advise.wacasco" arg0="%= insurance.getProperty(argstring1).toString() %" arg1="%= insurance.getProperty(argstring2).toString() %"/ I must define bean:define id="argstring1" value="totalautotheft"/ because i can't do this: bean:message arg0="%= insurance.getProperty("totalautotheft").toString() %" I find this a bug of the Tomcat parser if you ask me. Because if he sees that it is a reqexpr (%=) then it should first find the % before looking at the closing "!! Because if these problems i wanted to find a solution Why is is not possible that i get the Object[] from a name/property??? Then the BeanTag is also not limmited to only 5 args My example for the above one: app:message key="prompt.advise.wacasco" (arg)name="insurance" (arg)property="wacascoObjects"/ and the insurance.getWacascoObjects() does return the Object[] for that string: object[0] = insurance.getProperty("totalautotheft"); object[1] = insurance.getProperty("autotheft"); return object; Johan Compagner
DefineTag.value question (proposal)
Hi, If i specify the value in the DefineTag then the name/property is ignored!! But when i also specify the name/property then i want the value to be filled in when name/property seems to be null! so not: // Retrieve the required property value Object value = this.value; if (value == null) value = RequestUtils.lookup(pageContext, name, property, scope); but: // Retrieve the required property value Object value = null; if(name != null) value = RequestUtils.lookup(pageContext, name, property, scope); if (value == null) value = this.value; johan
Re: DefineTag.value question (proposal)
so not: // Retrieve the required property value Object value = this.value; This will return null if you did not specify a "value" attribute, so the effect is the same as your desired result -- setting the new bean based on the name/property combination. This is not my desired result because i want it to be a default value. It should not ignore the name and property attributes if they are specified. // Retrieve the required property value Object value = null; if(name != null) value = RequestUtils.lookup(pageContext, name, property, scope); if (value == null) value = this.value; This would reverse the priority of lookups, and make the string you specified for the "value" essentially a default if the specified property returns null. That is different from the current behavior, and different from what is documented, but makes a certain kind of sense. But the behaviour is not changed for all the application build today because None in using a name, value combo because at this time that combo doesn't make any sense because it doesn't do a thing. What do people think about changing this? You got my vote! johan
Tomcat (servlet2.2 spec question)
Hi all, Is it really true that everything that is in the webapp context must be served by the webapp? Here our discussion with the support of ServletExec: -- Hi, Who has made that specification?? Because it it stupid. Apache/IIS must do the things they are goed at and that is serving static content. ServletExec/Tomcat/JRun to name a few must do things they are good at and that is serving jsp/servlets And saying that i must keep the images, static html ect ect in an other place is an enormous maintenance and development problem. I want everything to getter what belongs to each other. Apache with tomcat works perfectly the way i want. Je specify a Alias in apache: Alias /myprogram c:/tomcat/webapps/myprogram And in the conf files of apache that is included in the httpd.conf of apache you say this; JkMount /*.jsp ajp13 JkMount /*.do ajp13 That is the way it should work Only the JSP's and the .do (struts framework redirects) are handled by tomcat the rest by tomcat. And if i want to do the same with ServletExec then i must put the jsp ect in the webapps/myprogram and the rest in /myprogramstatic? And i must switch in both constantly pointing to each other? What happens if webapps/myprogram changes in webapps/myprogram2 ? Everything in /myprogramstatic my also change? Because i can't use relative url's anymore?? Not to mention that in development you must do the same but there i use Tomcat as http server and app server. And for every project i must have 2 context in tomcat. And they must be exactly the way be configured as the deployment server! Horrible Johan Compagner - Original Message - From: Unify Support To: [EMAIL PROTECTED] Sent: Friday, March 09, 2001 8:58 PM Subject: Re: Information about coupling IIS and servletexec Per the servlet 2.2 specification (see the last sentence of the first paragraph in section 9), all requests to a web application context are directed to the servlet/JSP container. If you need objects to be served by the HTTP server, they will need to be outside the web application (there is no reason why URLs in the web application cannot refer to objects outside said web application). Unify Support [EMAIL PROTECTED] Support FAQhttp://www.servletexec.com/support/support-faq.jsp -Original Message- From: Albert Schreuder [mailto:[EMAIL PROTECTED]] Sent: Friday, March 09, 2001 11:10 AM To: [EMAIL PROTECTED] Cc: Johan Compagner Subject: Information about coupling IIS and servletexec Dear reader, Today we tried to couple Servletexec with IIS 5.0, after some compiliation problems, we succeeded int this. The ServletExec dll was indeed included in the ISAPI filter of the website. But when we started testing, we got the idea, that all the information voor the webapplication was done by ServletExec. To our opion also information like for example html and gif was done by ServletExec. Now were we wondering if there is a way to configure the coupling between IIS and ServletExec, that only .jsp and .do files are handled by ServletExec? We hope we can get response from you soon, because this is a major item for us to go using ServletExec. With kind regards, Albert Schreuder Topicus BV Deventer, The Netherlands
RE: Business Object Bean Persistence Strategies
Hi, Because i want Database Objects to control them self completely (like Enity beans) I must have a way to get Transaction support and make sure that in on thread the same connection is being used. For example: class Person { private String name; private Country country; public static Person findByPrimaryKey(int i) { Connection connection = datasource.getConnection(); // Select Person person = new Person(); person.setName(rs.getString(1)); person.setCountry(Countr.findByPrimaryKey(rs.getInt(2))); connection.close(); } } class Country { privatge String name public static Country findByPrimaryKey(int i) { // Now another connection is being taken from the datasource // if max == 2 then another call in this thread to the datasource // will present a deadlock!! Connection connection = datasource.getConnection(); // Select Country country = new Country (); /// Filling connection.close() return country; } } So i want a datasource to return a connection that is already attached to the current thread. Same goes for updating or inserting of data for example a new Person with a new Country object that i want to insert into the database person clas: { public void store() { Connection connection = datasource.getConnection(); // Before storing the country id the country must first be stored: country.store(); // if all goes well: // Store the person (insert into person values(?,?,?,?) ps.setInt(2,country.getPrimaryKey()); // if not all goes well the connection.rollback must be called. // but one problem the country was stored under a different connection // so it will not be rolledback!! } } country class { public void store() { // Another connection is taken so if it goes bad then you can't rollback // everything!! Connection connection = datasource.getConnection(); // Store the country (insert into person values(?,?,?,?) } } To get around those above problems i am building a Transaction class. This wraps around the Datasource it has a static method: public static Transaction startTransaction() // Only starts a transaction onces for the current thread. and the Transaction object has methods: public Connection getConnection() public void setRollbackOnly() // Error occured somewhere so only a rollback allowed. public int getStatus() // Must rollback, Healty. public void rollback() public void commit() // Can only do this if mustRollback == false else throw exception public void stopTransaction() In the above examples i don't do datasource.getConnection() but Transaction transaction = Transaction.startTransaction(); Connection connection = transaction.getConnection(); // Cannot call connection.close() , connection.rollback(), connection.commit() directly!!! transaction.stopTransaction(); If anyone is interrested or has some comments i am happy to hear it. Johan -Original Message- From: Michael McCallister [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 08, 2001 11:19 PM To: [EMAIL PROTECTED] Subject: Business Object Bean Persistence Strategies What strategies or patterns do people use to manage persistence of business object data in a Struts application when there is no EJB layer and there is a desire to keep the business objects as independent of the web portion of the application as possible? Do you use the Struts DataSource and pass either it or a Connection as a parameter to bean methods that take responsibility for managing persistence? Do you follow the J2EE blueprint and create separate Data Access Objects to support persistence? Are you using an open-source framework to manage persistence? This seems like a common problem, but I haven't seen much talk about common solutions. Mike
Datasource proposal
Using another one is very difficult because how the properties are set. (I want to use the org.apache.struts.sql one but this one has many more options and totally different method names to set the properties (like url ect) And also the open en close methods aren't called automaticly. So i propose a new interface: interface StrutsDataSource extends DataSource { open() close() setProperty(String str,String) } those property can be everything: url,driver class ect ect exactly the things that can be specified in the struts-config.xml Then the implementor must map the string "url" to it's own method. Then struts must use this and handle this a bit different then now (it must detect that the object is a StrutsDataSource and then not trying to set the properties through PropertyUtil (or BeanUtil) but calling the setProperty method. Johan
RE: Database pooling code
Do you just test the isClosed() method? My plan was to execute a small sql code that has a very little overhead and alway's returns normal for every db if the connection is still good. But i don't know what kind of sql statement works for every db. johan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Matthias Bauer Sent: Wednesday, March 07, 2001 4:02 PM To: [EMAIL PROTECTED] Subject: Re: Database pooling code Database pooling works pretty well for me. But there are some pitfalls, when a connection times out or the database server is restarted. As the framework does not check if a connection is still valid before returning it to the application you will run into an exception when trying to use a connection which has timed out or was closed due to some other reason on the server side. I know there was some discussion going on about this on the list in the past. There were some pros and cons about whether the framework should check the validity of a connection before returning it to the application. I patched the struts code in order to do this check and always return a valid connection (requires the jdbc driver Connection.isClosed() method to work correctly - some have a bug in their implementation). If you are interested in this little patch, please let me know. --- Matthias I patched Jim Richards wrote: Has anyone got the database pooling code/DataSource to work or specifically had it fail? I've been having problems (documented previously) and I've read about a few others who can't seem to get the pooling to work as well, and I want to get an idea of specifically where the problem might lie in order to fix it. You are the simulacrum of my dreams and the signifier of my desires Mr Grumpy ... come and visit his home! http://www.cyber4.org/members/grumpy/index.html
RE: Populating a Form
Mostly at my place this is nothing more then setting one id!! I would love to have the abillity that i didn't need any action for this. johan -Original Message- From: Michael McCallister [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 4:16 PM To: [EMAIL PROTECTED] Subject: Re: Populating a Form I am strongly in favor of using two actions, one to pre-populate the form, the other to receive the user's input. My rationale is that in substantial forms, there is enough logic involved in each of these activities that lumping them together makes for an overly large and confusing Action. Mike At 07:55 AM 3/7/2001, you wrote: I guess my question is, how do most people handle the pre-population of data entry forms.
Re: VA Java and Struts without Tomcat / WebSphere
It doesn't work on the Websphere test environment in VAJ yet. Because the websphere inside VAJ doesn't support JSP1.1 yet (only the real websphere does that) you must wait for Fixpack3 that will get the test environment to the same level of Websphere 3.5.3 johan - Original Message - From: Don Elliott To: [EMAIL PROTECTED] Sent: Monday, March 05, 2001 8:06 AM Subject: VA Java and Struts without Tomcat / WebSphere Hi Struts Users, Has anyone been able to install and use Struts within the cut-down servlet engine shipped with VA Java ? ie. without installingTomcat or Websphere? Does this work ? I understand the servlet engine shipped with VA Java is a cut-down version of Websphere, and looking at all the feedback on getting Websphere working I'm wondering if it is worth my while attempting to do this. Regards, Don Elliott
Re: Admin actions
This would be very nice but remember that the struts-config.xml sits inside the war file And you don't have any control over it then. Some containers extract it (like tomcat) others work directly in it. And maybe other extract it to a internal database. So what to update? Maybe if struts build in functions that you store every setting to a database souce that is specified and struts wants (a) specifiek table(s) for it and that are updated when you do addForm ect ect. johan - Original Message - From: Dan Miser To: [EMAIL PROTECTED] Sent: Saturday, March 03, 2001 7:42 AM Subject: Admin actions Iused the default org.apache.struts.actions.AddFormBeanAction action (and others)from 1.0b1 with success. However, it appears that this just makes the added FormBean available for the lifetime of the application. In other words, struts-config.xml is not updated to reflect the dynamic actions you can take in the actions package. I almost have a graphical interface to the admin actions done, but in order to make it truly useful, I think automatic update of the config file needs to happen on unload (or even before). Is there a technical reason preventing this from happening, or is it just implemented this way for now? If it turns out to be an omission, I'll implement that as well to support the admin application. One other thing: I noticed that with Tomcat it's possible to get a list of webapps defined for the engine. It appears that this is not a J2EE standard. Is that correct? If so, the admin classes and config file changes would need to happen on a per-webapp basis. I'd prefer to walkthrough the webapps and have a "struts-admin.war" file to do all of the administration. I just don't think that will be feasible in a portable manner. Any opinions or advice? Thanks. -- Dan Miser
Re: Class reloading?
Tomcat 3.1 and 3.2 seem to reliably detect cases where the servlet class you are actually calling has been changed, but they do not always seem to catch the fact that other classes have been changed. Tomcat 4.0 uses a different mechanism that reliably catches *all* changes to classes found in WEB-INF/classes. But that is not needed. It is nice in a development environment but what happens if i update de war file Is that detected and is it automaticly being extracted ect ect? That is what's needed if you use tomcat for deployment also (in combo with apache) johan
How does Struts compare to Barracuda?
Here is the link: http://barracuda.enhydra.org/Barracuda/ Can we learn something from it? Is it better or worse? Johan
Re: which development tool to use?
Are you developing in java? :-) Why? You don't like it if i look at your list. Every IDE that is written in Java has this as a negative 'feature' johan
Re: which development tool to use?
I use VAJ 3.5 with Tomcat and struts. works perfectly can debug throught the jsp's (not really jsp's but the generated servlets) Can change code on the fly without restarting anything. johan
What happend to the binary's??
They aren't there or only 1K great of the last few day's Johan C.
bean:parameter question
Hi, If the bean:parameter is used and the request parameter (the name specified) isn't found i don't want an exeception but i want the bean parameter to use a empty string (""). So that after that all bean:write prints that empty string if the paramter wasn't there. I want this behaviour because if a specifiek paramater is specified i want the title to include this parameter. But this is not a requiredment! If it isn't specified then noting must be added to the title (the jsp does after that a logic:present and shows something if it is there. Can't a simple property be added to bean:parameter? like defaultvalue="" Then i can specify that that value must be used when the parameter isn't there. Johan
test
test
Re: GenericDataSource usage in non-servlet classes
You must have a reference to the servlet or servletcontext somehow. You could do something like this (you should store the servlet not the session): protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session= request.getSession(true); SessionHandler.storeCurrentSession(session); super.process(request, response); SessionHandler.removeCurrentSession(); } And the SessionHandler is this: public class SessionHandler { private static java.util.HashMap _hmSessions = new java.util.HashMap(); public static HttpSession getCurrentSession() { return (HttpSession)_hmSessions.get(Thread.currentThread().getName()); } public static void removeCurrentSession() { _hmSessions.remove(Thread.currentThread().getName()); } public static void storeCurrentSession(HttpSession session) { _hmSessions.put(Thread.currentThread().getName(), session); } } Then you can always call SessionHandler.getCurrentSession() As long as you are in the same thread as the current request, which is very likely Johan - Original Message - From: "Deping Chian" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 23, 2001 2:50 PM Subject: GenericDataSource usage in non-servlet classes Could somebody tell me how to use GenericDataSource in non-servlet classes? I could access the pool in action servlets using GenericDataSource ds = (GenericDataSource) servlet.findDataSource(null). But my my non-struts-related classes cannot access the pool. Thanks, Deping
Jsp Compilation question. (Want to load Jsp's from my own location=database)
Hi, My JSP files are stored in a database because it should be possible to change the jsp pages on the fly without deploying a complete new war file and/or shutting down the application server. And it must be possible to upload those jsp pages through our maintenance web pages of our application. The problem is how to develop a standaard way so that the (re)compilation of those jsp's works over different application servers. In tomcat i can override the jspCompilerPlugin param of the JspServlet to get what i want i believe!? init-param param-namejspCompilerPlugin/param-name param-valueorg.apache.jasper.compiler.JikesJavaCompiler/param-value /init-param But this is i believe Tomcat specifiek. So what i can do is make my own JspServlet and replace the default JspServlet of the application servlet by defining in my web.xml my own mapping and servlet: servlet-mapping servlet-name jsp /servlet-name url-pattern *.jsp /url-pattern /servlet-mapping and a servlet: servlet servlet-name jsp /servlet-name servlet-class my.package.MyJspServlet /servlet-class /servlet In tomcat 3.1 this works: Context log: path="/postbank" Removing duplicate servlet jsp Wrapper(my.package.MyJspServlet) Context log: path="/postbank" Removing duplicate *.jsp - Wrapper(jsp org.apache.jasper.runtime.JspServlet) So it seems that by default the JspServlet is attached to that context and when specified another one it removes that one and uses the specified one. Is this standard behaviour? But after that i come accross a problem: How can i parse and complile the Jsp to a Servlet??? Because then i need an application specifiek item. In tomcat i believe Jasper? So to make a large question short: If i want to load the Jsp pages from my own location how to implement the rest so that it works with more then one specifiek App Server? Johan C.
Re: How to reload struts application parameters dynamically?
Look at the struts_config.xml of the sample application. Below there are some /admin/XXX actions specified. If you copy the /admin/reload to your config file then you can do this: /Your app/admin/reload.do johan - Original Message - From: "Baquedano Jess" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 22, 2001 10:57 AM Subject: How to reload struts application parameters dynamically? Hi all: Our application server does not allow us hot redeployment of web applications. Let's suppose we need to change a message in the ApplicationResources.properties file because it is Wrong. Once the message tag is called first time, this file is in memory and any change does not take place until application server restarts. Do you know any way to be able to make changes like this without restarting the application server? Thank You!! Saludos!! ___ Do You Yahoo!? Consiga gratis su direccin @yahoo.es en http://correo.yahoo.es
Re: Auto Form Validation Not Done?
Do you use the nightly builds (so a one after 0.5?) Then you shouldn't use the struts.tld. But use one of the bean/html/logif tld's johan - Original Message - From: "Juergen Ebert" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 7:52 PM Subject: AW: Auto Form Validation Not Done? Had the same problem today. Just forgot to include the taglib declaration in the JSP file ... %@ taglib uri="/WEB-INF/struts.tld" prefix="struts" % Juergen -Ursprngliche Nachricht- Von: Hee Meng, Poh [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 17. Januar 2001 17:38 An: [EMAIL PROTECTED] Betreff: Re: Auto Form Validation Not Done? Hi, U r right. Just found this too. But still having problem of html:errors/ not producing my error messages. Digging further... Regards - Original Message - From: "Johan Compagner" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 7:08 PM Subject: RE: Auto Form Validation Not Done? In the struts config file you specify if the validate must be called or not: actionpath="/action" type="package.FormClass" name="formName" scope="session" validate="true" Maybe you have specified false? johan -Original Message- From: Hee Meng, Poh [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 17, 2001 10:51 AM To: [EMAIL PROTECTED] Subject: Auto Form Validation Not Done? Hi, Anyone can verify if auto form validation is working in struts@16012001? Implemented the method public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) in my action form class but can't see it being executed... Regards
Re: Datasource serializeable (Was: 1.0 status of MessageBundle and non-serializable application resources)
Why depend on this? Because it is the standard approach mandated for J2EE applications, to access all sorts of resources (including data sources). But i don't want to get dependend on a J2EE server. (it's already hard to find a JSP/Servlet ISP on the internet) But the problem is that i am writing a Web app at this time. And i want it to run on both environments. (A normal JSP/servlet container and a J2EE container) Because i want it to run on both environments i must just the lowest common denominator (do i say this right?) And that is using a Datasource. Why not make the GenericDatabaseSource also serializeable with externalizeable? I don't think just making it Externalizable (without also declaring Serializable) will meet the requirements of the app servers. Does anyone know? The interface Serializable is a super interface of Externalizable (it extends)! The only difference is that Externalizeable gives you complete control (i almost use Externalizable for everyting) then in the writeExternal(ObjectOutputStream) you close all the connections and save all the data (properties/maxcount/readOnly/ect/ect) when the readExternal is called you read all those properties and the connections will be created with the next call to getConnection() You could do the same (with only slightly more pain) by creating custom readObject() / writeObject() methods for serialization. I'd be willing to accept a patch that does this -- I'm not going to have time to do it in the short term. Yes that is my idee. Only the logWriter is a problem then. However, there's a bigger issue here. The reason an app server wants to serialize these things is to distribute them -- and there is no guarantee that the database URL, username, password etc. are valid from every single server you might distribute them to. You are also increasing the number of total connections that will be established to your database -- perhaps without knowing it -- even if the connection parameters are valid. I will check this out. thx for the info. It seems to me that data sources belong to an individual server instance. Not always why? If the server where it's getting distruted do have everywhere the same connections Then the database driver/ url and password should work over every server johan
RE: Struts without SQL?
Add the jdbc optional package to your classpath. Even it you don't use jdbc you need that package. johan -Original Message- From: Timur Mehrvarz [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 11, 2001 2:40 PM To: [EMAIL PROTECTED] Subject: Struts without SQL? Hello. We are not using SQL in the presentation-tier. All DB-access happens in the EJB-tier. Therefor, when building Struts we get an "cannot resolve symbol javax.sql.DataSource" in share\org\apache\struts\action\ActionServlet.java:82 What shall I do? Regards.
Re: Orion Application Server And Struts 1.0
Try to set the dtd file in the web-inf of your app. I remember also having this problem but i thought i fixed it this way. johan - Original Message - From: "Hee Meng, Poh" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 09, 2001 4:53 PM Subject: Re: Orion Application Server And Struts 1.0 Hi Denis, Thanks for the link. Went thru the archives but couldn't find a solution. May I ask what tweaks you employed to get them to work? Coz I got problem getting orion to resolve the dtd properly. I removed the dtd from struts.jar and put it under WEB-INF/classes/org/apache/struts/resources; struts.jar is in WEB-INF/lib. And the latest exception I am getting (I got all kinda exception for the past 2 days with tweaks I could think of :-( ) is java.net.UnknownHostException: jakarta.apache.org at com.sun.xml.parser.Parser.fatal(Parser.java:2817) at com.sun.xml.parser.Parser.externalParameterEntity(Parser.java:2506) at com.sun.xml.parser.Parser.maybeDoctypeDecl(Parser.java:1137) at com.sun.xml.parser.Parser.parseInternal(Parser.java:481) at com.sun.xml.parser.Parser.parse(Parser.java:284) at javax.xml.parsers.SAXParser.parse(SAXParser.java:155) at javax.xml.parsers.SAXParser.parse(SAXParser.java:77) at org.apache.struts.digester.Digester.parse(Digester.java:708) at org.apache.struts.action.ActionServlet.initMapping(ActionServlet.java :1207) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:421) at javax.servlet.GenericServlet.init(GenericServlet.java) at com.evermind.server.http.HttpApplication.wo(JAX) at com.evermind.server.http.HttpApplication.v6(JAX) at com.evermind.server.http.HttpApplication.wh(JAX) at com.evermind.server.http.HttpApplication.vs(JAX) at com.evermind.server.http.HttpApplication.init(JAX) at com.evermind.server.Application.ue(JAX) at com.evermind.server.http.ej.ue(JAX) at com.evermind.server.http.ei.na(JAX) at com.evermind.server.http.ed.sp(JAX) at com.evermind.server.http.ed.so(JAX) at com.evermind.util.f.run(JAX) My machine is currently not connected to the net and I suppose orion would first attempt to look for a local copy of the dtd. Also, I have not packaged my J2EE app in an ear file yet. I am running Orion 1.3.8 and struts20001227. Thanks for any clue u may have. Regards - Original Message - From: "Denis Hanson" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 09, 2001 10:06 PM Subject: RE: Orion Application Server And Struts 1.0 Hello Hee, I'm using orion 1.3.8 and Struts 1.0 and things are working well. A good place to look for help is in the struts mailing list archives at http://www.mail-archive.com/struts-user@jakarta.apache.org/. Its where I found the directions given below. - Original Message - From: "Ate Douma" [EMAIL PROTECTED] To: "Orion-Interest" [EMAIL PROTECTED] Sent: Friday, December 15, 2000 20:19 Subject: Re: Struts 1.0 - Anyone Do It? Ok, once more: Deploying the stuts 1.0 pre-release example web application on Orion in (more or less) five steps (based on Orion 1.3.8 and jakarta-struts-src-20001209.zip on W2k, jdk1.3): 1. build the struts example web application (or retrieve it from the nightly build distribution) 1.1. extract the struts src distribution in a temporary directory ([struts]) 1.2. build struts distribution by executing "[struts]\jakarta-struts\ant dist" (using [struts]\jakata-struts\build.xml) 2. modify the web application archive [struts]\dist\struts\webapps\struts-example.war: 2.1. extract struts-example.war in a clean temporary directory ([temp]) 2.2. open [temp]\WEB-INF\lib\struts.jar and extract org\apache\struts\resources\struts-config_1_0.dtd to [temp]\WEB-INF\classes\ creating file [temp]\WEB-INF\classes\org\apache\struts\resources\struts-config_1_0.dtd 2.3 delete the above file from struts.jar and save struts.jar in [temp]\WEB-INF\lib\ 2.4 jar (or zip) the contents of [temp]\ in a new web application archive [temp]\struts-example.war (don't forget keeping the folder names) 3. create a struts.ear file by: 3.1. create file [temp]\META-INF\application.xml containing the following: ?xml version="1.0"? !DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd" application display-namestruts/display-name module web web-uristruts-example.war/web-uri context-root/struts-example/context-root /web /module /application 3.2 jar
Re: GenericDataSource Enhancement
Except that the javax.sql.DataSource API still includes this method signature, so we need to do something. I guess it would probably be better to return a "not implemented" exception of some sort, then just return a "regular" connection like it does now. Yes or just a normal connection that the user auto closes when he calls close, so won't be pooled or anything. What should be done is testing the isClosed() method before given the Connection to the request. If the database closes the connection will the connection.isClosed() return a boolean true then? My experience has been that this is not sufficient. You don't find out that the driver connection got closed until you try to submit an SQL statement for execution -- what we need to be able to configure is a very low-overhead SQL call that can be tried before returning the connection to the user. What about a extra rollback() call right before given it back to the request? Or is the driver/connection smart enough that the rollback doesn't do anything (because nothing happend) and it doesn't send it to the server? johan
Re: HTML tag library
Do it before the 1.0 release. Because after that is will be much more difficult. johan - Original Message - From: "Ted Husted" [EMAIL PROTECTED] To: "Struts List" [EMAIL PROTECTED] Sent: Monday, January 08, 2001 12:04 PM Subject: HTML tag library Did we decide to rename the FORM tag library as the HTML tag library in a 1.0 timeframe? I agree it makes sense, the library has outgrown just forms, but it seems to break my existing late-model JSPs. Worked on the third, now not. We've been assuring people for several weeks that the code-breaking changes were complete. Or, is there a top-level way we can get the JSP's to use the HTML lib instead without editing them all? The change is not mentioned in the release notes, and I didn't see anything here; at first I thought it was a new library that would hold additional non-form tags. If we have some other non-form tags in mind (image, et cetera), I would suggest we leave the form library as it is, and introduce a new HTML library (since the form library is big enough), where both libraries would support the :html, :base, :link tags, and tags on an interim basis. I would also consider moving the bean:message, logic:interate, and logic:redirect tags to a HTML library. Of course, this becomes a discussion of procedural versus functional cohesion, and reasonable people can disagree. In any event, seperate HTML and Form libraries does seem to have higher cohesion to me, since some people might want to use the HTML tags without the rest of it. Incidentally, I note the JAR has jumped in size a bit this week. Was that the addition of the bean property options, or something else?
Re: GenericDataSource Enhancement
I suppose besides adding datasources with different logins, we could also add entirely different DBMS's?, on entirely different servers? Yes that is what the current solution already offers. So the getConnection(String user, String pasword) doesn't have to be implemented, Because if you really need this make another datasource under some kind of key. What should be done is testing the isClosed() method before given the Connection to the request. If the database closes the connection will the connection.isClosed() return a boolean true then? Johan
RE: Template layout file with an include (bean or jsp) to a jsp with a form. (there are many tomcat developer here also i believe)
Hi, I thought i shall be smart, i developed my own: IncludeServletResponse that implements HttpServletResponse) That one routes everything to the base servlet response of the pagecontext except the outputstream ones: The getOutputStream() returns not the default one of the first Response but my own implementation but now the bug of Tomcat??: IncludeResponse iResponse = new IncludeResponse((HttpServletResponse)pageContext.getResponse()); RequestDispatcher rd= pageContext.getServletContext().getRequestDispatcher(_sPage); rd.forward(pageContext.getRequest(), iResponse); iResponse is my own implentation. The RequestDispatcher interface wants only a ServletResponse (and a ServletRequest) It compiles fine so how is it possible that the RequestDispatcher throws a ClassCastException inside itself? What kind of ServletResponse does it wants? Johan Compagner -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED]] Sent: Friday, January 05, 2001 4:05 PM To: Struts-User Subject: Template layout file with an include (bean or jsp) to a jsp with a form. Hi, I will ask the basic question first so that you don't have to read the whole email: So is there no way to use the same request over 2 or more jsp files that are nested in each other? Now my test case: I have a template jsp file that has all the layout of my site. in the right left corner will al the dynamic data. like this: // tag libs includes form:html locale="true" head titlebean:message key="index.title"//title /head body bgcolor="#fce8a0" topmargin="0" leftmargin="0" table width="100%" border="0" height="123" cellpadding="0" cellspacing="0" bgcolor="#0066ff" tr td // standard layout of my site // jadajadajadajada /td // The include logic. logic:present name="%= JSP_INCLUDE_KEY %" scope="request" bean:include id="subpage" name="%= (String)request.getAttribute(Constants.JSP_INCLUDE_KEY) %"/ %= subpage % /logic:present logic:notPresent name="%= Constants.JSP_INCLUDE_KEY %" scope="request" bean:include id="subpage" name="/index.jsp"/ %= subpage % /logic:notPresent /tr /table /body /form:html This template file is always the ActionForward that i return as the next page to see after this action, something in the perform method of a Action: request.setAttribute(Constants.JSP_INCLUDE_KEY, mapping.findForward("pensioen3a").getPath()); return mapping.findForward("template"); The nicest thing about this is that if i want to change something of my site i only have to edit one file and every page/view is changed also like the logon page or the pages with the forms. But now my problem. An Action is mostly triggerd by the subpage (where the form is in). That Action is testing the input (some validation) if that goes wrong that a ACtionError is made and is attached to the request. But when i forward it (to the same page) i forward it to the template again and that template includes the page with the form. But the include generates another request for that subpage so my ActionErrors object and other objects that i stored in the request aren't there!! I also do this in te validate() of a Form: String fromPage = request.getParameter("frompage"); mapping.setInput(mapping.findForward("template").getPath()); request.setAttribute(Constants.JSP_INCLUDE_KEY, mapping.findForward(fromPage).getPath()); So that when there are errors returned it knows that the input is the template and the include is the same page it come's from. But this also doesn't work. I can't be the only one with this problem. Are nobody else using subpages where the form/inputs are in an another one that is the standard layout page? I thought to be smart and made my own include tag: public int doStartTag() throws JspException { try { RequestDispatcher rd= pageContext.getServletContext().getRequestDispatcher(_sPage); rd.forward(pageContext.getRequest(), pageContext.getResponse()); } catch(Exception e) { throw new JspException(e.getMessage()); } return SKIP_BODY; } But the problem is then that the subpage (the _sPage string) is displayed first, above the main page instead of in the main page. Why is this? Because when i walk through the code then i see the main page that writes to the output and then the subpage and then the main page again. I think this has something to do with flushing ect. But if i flush first (right above the RequestDispatcher line i do this: pageContext.getOut().flush(); Then i get the main page on to
Re: SilverStream 3.7 and Struts
Did you try one of the latest builds? johan - Original Message - From: "Bill Pfeiffer" [EMAIL PROTECTED] To: "Struts-User" [EMAIL PROTECTED] Sent: Tuesday, January 02, 2001 1:48 PM Subject: SilverStream 3.7 and Struts There was some mention a while back in a thread titled "Proposed Solution to Non-Serializable MessageResources Class" that described a problem that I am encountering with SilverStream 3.7. I am not actually using MessageResources in my web application, but I am encountering the following when deploying a very simple struts web app to SilverStream: java.lang.LinkageError: Class org/apache/struts/action/ActionForm violates loader constraints SilverStream support indicated that this had something to do with the way the MessageResources is not serializable. Is there an update (Struts or SilverStream) that addresses this problem? TIA, Bill Pfeiffer
Re: Form errors
Use my ErrorTag attached. I copied almost from ErrorsTag but only generated it for the property that was set. I hope this or another one just like it will be in the default struts lib. (they can use mine attached) The current implementation isn't used very much on the internet. Users want to see what the did wrong and where to fix it. And that's why the ErrorTag is much handier then the ErrorsTag. If multiply errors are set for one property it will be comma seperated. johan I probably missed this in the documentation, but if I want to pull out the error message for a specific field, how would I do it? Let's say I have a username which was left blank and I create a new ActionError : errors.add("username",new ActionError("error.username.required")); Now, in my .jsp, rather than having all the errors displayed with form:errors/, I want to put the error.username.required error right next to the username field: form:text property="username" size="16" maxlength="16"/ nbsp; form:errors username-only I don't want it to use errors.header or errors.footer either in this case. Is that possible? Thanks. ErrorTag.java
Re: agh! Suddenly Tomcat does not start with struts!
I use the one of 27/12/2000 in VAJ3.5p2 with tomcat 3.1 and it works fine johan - Original Message - From: "Ned Seagoon" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 28, 2000 1:59 PM Subject: agh! Suddenly Tomcat does not start with struts! Hi Guys, hope you all had a good xmas... I tried to start up struts-29/11/00 with tomcat 3.1 (inside VAJ 3.5p2) today and had the following errors. Anybody got any ideas? BTW, it worked ok last week! I also checked all the .xml files and they don't seem to have any structural errors in them. Cheers Ned error: Thread[main,5,main] (Alive) Exception Caught: java.lang.ArrayIndexOutOfBoundsException console: Context log path="/pw" :tomcat.errorPage: init Context log: path="/pw" XmlReader - init /pw C:\jakarta\jakarta-struts\web\paine Context log: path="/pw" Reading C:\web\conf\web.xml Context log: path="/pw" Reading C:\jakarta\jakarta-struts\web\paine\WEB-INF\web.xml Context log: path="/pw" Loading -2147483646 jsp Context log path="/pw" :jsp: init Context log: path="/pw" Loading -2147483646 default Context log path="/pw" :default: init Context log: path="/pw" Loading 2 action Context log path="/pw" :action: init Context log path="/pw" :action: Loading application resources from resource org.secretsquirrel.pwdemo.ApplicationResources Context log path="/pw" :action: Initializing configuration from resource path /WEB-INF/struts-config.xml Stack trace attached. _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Is there a good documentation for all the xml config files parameters/settings that can be used?
Hi, What parameters can i use and is recognized by struts in the WEB.XML file? And the struts-config.xml? (i know i can look into the dtd but is there also a doc/html that explains everything?) johan
(Property)MessageResources proposed changes.
Hi, ( i am trying to subscribe to STRUTS-DEV but i don't get a confirmation message so i post it first here) When the new MessageResources class (and its sub) where introduced my app didn't work anymore because of the changed behaviour in loading resouces. I have 2 fixes that i have attached here: First is the MessageResources.localeKey(Locale) method that is needed by both PropertyMessageResources that i send in. this: protected String localeKey(Locale locale) { if (locale == null) return (""); else if (locale.equals(defaultLocale)) return (""); else return (locale.toString()); } is changed to this: protected String localeKey(Locale locale) { if (locale == null) return (""); else return (locale.toString()); } Because when it is the default locale or not that doesn't matter. First it must try to load the right resources for the default locale. For example if the default locale is nl_NL then i want it to try to load: xxx.nl_NL.properties or xxx.nl.properties before it tries to load xxx.properties. Because maybe now my webapp is on a system there the default locale is nl_NL but maybe it's also getting deployed on a system with the default locale en_US. Then suddenly the struts load the wrong properties file for the locale, (What must be the xxx.properties file? English or Dutch?) ResourceBundle it self does also try to load the nl_NL first it doesn't look if the given locale is the default one or not. PropertyMessageResources.getMessage(Locale,String) changes: this piece of code: // As a last resort, try the default Locale localeKey = localeKey(defaultLocale); messageKey = messageKey(localeKey, key); loadLocale(localeKey); synchronized (messages) { message = (String) messages.get(messageKey); if (message != null) { if (addIt) messages.put(originalKey, message); return (message); } } is changed to this: // try the default Locale if current locale isn't default if(locale != defaultLocale) { localeKey = localeKey(defaultLocale); messageKey = messageKey(localeKey, key); loadLocale(localeKey); synchronized (messages) { message = (String) messages.get(messageKey); if (message != null) { if (addIt) messages.put(originalKey, message); return (message); } } } // last resort: try loading de base localeKey = ""; messageKey = messageKey(localeKey, key); loadLocale(localeKey); synchronized (messages) { message = (String) messages.get(messageKey); if (message != null) { if (addIt) messages.put(originalKey, message); return (message); } } So i my last resort isn't trying to get it with the defaultLocale I test it first (maybe equals should be used in tead of == ) so that the loading and the synchronized lock isn't invane. After that and still the message isn't returned i go to my last resort and that is loading the base (xxx.properties) But i thought why implement the exact same behaviour of the ResouceBundle? So i made my own class. Here are the 2 methods: public String getMessage(java.util.Locale locale, String key) { if(locale == null) locale = defaultLocale; String localeKey = localeKey(locale); String messageKey = messageKey(localeKey, key); String message = null; // first try to load a previous stored resource. synchronized (messages) { message = (String) messages.get(messageKey); } // if there was no previous stored resource. if(message == null) { // try loading the resources loadMessages(locale); // try getting it again. synchronized (messages) { message = (String) messages.get(messageKey); } } // If still null. if(message == null) { // Return an appropriate error indication if (returnNull) return (null); else return ("???" + messageKey(locale, key) + "???"); } return message; } protected void loadMessages(Locale locale) { String localeKey = localeKey(locale); // Have we already attempted to load messages for this locale? synchronized (locales) { if (locales.get(localeKey) != null) return; locales.put(localeKey, localeKey); } ResourceBundle bundle = java.util.ResourceBundle.getBundle(config,locale,this.getClass().getClassLoader()); if(bundle != null) { synchronized (messages) { Enumeration names = bundle.getKeys(); while (names.hasMoreElements()) { String key = (String) names.nextElement(); messages.put(messageKey(localeKey, key), bundle.getObject(key)); } } } } I use the resoucebundle class to get the properties. This has the following advantages: 1 Not having to implement and maintain the complete reading in code. 2 support for not only resource property files but also resource class files!! 3 No double keys for all the resouces when given locale = nl_NL and the properties file = xx_nl.properties explain 3: Locale = nl_NL propertie file = xxx._nl.properties first messages aren't found for that locale key.
Re: i18n problem
Which build do you use? There are some problems with locale property resources with of 17 december I don't know if these are fixed with a later release. See my bug report about properties don't load anymore. I haven't heard anything back from my mail but i am hoping that it get's fixed. Just let The ResourceBundle class do its work loading the right .properties or .class files for a given locale. johan compagner - Original Message - From: "Andre Wittenburg" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 19, 2000 12:36 PM Subject: i18n problem Hi! I do have some problems with the messages displayed via bean:message key="myKey"/. The documentation says, that if no Locale is specified the default locale from the Action class will be taken. When i ask for the Locale in the jsp with the following commands, i get the locale which i set during the logon procedure, but the messages are taken from the default MessageResource... - Localebr Language:%=((java.util.Locale) session.getAttribute(org.apache.struts.action.Action.LOCALE_KEY)).getLanguag e()% br Country:%=((java.util.Locale) session.getAttribute(org.apache.struts.action.Action.LOCALE_KEY)).getCountry ()% - the result is: Locale Language: de Country: DE but ApplicationResources.properties is taken and not ApplicationResources_de.properties ? Any help or suggestions ? Thanx Andre
GenericConnection.close() method changes:
I changed this: try { conn.setTypeMap(this.map); } catch (SQLException e) { into this: try { conn.setTypeMap(this.map); } catch (Exception e) { (Changed all SQLException into normal Exceptions of al the catches) because on the above statement the odbc driver to a access db throws a NotSupportedException so none of the connections where returned to the pool because the source.returnConnection(this); was never reached. Johan compagner
Does struts have a Dynamic Form.
Hi, Let's say i want to make something so that i can edit database tables. I don't want to write for every database table that must be editiable a special jsp page. For every database table i have a Java Mapping Object. Not all Columns are editable, only the specified ones. DynamicForm form = new DynamicForm() form.setDatabaseObject(javaMappingObject); form.setEditableColumns(String[]) When the user presses submit i can validate the form in the perfom() and get the updated database object back so that i can update the database. does struts have something like this? Johan Compagner
vote for a Action.USER_KEY constant.
In many jsp/servlets apps there is somekind of user object. It would be nice to have a default constant for this. And with taht in mind it would also be usefull that i can define in the web.xml or struts_config.xml that is want to load that object as User object (using the Action.USER_KEY) whenever a Session object is created. Or is this possible already? Because now i must in every jsp page check if that object is there because i user can bookmark a page in the middle of my app. So defining something like this would be handy: servlet init-objects param scope=session keyorg.apache.struts.action.Action.USER_KEY/key objectcom.xxx.xxx.User/object /param param scope=application keycom.xxx.xxx..DATABASE_KEY/key objectcom.xxx.xxx.DatabaseHandler/object /param /init-objects /servlet Or defining an object for every request. Johan Compagner
Re: MessageTag
I use it also for labels of the form like: Username [] (english) Gebruikersnaam [] (My language) - Original Message - From: "David Winterfeldt" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 12, 2000 10:28 PM Subject: MessageTag I don't know if anyone has suggested this before, but does anyone else have a use for a message besides error messages? There could be a message tag to show confirmation messages if a record is deleted or to show the status of something. David Winterfeldt __ Do You Yahoo!? Yahoo! Shopping - Thousands of Stores. Millions of Products. http://shopping.yahoo.com/
Where is the form:error property=xxxxx tag?
Hi, I have attached 2 html files as an example; Errors.html is the default one that i get when using: form:errors/ tag in a jsp file. and a Error.html is the one that i want to have. form:errors/ has some drawbacks like: 1 The layout of the input screen suddenly changes. 2 You must link the error text and the right input field with each other. (the user must, visually) In the second approace the error text is right besides the input field. You do store errors under it's property name: errors.add("fromAddress", new ActionError("error.fromAddress.required")); so with that in mind there must be somthing to get one specifiek error very easy without much code. something like this: (registration.jsp example from adress section) tr th align="right" bean:message key="prompt.fromAddress"/ /th td align="left" form:text property="fromAddress" size="50"/ /td /tr becomes this: tr th align="right" bean:message key="prompt.fromAddress"/ /th td align="left" form:text property="fromAddress" size="50"/ font color=#ffform:error property="fromAddress"//font /td /tr The form:error property="fromAddress"/ returns the same error string that belowns to that property or "" if none set. Before i code this myself i thought let's ask it before i do something twice. Johan Compagner Title: Register for the MailReader Demostration Application Validation ErrorYou must correct the following error(s) before proceeding: From Address is required Full Name is required Username is required Username: Password: (Repeat) Password: Full Name: From Address: Reply To Address: Title: Register for the MailReader Demostration Application Username: Username is required Password: (Repeat) Password: Full Name: Full Name is required From Address: From Address is required Reply To Address:
Why are there 2 ForwardTag classes (and someothers)?
logic and in taglib have both classes that are almost exactly the same. one difference: In logic package exceptions are first added as an attribute of pageContext: pageContext.setAttribute(Action.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE); and then the exception is thrown. throw new JspException(messages.getMessage("forward.forward", name, e.toString())); in taglib only the exception is thrown. Why is this? Johan Compagner
getting Locale strings in a ActionForm
hi, I want to use a html select with a few options. Those options are specified in resourcebundles for different locales. I have a CustomForm class: class CustomForm { public String[] getOptionValues() { return new String[]{"resourcekey1","resourcekey2"} } public String[] getOptionLabels() { String[] asValues = getOptionValues(); String[] asLabels = new String[_asValues .length]; org.apache.struts.util.MessageResources messages = servlet.getResources(); for (int i = 0; i asWaarden.length; i++) { asLabels[i] = messages.getMessage(asValues [i]); } return asLabels; } } i use this in a JSP page: struts:select property="optionvalue" struts:options property="optionValues" labelProperty="optionLabels"/ /struts:select This goes well for the default locale, but if i let the user changes it's locale then everything changes with it except the options in the select!! This is because the messages.getMessage(asValues [i]); call the message.getMessage(Locale locale ,) with the locale as a null property. And when the MessageResources class gets a null locale it uses the default locale of the server. So when the server has a locale nl_NL and the users selects a different one: en_US everything else that uses struts:message / changes but not the options. Can i get the handle to the current session object in a ActionForm bean? Why not set the Session object also so that we have much more power/data at our hands? So why nog change the protected ActionForm processActionForm into this: protected ActionForm processActionForm(ActionMapping mapping, HttpServletRequest request) { // Is there a form bean associated with this mapping? String attribute = mapping.getAttribute(); if (attribute == null) return (null); // Look up the existing form bean, if any if (debug = 1) log(" Looking for ActionForm bean under attribute '" + attribute + "'"); ActionForm instance = null; HttpSession session = null; if ("request".equals(mapping.getScope())) { instance = (ActionForm) request.getAttribute(attribute); } else { session = request.getSession(); instance = (ActionForm) session.getAttribute(attribute); } if (instance != null) { instance.setSession(session); //ADDED return (instance); } // Create a new form bean if we need to if (debug = 1) log(" Creating new ActionForm instance"); String name = mapping.getName(); String className = null; ActionFormBean formBean = findFormBean(name); if (formBean != null) className = formBean.getType(); if (className != null) { try { Class clazz = Class.forName(className); instance = (ActionForm) clazz.newInstance(); instance.setServlet(this); } catch (Throwable t) { log("Error creating ActionForm instance of class '" + className + "'", t); } } if (instance == null) return (null); // Store the newly created bean in the appropriate scope if (debug = 1) log(" Storing instance under attribute '" + attribute + "'"); if ("request".equals(mapping.getScope())) request.setAttribute(attribute, instance); else session.setAttribute(attribute, instance); instance.setSession(session); //ADDED return (instance); } Johan Compagner
getting Locale strings in a ActionForm
hi, I want to use a html select with a few options. Those options are specified in resourcebundles for different locales. I have a CustomForm class: class CustomForm { public String[] getOptionValues() { return new String[]{"resourcekey1","resourcekey2"} } public String[] getOptionLabels() { String[] asValues = getOptionValues(); String[] asLabels = new String[_asValues .length]; org.apache.struts.util.MessageResources messages = servlet.getResources(); for (int i = 0; i asWaarden.length; i++) { asLabels[i] = messages.getMessage(asValues [i]); } return asLabels; } } i use this in a JSP page: struts:select property="optionvalue" struts:options property="optionValues" labelProperty="optionLabels"/ /struts:select This goes well for the default locale, but if i let the user changes it's locale then everything changes with it except the options in the select!! This is because the messages.getMessage(asValues [i]); call the message.getMessage(Locale locale ,) with the locale as a null property. And when the MessageResources class gets a null locale it uses the default locale of the server. So when the server has a locale nl_NL and the users selects a different one: en_US everything else that uses struts:message / changes but not the options. Can i get the handle to the current session object in a ActionForm bean? Why not set the Session object also so that we have much more power/data at our hands? So why nog change the protected ActionForm processActionForm into this: protected ActionForm processActionForm(ActionMapping mapping, HttpServletRequest request) { // Is there a form bean associated with this mapping? String attribute = mapping.getAttribute(); if (attribute == null) return (null); // Look up the existing form bean, if any if (debug = 1) log(" Looking for ActionForm bean under attribute '" + attribute + "'"); ActionForm instance = null; HttpSession session = null; if ("request".equals(mapping.getScope())) { instance = (ActionForm) request.getAttribute(attribute); } else { session = request.getSession(); instance = (ActionForm) session.getAttribute(attribute); } if (instance != null) { instance.setSession(session); //ADDED return (instance); } // Create a new form bean if we need to if (debug = 1) log(" Creating new ActionForm instance"); String name = mapping.getName(); String className = null; ActionFormBean formBean = findFormBean(name); if (formBean != null) className = formBean.getType(); if (className != null) { try { Class clazz = Class.forName(className); instance = (ActionForm) clazz.newInstance(); instance.setServlet(this); } catch (Throwable t) { log("Error creating ActionForm instance of class '" + className + "'", t); } } if (instance == null) return (null); // Store the newly created bean in the appropriate scope if (debug = 1) log(" Storing instance under attribute '" + attribute + "'"); if ("request".equals(mapping.getScope())) request.setAttribute(attribute, instance); else session.setAttribute(attribute, instance); instance.setSession(session); //ADDED return (instance); } Johan Compagner