RE: Forwards and frames
we have a similar situation. What we did to solve it was this. The login page was a normal HTML page, no frames, this sent the details to our server (username / password) , where the server validated the request and forwarded it to our Welcome.jsp. This Welcome.jsp is actually a frameset definition, which includes other jsp's as the content for the menu and content frame. (frame src="Menu.jsp") (frame src="LoggedIn.jsp") The menu frames href's have a "target=content_frame" and all your server responses are now sent to the content frame. BUT, the inital content page (LoggedIn.jsp), spawned by the frameset defintion page (Welcome.jsp) cannot access the request. As the request has been used / died in the frameset page. (It's essentially a different window) So our inital content page is just a static logged in page. (You could use the session var here though, for reasons I won't go into we couldn't, so we just stuck with a static page) Damien -Original Message- From: Alex Punyansky [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 12:14 AM To: [EMAIL PROTECTED] Subject: Forwards and frames Hello, In my application I have two frames: menu frame and content frame. When the user opens my application, he sees nothing in the menu frame and login page in the content frame. When the user submits user id and password, I display the next page in the content frame. The problem is that I also need to update the menu frame to display the possible menu options for that user. I don't think that I can use JavaScript to update the contents of both frames because the menu frame requires existense of user object in session, and it can't be guaranteed that user's object will be initialized before the menu frame is loaded. Another problem arises, when I check whether the user is logged in ( using custom CheckLogonTag ). This tag forwards to /Logon.jsp in the content frame only, if user's session expired or it can't find User object in session but I also need to update the contents of the menu frame at this point, so that there are no menu options in it. Has anyone encountered and solved this kind of problem before? Thanks Alex
Unable to execute any examples ...
Hi, I've dowloaded last version of Struts, and I'm trying to execute first example of bluestone. I've always the same error : org.apache.jasper.JasperException: Unable to open taglibrary /WEB-INF/struts-bean.tld : Parse Error in the tag library descriptor: com.sun.xml.parser/V-036 web-app welcome-file-list It was only a copy from sources ... can anyone help me ? thanks, Raymond - Original Message - From: "Corbishley, Damien" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 11:02 AM Subject: RE: Forwards and frames we have a similar situation. What we did to solve it was this. The login page was a normal HTML page, no frames, this sent the details to our server (username / password) , where the server validated the request and forwarded it to our Welcome.jsp. This Welcome.jsp is actually a frameset definition, which includes other jsp's as the content for the menu and content frame. (frame src="Menu.jsp") (frame src="LoggedIn.jsp") The menu frames href's have a "target=content_frame" and all your server responses are now sent to the content frame. BUT, the inital content page (LoggedIn.jsp), spawned by the frameset defintion page (Welcome.jsp) cannot access the request. As the request has been used / died in the frameset page. (It's essentially a different window) So our inital content page is just a static logged in page. (You could use the session var here though, for reasons I won't go into we couldn't, so we just stuck with a static page) Damien -Original Message- From: Alex Punyansky [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 12:14 AM To: [EMAIL PROTECTED] Subject: Forwards and frames Hello, In my application I have two frames: menu frame and content frame. When the user opens my application, he sees nothing in the menu frame and login page in the content frame. When the user submits user id and password, I display the next page in the content frame. The problem is that I also need to update the menu frame to display the possible menu options for that user. I don't think that I can use JavaScript to update the contents of both frames because the menu frame requires existense of user object in session, and it can't be guaranteed that user's object will be initialized before the menu frame is loaded. Another problem arises, when I check whether the user is logged in ( using custom CheckLogonTag ). This tag forwards to /Logon.jsp in the content frame only, if user's session expired or it can't find User object in session but I also need to update the contents of the menu frame at this point, so that there are no menu options in it. Has anyone encountered and solved this kind of problem before? Thanks Alex
Database pooling code
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
URGENT RE: token issue in hyperlink
Hello, I have posted this before. This is extremely urgent for me. I know that the token support exists for posting Form(s). How can i ensure that this same token will be issued to a hyperlink so that i can validate that the user will click on the hyperlink only once ? Any help is greatly appreciated. Thanks a lot. cheers, Amar.. -Original Message- From: Nanduri, Amarnath [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 2:23 PM To: '[EMAIL PROTECTED]' Subject: token issue in hyperlink Hello All , I am using the Action class saveToken() method to ensure that a token is created and set (so that the user has proper screen flow). My question is ... how can i add this token to a hyperlink ? I have a hyperlink in a jsp page, which takes me to a different Action class. I am checking for this token in the second Action class. Any help is greatly appreciated. Thanks. cheers, Amar..
Re: simple forward/redirect
Thanks for the quick response. Ana Narvaez Vila wrote: You could define a 'general' ForwardAction that simply makes the forward in its perform. Something like this. public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletMaravediNetException { return (mapping.findForward("success")); } This class could be com.yourcompany.yourpackage.ForwardAction and you could use it everytime that you want to do a simply forward or redirect. !-- Process a user logon -- actionpath="/logon" type="com.yourcompany.yourpackage.ForwardAction" forward name="success" path="/logon.jsp" / /action actionpath="/anotheraction" type="com.yourcompany.yourpackage.ForwardAction" forward name="success" path="/other.jsp" redirect="true"/ /action Matthias Bauer wrote: Hi everybody! There was a discussion about not calling jsp pages directly, but to always go through an action instead. I agree that this makes a lot of sense it quite a few cases. Now my stupid question is: What do I have to enter in struts-config.xml in order to do a simple forward or redirect e. g. from logon.do to logon.jsp? Normally I would write something like this: !-- Process a user logon -- actionpath="/logon" type="login.LogonAction" forward name="success" path="/logon.jsp" / /action But I don't need to do something special in the action LogonAction before diplaying logon.jsp. So how do I come around this? Write a dummy action which always returns success and use it in each of these cases? Thanks a lot, --- Matthias -- This email is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Sema Group. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. --
setting token in jsp page...
Hello all, Is there a way that i can set a token in a jsp page ? When the user enters the first page in a web application, i want to set a token (to guard agains't double submission). The reason for this question is that..the user HAS TO BE IN THE FIRST PAGE , before he/she can go to the next page. Since i am checking for a token in the Action class (on submission of the form), i have to set the token in the first page. Any suggestions are appreciated. Thanks a lot. cheers, Amar..
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: JSP design
How do i get off this list ? [EMAIL PROTECTED] wrote: Hi I am a new-comer in the struts area and trying to evaluate the framework to use for our new B2B project. I have been going thru the examples and documentation where capturing the request and further delegation is explained. I have two scenarios in the project where I need your inputs on how to go about designing using struts: 1. Dispatch schedule entry screen --- Here I have to pick-up the schedule from the database and present it to the user and allow him to modify and submit the form. Now I am not clear how do I use struts to pick-up the schedule from the database and display it on the entry form. Do I have to develop my own JSP tag for this?? 2. Catalog display Here again I have pick up the items from the database and show to the user. Also the catalog needs to have paging mechanism and the user can select multiple items and submit the page. Anybody has done similar design using struts?? Thanks Best Regards.Biju Isac begin:vcard n:Quinn;Martin tel;pager:888 498 2215 tel;cell:206 890 8780 tel;fax:206 522 1947 tel;work:206 517 6450 x-mozilla-html:FALSE org:BRIMG SRC="http://www.irista.com/logo/irista.gif"BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain/B/FONTBR adr:;;115 NE 100th Street;Seattle;WA;98125; version:2.1 email;internet:[EMAIL PROTECTED] title:Director, Product Development end:vcard
Re: simple forward/redirect
Please take me off this list. Matthias Bauer wrote: Thanks for the quick response. Ana Narvaez Vila wrote: You could define a 'general' ForwardAction that simply makes the forward in its perform. Something like this. public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletMaravediNetException { return (mapping.findForward("success")); } This class could be com.yourcompany.yourpackage.ForwardAction and you could use it everytime that you want to do a simply forward or redirect. !-- Process a user logon -- actionpath="/logon" type="com.yourcompany.yourpackage.ForwardAction" forward name="success" path="/logon.jsp" / /action actionpath="/anotheraction" type="com.yourcompany.yourpackage.ForwardAction" forward name="success" path="/other.jsp" redirect="true"/ /action Matthias Bauer wrote: Hi everybody! There was a discussion about not calling jsp pages directly, but to always go through an action instead. I agree that this makes a lot of sense it quite a few cases. Now my stupid question is: What do I have to enter in struts-config.xml in order to do a simple forward or redirect e. g. from logon.do to logon.jsp? Normally I would write something like this: !-- Process a user logon -- actionpath="/logon" type="login.LogonAction" forward name="success" path="/logon.jsp" / /action But I don't need to do something special in the action LogonAction before diplaying logon.jsp. So how do I come around this? Write a dummy action which always returns success and use it in each of these cases? Thanks a lot, --- Matthias -- This email is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Sema Group. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. -- begin:vcard n:Quinn;Martin tel;pager:888 498 2215 tel;cell:206 890 8780 tel;fax:206 522 1947 tel;work:206 517 6450 x-mozilla-html:FALSE org:BRIMG SRC="http://www.irista.com/logo/irista.gif"BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain/B/FONTBR adr:;;115 NE 100th Street;Seattle;WA;98125; version:2.1 email;internet:[EMAIL PROTECTED] title:Director, Product Development end:vcard
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
Struts Framework Class Model
Hello I say a request for the class model of the struts framework. I attached the model file. Unzip and open the readme file. For me it helped a lot... A+ Jeff StrutsFrameworkModel.zip
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: Database pooling code
Weblogic's connection pooling lets you specify the SQL statement that you want to test with. In Oracle you would typically test a connection with "select dummy from dual". I think you need to allow the test SQL statement to be configured for each pool. If an exception is raised when it is executed you can assume the connection is bad. Hal -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 10:23 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: 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
Parallel Forms Bean Instances, does Struts support it
Hello, I am new to Struts. One thing that is key in making a decision on weather to use or not to use Struts is this. Suppose I have an ActionForm with class type com.myapp.MyServiceForm. This would be a form bean that would represent some sortr of service in an application that is supposed to control system services. Is there a way or is Struts able todistinguish 2 instances of the MyServiceForm , one for service A and one for Service B. My interpretation of the the Source Code is that the ActionFormBeans class only cashes one copy of the form class keyed off by the logical name of the form. How would you deal with relating the aproriate bean to a form when you have multiple instances of the form bean Am i looking at it from the wrong perspective? Thanks for in info. Thanks
RE: Parallel Forms Bean Instances, does Struts support it
Correct me if i am wrong One way to do it would be to give 'request' scope to the form. In the Action class, you set the form to a session scope, under a different key...one for each different service. Make sure that only one kind of Action can handle one kind of service. i.e for Service A, use Action A and for Service B use Action B. In your action classes set the scope of forms to session (using different keys). Also in your struts-config.xml file, set the scope (for every action) to request. cheers, Amar.. -Original Message-From: Sarbjit Singh [mailto:[EMAIL PROTECTED]]Sent: Wednesday, March 07, 2001 10:50 AMTo: [EMAIL PROTECTED]Subject: Parallel Forms Bean Instances, does Struts support it Hello, I am new to Struts. One thing that is key in making a decision on weather to use or not to use Struts is this. Suppose I have an ActionForm with class type com.myapp.MyServiceForm. This would be a form bean that would represent some sortr of service in an application that is supposed to control system services. Is there a way or is Struts able todistinguish 2 instances of the MyServiceForm , one for service A and one for Service B. My interpretation of the the Source Code is that the ActionFormBeans class only cashes one copy of the form class keyed off by the logical name of the form. How would you deal with relating the aproriate bean to a form when you have multiple instances of the form bean Am i looking at it from the wrong perspective? Thanks for in info. Thanks
Re: URGENT RE: token issue in hyperlink
Here is what I do in a similar situation: html:link paramId="role" paramName="role" page='%="/user/saveUser.do?action=Removeorg.apache.struts.taglib.html.TOKEN=" + session.getAttribute("org.apache.struts.action.TOKEN")%' Removenbsp;Role /html:link It's ugly, but it works for now. Notice the single quotes around the page argument. Very important or the JSP parser will get confused by the embedded double quotes in the expression. I've submitted an enhancement request (Bug #874 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=874) to add an optional parameter to the html:link tag that would do this magic without the need for the expression shown above. If I can get Struts set up to build locally, I will probably give implementing this a go myself so I can submit a patch rather than just a request. Using the link above, you can vote for the implementation of this enhancement. Mike At 07:43 AM 3/7/2001, you wrote: Hello, I have posted this before. This is extremely urgent for me. I know that the token support exists for posting Form(s). How can i ensure that this same token will be issued to a hyperlink so that i can validate that the user will click on the hyperlink only once ? Any help is greatly appreciated. Thanks a lot. cheers, Amar.. -Original Message- From: Nanduri, Amarnath [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 2:23 PM To: '[EMAIL PROTECTED]' Subject: token issue in hyperlink Hello All , I am using the Action class saveToken() method to ensure that a token is created and set (so that the user has proper screen flow). My question is ... how can i add this token to a hyperlink ? I have a hyperlink in a jsp page, which takes me to a different Action class. I am checking for this token in the second Action class. Any help is greatly appreciated. Thanks. cheers, Amar..
Re: Database pooling code
On Wed, 7 Mar 2001, 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. I'm using the database connection pool with Informix Dynamic Server v7.2 and it appears to be working well. I have noticed that if my network connection goes down (I pull the plug on the network for a while), I need to restart Tomcat to reinitialize the connection pool. If I only momentarily pull the plug, the subsequent query takes longer to run, but does so successfully. I admit, I have not looked into the details of all this. But if there is a way to automate detection of an expired connection and tossing it, or reinitializing the connection pool (if all the connections are bad), I'd certainly be interested in having that capability either incorporated into Struts or available as a patch. Thanks.
Minimizing Action class proliferation
I'm certainly not the most experienced Struts person around, so weigh my opinions accordingly. However, it's repeatedly occurred to me that one of the "barriers to entry", so to speak, of using Struts is the rapidity with which Action classes proliferate. The project we're working on, which will eventually be fairly large but so far isn't, has dozens of Action classes. It approaches one per page that could be displayed. Perhaps there's a design pattern that we've missed which would alleviate this. But apart from looking at the request path during "perform" and then acting conditionally, which is very brute force, I don't see a lot of options. I believe it would be preferable to have a single Action class in which all related activity occurs. This makes it easier to add new "logical" actions. More importantly, however, it greatly eases maintenance in the case where you need to change a lot of related/similar code (maybe a back-end API changed). Here's one question: Would it work to specify an inner class as the "type" for an action? For example (pseudocode): public class OrderActions { public class Query extends ActionBase { ActionMapping perform( ... ) } public class Edit extends ActionBase { ActionMapping perform( ... ) } public class Save extends ActionBase { ActionMapping perform( ... ) } } I think you get the point. Assuming that I'm not completely missing something, here's what I'm thinking of as an enhancement. Add a "method" attribute to the "action" element in struts-config.xml. If present, the ActionServlet would call this method (using introspection or whatever makes sense); if it's not present, then call "perform" as we do now; if the attribute is specified but the method doesn't exists, it's an exception. Thoughts??? Thanks, Donnie
RE: URGENT RE: token issue in hyperlink
Mike, Thanks a lot. It works. I did vote for this enhancement to take place. One question i have is...how come i don't see the session id in the address bar ? Is it because GET limits the number of characters that can be kept in the Address Bar ? Also i did not see the sessionid when i did a 'view source' and checked the source of my generated page. Clarification on this issue is greatly appreciated. cheers, Amar.. -Original Message- From: Michael McCallister [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 11:06 AM To: [EMAIL PROTECTED] Subject: Re: URGENT RE: token issue in hyperlink Here is what I do in a similar situation: html:link paramId="role" paramName="role" page='%="/user/saveUser.do?action=Removeorg.apache.struts.taglib.html.TOKE N=" + session.getAttribute("org.apache.struts.action.TOKEN")%' Removenbsp;Role /html:link It's ugly, but it works for now. Notice the single quotes around the page argument. Very important or the JSP parser will get confused by the embedded double quotes in the expression. I've submitted an enhancement request (Bug #874 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=874) to add an optional parameter to the html:link tag that would do this magic without the need for the expression shown above. If I can get Struts set up to build locally, I will probably give implementing this a go myself so I can submit a patch rather than just a request. Using the link above, you can vote for the implementation of this enhancement. Mike At 07:43 AM 3/7/2001, you wrote: Hello, I have posted this before. This is extremely urgent for me. I know that the token support exists for posting Form(s). How can i ensure that this same token will be issued to a hyperlink so that i can validate that the user will click on the hyperlink only once ? Any help is greatly appreciated. Thanks a lot. cheers, Amar.. -Original Message- From: Nanduri, Amarnath [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 2:23 PM To: '[EMAIL PROTECTED]' Subject: token issue in hyperlink Hello All , I am using the Action class saveToken() method to ensure that a token is created and set (so that the user has proper screen flow). My question is ... how can i add this token to a hyperlink ? I have a hyperlink in a jsp page, which takes me to a different Action class. I am checking for this token in the second Action class. Any help is greatly appreciated. Thanks. cheers, Amar..
yet another interesting question on tokens
Hi all, In the Action class , on calling the isTokenValid() method, we can find out if a token is valid (or) not and send the user to an error page (or welcome page). My question is..when the user double-submits, how can i ignore the second submit i.e. i don't want to kick the user off to a welcome (or) error page ... I am presenting 2 scenarios . User book marks a page (or) uses the back button to submit the same page again. In this case kick him off to a welcome / error page . User is impatient like me :) and double-submits. In this case i want to ignore the second submit. I don't want to take the user to some other page because the user might not want to start all over again...all because they have accidentally double-clicked the submit button. Thanks a lot... cheers, Amar..
RE: URGENT RE: token issue in hyperlink
I can't speak about the address bar (different browsers probably behave differently), but if you aren't seeing it in the generated source then there is a problem. To confirm, you don't see the org.apache.struts.taglib.html.TOKEN=4bb7c9e6084fbf88acc2aa976ea9e3 string in your generated hyperlink href? Do you see the "org.apache...TOKEN" part but not the hex string after the equals sign? If so, maybe you are not doing a saveToken(request) in an Action before you forward to your JSP page. Mike At 10:58 AM 3/7/2001, you wrote: Mike, Thanks a lot. It works. I did vote for this enhancement to take place. One question i have is...how come i don't see the session id in the address bar ? Is it because GET limits the number of characters that can be kept in the Address Bar ? Also i did not see the sessionid when i did a 'view source' and checked the source of my generated page. Clarification on this issue is greatly appreciated. cheers, Amar..
RE: WLS5.1/SP8 Problem defining JSP class
Hi Bob! Thanks a lot... the problem is solved. I think earlier my SP8 was not active due to wrong positioning in the weblogic path. Much appreciated. Biju Isac [EMAIL PROTECTED] elheim.comTo: [EMAIL PROTECTED] cc: 03/07/01 07:35 PM Subject: RE: WLS5.1/SP8 Problem defining JSP class Please respond to struts-user --- My System Classpath: --- F:\weblogic\lib\weblogic510sp8boot.jar;F:\Tools\jdk1.3\lib\j2ee.jar; f:\Oracle\Ora81\jdbc\lib\classes12.zip;f: \Oracle\Ora81\jdbc\lib\nls_charset1 2_01.zip; f:\Oracle\Ora81\jdbc\lib\nls_charset11.zip;f: \Oracle\Ora81\jdbc\lib\nls_char set10.zip; f:\Oracle\Ora81\jdbc\lib\classes102.zip;f: \Oracle\Ora81\jdbc\lib\classes111. zip; f:\tools\lib\tools.jar;f:\tomcat\lib\webserver.jar; f:\tomcat\lib\xml.jar;f:\tomcat\lib\jasper.jar;f:\tomcat\lib\servlet.jar; f:\tomcat\lib\ant.jar;f:\tools\xerces-1_3_0\xerces.jar -- My Weblogic classpath: -- set WEBLOGIC_CLASSPATH=.\license;.\classes;.\lib\weblogicaux.jar;. \myserver\serv erclasses; .\lib\wlssp8-struts.jar;.\lib\weblogic510sp8.jar;f: \tools\xerces-1_3_0\xerce s.jar Why does your classpath make reference to tomcat libraries? I would stick to the WL supplied servlet classes. And, your SP8 files must be placed at the start of both classpaths. I recommend the following: 1) Make sure WL is started from the \weblogic root. Also, javac.exe and weblogic/bin directory need to be included in your windows system PATH. 2) Change your system CLASSPATH to: .\lib\weblogic510sp8boot.jar;.\classes\boot;f: \Oracle\Ora81\jdbc\lib\classes 111.zip;f:\tools\xerces-1_3_0\xerces.jar 3) and your weblogic classpath to: .\lib\weblogic510sp8.jar;.\license;.\classes;.\lib\weblogicaux.jar;. \myserve r\serverclasses 4) In addition to this, you will need to extract the ApplicationProfile.properties from each war file to the _tmp directory created by WL. Refer to the installation notes for WL5.1 supplied with the Struts distibution for more information. For reference, I have attached my startup script for WL. I use this on both NT and HP-UX successfully (with a few minor OS related changes) startwl.cmd Bob -Original Message- From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 1:00 AM To: [EMAIL PROTECTED] Subject: Re: WLS5.1/SP8 Problem defining JSP class Hi Matthias, Thanks for your quick response. I am attaching the complete error details, any help would be much appreciated... (See attached file: error.txt) Matthias Kerkhoff To: "[EMAIL PROTECTED]" [EMAIL PROTECTED] make@BESToffcc: ers.de Subject: Re: WLS5.1/SP8 Problem defining JSP class 03/07/01 04:57 AM Please respond to struts-user I have successfully implemented the struts example on Apache/Tomcat but not able to the same on WebLogic 5.1. I am getting the error: Problem defining JSP class java.lang.NullPointerException at weblogic..servlet.jsp.OneOffJspLoader.initJspStub.java:420 Looks like a classpath problem. Anyway, a full stack trace would be helpful to track your problem down to it's cause. Hopefully installing the fix becomes obsolete with SP9. SP9 should be out real soon now. If(!) you've installed Struts in the correct place and have configured your classpaths correctly, you should probably wait until SP9 is officially released. Matthias(mailto:[EMAIL PROTECTED]) PS. I have applied the fix published in the mailing list for WLS5.1/SP8 PS: The fix leaves (at least) two bugs open, one leading to trouble with
RE: URGENT RE: token issue in hyperlink
I was able to see the Token . I am talking about the jsessionid that will be created for a hyperlink. If the html:link tag is used, it automatically re-writes the url to include a jsessionid. I was unable to see this. Thanks. cheers, Amar.. -Original Message- From: Michael McCallister [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 12:23 PM To: [EMAIL PROTECTED] Subject: RE: URGENT RE: token issue in hyperlink I can't speak about the address bar (different browsers probably behave differently), but if you aren't seeing it in the generated source then there is a problem. To confirm, you don't see the org.apache.struts.taglib.html.TOKEN=4bb7c9e6084fbf88acc2aa976ea9e3 string in your generated hyperlink href? Do you see the "org.apache...TOKEN" part but not the hex string after the equals sign? If so, maybe you are not doing a saveToken(request) in an Action before you forward to your JSP page. Mike At 10:58 AM 3/7/2001, you wrote: Mike, Thanks a lot. It works. I did vote for this enhancement to take place. One question i have is...how come i don't see the session id in the address bar ? Is it because GET limits the number of characters that can be kept in the Address Bar ? Also i did not see the sessionid when i did a 'view source' and checked the source of my generated page. Clarification on this issue is greatly appreciated. cheers, Amar..
Re: Database pooling code
Work is under way on a database connection pool that can be used by Struts and other Jakarta products. The codebase includes several requested features, including monitoring expired connections. For a few additional details, see http://www.webappcabaret.com/rwald/dbcp/ . Rodney Waldhoff is working on this with Geir Magnusson, of Velocity, and several committers from other projects, including, or course, The Craig. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/commons 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.
Any reference on how to handle errors in web applications?
Hi, Does anyone have any references like articles, etc. on the best practices for handling errors in web application. Are there any guidelines available anywhere? Thanks in anticipation. -Nimmi
Re: Parallel Forms Bean Instances, does Struts support it
Hi, thanks for the quick reply/ That would beok if we had a well defined number of services. These services are dinamically created by the user. For example: Do give a scop of what i am trying to do: Imagine an application that would allow you to create and mantain multiple Instances of aXYZ Servers (Web,Direcotry,appserver, whatever) in a particular host. The administrator wanted to instanciate lets say an app server to run on port 8080 and it used this web application to make/edit this configuration. Than hi also creates another instance throug this web application, this one to run on port 18080. Thistwo seperates instances could be managedwith the same application server. The would have the same set of configuration items however their configuration is disjoint. The thing is, i cannont predifine Id's to actions/forms. because that number of instances of servers dynamically grows as the user may create or delete server instances. Also a user may be editingmany server info at the same time. (in separate windows but sharing the same sesssion) BTW, what is the purpose/difference of: ActionForm and ActionFormBean? - Original Message - From: Nanduri, Amarnath To: '[EMAIL PROTECTED]' Sent: Wednesday, March 07, 2001 10:00 AM Subject: RE: Parallel Forms Bean Instances, does Struts support it Correct me if i am wrong One way to do it would be to give 'request' scope to the form. In the Action class, you set the form to a session scope, under a different key...one for each different service. Make sure that only one kind of Action can handle one kind of service. i.e for Service A, use Action A and for Service B use Action B. In your action classes set the scope of forms to session (using different keys). Also in your struts-config.xml file, set the scope (for every action) to request. cheers, Amar.. -Original Message-From: Sarbjit Singh [mailto:[EMAIL PROTECTED]]Sent: Wednesday, March 07, 2001 10:50 AMTo: [EMAIL PROTECTED]Subject: Parallel Forms Bean Instances, does Struts support it Hello, I am new to Struts. One thing that is key in making a decision on weather to use or not to use Struts is this. Suppose I have an ActionForm with class type com.myapp.MyServiceForm. This would be a form bean that would represent some sortr of service in an application that is supposed to control system services. Is there a way or is Struts able todistinguish 2 instances of the MyServiceForm , one for service A and one for Service B. My interpretation of the the Source Code is that the ActionFormBeans class only cashes one copy of the form class keyed off by the logical name of the form. How would you deal with relating the aproriate bean to a form when you have multiple instances of the form bean Am i looking at it from the wrong perspective? Thanks for in info. Thanks
Re: URGENT RE: token issue in hyperlink
I think you must disable the cookies of your browser "Nanduri, Amarnath" wrote: I was able to see the Token . I am talking about the jsessionid that will be created for a hyperlink. If the html:link tag is used, it automatically re-writes the url to include a jsessionid. I was unable to see this. Thanks. cheers, Amar.. -Original Message- From: Michael McCallister [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 12:23 PM To: [EMAIL PROTECTED] Subject: RE: URGENT RE: token issue in hyperlink I can't speak about the address bar (different browsers probably behave differently), but if you aren't seeing it in the generated source then there is a problem. To confirm, you don't see the org.apache.struts.taglib.html.TOKEN=4bb7c9e6084fbf88acc2aa976ea9e3 string in your generated hyperlink href? Do you see the "org.apache...TOKEN" part but not the hex string after the equals sign? If so, maybe you are not doing a saveToken(request) in an Action before you forward to your JSP page. Mike At 10:58 AM 3/7/2001, you wrote: Mike, Thanks a lot. It works. I did vote for this enhancement to take place. One question i have is...how come i don't see the session id in the address bar ? Is it because GET limits the number of characters that can be kept in the Address Bar ? Also i did not see the sessionid when i did a 'view source' and checked the source of my generated page. Clarification on this issue is greatly appreciated. cheers, Amar.. -- This email is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Sema Group. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. --
Re: Database pooling code
Ted, I've seen a lot of discussion re: connection pooling, etc. Perhaps you can answer my question as to why people just don't use the connection pooling in drivers supporting the JDBC 2.0 spec (apart from the obvious situation where the drivers don't yet support 2.0, in which case, considering how long that spec's been available, I'd consider switching databases). -Donnie [EMAIL PROTECTED] 03/07/01 12:49PM Work is under way on a database connection pool that can be used by Struts and other Jakarta products. The codebase includes several requested features, including monitoring expired connections. For a few additional details, see http://www.webappcabaret.com/rwald/dbcp/ . Rodney Waldhoff is working on this with Geir Magnusson, of Velocity, and several committers from other projects, including, or course, The Craig. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/commons 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.
RE: Problem for connecting DB
Here is the whole exception info: Error: 500 Location: /database-test/logon.do Internal Servlet Error: java.lang.NoSuchMethodError at com.sapmarkets.isa.cic.LogonAction.perform(LogonAction.java:117) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va:1456) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1334) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:447) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection (HttpConnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) By the way, I tried the traditional JDBC(Not use the Datasource interface) to connect the DB. It works. Why struts way does NOT work? Thanks! -Original Message- From: Jim Richards [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 7:17 PM To: [EMAIL PROTECTED] Subject: Re: Problem for connecting DB Can you send the top few lines from the exception stack trace? I think I have a similar problem with a different set up (solaris/postgreSQL). I have a feeling the database code just doesn't work. "Wang, Meng" wrote: Dear Jim, Thank you for your rapid response. Here is the specific information: Web server: tomcat321 database: ACCESS OS: Window 2000 JDK:JDK1.3 -- 1. For testing purpose, I put database under my application root directory and setup DSN in ODBC. 2. I initiate the database config in the struts-config.xml: data-sources data-source autoCommit="false" description="Example Data Source Configuration" driverClass="sun.jdbc.odbc.JdbcOdbcDriver" maxCount="4" minCount="2" key="abc" password="" url="jdbc:odbc:test" user="" / /data-sources 3. The codes in the Action class for connecting the database is: try { DataSource ds = servlet.findDataSource("abc"); . The problem is: can NOT find the data source. Is there any more thing to do for connecting the database? Thanks a lots!!
Re: Interface testing
Thanks - I think JUnit will help a lot to improve my development process. I'm still interesting in hearing about techniques people use to separate the design of the UI (jsp pages) from the backend implementation (Action classes). Currently, I have to write ActionForm's and Action's so the jsp pages don't get exceptions. I'd like to be able to decouple these two separate phases of development as much as possible... Zach Michael Kelly wrote: I've been using JUnit to test the form and action objects (which required creating response, request, and servlet stubs for the perform method of the action object). Then I use HTTPUnit for the interface testing. -=michael=- == Michael S. Kelly _ Axian, Inc. // |_ __(_) ___ _ __ 4800 SW Griffith Dr., Ste. 202 //| |\\/ /| |/ _ \| '_ \ Beaverton, OR 97005 USA _//_| | / / | | |_| | | | | Voice: (503)644-6106 x122 (( // |_|/_/\\|_|\_/|_|_| |_| Fax: (503)643-8425 ``-'' ``-'' http://www.axian.com/ Software Consulting and Training mailto:[EMAIL PROTECTED] Axian mailto:[EMAIL PROTECTED] == On Sun, 4 Mar 2001, Zach Thompson wrote: Hello, Does anyone have suggestions about how to test the user interface of a Struts application before the backend (Action and ActionForm)'s have been implemented? I'm having trouble separating development of the UI from the backend. It seems like we spend too much time going back and forth trying to get the jsp and all the Struts tags to interact well with the Action's. Sometimes the UI is unstable or untestable until something on the backend is fixed. I think my development process is broken... xmlc from Enhydra (enhydra.org) was one approach I looked at, and I like the concept of mocking up the entire site up in html before code is written. We have found that use tests can lead to major re-designs of the backend (especially when the use tests are conducted by clients). Ideally, I'd have the UI and the backend be two separate, independently functioning units that can implemented and tested at different times by different groups and plugged together. Do I need to create Action and ActionForm stubs to use for testing? Is there something that could be integrated into Struts to help with this? Maybe have a setting in struts-config.xml that allows jsp's to run even if there are errors in Struts tags (beans not found, etc.)? Or, am I just going about this all wrong? Thanks so much, Zach
RE: Parallel Forms Bean Instances, does Struts support it
Don't predefine id's. Generate them dynamically. For example the id may be based on the appservername + port on which it runs. Since you will be storing all this info in the same session, you can get to any appserver that you want to and start/stop the services (or) whatever you want to do with them. -Original Message- The thing is, i cannont predifine Id's to actions/forms. because that number of instances of servers dynamically grows as the user may create or delete server instances. Also a user may be editingmany server info at the same time. (in separate windows but sharing the same sesssion) BTW, what is the purpose/difference of: ActionForm and ActionFormBean? - Original Message - From: Nanduri, Amarnath To: '[EMAIL PROTECTED]' Sent: Wednesday, March 07, 2001 10:00 AM Subject: RE: Parallel Forms Bean Instances, does Struts support it Correct me if i am wrong One way to do it would be to give 'request' scope to the form. In the Action class, you set the form to a session scope, under a different key...one for each different service. Make sure that only one kind of Action can handle one kind of service. i.e for Service A, use Action A and for Service B use Action B. In your action classes set the scope of forms to session (using different keys). Also in your struts-config.xml file, set the scope (for every action) to request. cheers, Amar.. -Original Message-From: Sarbjit Singh [mailto:[EMAIL PROTECTED]]Sent: Wednesday, March 07, 2001 10:50 AMTo: [EMAIL PROTECTED]Subject: Parallel Forms Bean Instances, does Struts support it Hello, I am new to Struts. One thing that is key in making a decision on weather to use or not to use Struts is this. Suppose I have an ActionForm with class type com.myapp.MyServiceForm. This would be a form bean that would represent some sortr of service in an application that is supposed to control system services. Is there a way or is Struts able todistinguish 2 instances of the MyServiceForm , one for service A and one for Service B. My interpretation of the the Source Code is that the ActionFormBeans class only cashes one copy of the form class keyed off by the logical name of the form. How would you deal with relating the aproriate bean to a form when you have multiple instances of the form bean Am i looking at it from the wrong perspective? Thanks for in info. Thanks
RE: Minimizing Action class proliferation
I know what you're saying, but hopefully your action classes are small, and you haven't emulated the example application, which places business logic in the Action class. That stuff should be in separate business logic beans (code to do the database access, business logic, etc). Maybe that's what you've missed. There's going to be an Action class for each type of action the user can do, pretty much, but they should only perform that 'traffic cop' functionality of using the business logic beans to do the work, forwarding to the next appropriate page, trapping/logging any exceptions, etc. Bill Hines Hershey Foods -Original Message- From: DONNIE HALE [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 11:25 AM To: [EMAIL PROTECTED] Subject: Minimizing Action class proliferation I'm certainly not the most experienced Struts person around, so weigh my opinions accordingly. However, it's repeatedly occurred to me that one of the "barriers to entry", so to speak, of using Struts is the rapidity with which Action classes proliferate. The project we're working on, which will eventually be fairly large but so far isn't, has dozens of Action classes. It approaches one per page that could be displayed. Perhaps there's a design pattern that we've missed which would alleviate this. But apart from looking at the request path during "perform" and then acting conditionally, which is very brute force, I don't see a lot of options. I believe it would be preferable to have a single Action class in which all related activity occurs. This makes it easier to add new "logical" actions. More importantly, however, it greatly eases maintenance in the case where you need to change a lot of related/similar code (maybe a back-end API changed). Here's one question: Would it work to specify an inner class as the "type" for an action? For example (pseudocode): public class OrderActions { public class Query extends ActionBase { ActionMapping perform( ... ) } public class Edit extends ActionBase { ActionMapping perform( ... ) } public class Save extends ActionBase { ActionMapping perform( ... ) } } I think you get the point. Assuming that I'm not completely missing something, here's what I'm thinking of as an enhancement. Add a "method" attribute to the "action" element in struts-config.xml. If present, the ActionServlet would call this method (using introspection or whatever makes sense); if it's not present, then call "perform" as we do now; if the attribute is specified but the method doesn't exists, it's an exception. Thoughts??? Thanks, Donnie
Question/Problem using Multiple Select Options
Help! Unable to send back muliple select options. // Define the Array protected String[] geography; // Get the Array public String[] getGeography() { return (geography); } // Set the Array public void setGeography(String[] geography) { { this.geography = geography; } } Code In JSP Page ** html:select property="geography" multiple="true" size="2" html:options collection="cmProviderTypes" property="value" labelProperty="label" / /html:select This is only returning 1 value??? Has anyone done this successfully? I would really appreciate some help. Thanks in advance, Spencer
Re: Tomcat 3.2.1
I've found the problem and will post it as a bug. I just wanted to see if anyone else has run into this situation. We've tested it on several machines here and have encountered the same error. First of all the environment. struts - 1.0-b1 - installed in c:\jakarta-struts-1.0-b1 tomcat - 3.2.1 - installed in c:\jakarta-tomcat-3.2.1 jdk - 1.3.0_02 - installed in c:\jdk1.3.0_02 MS Windows 2000 Also tested on NT 4.0 The struts-example.war installed in Tomcat's webapp directory run and behaves as expected. If I add c:\jakarta-struts-1.0-b1\lib\struts.jar to my Windows CLASSPATH, then run tomcat, I get several errors. 1. During Tomcat startup, I get: 2001-03-07 01:12:39 - path="/struts-example" :database: init 2001-03-07 01:12:39 - path="/struts-example" :database: Initializing database servlet 2001-03-07 01:12:39 - path="/struts-example" :database: Loading database from '/WEB-INF/database.xml' 2001-03-07 01:12:39 - path="/struts-example" :database: Database load exception - org.xml.sax.SAXException: org.apache.struts.example.User at org.apache.struts.digester.Digester.startElement(Digester.java:501) at com.sun.xml.parser.Parser.maybeElement(Parser.java:1391) at com.sun.xml.parser.Parser.content(Parser.java:1499) at com.sun.xml.parser.Parser.maybeElement(Parser.java:1400) at com.sun.xml.parser.Parser.parseInternal(Parser.java:492) 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:716) at org.apache.struts.example.DatabaseServlet.load(DatabaseServlet.java:283) at org.apache.struts.example.DatabaseServlet.init(DatabaseServlet.java:178) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317) at org.apache.tomcat.core.Handler.init(Handler.java:215) at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296) at org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(LoadOnStartupInterceptor.java:130) at org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:491) at org.apache.tomcat.core.ContextManager.init(ContextManager.java:453) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235) 2. When I open a browser (IE 5.5) and goto http://localhost:8080/struts-example, I get: Error 500 javax.servlet.jsp.JspException: Missing message for key index.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:242) at _0002findex_0002ejspindex_jsp_3._jspService(_0002findex_0002ejspindex_jsp_3.java:90) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) I will post this as a bug, has anyone else noticed this behavior? -Donnie Hall Enron Broadband Services I'm a new member to your group and am having a strange problem. I was happily writing struts code when suddenly I was unable to find applicationresources.properties and struts-config.xml from my app. I went back to the struts-example and it fails too. The only way I can make it work the example work again is to add c:\jakarta-tomcat\webapps\struts-example\WEB-INF\classes to my classpath and restart Tomcat. Of course, this is not the correct way to do this and only works for the current application. Any ideas, before I start uninstalling everything from my hard disk. Thanks, Donnie Hall Enron Broadband Services.
RE: Interface testing
I have a SuccessAction which is just an simple action that forwards to success. To test a JSP with the request first flowing through the ActionServlet you need only specify a mapping for the JSP to test in the struts-config.xml file. In the mapping specify SuccessAction as the type and your jsp as the success forward. You can define any path that you want. You still might need to create an associated ActionForm, however creating a stub ActionForm to test your JSP is fairly trivial. To test the back-end without having a JSP, I have defined a Snoop.JSP that works with a Snooper class. I have overridden the ActionServlet (i.e., the processActionForward) method to redirect any forwards to *.jsp to Snoop.jsp if the request has a http request parameter 'snoop'. Snoop.jsp with the assistance of the Snooper class uses java introspection to dump the contents of the session and request contents. This allows the Action (i.e., controller/model) to be developed independently of the view (i.e., JSP). -Original Message- From: Zach Thompson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 1:34 PM To: [EMAIL PROTECTED] Subject: Re: Interface testing Thanks - I think JUnit will help a lot to improve my development process. I'm still interesting in hearing about techniques people use to separate the design of the UI (jsp pages) from the backend implementation (Action classes). Currently, I have to write ActionForm's and Action's so the jsp pages don't get exceptions. I'd like to be able to decouple these two separate phases of development as much as possible... Zach Michael Kelly wrote: I've been using JUnit to test the form and action objects (which required creating response, request, and servlet stubs for the perform method of the action object). Then I use HTTPUnit for the interface testing. -=michael=- == Michael S. Kelly _ Axian, Inc. // |_ __(_) ___ _ __ 4800 SW Griffith Dr., Ste. 202 //| |\\/ /| |/ _ \| '_ \ Beaverton, OR 97005 USA _//_| | / / | | |_| | | | | Voice: (503)644-6106 x122 (( // |_|/_/\\|_|\_/|_|_| |_| Fax: (503)643-8425 ``-'' ``-'' http://www.axian.com/ Software Consulting and Training mailto:[EMAIL PROTECTED] Axian mailto:[EMAIL PROTECTED] == On Sun, 4 Mar 2001, Zach Thompson wrote: Hello, Does anyone have suggestions about how to test the user interface of a Struts application before the backend (Action and ActionForm)'s have been implemented? I'm having trouble separating development of the UI from the backend. It seems like we spend too much time going back and forth trying to get the jsp and all the Struts tags to interact well with the Action's. Sometimes the UI is unstable or untestable until something on the backend is fixed. I think my development process is broken... xmlc from Enhydra (enhydra.org) was one approach I looked at, and I like the concept of mocking up the entire site up in html before code is written. We have found that use tests can lead to major re-designs of the backend (especially when the use tests are conducted by clients). Ideally, I'd have the UI and the backend be two separate, independently functioning units that can implemented and tested at different times by different groups and plugged together. Do I need to create Action and ActionForm stubs to use for testing? Is there something that could be integrated into Struts to help with this? Maybe have a setting in struts-config.xml that allows jsp's to run even if there are errors in Struts tags (beans not found, etc.)? Or, am I just going about this all wrong? Thanks so much, Zach
RE: Minimizing Action class proliferation
Bill, Thanks for responding. I understand what you're saying re: keeping the action classes simple. However, it still makes the whole cycle more tedious than perhaps it needs to be. It's harder to write "helper" methods, perhaps for bean manipulation, that can be shared across action classes. In the real world, where revision control is being used, you have to make sure to check all the action classes in. And so on. Further, the smaller those action classes are, the more painful it is to have to put each in a separate source file. I did answer my own question regarding nested classes, and perhaps came up with a design pattern in the process. I've successfully used nested classes as action classes: public class SampleActions { public static class Step1 extends Action { public ActionForward perform( ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws java.io.IOException, ServletException { SampleFormBean b = (SampleFormBean) form; // whatever return mapping.findForward("next"); } } public static class Step2 extends Action { public ActionForward perform( ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws java.io.IOException, ServletException { SampleFormBean b = (SampleFormBean) form; // whatever return mapping.findForward("next"); } } } The only trick is that you have to specify the "type" attribute in struts-config.xml as "package.OuterClass$InnerClass" (note the '$' qualifier rather than a '.'). My not-yet-fully-formed thinking is to represent all action classes which have the same "name" attribute (the form bean) as nested classes in the same outer class. There may be a better way to determine what actions should be considered "related". Donnie [EMAIL PROTECTED] 03/07/01 02:11PM I know what you're saying, but hopefully your action classes are small, and you haven't emulated the example application, which places business logic in the Action class. That stuff should be in separate business logic beans (code to do the database access, business logic, etc). Maybe that's what you've missed. There's going to be an Action class for each type of action the user can do, pretty much, but they should only perform that 'traffic cop' functionality of using the business logic beans to do the work, forwarding to the next appropriate page, trapping/logging any exceptions, etc. Bill Hines Hershey Foods -Original Message- From: DONNIE HALE [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 11:25 AM To: [EMAIL PROTECTED] Subject: Minimizing Action class proliferation I'm certainly not the most experienced Struts person around, so weigh my opinions accordingly. However, it's repeatedly occurred to me that one of the "barriers to entry", so to speak, of using Struts is the rapidity with which Action classes proliferate. The project we're working on, which will eventually be fairly large but so far isn't, has dozens of Action classes. It approaches one per page that could be displayed. Perhaps there's a design pattern that we've missed which would alleviate this. But apart from looking at the request path during "perform" and then acting conditionally, which is very brute force, I don't see a lot of options. I believe it would be preferable to have a single Action class in which all related activity occurs. This makes it easier to add new "logical" actions. More importantly, however, it greatly eases maintenance in the case where you need to change a lot of related/similar code (maybe a back-end API changed). Here's one question: Would it work to specify an inner class as the "type" for an action? For example (pseudocode): public class OrderActions { public class Query extends ActionBase { ActionMapping perform( ... ) } public class Edit extends ActionBase { ActionMapping perform( ... ) } public class Save extends ActionBase { ActionMapping perform( ... ) } } I think you get the point. Assuming that I'm not completely missing something, here's what I'm thinking of as an enhancement. Add a "method" attribute to the "action" element in struts-config.xml. If present, the ActionServlet would call this method (using introspection or whatever makes sense); if it's not present, then call "perform" as we do now; if the attribute is specified but the method doesn't exists, it's an exception. Thoughts??? Thanks, Donnie
Problem with using logic:equal tag
I want to use logic:equal with a boolean attribute of a bean. But I always received error: -- Exception Report: javax.servlet.ServletException: No bean found under attribute key currentSupplier at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:481) at _0002fsuppliers_0002ejspsuppliers_jsp_0._jspService(_0002fsuppliers_0002ejsp suppliers_jsp_0.java:272) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) . Root Cause: javax.servlet.jsp.JspException: No bean found under attribute key currentSupplier at org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:131) at _0002fsuppliers_0002ejspsuppliers_jsp_0._jspService(_0002fsuppliers_0002ejsp suppliers_jsp_0.java:258) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) ... - This is my JSP page: logic:iterate id="currentSupplier" name="ViewSuppliersAction.suppliers" scope="request" ... logic:equal name="currentSupplier" property="active" scope="request" value="true" input type="checkbox" name="checkbox" checked /logic:equal logic:equal name="currentSupplier" property="active" scope="request" value="false" input type="checkbox" name="checkbox" /logic:equal ... /logic:iterate - I don't know what's wrong. Maybe this tag can't handle boolean value? I know that currentSupplier bean is valid (because bean:message tag can work in the logic:iterate tag) Please help me! Regards, Thai
RE: Tomcat 3.2.1
Hi.. This is the from the archive... dated: Tue 2/13/01 Subject: Classpaths and the "struts.jar" file From: Craig R. McClanahan [[EMAIL PROTECTED]] Hope this helps Sudhi There has been some confusion around the issue of placing "struts.jar" on your CLASSPATH at execution time, in a servlet container like Tomcat that makes all such libraries visible to web applications. This message is an attempt to clarify the issues, and document why this is prohibited. * The "struts.jar" must appear on your classpath at compile time for your web application. The easiest way to make this happen is to use an Ant "build.xml" file (like Struts itself does) that sets the classpath dynamically, or create a custom shell script that sets the classpath temporarily for compiling Struts based classes. * The "servlet.jar" file (from your servlet container) must be on your classpath at compile time as well, because your application's Action classes will refer to interfaces that are defined here. * For reasons discussed further below, "struts.jar" MUST NOT be on your system CLASSPATH when you start your servlet container (in particular, this applies to Tomcat). * Placing JAR files in $JAVA_HOME/jre/lib/ext (the system extensions directory for Java2) is the same as placing them on the classpath. In other words, you will NOT want to put "struts.jar" or "servlet.jar" there. * For Tomcat, placing JAR files in the "lib" directory (as opposed to the WEB-INF/lib directory of your web app) causes them to be added to the CLASSPATH automatically. Therefore, you should not put struts.jar here either. The reason that putting "struts.jar" on your classpath is a bad idea has to do with the way classloaders work in most servlet containers. The details differ between them -- but here is the scoop for Tomcat (3.x and 4.x): * The library files that are placed on the CLASSPATH when Tomcat starts up are made visible through the "system" class loader. * Each individual web application has a custom class loader created for it, which makes the classes in WEB-INF/classes and WEB-INF/lib visible. The "parent" class loader of this custom class loader is set to the system class loader mentioned above. * When classes are loaded, the JVM starts at the bottom of the hierarchy of class loaders, with the webapp class loader, and works its way up the hierarchy until it finds that class. Thus, if you have struts.jar in the system classpath, classes from struts.jar will be loaded by the system class loader instead of the web app class loader. * When a loaded class references other classes, it looks in its own class loader first, and then up the hierarchy. Under NO circumstances will it go down the hierarchy. * Therefore, if a Struts class is loaded from the system class path, that class CANNOT see any of your application classes in WEB-INF/classes or WEB-INF/lib -- you will get ClassNotFoundException instead. This is the reason that the Struts example application will not run when you have "struts.jar" on your CLASSPATH. The digester module of Struts is loaded from the system class path. Therefore, it cannot see the "User" class of the example app, because that class is under WEB-INF/classes. If you find that you need to put "struts.jar" on your system classpath to make Struts work in Tomcat, that means your Tomcat install has been corrupted. If you find that your own app will not work UNLESS struts.jar is in the system classpath, there is something about your application organization that needs to be analyzed in detail. Craig I've found the problem and will post it as a bug. I just wanted to see if anyone else has run into this situation. We've tested it on several machines here and have encountered the same error.
build problems, finding javax.sql.DataSource
I am having problems building any of the applications found in struts. It can't seem to import the javax.sql.DataSource package. Does anyone know where I might find this package? Here are the details of the error: [javac] C:\jakarta-struts-1.0-b1\jakarta-struts-1.0-b1-src\src\share\org\apache\struts\action\ActionServlet.java:82: cannot resolve symbol [javac] symbol : class DataSource [javac] location: package sql [javac] import javax.sql.DataSource; [javac] ^ Thanks in advance, Mike
Re: Problem with using logic:equal tag
Hello, There's nothing wrong with the Struts logic handling the boolean value. The problem is that you misunderstood the iterate syntax. Looking at the thrown exception, it seems that it couldn't find your bean. In your code, logic:iterate id="currentSupplier" name="ViewSuppliersAction.suppliers" scope="request" since you left out the property attribute in the logic:iterate, Struts will assume that your name attribute (ViewSuppliersAction.suppliers) is a bean name. Try this: logic:iterate id="currentSupplier" name="ViewSuppliersAction" property="suppliers" scope="request" BTW, are you located in Vietnam? or at your headquarter in GA?... just curious Happy Strutting Du~ng - Original Message - From: "Thai Thanh Ha" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 4:43 AM Subject: Problem with using logic:equal tag I want to use logic:equal with a boolean attribute of a bean. But I always received error: -- Exception Report: javax.servlet.ServletException: No bean found under attribute key currentSupplier at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:481) at _0002fsuppliers_0002ejspsuppliers_jsp_0._jspService(_0002fsuppliers_0002ejsp suppliers_jsp_0.java:272) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) . Root Cause: javax.servlet.jsp.JspException: No bean found under attribute key currentSupplier at org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:131) at _0002fsuppliers_0002ejspsuppliers_jsp_0._jspService(_0002fsuppliers_0002ejsp suppliers_jsp_0.java:258) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) ... - This is my JSP page: logic:iterate id="currentSupplier" name="ViewSuppliersAction.suppliers" scope="request" ... logic:equal name="currentSupplier" property="active" scope="request" value="true" input type="checkbox" name="checkbox" checked /logic:equal logic:equal name="currentSupplier" property="active" scope="request" value="false" input type="checkbox" name="checkbox" /logic:equal ... /logic:iterate - I don't know what's wrong. Maybe this tag can't handle boolean value? I know that currentSupplier bean is valid (because bean:message tag can work in the logic:iterate tag) Please help me! Regards, Thai _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: Struts Framework Class Model
Could you repost the model with a XMI format ? Thanks Joel --- JeffTaillon [EMAIL PROTECTED] a crit : Hello I say a request for the class model of the struts framework. I attached the model file. Unzip and open the readme file. For me it helped a lot... A+ Jeff ATTACHMENT part 2 application/x-zip-compressed name=StrutsFrameworkModel.zip ___ Do You Yahoo!? -- Pour dialoguer en direct avec vos amis, Yahoo! Messenger : http://fr.messenger.yahoo.com
Re: can't get struts working w/ orion ...
This has been discussed in length on both the struts-user and orion-interest mailing lists. I suggest you search www.mail-archive.com for hints. If I recall correctly, Struts-1.0b1 won't work in Orion (for exact reasons, search the above). Try Struts-0.5 and it should work fine. --- "G.L. Grobe" [EMAIL PROTECTED] wrote: After reading this, could it be that I don't have my ActionServlet installed. I thought I'd be able to just test the taglibs in a very simple configuration. Just started learning struts. I'm using orion server 1.4.5. I've got the struts.jar in my ~/WEB-INF/lib dir and have listed the taglibs in the ~/WEB-INF/web.xml file as well as included all the *.tld files in this same dir. snip __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
RE: Minimizing Action class proliferation
Bill Hines said: I know what you're saying, but hopefully your action classes are small, and you haven't emulated the example application, which places business logic in the Action class. Are there plans to revise the example application so it doesn't have these problems? Personally, I think a good example is worth a thousand newsgroup postings. :-) Dan
question about ActionForm reset()
I have a Actionform with request scope populated using PropertyUtil.copyProperties() and forwarded another page. All the properties display correctly on that page but when I actually submit I see the reset() method being called and then validate(), however between reset() and validate() the form properties are not repopulated and validation fails. This is very much like the example edit/save subscription example which works perfectly. Anyone have any ideas on where I'm going wrong? Thanks Sean
a simple struts test
Should my struts-config.xml have to be configured if I'm just testing to see ifI can get struts working w/ Orion. I've been having trouble getting struts working with orion 1.4.5. I've done everything the struts docs have said for the install and taken out all struts*.tld's from the struts.jar (removed, andwhich is in my WEB-INF/lib dir) and put them in theWEB-INF dir. Made the correct entries to web.xml. So I think I've got everything needed for a basic test of jsp's w/ a very simple config. I'm wondering if I need to do the controller, config files,etc.. for a simple test like this. %@ page language="java" %%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % html:htmlheadtitle bean:message key="main.title" //title/head bodyhtml:errors / This is a atest./body/html:html Any help much appreciated.
Re: HTML Radio
It looks like no bean was found for the form in which your radio button is contained. Struts is trying to obtain the actionType property from this bean to set up the radio button. Since your html:radio tag does not specify the name attribute, Struts looks for the bean for the html:form tag. You don't specify name there either, so the form tag would have tried to locate a bean based on information under the corresponding action entry in your struts-config.xml file. If there is no entry there, then I guess you would be out of luck, which may be what's happening here. Hope this helps. -- Martin Cooper - Original Message - From: "Frank Ling" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 05, 2001 8:18 PM Subject: HTML Radio Hi, There: I try to using HTML Redio tags, and keeping getting following error: javax.servlet.jsp.JspException: No getter method available for property actionType for bean under name org.apache.struts.taglib.html.BEAN at org.apache.struts.taglib.html.RadioTag.doStartTag(RadioTag.java:197) My simple JSP page is as following: %@ page language="java" % %@ taglib uri="/WEB-INF/apt.tld" prefix="apt" % %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" % %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % %@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" % app:checkLogon/ jsp:useBean id="user" scope="session" type="com.ingenuity.app.apt.User"/ html:html head titlebean:message key="paymentSearch.title"//title html:base/ /head body bgcolor="white" html:form action="/paymentSearch" h3bean:message key="paymentSearch.heading"/ jsp:getProperty name="user" property="username"//h3 tr th align="right"Single Select Allowed:/th td align="left" html:radio property="actionType" value="displayStm" bean:message key="paymentSearch.searchType.displayStm"/ /html:radio html:radio property="actionType" value="reinsertArticle" bean:message key="paymentSearch.searchType.reinsertArticle"/ /html:radio html:radio property="actionType" value="interestCountry" bean:message key="paymentSearch.searchType.interestCountry"/ /html:radio /td /tr tr td align="right" html:submitSave/html:submit /td td align="left" html:resetReset/html:reset html:cancelCancel/html:cancel /td /tr ul lihtml:link page="/logoff.do"bean:message key="paymentSearch.logoff"//html:link/li /ul /html:form /body /html:html I don't really understand what is this getter method mean, and it's really frastrated. Any help will be highly appreciated. Regard Frank Ling
select options
Hi, Looking at: http://jakarta.apache.org/struts/struts-html.html#select I notice that for the name attribute, the following description is given: name The fully-qualified java class name of the bean containing the underlying property. [RT Expr] Is this correct? I thought 'type' was usually used for class names and 'name' was used for variable names. Could someone please tell me what the name attribute means and when it should/shouldn't be used with select boxes? Cheers, Nick
Indexed and nested references
Hi I have been away from this list for a while, so please forgive me if this is a known problem. I was not able to find a reference... I am using a JSP with a form bean that has the following properties: Vector questions; String foo; There are the usual accessors: public QuestionBean getQuestion(int no); public String getFoo(); ... Each element in the vector is a QuestionBean, and each QuestionBean has: Vector answers; String userText; and the usual accessors: public AnswerBean getAnswer(int no); public String getUserText(); Each element in *this* vector is an AnswerBean, with only scalar properties and accessors. My jsp then uses constructs that result in this HTML: input type="text" name="question[0].userText" value="Blue" The JSP is properly populated before it's displayed. (Note the value "Blue" above.) All the values are correctly pulled from the form bean and its nested beans. When I submit the form, the next action uses the same form bean class, and this is where things fall apart. The only request parameter that gets pulled into the form bean is foo. The indexed "question" is not recognized. I reuse the QuestioBean as a form in another place (It extends ActionForm) and the generated HTML does not use any indexed or nested references. It works perfectly. So what's happening? Is the indexed/nested stuff broken? Is the problem caused by the fact that question[0] yields another bean? (The docs say you can combine index/nested/simple references.) And why does the formBean -- JSP populating work, but request -- formBean not? Any and all hints gratefully accepted. --johnt
Re: Cannot find message resources underkeyorg.apache.struts.action.MESSAGE
In a word, internationalization. (OK, it's a very long word! :-) ) Different users may be running in different locales, so the message resources need to be stored on a per-user basis. -- Martin Cooper - Original Message - From: "Jeff Schnitzer" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 04, 2001 11:12 PM Subject: RE: Cannot find message resources under keyorg.apache.struts.action.MESSAGE The next logical question is then: Why does Struts store resources in the session (actually, servlet context)? What is wrong with using the static cache that ResourceBundle maintains? Since each web application should have its own classloader, there shouldn't be any risk of conflict. Thanks, Jeff Schnitzer [EMAIL PROTECTED] -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Sunday, March 04, 2001 7:21 PM To: [EMAIL PROTECTED] Subject: Re: Cannot find message resources under keyorg.apache.struts.action.MESSAGE Why does struts eschew the ResourceBundle for a homebrew framework? The problem, as I understand it, boils down to the fact that ResourceBundle does not implement Serializable. Struts stores application resources in the session. However, some containers require that objects stored in the session implement Serializable in order for the web app to be distributable. Since ResourceBundle does not meet this requirement, a new implementation was constructed which does. (Originally, Struts did indeed use ResourceBundle for its resources.) -- Martin Cooper - Original Message - From: "Jeff Schnitzer" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, March 03, 2001 3:59 AM Subject: RE: Cannot find message resources under key org.apache.struts.action.MESSAGE The problem is that the Orion classloader does not implement getResourceAsStream(). It's been logged in Orion's bugzilla. There are workarounds posted in the struts-user and orion-interest archives, mostly involving packaging the application in funny ways. Yuck. This was a brief conversation on the Orion list, but it's probably more appropriate here: Why does struts eschew the ResourceBundle for a homebrew framework? Jeff -Original Message- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 03, 2001 1:27 AM To: [EMAIL PROTECTED] Subject: Cannot find message resources under key org.apache.struts.action.MESSAGE Just started learning struts. I'm using orion server 1.4.5. I've got the struts.jar in my ~/WEB-INF/lib dir and have listed the taglibs in the ~/WEB-INF/web.xml file as well as included all the *.tld in this same dir. taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-html.tld/taglib-uri taglib-location/WEB-INF/struts-html.tld/taglib-location /taglib ... When running the following page, I get the error list down below: I've also got a file called 'myProps.properties' packaged under the ~/WEB-INF/classes/com.mydir1/mydir2/resources dir. index.jsp --- %@ page language="java" % %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" % %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % html:html head title bean:message key="main.title" / /title /head body html:errors / This is a atest. /body /html:html --- error output - 500 Internal Server Error javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE at org.apache.struts.util.RequestUtils.message(RequestUtils.java, Compiled Code) at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at com.orionserver.http.OrionHttpJspPage.service(JAX, Compiled Code) at com.evermind.server.http.HttpApplication.xj(JAX, Compiled Code) at com.evermind.server.http.JSPServlet.service(JAX, Compiled Code) at com.evermind.server.http.d3.sw(JAX, Compiled Code) at com.evermind.server.http.d3.su(JAX, Compiled Code) at com.evermind.server.http.ef.s1(JAX, Compiled Code) at com.evermind.server.http.ef.do(JAX, Compiled Code) at com.evermind.util.f.run(JAX, Compiled Code) Any help much appreciated.
RE: Form tags
Does anyone have any ideas about this? -Original Message- From: Brian Knorr [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 12:16 PM To: [EMAIL PROTECTED] Subject: struts -- Form tags Ted, Hi... I was wondering if you ever heard anything back from the struts user group on the "Form tags" issue you posted? I was wondering the exact same thing... especially for radio buttons. Thanks, Brian Knorr NextJet! the leader in same day delivery. -Original Message- From: Ted Bergeron [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 5:28 PM To: Struts-User Subject: Form tags I'm wondering about the logic behind the form tags. Here I have a simple form that is created by iterating over a collection. The iterator exposes the variable "item" which is a String for this simple case. The name attribute of bean:write treats "item" as a variable, while the value attribute of various form tags (radio, text, hidden) treats "item" as a literal. Thus, the "%= item %" workaround. This workaround leads to code that is not well formed xml, and becomes much uglier with a collection of complex objects. Am I using the framework incorrectly? Is this an oversight/bug? Is this a necessary behavior? Thanks for the help, Ted %java.util.ArrayList list = new java.util.ArrayList(); list.add("First"); list.add("Second"); list.add("Third"); list.add("Fourth"); list.add("Fifth"); pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE); % html:form action="/test.do" table logic:iterate id="item" name="list" type="java.lang.String" tr tdhtml:radio property="username" value="item"//td tdhtml:radio property="username" value="%= item %"//td tdbean:write name="item"//td /tr /logic:iterate /table /html:form
Dynamic selections from Option tag
Hi All, The scenario is this, I have 2 option boxes I would like to make what is available in the 2nd option box dependent on what is selected in the first option box, is this possible? Ifnothow can I achieve the same affect. Thanks in advance Cameron Ingram
Re: Dynamic selections from Option tag
Cameron Ingram0 wrote: Hi All, The scenario is this, I have 2 option boxes I would like to make what is available in the 2nd option box dependent on what is selected in the first option box, is this possible? If not how can I achieve the same affect. This is possible, and i believe you have two options for this. 1) write a java script function that changes the values of the second box after an onchange event of the first. You can populate arrays of data using the struts logic:iterate tag. 2) If you have a lot of data, do a post back to the server after the first box onchange event fires, then resend the page with the second box populated. Regards, Nick Thanks in advance Cameron Ingram
RE: Problem for connecting DB
So, Did you figure out the problem? Thanks! Meng Wang -Original Message- From: Jim Richards [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 7:17 PM To: [EMAIL PROTECTED] Subject: Re: Problem for connecting DB Can you send the top few lines from the exception stack trace? I think I have a similar problem with a different set up (solaris/postgreSQL). I have a feeling the database code just doesn't work. "Wang, Meng" wrote: Dear Jim, Thank you for your rapid response. Here is the specific information: Web server: tomcat321 database: ACCESS OS: Window 2000 JDK:JDK1.3 -- 1. For testing purpose, I put database under my application root directory and setup DSN in ODBC. 2. I initiate the database config in the struts-config.xml: data-sources data-source autoCommit="false" description="Example Data Source Configuration" driverClass="sun.jdbc.odbc.JdbcOdbcDriver" maxCount="4" minCount="2" key="abc" password="" url="jdbc:odbc:test" user="" / /data-sources 3. The codes in the Action class for connecting the database is: try { DataSource ds = servlet.findDataSource("abc"); . The problem is: can NOT find the data source. Is there any more thing to do for connecting the database? Thanks a lots!!
Re: Anyway to onFocus without Javascript?
Well, there is, but I don't think this answers the original question. You can use the focus attribute of the html:form tag: html:form action="[action]" focus="[name of field to focus on]" Alas, this will make it so that that field is always focussed on, not the field that gave the error. I am not sure if that is possible. - eric - Original Message - From: "William Jaynes" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 2:02 PM Subject: Re: Anyway to onFocus without Javascript? Sorry, Jessica, There is no way to focus on to an html field without using JavaScript. - Original Message - From: "Anderson, Jessica" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 10:31 AM Subject: Anyway to onFocus without Javascript? Does Struts provide any mechanism for focusing on a text field in the event that the field did not pass validation - WITHOUT using Javascript? Not sure if this is possible...thought i'd ask. Thanks, Jessica
RE: Minimizing Action class proliferation
Donnie, How about this as an alternative. I have created a subclass of Action called StandardAction which uses reflection to invoke a method with the same name as the "actions" path (defined in the struts-config.xml file). So all you have to do is extend the Standard action and implement methods that correspond to the paths that use it. For example if you define three actions in your struts-config.xml file of /saveOrder, /editOrder and /deleteOrder that all use a class OrderAction which extends StandardAction and then create a OrderAction class as shown below: I hope this is of use. Niall --Example of StandardAction implementation--- public class OrderAction extends StandardAction{ public ActionForward saveOrder(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { } public ActionForward editOrder(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { } public ActionForward deleteOrder(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { } } ---StandardAction Class--- package nkp; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; /** * @author Niall Pemberton * @version 1.0 */ public abstract class StandardAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { // Determine the method name to call (based on the path without the "/") String methodName = mapping.getPath().substring(1); // Get the method with the same name as the path Class cls = this.getClass(); Method method = null; try { method = cls.getMethod(methodName, new Class[] {ActionMapping.class, ActionForm.class, HttpServletRequest.class, HttpServletResponse.class}); } catch (NoSuchMethodException ex) { servlet.log("Method "+methodName+" not found in class "+this.toString()); } // Invoke the Method Object obj = null; try { obj = method.invoke(this, new Object[] {mapping, form, request, response}); } catch (InvocationTargetException etargEx) { servlet.log("Error Involing Method "+methodName+"(InvocationTargetException) "+this.toString()); } catch (IllegalAccessException illEx) { servlet.log("Error Involing Method "+methodName+"(IllegalAccessException) "+this.toString()); } ActionForward actionForward = (ActionForward)obj; // Forward control to the specified success URI return actionForward; } } winmail.dat
Re: setting a property from a parameter
Would somebody please tell me the proper way to set a form property from a request parameter? The short answer to this is that you don't - Struts does all the work for you. If the submitted query string contains 'mode=foo', then Struts will call setMode("foo") on your form bean before your Action's perform() method is called. You can access the value using your form bean's getMode() method. If you need to set up 'mode' as a hidden field so that 'mode=foo' is always submitted, then you only need: html:hidden property="mode"/ When the JSP is processed, Struts will call your form bean's getMode() method and use the result to generate the 'value' attribute of the input tag. Hope this helps. -- Martin Cooper - Original Message - From: "Fickes, Vic" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 06, 2001 11:24 AM Subject: setting a property from a parameter Would somebody please tell me the proper way to set a form property from a request parameter? After reading the docs on the html:hidden tag I thought I could do it using the value attribute: html:hidden property="mode" value="%= request.getParameter('mode') %"/ But this doesn't appear to call the setMode() method of the Form. Then I tried using the bean:define tag, again using the value attribute: bean:define id="mode" property="mode" name="testForm" value="%= request.getParameter('mode') %"/ But this doesn't work either. Currently, this is the only way I found to do it, but it seems kind of klunky. bean:define id="testForm" name="testForm"/ % ((web.app.test.TestForm)testForm).setMode(request.getParameter("mode")); % Thanks in advance, Vic
Re: JSP design
1. Dispatch schedule entry screen When your input form is submitted, Struts will populate a form bean with the values from that form, and pass the form bean to your Action class's perform() method. Your perform method would then prepare and issue the database query (or have some other business logic component do that on its behalf), and then create beans to represent the results you want to display. The perform() method would then forward to the appropriate JSP page to display the results. The Struts tags on the JSP page will extract the values from the beans and create the HTML to render them. You probably won't need custom tags, but it really depends on your particular situation. 2. Catalog display You'll most likely want to use the Struts logic:iterate tag to iterate over a collection that represents the items returned from your query. For paging, some people have had success using the Pager tag library from: http://jsptags.com/tags/navigation/pager/ Unfortunately, we needed something quite a bit more complex, so we ended up writing a set of custom tags for what we needed. Again, it really depends on your particular situation. Hope this helps. -- Martin Cooper - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 20, 2001 10:13 PM Subject: JSP design Hi I am a new-comer in the struts area and trying to evaluate the framework to use for our new B2B project. I have been going thru the examples and documentation where capturing the request and further delegation is explained. I have two scenarios in the project where I need your inputs on how to go about designing using struts: 1. Dispatch schedule entry screen --- Here I have to pick-up the schedule from the database and present it to the user and allow him to modify and submit the form. Now I am not clear how do I use struts to pick-up the schedule from the database and display it on the entry form. Do I have to develop my own JSP tag for this?? 2. Catalog display Here again I have pick up the items from the database and show to the user. Also the catalog needs to have paging mechanism and the user can select multiple items and submit the page. Anybody has done similar design using struts?? Thanks Best Regards.Biju Isac
Re: Preferred HTML Editor
DONNIE HALE wrote: It's got Tomcat built into it, so you can right-click on a JSP and say "Execute". It also has auto-completion for custom tags - once you put the prefix:tag in, it will show the list of parameters for that tag. ... Of course that means we'll all get Alzheimer's at an early age because we're not using our memory any more... Paul Jackson Meridian Informatics Sydney, Australia Ph 8233 7564 Fax 8233 7533
Re: URGENT RE: token issue in hyperlink
The session ID will only show up in the URL in two cases: 1) On the first request in the session (i.e. session creation time). 2) When cookies are disabled in the browser. On the first request, the server sends the session ID back to the browser both in the URL and in a cookie, because it doesn't know yet whether or not cookies are enabled. If it discovers that cookies are enabled, it will stop sending the session ID as part of the URL, and just use cookies from then on. If, however, cookies are disabled, then it will continue to send the session ID as part of the URL. Hope this helps. -- Martin Cooper - Original Message - From: "Nanduri, Amarnath" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 8:46 AM Subject: RE: URGENT RE: token issue in hyperlink Mike, Thanks a lot. It works. I did vote for this enhancement to take place. One question i have is...how come i don't see the session id in the address bar ? Is it because GET limits the number of characters that can be kept in the Address Bar ? Also i did not see the sessionid when i did a 'view source' and checked the source of my generated page. Clarification on this issue is greatly appreciated. cheers, Amar.. -Original Message- From: Michael McCallister [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 11:06 AM To: [EMAIL PROTECTED] Subject: Re: URGENT RE: token issue in hyperlink Here is what I do in a similar situation: html:link paramId="role" paramName="role" page='%="/user/saveUser.do?action=Removeorg.apache.struts.taglib.html.TOKE N=" + session.getAttribute("org.apache.struts.action.TOKEN")%' Removenbsp;Role /html:link It's ugly, but it works for now. Notice the single quotes around the page argument. Very important or the JSP parser will get confused by the embedded double quotes in the expression. I've submitted an enhancement request (Bug #874 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=874) to add an optional parameter to the html:link tag that would do this magic without the need for the expression shown above. If I can get Struts set up to build locally, I will probably give implementing this a go myself so I can submit a patch rather than just a request. Using the link above, you can vote for the implementation of this enhancement. Mike At 07:43 AM 3/7/2001, you wrote: Hello, I have posted this before. This is extremely urgent for me. I know that the token support exists for posting Form(s). How can i ensure that this same token will be issued to a hyperlink so that i can validate that the user will click on the hyperlink only once ? Any help is greatly appreciated. Thanks a lot. cheers, Amar.. -Original Message- From: Nanduri, Amarnath [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 2:23 PM To: '[EMAIL PROTECTED]' Subject: token issue in hyperlink Hello All , I am using the Action class saveToken() method to ensure that a token is created and set (so that the user has proper screen flow). My question is ... how can i add this token to a hyperlink ? I have a hyperlink in a jsp page, which takes me to a different Action class. I am checking for this token in the second Action class. Any help is greatly appreciated. Thanks. cheers, Amar..
Help in deciding weather or not to use struts
I'm new to struts, but I've had expierence with MVC, JSPs, and the like. I'm using Resin1.2.3 as my servlet runner. I've come into a bunch of problems using Resin + Struts and I don't know if its because of resin, or because of struts. First of all, when i put struts.jar into my application's WEB-INF/lib directory, it works under resin + linux, but it doesn't work under resin + windows. In resin + windows, I need to but the struts.jar file in c:\resin1.2.3\lib (this is where JDBC drivers and such usually go, since they can't be in WEB-INF/lib for a reason i forget right now) Does this requirement also hold for struts? Also, I've noticed that the error messages that struts gives are NOT very informative at all... Where are the stack traces? Errors like: Error creating bean x.y.c or 500 No instance of action class /blah could be created are close to useless. Yes, I could check the error.log, but those errors are not much better. I am weighing the consequences of what a switch from my home-brew sorta MVC architecture to jakarta-struts would be a good idea or not. If struts turns out to extremely difficult to debug, it might not be worth it. Would it be possible for struts to print stack traces instead of "nice" error messages. Also, would it be possible to use Log4J as the logging sub-system instead of servlet.log()? Thanks.
Re: Parallel Forms Bean Instances, does Struts support it
In your example, if the app servers have the same set of configuration items, then you only need one ActionForm class to represent that common set of items. One of the properties of your form bean would be the identifier you use to identify the particular app server associated with a request. You can use a hidden field on your JSP pages to make sure that the identifier is sent back with the request, so you do not need to maintain state on the server. The ActionForm class is the base class to use for all of your Struts application's form beans. The ActionFormBean is an internal class used to manage form beans inside of Struts. You should never need to worry about it. Hope this helps. -- Martin Cooper - Original Message - From: "Sarbjit Singh" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 9:54 AM Subject: Re: Parallel Forms Bean Instances, does Struts support it Hi, thanks for the quick reply/ That would be ok if we had a well defined number of services. These services are dinamically created by the user. For example: Do give a scop of what i am trying to do: Imagine an application that would allow you to create and mantain multiple Instances of a XYZ Servers (Web,Direcotry,appserver, whatever) in a particular host. The administrator wanted to instanciate lets say an app server to run on port 8080 and it used this web application to make/edit this configuration. Than hi also creates another instance throug this web application, this one to run on port 18080. This two seperates instances could be managed with the same application server. The would have the same set of configuration items however their configuration is disjoint. The thing is, i cannont predifine Id's to actions/forms. because that number of instances of servers dynamically grows as the user may create or delete server instances. Also a user may be editing many server info at the same time. (in separate windows but sharing the same sesssion) BTW, what is the purpose/difference of: ActionForm and ActionFormBean? - Original Message - From: Nanduri, Amarnath mailto:[EMAIL PROTECTED] To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Wednesday, March 07, 2001 10:00 AM Subject: RE: Parallel Forms Bean Instances, does Struts support it Correct me if i am wrong One way to do it would be to give 'request' scope to the form. In the Action class, you set the form to a session scope, under a different key...one for each different service. Make sure that only one kind of Action can handle one kind of service. i.e for Service A, use Action A and for Service B use Action B. In your action classes set the scope of forms to session (using different keys). Also in your struts-config.xml file, set the scope (for every action) to request. cheers, Amar.. -Original Message- From: Sarbjit Singh [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 10:50 AM To: [EMAIL PROTECTED] Subject: Parallel Forms Bean Instances, does Struts support it Hello, I am new to Struts. One thing that is key in making a decision on weather to use or not to use Struts is this. Suppose I have an ActionForm with class type com.myapp.MyServiceForm. This would be a form bean that would represent some sortr of service in an application that is supposed to control system services. Is there a way or is Struts able to distinguish 2 instances of the MyServiceForm , one for service A and one for Service B. My interpretation of the the Source Code is that the ActionFormBeans class only cashes one copy of the form class keyed off by the logical name of the form. How would you deal with relating the aproriate bean to a form when you have multiple instances of the form bean Am i looking at it from the wrong perspective? Thanks for in info. Thanks
Re: Minimizing Action class proliferation
I'm not sure if you would consider this a brute force approach or not, but here goes. You could add a parameter to your requests to identify the "sub-action" or "command" you want to invoke. At the top of your perform() method, you can call getSubAction() on your form bean, and take whatever action you desire. No Struts changes required. ;-) The problem becomes very generic at this point. You could choose to use if/then/else if you only had a small number of sub-actions. Or you could get fancy and use something similar to Struts itself, where you define a SubAction base class and maintain a HashMap mapping sub-action names to the appropriate class instances. Or you could use reflection to look for a method matching the sub-action name. Or... Hope this helps. -- Martin Cooper - Original Message - From: "DONNIE HALE" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 8:25 AM Subject: Minimizing Action class proliferation I'm certainly not the most experienced Struts person around, so weigh my opinions accordingly. However, it's repeatedly occurred to me that one of the "barriers to entry", so to speak, of using Struts is the rapidity with which Action classes proliferate. The project we're working on, which will eventually be fairly large but so far isn't, has dozens of Action classes. It approaches one per page that could be displayed. Perhaps there's a design pattern that we've missed which would alleviate this. But apart from looking at the request path during "perform" and then acting conditionally, which is very brute force, I don't see a lot of options. I believe it would be preferable to have a single Action class in which all related activity occurs. This makes it easier to add new "logical" actions. More importantly, however, it greatly eases maintenance in the case where you need to change a lot of related/similar code (maybe a back-end API changed). Here's one question: Would it work to specify an inner class as the "type" for an action? For example (pseudocode): public class OrderActions { public class Query extends ActionBase { ActionMapping perform( ... ) } public class Edit extends ActionBase { ActionMapping perform( ... ) } public class Save extends ActionBase { ActionMapping perform( ... ) } } I think you get the point. Assuming that I'm not completely missing something, here's what I'm thinking of as an enhancement. Add a "method" attribute to the "action" element in struts-config.xml. If present, the ActionServlet would call this method (using introspection or whatever makes sense); if it's not present, then call "perform" as we do now; if the attribute is specified but the method doesn't exists, it's an exception. Thoughts??? Thanks, Donnie
Re: question about ActionForm reset()
Could you post your JSP, or a fragment of it? That would probably help us help you. Thanks. -- Martin Cooper - Original Message - From: "Sean Giles" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 2:57 PM Subject: question about ActionForm reset() I have a Actionform with request scope populated using PropertyUtil.copyProperties() and forwarded another page. All the properties display correctly on that page but when I actually submit I see the reset() method being called and then validate(), however between reset() and validate() the form properties are not repopulated and validation fails. This is very much like the example edit/save subscription example which works perfectly. Anyone have any ideas on where I'm going wrong? Thanks Sean
Re: select options
It seems the documentation is wrong. It should be something like this instead: - 8 - The attribute name of the bean whose properties are consulted to determine which option should be pre-selected when rendering this input field. If not specified, the bean associated with the form tag we are nested within is utilized. [RT Expr] - 8 - As with the other form-related tags, I have never had to specify the name attribute, because I've always been able to use the default, meaning "use the form's bean". Hope this helps. -- Martin Cooper - Original Message - From: "Nick Pellow" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 5:01 PM Subject: select options Hi, Looking at: http://jakarta.apache.org/struts/struts-html.html#select I notice that for the name attribute, the following description is given: name The fully-qualified java class name of the bean containing the underlying property. [RT Expr] Is this correct? I thought 'type' was usually used for class names and 'name' was used for variable names. Could someone please tell me what the name attribute means and when it should/shouldn't be used with select boxes? Cheers, Nick
how does a jsp find the resource file
I've been following the examples trying to get struts working w/ orion. When I go to a url like http://localhost/cais/index.jsp, I expect the following jsp test page to show up. But since it's mapped to the action servlet in the web.xml file (below), and since the jsp page has no reference to a servlet, how does it know where to find the resource properties file that's in the web.xml? - index.jsp - %@ page language="java" % %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" % %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % html:html head title bean:message key="main.title" / /title /head body html:errors / This is a atest. /body /html:html - web.xml - The mapping in the ~/WEB-INF/web.xml file has the following entry: servlet servlet-nameaction/servlet-name servlet-class org.apache.struts.action.ActionServlet /servlet-class init-param param-nameapplication/param-name param-valuecom.neuroquest.cais.resources.cais/param-value /init-param /servlet - I have a file called cais.properties within the com/neuroquest/cais/resource directory. I keep getting the following error: 500 Internal Server Error javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE at org.apache.struts.util.RequestUtils.message(RequestUtils.java, Compiled Code) at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at com.orionserver.http.OrionHttpJspPage.service(JAX, Compiled Code) at com.evermind.server.http.HttpApplication.xj(JAX, Compiled Code) at com.evermind.server.http.JSPServlet.service(JAX, Compiled Code) at com.evermind.server.http.d3.sw(JAX, Compiled Code) at com.evermind.server.http.d3.su(JAX, Compiled Code) at com.evermind.server.http.ef.s1(JAX, Compiled Code) at com.evermind.server.http.ef.do(JAX, Compiled Code) at com.evermind.util.f.run(JAX, Compiled Code) Any help much appreciated.
Re: can't get struts working w/ orion ...
Yeah, same here. I noticed that when I use tomcat I get this message: Resolving to alternate DTD 'jar:file:/usr/local/jakarta-tomcat/webapps/struts-upload/WEB-INF/lib/struts.jar!/org/apache/struts/resources/struts-config_1_0.dtd' But when I use orion it says this: Resolving to alternate DTD 'jndi:/usr/local/orion/lib/struts.jar/org/apache/struts/resources/struts-config_1_0.dtd' End event threw exception The difference is it says 'jar:file:/' in tomcat and 'jndi"/' in orion. Anyone know why this is? Alan Yackel Christian Billen wrote: I had the same problem with Orion 1.4.7 and Struts 1.0beta (today's build), here's how I got it to work: You have to remove all the tlds from WEB-INF/lib/struts.jar that are under org.apache.struts.resources and put them under WEB-INF/classes/org/apache/struts/resources. Don't just copy them, they have to disapear from your struts.jar Took care of my issue, a bit annoying we have to do this but looks more like a bug in Orion than in Struts. Any comments on this? Christian -Original Message- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 2:59 PM To: [EMAIL PROTECTED] Subject: can't get struts working w/ orion ... After reading this, could it be that I don't have my ActionServlet installed. I thought I'd be able to just test the taglibs in a very simple configuration. Just started learning struts. I'm using orion server 1.4.5. I've got the struts.jar in my ~/WEB-INF/lib dir and have listed the taglibs in the ~/WEB-INF/web.xml file as well as included all the *.tld files in this same dir. taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-html.tld/taglib-uri taglib-location/WEB-INF/struts-html.tld/taglib-location /taglib ... When running the following page (or even just browsing to http://localhost:80 to see if the orion server is running), I get the error listed at the bottom of this page. I've also got a file called 'myProps.properties' packaged under the ~/WEB-INF/classes/com.neuroquest.cais.resources dir. (i think i've got this right as resources is a dir name and i've got a file called myProps.properties in it, though I don't see how orion knows about this file just cause it's in this dir). index.jsp --- %@ page language="java" % %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" % %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % html:html head title bean:message key="main.title" / /title /head body html:errors / This is a atest. /body /html:html web.xml --- ?xml version="1.0" encoding="ISO-8859-1"? !DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd" web-app servlet servlet-nameaction/servlet-name servlet-class org.apache.struts.action.ActionServlet /servlet-class init-param param-nameapplication/param-name param-valuecom.neuroquest.cais.resources/param-value /init-param /servlet welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-form.tld/taglib-uri taglib-location/WEB-INF/struts-form.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-html.tld/taglib-uri taglib-location/WEB-INF/struts-html.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-logic.tld/taglib-uri taglib-location/WEB-INF/struts-logic.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-template.tld/taglib-uri taglib-location/WEB-INF/struts-template.tld/taglib-location /taglib /web-app --- error output - 500 Internal Server Error javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE at org.apache.struts.util.RequestUtils.message(RequestUtils.java, Compiled Code) at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at com.orionserver.http.OrionHttpJspPage.service(JAX, Compiled Code) at com.evermind.server.http.HttpApplication.xj(JAX, Compiled Code) at com.evermind.server.http.JSPServlet.service(JAX, Compiled Code) at com.evermind.server.http.d3.sw(JAX,
Re: can't get struts working w/ orion ...
Follow the instructions below and it should work - Original Message -From: "Ate Douma" [EMAIL PROTECTED]To: "Orion-Interest" [EMAIL PROTECTED]Sent: Friday, December 15, 2000 20:19Subject: 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 thenightly 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 (or zip) [temp]\META-INF\application.xml and [temp]\struts-examples.war into a new enterprise application archive [temp]\struts.ear (using folder names) 4. deploy the example web application on orion 4.1. extract orion1.3.8.zip in some directory ([orion]) 4.2. copy the struts.ear file into [orion]/application 4.3. modify [orion]\config\server.xml by adding the following element under (nested within) the application-server ... element: application name="struts" path="../applications/struts.ear" / 4.4. modify [orion]\config\default-web-site.xml by adding thefollowing element under (nested within) the web-site ... element: web-app application="struts" name="struts-example" root="/struts-example" / 5. run the example web application 5.1. startup orion by executing "java -jar orion.jar" within the [orion]\ directory 5.2. access the example web application from a browser using url: http://localhost/struts-example Ate Douma Regards, Thierry Thierry CoolsSenior Java Developer S1 Brussels Kleine Kloosterstraat, 23 1932 st. Stevens-Woluwe Belgium Tel : +32 2 200 43 82 Email : [EMAIL PROTECTED] - Original Message - From: Alan Yackel To: [EMAIL PROTECTED] Sent: Thursday, March 08, 2001 7:53 AM Subject: Re: can't get struts working w/ orion ... Yeah, same here. I noticed that when I use tomcat I get this message:Resolving to alternate DTD'jar:file:/usr/local/jakarta-tomcat/webapps/struts-upload/WEB-INF/lib/struts.jar!/org/apache/struts/resources/struts-config_1_0.dtd'But when I use orion it says this: Resolving to alternate DTD'jndi:/usr/local/orion/lib/struts.jar/org/apache/struts/resources/struts-config_1_0.dtd' End event threw exceptionThe difference is it says 'jar:file:/' in tomcat and 'jndi"/' in orion. Anyoneknow why this is?Alan YackelChristian Billen wrote: I had the same problem with Orion 1.4.7 and Struts 1.0beta (today's build), here's how I got it to work: You have to remove all the tlds from WEB-INF/lib/struts.jar that are under org.apache.struts.resources and put them under WEB-INF/classes/org/apache/struts/resources. Don't just copy them, they have to disapear from your struts.jar Took care of my issue, a bit annoying we have to do this but looks more like a bug in Orion than in Struts. Any comments on this? Christian -Original Message- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 2:59 PM To: [EMAIL PROTECTED] Subject: can't get struts working w/ orion ... After reading this, could it be that I don't have my ActionServlet installed. I thought I'd be able to just test the taglibs in a very simple configuration. Just started learning struts. I'm using orion server 1.4.5. I've got the struts.jar in my ~/WEB-INF/lib dir and have listed the taglibs in the ~/WEB-INF/web.xml file as well as included all the *.tld files in this same dir. taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-html.tld/taglib-uri
Help with BeanUtils.populate()
Hi, First off, let me say that I'm not building on top of the Struts framework. Rather, I'm leveraging the libraries and tag libraries. I'm writing my own controller servlet and I tried to use BeanUtils to populate my bean with: public class MyController { . . . public static void populate(Object dobean, HttpServletRequest req) throws IllegalAccessException, InvocationTargetException { Map paramMap = new Hashtable(); Enumeration names = req.getParameterNames(); while (names.hasMoreElements()) { String name, value; name = (String) names.nextElement(); value = req.getParameter(name); paramMap.put(name, value); } BeanUtils.populate(dobean, paramMap); } . . . } And I get: java.lang.IllegalArgumentException: argument type mismatch at java.lang.reflect.Method.invoke(Native Method) at org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:825) at org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:756) at org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:782) at org.apache.struts.util.BeanUtils.populate(BeanUtils.java:541) I know building the Map just to use BeanUtils.populate() seems redundant, but ... ignore that for now. It seems like the above would only work for bean properties of type String? But doesn't BeanUtils.populate() claim to do the type conversion based on reflection on the setter methods? Is there anything in the library that can help me or do I have to write my own populate() that handles the type conversion? Thanks. -jay
question about access property value?
Hi struts-user, How to get property value that defined in the struts_config.xml by set-property tags? And how does it work? :=) Best regards, JeanX pacificnet.com(GZ)