RE: Indexed tags problem
I moved the getPersonFields() method into the personForm object and I still get the problem! So it is probably not because of the nested property! i.e. logic:iterate id=personField name=personForm property=personFields any thoughts, (I have read through other postings, regarding session etc.. ) cheers Andy -Original Message- From: Andrew Paul Swift [mailto:[EMAIL PROTECTED]] Sent: 6. august 2001 17:32 To: '[EMAIL PROTECTED]' Subject: Indexed tags problem I am using the indexed tags (cheers, made my life a lot easier!) but I am having a problem. When submitting a form the data in the form is not updated. I have got updates working elsewhere, but I can't get this working. Is it because I use a nested property in the iterate tag i.e. getPerson().getPersonFields(); Cheers in advance Andy === JSP logic:iterate id=personField name=personFormproperty=person.personFields td html:text name=personField property=value indexed=true/ /td /logic:iterate=== HTML produced td input type=text name=personField[0].value value=1000831 /td === struts-config.xml form-bean name=personForm type=forms.PersonForm/ !-- Action that retrieves details about a person -- actionpath=/persontype=actions.PersonAction name=personFormscope=session input=/customerSearch.jsp forward name=success path=/personDetail.jsp/ /action !-- Action that stores details about a person -- actionpath=/storePerson type=actions.StorePersonAction name=personForm scope=session input=/personDetail.jsp forward name=cancel path=/customerSearch.jsp/ forward name=delete path=/customerSearch.jsp/ forward name=savepath=/personDetail.jsp/ /action Log action: Processing a POST for /storePerson action: Looking for ActionForm bean under attribute 'personForm' action: Recycling existing ActionForm bean instance of class 'forms.PersonForm' action: Populating bean properties from this request action: Validating input form properties action: No errors detected, accepting input action: Looking for Action instance for class actions.StorePersonAction action: Double checking for Action instance already there action: Creating new Action instance action: Saving customer - To send us encrypted mail, please refer to: http://www.millionhandshakes.com/emailpolicy/pgp.html Million Handshakes - To send us encrypted mail, please refer to: http://www.millionhandshakes.com/emailpolicy/pgp.html Million Handshakes
retrieving nested property values
Help! I have a form bean defined as MainBean. The attribute I would like to target can be retrieved via MainBean.getVO().getPrimaryKey().getId() In my JSP, I have an html:hidden .../ tag whose property I would like to set to the ID defined above. Is this possible? No matter what syntax I try for the property= value, I continue to get the following error: ...No getter method for property ... Thanks in advance, -Brenda _ Brenda M. Faber
How to access an xml file in Action class
Hi I have got one xml file say client.xml in the home of an application which is developed using Struts framework. The server I am using is ORION 1.5.2. I wanted to pass this xml file(i.e. its path) as a parameter in the Action servlet of the struts framework(say this action class is there in home/web-inf/classes/com ). How can I retrieve the path of this XML file in the action servlet? Thanks Eda __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: How to access an xml file in Action class
why not just use an init param? servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-namexmlFile/param-name param-value/path/to/file.xml/param-value /init-param load-on-startup1/load-on-startup /servlet retrieve it from inside your ActionServlet (or a subclass) like so: String xmlSource = getInitParameter(xmlFile); you could always retrieve the path from a properties file as well. that wouldn't force you to bounce the server if the path changed... Original Message Follows From: Eda Srinivasareddy [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: How to access an xml file in Action class Date: Tue, 7 Aug 2001 05:15:55 -0700 (PDT) Hi I have got one xml file say client.xml in the home of an application which is developed using Struts framework. The server I am using is ORION 1.5.2. I wanted to pass this xml file(i.e. its path) as a parameter in the Action servlet of the struts framework(say this action class is there in home/web-inf/classes/com ). How can I retrieve the path of this XML file in the action servlet? Thanks Eda __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
session question
Hi all, Does anybody know whether it is possible to access elements on the session from the action form? - outside of the methods reset and validae? Thanks, Simon. For optimum solutions that save you time, visit www.ds-s.com.
how to create reset and cancel buttons with my own image
As I couldn't get the html:submit tag to display my own image, I'm using the image tag: html:image src=../../images/save.gif/ to do a submit. However, I don't see how to display my own image on a canel or reset button. Is it possible to set the image tag to cancel/ reset or to set the cancel/ reset tags to display my own image? cheers, Rachel ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
Field level ActionErrors
I have been told that struts can associate an individual error to fields ( i.e. form properties ). Is this so? It didn't look like it to me but I know I could be wrong. Or, does ActionError.getKey() have to be manually set?
Re: session question
the action form's perform method receives a HttpServletRequest object, which has a getSession() method. call it to get access to the current session. note that getAttribute(String key) returns Object, so a typecast would probably be required. public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); YourObject o = (YourObject)session.getAttribute(yourSessionKey); //do something with the object } Original Message Follows From: Prior, Simon [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: session question Date: Tue, 7 Aug 2001 13:33:31 +0100 Hi all, Does anybody know whether it is possible to access elements on the session from the action form? - outside of the methods reset and validae? Thanks, Simon. For optimum solutions that save you time, visit www.ds-s.com. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
how to create reset and cancel buttons with my own image
As I couldn't get the html:submit tag to display my own image, I'm using the image tag: html:image src=../../images/save.gif/ to do a submit. However, I don't see how to display my own image on a canel or reset button. Is it possible to set the image tag to cancel/ reset or to set the cancel/ reset tags to display my own image? cheers, Rachel ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
Re: Field level ActionErrors
Will, It's actually pretty easy. When you are generating your errors, i.e.: ActionErrors errors = new ActionErrors(); errors.add(field1, new ActionError(field1.error.message)); That ties the error to a property on your form called field1. Then if you want to display that error message (if it exists) next to that field (or anywhere), just use this on your jsp page: html:errors property=field1/ That's about it! -jason Will Spies/Towers Perrin [EMAIL PROTECTED] 08/07/2001 07:44 AM Please respond to struts-user To: [EMAIL PROTECTED] cc: Subject:Field level ActionErrors I have been told that struts can associate an individual error to fields ( i.e. form properties ). Is this so? It didn't look like it to me but I know I could be wrong. Or, does ActionError.getKey() have to be manually set?
Stateful applications
Hi , As a newbie I have a question regarding stateful-/stateless-ness. I am aware that it is sometimes pointed out that stateful web applications do not scale very well. * First: can anyone give me some arguments pro/con or refer me to a good resource? * Second: does struts typically keep state (I think so because it keeps the user session) and if so, is it subject to scalability problems? Is struts's statefulness connected to statefulness of an application consisting of EJB's running behind struts, or can the two be viewed separately? I would be very grateful for any hints or arguments or links to other useful info. Thanks! David __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
RE: session question
Thanks for the response but I was talking about the ActionForm not the Action - perhaps I wasn't clear in my earlier post. The reason I am asking is that I would like to prepare some data for a jsp within an ActionForms constructor and have the jsp display this data via reflection of the ActionForms elements. I would like to be able to grab a value from the session within the ActionForms constructor but can't figure out how to access it as there doesn't seem to be any means of doing so. Anyone have any thoughts? Simon. -Original Message- From: Jon Crater [mailto:[EMAIL PROTECTED]] Sent: 07 August 2001 13:47 To: [EMAIL PROTECTED] Subject: Re: session question the action form's perform method receives a HttpServletRequest object, which has a getSession() method. call it to get access to the current session. note that getAttribute(String key) returns Object, so a typecast would probably be required. public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); YourObject o = (YourObject)session.getAttribute(yourSessionKey); //do something with the object } Original Message Follows From: Prior, Simon [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: session question Date: Tue, 7 Aug 2001 13:33:31 +0100 Hi all, Does anybody know whether it is possible to access elements on the session from the action form? - outside of the methods reset and validae? Thanks, Simon. For optimum solutions that save you time, visit www.ds-s.com. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp For optimum solutions that save you time, visit www.ds-s.com.
RE: Question: Struts on Weblogic - Urgent please
Thanks Quan. However, I have following problem: The server.xml has nested markups as: Server/ContextManagerContext/ContextContextManager/Server Inside this Context tag I put the specified entry. However, the web.xml has totally different set of markups. Does it support Context tag? If yes, under which tag should this be added? Please let me know. Thanks again, Sujit -Original Message- From: Pham Thanh Quan [mailto:[EMAIL PROTECTED]] Sent: Monday, August 06, 2001 9:27 PM To: [EMAIL PROTECTED] Subject: Re: Question: Struts on Weblogic - Urgent please Try putting it into the file web.xml in Web-inf directory Quan - Original Message - From: Upadhye, Sujit (GEAE, Foreign National) [EMAIL PROTECTED] To: Craig R. McClanahan [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, August 07, 2001 12:40 AM Subject: Question: Struts on Weblogic - Urgent please Hi, I am using Struts on Weblogic 5.1 with SP9. Initially I developed my app on Tomcat. Here, I am forwarding control to another action object. So, in my config.xml, I have: forward name=next path=/detcontrol.do redirect=true/ I start my app on Tomcat through URL: http://localhost/wls/cmweb/detrunselect.do. When I submit this page, the new URL I get is: http://localhost/wls/cmweb/detcontrol.do. This is the expected behavior. However, when I try to run the same on Weblogic, the second URL comes up as: http://localhost/cmweb/detcontrol.do. Please note that 'wls' get dropped from the URL. This causes the app to fail. Can some one tell me how can I still get the 'wls' while using 'redirect = true'? For my Tomcat, I have an entry in server.xml as: Context path=/wls/cmweb docBase=apps/cmweb debug=0 reloadable=true/Context I feel it is this entry that is adding 'wls' to the relative path. Where can I add this entry for the Weblogic. (Weblogic does not seem to have server.xml). Thanks in advance, Sujit
doc
is there any printable documentation with examples of struts ? i would appreciate any help, link or whatever. Catalin
Re: Field level ActionErrors
Thanks! To: [EMAIL PROTECTED] VASQUEZ_JASONcc: (bcc: Will Spies/Towers Perrin) @LILLY.COM Subject: Re: Field level ActionErrors 08/07/01 08:55 AM Please respond to struts-user Will, It's actually pretty easy. When you are generating your errors, i.e.: ActionErrors errors = new ActionErrors(); errors.add(field1, new ActionError(field1.error.message)); That ties the error to a property on your form called field1. Then if you want to display that error message (if it exists) next to that field (or anywhere), just use this on your jsp page: html:errors property=field1/ That's about it! -jason Will Spies/Towers Perrin [EMAIL PROTECTED] 08/07/2001 07:44 AM Please respond to struts-user To: [EMAIL PROTECTED] cc: Subject:Field level ActionErrors I have been told that struts can associate an individual error to fields ( i.e. form properties ). Is this so? It didn't look like it to me but I know I could be wrong. Or, does ActionError.getKey() have to be manually set?
doc
is there any printable documentation with examples of struts ? i would appreciate any help, link or whatever. Catalin
RE: Indexed tags problem
I have finally solved the problem, and it was due to the nested property. So ignore my last posting or take note of the word probably ! Is there currently a way to access nested properties stored in forms when using indexed tags?? e.g. for automatic updates form.getDetail(index).setProperty() cheers Andy -Original Message- From: Andrew Paul Swift [mailto:[EMAIL PROTECTED]] Sent: 7. august 2001 11:28 To: '[EMAIL PROTECTED]' Subject: RE: Indexed tags problem I moved the getPersonFields() method into the personForm object and I still get the problem! So it is probably not because of the nested property! i.e. logic:iterate id=personField name=personForm property=personFields any thoughts, (I have read through other postings, regarding session etc.. ) cheers Andy-Original Message- From: Andrew Paul Swift [mailto:[EMAIL PROTECTED]] Sent: 6. august 2001 17:32 To: '[EMAIL PROTECTED]' Subject: Indexed tags problem I am using the indexed tags (cheers, made my life a lot easier!) but I am having a problem.When submitting a form the data in the form is not updated. I have got updates working elsewhere, but I can't get this working. Is it because I use a nested property in the iterate tag i.e. getPerson().getPersonFields(); Cheers in advanceAndy=== JSP logic:iterate id=personField name=personFormproperty=person.personFields td html:text name=personField property=value indexed=true/ /td /logic:iterate === HTML produced td input type=text name=personField[0].value value=1000831 /td === struts-config.xml form-bean name=personForm type=forms.PersonForm/ !-- Action that retrieves details about a person -- action path=/persontype=actions.PersonAction name=personFormscope=session input=/customerSearch.jsp forward name=success path=/personDetail.jsp/ /action !-- Action that stores details about a person -- action path=/storePerson type=actions.StorePersonAction name=personForm scope=sessioninput=/personDetail.jsp forward name=cancelpath=/customerSearch.jsp/ forward name=deletepath=/customerSearch.jsp/ forward name=save path=/personDetail.jsp/ /action Log action: Processing a POST for /storePerson action: Looking for ActionForm bean under attribute 'personForm' action: Recycling existing ActionForm bean instance of class 'forms.PersonForm' action: Populating bean properties from this request action: Validating input form properties action: No errors detected, accepting input action: Looking for Action instance for class actions.StorePersonAction action: Double checking for Action instance already there action: Creating new Action instance action: Saving customer -- --- To send us encrypted mail, please refer to: http://www.millionhandshakes.com/emailpolicy/pgp.html Million Handshakes -- ---To send us encrypted mail, please refer to:http://www.millionhandshakes.com/emailpolicy/pgp.html Million Handshakes - To send us encrypted mail, please refer to: http://www.millionhandshakes.com/emailpolicy/pgp.html Million Handshakes
RE: doc
Under IBM redbooks there is one with an implementation using websphere. www.ibm.com/redbooks -Original Message- From: Catale [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 9:51 AM To: [EMAIL PROTECTED] Subject: doc is there any printable documentation with examples of struts ? i would appreciate any help, link or whatever. Catalin
Retrieving values from a Collection in JSP using tags
Hi, I want to retrieve values from a Hashtable present in a Form as an attribute.Is it possible using any struts tags. I have the key available. Mani The Information contained and transmitted by this E-MAIL is proprietary to Wipro Limited and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If this is a forwarded message, the content of this E-MAIL may not have been sent with the authority of the Company. If you are not the intended recipient, an agent of the intended recipient or a person responsible for delivering the information to the named recipient, you are notified that any use, distribution, transmission, printing, copying or dissemination of this information in any way or in any manner is strictly prohibited. If you have received this communication in error, please delete this mail notify us immediately at [EMAIL PROTECTED]
is there example code for...
Hi all. Is there example code about how to implement saveToken and isValidToken methods. Core J2ee patterns gives a good talk on theory but they drop the ball with examples. Thanks in advance. Tom
threads: again
Hello I read almost all articles on the list on the thread-safety subject, but still I cannot explain a problem occurring in production: --- i have an action that does the following thing ... loadfromdatabase_into_bean_customer_A populate ( actionform, bean ) forward to a jsp (referencing actionform) to display attributes. ... users tell me that sometimes, they get, while loading customer A some (not all) attributes with the values of another customer B --- the action does not contain any instance variable. All is done in the perform method. I am using struts 0.5 Any clue? thanks Michele Quaini
WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from request scope
Hello, I write an application using struts. I have a first JSP page with a link to a second JSP page which contains a form. The link looks like: html:link href=epologin.do?cmd=Createbean:message key =index.login//html:link I get the first page with the link. But, when I click on it, I get the following message: ...cant remove Attributes from request scope... I've seen a lot of mails in the struts-user list about the doEndTag method; so I tried to change the code of the FormTag class (in /taglib/html). It changes nothing. So, if anyone has a solution... A few questions: Where does the problem come from (Struts, Websphere)? Is there any improvement with Websphere 4.0? Thanks for your help. MIKAEL
Security question - how to provide faithful redirect?
This is a question that's only partially related to Struts, but on the topic of application security. The crux of it is trying to understand how to faithfully redirect a request, including the HTTP method. For a number of reasons, we've chosen to implement a lightweight authentication and authorization framework for our application that hangs off of ActionServlet (in short, we needed something in place until a higher-level decision on 3rd-party access control could be made by others outside our group.) We check on each request that we have a user logged in (by the presence of a user object in the session), and then that they have permission to request the given resource. Our definition of resource is a combination of HTTP method (GET, POST) and URL, similar to what the servlet 2.2 spec defines. The general flow is to (a) check whether the user is authenticated (b) if not, we save the URI they requested and forward them to our logon page (c) after logon, we check their credentials, and if they pass we redirect to the saved URI. The problem we're having is that it appears that the redirect done in (c) is always turned into a GET request, even if the original request was a POST. If we have a valid permission for the original POST request, we may well not have one defined for the GET method, and we'll get an authorization failure. Now, I've come to realize that this may just be an academic question, since on a POST, we will have lost our form data from the original request by the time the user has gone to a logon page and submitted that (unless we go to more extraordinary measures to save it), so that I'm starting to believe that our safer strategy in (c) is to simply redirect to our home page after authentication, in all circumstances, since everyone has rights to that URL via GET or POST. However, it's been gnawing at me that others have had to deal with something like this, but I don't know how. I've tried looking through the Tomcat 3.2.1 source to understand how it does form-based logon, and I'm still stymied. I can see where the AccessIntercepter stores the URI before a logon attempt, and then sends it back with a 302 response after logon, but that technique would also seem to lose the original HTTP method, and fail the same way in this situation (although I haven't taken the time to setup a secured Tomcat webapp to test the theory.) I've even gone so far as to check out the HTTP 1.1 spec to understand the redirect directive, but even that doesn't come right out and say the HTTP method is lost (or preserved) on redirect. The closest thing of interest is a note in section 10.3.3, describing the 302 (temporarily moved) request: Note: When automatically redirecting a POST request after receiving a 302 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request. So perhaps its a browser bug, but we're using IE 5, which I would hope would be a little more current. Thanks for any clues, insights, or tales of similar woe. John
jms
Has anyone tried JMS along with Struts. Rakesh Ayilliath(Software Engineer) Synergy IT Innovations Pvt Ltd,#196, 1st Floor, 9th Cross,HMT Layout, RT NagarBangalore 560032 [EMAIL PROTECTED]
RE: session question
On Tue, 7 Aug 2001, Prior, Simon wrote: Thanks for the response but I was talking about the ActionForm not the Action - perhaps I wasn't clear in my earlier post. The reason I am asking is that I would like to prepare some data for a jsp within an ActionForms constructor and have the jsp display this data via reflection of the ActionForms elements. I would like to be able to grab a value from the session within the ActionForms constructor but can't figure out how to access it as there doesn't seem to be any means of doing so. Like most JavaBeans, an ActionForm has to have a zero-arguments constructor in order to be dynamically instantiated. That means you will not be able to acquire any references to a session (or anything else) from within the constructor. You might consider adding a setHttpSession() method into your form bean's APIs so that whoever created the form bean could call this, and do your grabbing of session attributes at that point. But you do have to be careful if the session gets invalidated or timed out (your getAttribute() calls will start throwing IllegalStateException at that point). Anyone have any thoughts? Simon. Craig McClanahan
Re: is there example code for...
Never mind, I found the answer in the archives and in the struts-example code. It was easy to miss.. At 09:41 AM 8/7/01 -0500, you wrote: Hi all. Is there example code about how to implement saveToken and isValidToken methods. Core J2ee patterns gives a good talk on theory but they drop the ball with examples. Thanks in advance. Tom
RE: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from request scope
WAS 4.0 so far is no different, you will get the same error. The problem was fixed, by changing the code in org.apache.struts.taglib.html.FormTag per this solution posted a while ago: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg10964.html There is another FormTag class, org.apache.struts.taglib.FormTag. Make sure you got the right one, and rebuilt correctly? This solution has worked successfully repeatedly. The problem lies with the IBM implementation of the org.apache.jasper package. It behaves differently than the tomcat reference implementation, in that it will always throw an exception when specifically removing attributes from request scope. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 10:18 AM To: [EMAIL PROTECTED] Subject: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from request scope Hello, I write an application using struts. I have a first JSP page with a link to a second JSP page which contains a form. The link looks like: html:link href=epologin.do?cmd=Createbean:message key =index.login//html:link I get the first page with the link. But, when I click on it, I get the following message: ...cant remove Attributes from request scope... I've seen a lot of mails in the struts-user list about the doEndTag method; so I tried to change the code of the FormTag class (in /taglib/html). It changes nothing. So, if anyone has a solution... A few questions: Where does the problem come from (Struts, Websphere)? Is there any improvement with Websphere 4.0? Thanks for your help. MIKAEL
Re: Stateful applications
On Tue, 7 Aug 2001, David van Coevorden wrote: Hi , As a newbie I have a question regarding stateful-/stateless-ness. I am aware that it is sometimes pointed out that stateful web applications do not scale very well. That is a *slightly* simplistic view of the world, but has some validity :-). * First: can anyone give me some arguments pro/con or refer me to a good resource? I would certainly look to what the various app server providers say about designing highly scalable applications that run on their platforms. Be aware that the optimum designs might differ slightly per platform, depending on what particular areas that vendor has focused on. * Second: does struts typically keep state (I think so because it keeps the user session) and if so, is it subject to scalability problems? The primary state information for Struts is the ActionForm bean that you use to capture the request parameters on a form submit. Struts gives you the choice of either request scope or session scope. Request scope should be used when you can -- the only time this is problematic is when you have a transaction that requires more than one interaction with the user. The state that you care about here is the input data from forms other than the current page. Here, the choices basically boil down to: * Keep the state information in the user's session (but be sure you remove it when you're through with that particular transaction). * Keep the state information in hidden variables on each page so that you can continue to use request scope. * Store the state data externally in a database or EJB, and then keep track of a reference to that data (so it can be retrieved on the next request) in the user's session, or in a cookie. Is struts's statefulness connected to statefulness of an application consisting of EJB's running behind struts, or can the two be viewed separately? They can overlap if you want to. For example, if you wanted to implement the third Struts-state strategy above using the EJB layer, you could use stateful session beans -- you grab one when the transaction starts, and release it when the transaction ends. From the Struts perspective you only need to keep track of the reference to the stateful session bean you've allocated -- this is small enough to store in the web layer session without too much grief. Conceptually, this is exactly the same as storing state in session scope -- it is still occupying memory somewhere on the server. However, using an EJB this way lets you split up the work (your EJBs might be running on a different server, or a farm of different servers, so that you can scale the front end and the back end independently as needed). I would be very grateful for any hints or arguments or links to other useful info. Thanks! There are no really simple solutions that work all the time. But everything starts with an analysis of how many simultaneous users you plan to support, how much state data each user will have for each possible transaction, and how much memory you plan to install. David Craig
html:errors Presentation Questions
All, I have 2 questions: 1. When I use html:errors/, the following output is rendered: Last Name is required. First Name is required. Is it possible to use the iteration tag to go through the list and provide a break between the items? 2. Validation already occurs when my input form first appears (and error messages appear without the user first submitting the form). What is the easiest way to avoid validation until the user submits the form? Thanks, Brian
Re: is there example code for...
On Tue, 7 Aug 2001, Tom Tibbetts wrote: Hi all. Is there example code about how to implement saveToken and isValidToken methods. Core J2ee patterns gives a good talk on theory but they drop the ball with examples. The book even quotes the Struts code that implements this pattern :-). Thanks in advance. Tom This feature is actually used in the example application shipped with Struts -- but it's so easy to utilize that it's almost invisible. Down near the bottom of EditRegistrationAction, you will see the call: saveToken(request); which tells Struts to invoke the transaction control mechanism. When registration.jsp is displayed, the html:form tag will include an extra hidden variable with the submit (you can see it with View Source) that is then validated by this code in SaveRegistrationAction: if (!isTokenValid(request)) { ... handle the error ... } resetToken(request); Note that there are *zero* changes necessary in the JSP page itself to use this stuff -- it's totally a decision of the business logic designer when transaction tokens are appropriate. (Custom tags are your friend ;-). The whole point of the exercise is to catch double posts to the database caused by the user using their back button. To prove that it works, try this: * Log on to the example app and select the Edit your registration link. * Make some changes and press Save. * Although you're now on the main menu again, use your browser's back arrow and resubmit the form again. * You will get an error message because the transaction control token will no longer be valid. As a general design note, this pattern is especially easy to use when you have a pre-form action to set things up (EditRegistrationAction in this case) and a post-form action to process it. The pre-form action is also a perfect place to pre-initialize the form bean with values from your database. Craig
RE: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from request scope
On Tue, 7 Aug 2001, Mark Wilson wrote: WAS 4.0 so far is no different, you will get the same error. The problem was fixed, by changing the code in org.apache.struts.taglib.html.FormTag per this solution posted a while ago: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg10964.html There is another FormTag class, org.apache.struts.taglib.FormTag. Make sure you got the right one, and rebuilt correctly? This solution has worked successfully repeatedly. The problem lies with the IBM implementation of the org.apache.jasper package. It behaves differently than the tomcat reference implementation, in that it will always throw an exception when specifically removing attributes from request scope. More specifically, they used the Jasper that was in Tomcat 3.1 (which also has this same problem). For Tomcat, it was fixed in 3.2 and all later versions. Mark Craig
Re: html:errors Presentation Questions
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 07, 2001 9:15 AM Subject: html:errors Presentation Questions All, I have 2 questions: 1. When I use html:errors/, the following output is rendered: Last Name is required. First Name is required. Is it possible to use the iteration tag to go through the list and provide a break between the items? you can have a br in your resource file itself. error.last.required=Last Name is requiredbr 2. Validation already occurs when my input form first appears (and error messages appear without the user first submitting the form). What is the easiest way to avoid validation until the user submits the form? you can use an if condition for the *action* value eg: if(action.equals(create)) return null; Thanks, Brian rama.
Re: is there example code for...
Hi Tom, Tom Tibbetts wrote: Hi all. Is there example code about how to implement saveToken and isValidToken methods. Core J2ee patterns gives a good talk on theory but they drop the ball with examples. We cover the general theory of duplicate form submission issues and the synchronizer token in the Presentation Tier Design Considerations chapter of 'Core J2EE Patterns'. We also include an example with source code in the Presentation Tier Refactorings chapter. In fact the source code used with permission is from Struts itself, including the 'saveToken()' and 'isTokenValid()' methods. Hope this helps, Dan Thanks in advance. Tom -- Dan MalksSun Java Center Enterprise Java Architect703.208.5794
Re: html:errors Presentation Questions
Hiya, you can also specify additional formatting in your ApplicationResources file like this: #==# # # Html used to print out struts ActionErrors # errors.header=tabletrtdfont size=1 face=Arial, Helvetica, sans-serifPlease correct the following error(s) before proceeding:ul errors.footer=/ul/td/tr/tablebr #==# Bill ps. good tip on #2 Rama Rama Krishna wrote: - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 07, 2001 9:15 AM Subject: html:errors Presentation Questions All, I have 2 questions: 1. When I use html:errors/, the following output is rendered: Last Name is required. First Name is required. Is it possible to use the iteration tag to go through the list and provide a break between the items? you can have a br in your resource file itself. error.last.required=Last Name is requiredbr 2. Validation already occurs when my input form first appears (and error messages appear without the user first submitting the form). What is the easiest way to avoid validation until the user submits the form? you can use an if condition for the *action* value eg: if(action.equals(create)) return null; Thanks, Brian rama.
unsubscribe !!!!!!!!!!!!!!!!!!!!!!
please unsubscribe me
RE: how to create reset and cancel buttons with my own image
From HTML Spec, an image button acts just like a Submit button. So in order to implement your reset and cancel button by using your own image, you have to use Client side JavaScript. Just like the following code: html body form method=post action=http://www.yahoo.com input type=text value=original value input type=image src=reset.gif onclick=javascript:reset();return false; input type=image src=cancel.gif onclick=javascript:history.go(-1);return false; input type=image src=submit.gif /form /body /html Hope it will be helpful! Xin -Original Message- From: Rachel Warburton [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 5:51 AM To: '[EMAIL PROTECTED]' Subject: how to create reset and cancel buttons with my own image As I couldn't get the html:submit tag to display my own image, I'm using the image tag: html:image src=../../images/save.gif/ to do a submit. However, I don't see how to display my own image on a canel or reset button. Is it possible to set the image tag to cancel/ reset or to set the cancel/ reset tags to display my own image? cheers, Rachel ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
RE: unsubscribe !!!!!!!!!!!!!!!!!!!!!!
To remove your address from the list, send a message to: [EMAIL PROTECTED] -Original Message- From: Siping Liu [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 12:05 PM To: [EMAIL PROTECTED] Subject: unsubscribe !! please unsubscribe me
RE: unsubscribe !!!!!!!!!!!!!!!!!!!!!!
unsubscribe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Siping Liu Sent: Tuesday, August 07, 2001 10:05 AM To: [EMAIL PROTECTED] Subject: unsubscribe !! please unsubscribe me
How to forward from within an ActionForm validate method
I have been wracking my brain to remember how to do this but no luck so hopefully someone can help. I am trying to figure out how to forward to a jsp page or .do from within the ActionForm validate method. If for example during my validation I encounter a system error I want to redirect the user to the logoff.do action to get them off the system. Any ideas would be appreciated. I do apologize if there is an obvious answer but I am just running out of places to look. Thanks Scott Ryan Developer First Bank Data Corporation Work: (303) 235-1485 Cell:(303 263-3044
unsubscribe !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
please unsubscribe me
Bean convention vs. Struts convention
We had a situation where we were attempting to use the Struts tag lib to generate a checkbox. In our corresponding bean our instance variable name was 'oNum' and the corresponding getter was 'getONum()'. When we attempted the checkbox tag on it, we had an error to the effect 'can't find getter method'. However, when we changed it to 'getoNum()', the problem was solved. My question is, is this a bug or a purposeful implementation due to a Struts or industry standard? Anyone else run into this? - Original Message - From: Scott Ryan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 07, 2001 10:39 AM Subject: How to forward from within an ActionForm validate method I have been wracking my brain to remember how to do this but no luck so hopefully someone can help. I am trying to figure out how to forward to a jsp page or .do from within the ActionForm validate method. If for example during my validation I encounter a system error I want to redirect the user to the logoff.do action to get them off the system. Any ideas would be appreciated. I do apologize if there is an obvious answer but I am just running out of places to look. Thanks Scott Ryan Developer First Bank Data Corporation Work: (303) 235-1485 Cell:(303 263-3044
RE: unsubscribe !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
This is a test to see how many of you actually read the content of the messages posted to this group: Ken Fletcher posted an answer to this same question earlier today. You need to do the following to unsubscribe to this list: To remove your address from the list, send a message to: [EMAIL PROTECTED] Carl (Sorry to upset any of you that still want to be part of the list.) -Original Message- From: Najeeb [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 11:02 AM To: '[EMAIL PROTECTED]' Subject: unsubscribe !!!1 please unsubscribe me
Re: Bean convention vs. Struts convention
On Tue, 7 Aug 2001, John M. Corro wrote: We had a situation where we were attempting to use the Struts tag lib to generate a checkbox. In our corresponding bean our instance variable name was 'oNum' and the corresponding getter was 'getONum()'. When we attempted the checkbox tag on it, we had an error to the effect 'can't find getter method'. However, when we changed it to 'getoNum()', the problem was solved. My question is, is this a bug or a purposeful implementation due to a Struts or industry standard? Anyone else run into this? The use of introspection in Struts is totally based on the rules that the JDK implements (in the java.beans.Introspector class). These are in turn based on the naming design patterns in the JavaBeans Specification, which you can grab at: http://java.sun.com/products/javabeans/ Note that the standard JSP tags use exactly the same set of rules. Craig - Original Message - From: Scott Ryan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 07, 2001 10:39 AM Subject: How to forward from within an ActionForm validate method I have been wracking my brain to remember how to do this but no luck so hopefully someone can help. I am trying to figure out how to forward to a jsp page or .do from within the ActionForm validate method. If for example during my validation I encounter a system error I want to redirect the user to the logoff.do action to get them off the system. Any ideas would be appreciated. I do apologize if there is an obvious answer but I am just running out of places to look. Thanks Scott Ryan Developer First Bank Data Corporation Work: (303) 235-1485 Cell:(303 263-3044
RE: unsubscribe !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
It's okay, Carl. -Original Message- From: Carl Sziebert [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 1:30 PM To: [EMAIL PROTECTED] Cc: 'Najeeb' Subject: RE: unsubscribe !!!1 This is a test to see how many of you actually read the content of the messages posted to this group: Ken Fletcher posted an answer to this same question earlier today. You need to do the following to unsubscribe to this list: To remove your address from the list, send a message to: [EMAIL PROTECTED] Carl (Sorry to upset any of you that still want to be part of the list.) -Original Message- From: Najeeb [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 11:02 AM To: '[EMAIL PROTECTED]' Subject: unsubscribe !!!1 please unsubscribe me
Re: unsubscribe !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
yes, but what exactly is the correct number of exlamation points to use in the subject of the message? Or do the number of exlamation points just decide the speed of the removal? Bill Carl Sziebert wrote: This is a test to see how many of you actually read the content of the messages posted to this group: Ken Fletcher posted an answer to this same question earlier today. You need to do the following to unsubscribe to this list: To remove your address from the list, send a message to: [EMAIL PROTECTED] Carl (Sorry to upset any of you that still want to be part of the list.) -Original Message- From: Najeeb [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 11:02 AM To: '[EMAIL PROTECTED]' Subject: unsubscribe !!!1 please unsubscribe me
Can't get setter method(s) for indexed property right. Pleeze help
I'm having trouble getting the setter methods of an indexed property of my formbean to work (despite some postings on this list). It's driving me nuts. So what I'm trying to do is use a String property of my formbean (actually a List of Strings) as an indexed property. === JSP === html:form action=/editCart.do TABLE border=1 borderwidth=1 cellspacing=0 logic:iterate id=cartItem name=%= Constants.KEY_CART % type=com.webtothemax.shop.common.CartItem property=cartItems TR TDbean:write name=cartItem property=product.name //TD TDbean:write name=cartItem property=product.price //TD : : TDhtml:text property=test indexed=true //TD : : - Note that the last field references the formbean (at least it should since name= is omittted). Note also that the iteration is not over the formbean (property). = Struts-config = actionpath=/addToCart type=com.webtothemax.shop.actions.AddToCartAction name=editCartForm scope=request validate=false forward name=success path=/WEB-INF/jsp/editCart.jsp / forward name=error path=/WEB-INF/jsp/showError.jsp / /action actionpath=/editCart type=com.webtothemax.shop.actions.EditCartAction name=editCartForm scope=request validate=false input= /WEB-INF/jsp/editCart.jsp forward name=success path=/WEB-INF/jsp/editCart.jsp / forward name=error path=/WEB-INF/jsp/showError.jsp / /action - AddToCartAction adds the product and prepopulates the formbean. == Form bean editCartForm == public class EditCartForm extends ActionForm { : : private ArrayList testList = new ArrayList(); public EditCartForm() {} : : : public String getTest(int index) { return (String) testList.get(index); } public void setTest(int index, String test) { testList.set(index, test); } public ArrayList getTestList() { return testList; } public void setTestList( ArrayList testList ) { this.testList = testList; } } - I got the idea for set/getTestList from this mailinglist. The result: Error: 500 Location: /WEB-INF/jsp/editCart.jsp Internal Servlet Error: javax.servlet.ServletException: No getter method for property test of bean editCartForm at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:459) at WEB_0002dINF.jsp._0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart_ jsp_7._jspService(_0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart _jsp_7.java:690) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) : : Root cause: javax.servlet.jsp.JspException: No getter method for property test of bean editCartForm at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:519) at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:190) at WEB_0002dINF.jsp._0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart_ jsp_7._jspService(_0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart _jsp_7.java:534) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) What am I doing wrong? Any help appreciated Marcel Maré WebToTheMax [EMAIL PROTECTED]
Problem uploading MS-Word documents
Hi guys, I'm having problem uploading MS-Word documents using Struts (org.apache.struts.upload.FormFile). It works for plain text or html files, but Word documents get corrupted in the process. Also, it seems that the problem happens when I upload documents from Windows. I've tried with some Word documents that had been extracted from a zip archive directly into Unix and these work fine. Has any of you had a similar problem ? This is my environment: Struts 1.0 Tomcat 3.2.2 Apache 1.3.12 Solaris 7 on Sparc I apologize in advance if this question had already been answered before.I searched Google (news groups) and could not find anything there. Thanks for any help on this, Eduardo Fujii Monterey Institute of International Studies 400 Pacific Street Room D-203 Monterey, CA 93940 (831)647-6679 [EMAIL PROTECTED]
RE: Problem uploading MS-Word documents
Just a guess, but it sounds like a MIME type issue. Perhaps your server or service provider needs to add that word.doc MIME type to the recognized file types. -Original Message-From: Eduardo Fujii [mailto:[EMAIL PROTECTED]]Sent: Tuesday, August 07, 2001 2:44 PMTo: [EMAIL PROTECTED]Subject: Problem uploading MS-Word documents Hi guys, I'm having problem uploading MS-Word documents using Struts (org.apache.struts.upload.FormFile). It works for plain text or html files, but Word documents get corrupted in the process. Also, it seems that the problem happens when I upload documents from Windows. I've tried with some Word documents that had been extracted from a zip archive directly into Unix and these work fine. Has any of you had a similar problem ? This is my environment: Struts 1.0 Tomcat 3.2.2 Apache 1.3.12 Solaris 7 on Sparc I apologize in advance if this question had already been answered before.I searched Google (news groups) and could not find anything there. Thanks for any help on this, Eduardo Fujii Monterey Institute of International Studies 400 Pacific Street Room D-203 Monterey, CA 93940 (831)647-6679 [EMAIL PROTECTED]
Very Very Newbie::problem with digester
Hello, I am trying to build a small simple app that reads a database.xml file that contains one entry (a recipe with 2 ingredients) and then displays the recipe. I can access attributes of the recipe except for the ingredients, which don't seem to be loading into the database. I don't get any errors. Here is the database.xml file database recipe recipeName=dinner1 serves=2 prepTime=20 minutes ingredient ingredientName=pasta quantity=1 unit=cup/ ingredient ingredientName=sauce quantity=1unit=cup/ /recipe /database and here is the code for load() (in DatabaseServlet; everything else is the same as DatabaseServlet for the example app, except instead of addUser() there is addRecipe()): private synchronized void load() throws Exception { // Initialize our database database = new Hashtable(); // Acquire an input stream to our database file if (debug = 1) log(Loading database from ' + pathname + '); InputStream is = getServletContext().getResourceAsStream(pathname); if (is == null) { log(No such resource available - loading empty database); return; } BufferedInputStream bis = new BufferedInputStream(is); // Construct a digester to use for parsing Digester digester = new Digester(); digester.push(this); digester.setDebug(debug); digester.setValidating(false); digester.addObjectCreate(database/recipe, org.hilary.Recipe); digester.addSetProperties(database/recipe); digester.addSetNext(database/recipe, addRecipe); digester.addObjectCreate(database/recipe/ingredient, org.hilary.Ingredient); digester.addSetProperties(database/recipe/ingredient); digester.addSetTop(database/recipe/ingredient, setRecipe); // the setRecipe method is in the Ingredient class // I also tried: // digester.addSetTop(database/recipe/ingredient, addIngredient, org.hilaryIngredient); // where addIngredient is declared in the Recipe class // I got errors with that attempt. // Parse the input stream to initialize our database digester.parse(bis); bis.close(); } I can print out properties of the recipe that are in the recipe tag itself, like 'serves' and 'prepTime' and if I do: bean:write name=recipe property=ingredients scope=session filter=%= true %/ It prints out [Lorg.hilary.Ingredient;@7f0dde which seems promising to me, but I'm too inexperienced to feel confident about that! However if I try to iterate through the ingredients, I get nothing, no errors, no print out. here is the code: logic:iterate id=ingredient name=recipe property=ingredients tr td align=left bean:write name=ingredient property=ingredientName filter=%= true %/ /td td align=left bean:write name=ingredient property=quantity filter=%= true %/ /td td align=left bean:write name=ingredient property=unit filter=%= true %/ /td /tr /logic:iterate I tried to access the ingredients when I put the recipe in the session in MenuAction. In the Struts Example app, in LogonAction, when putting the user into the session, I can access a subscription associated with the user just fine, but when I try to do a similar thing in my own app it doesn't work, it always is null. What step did I miss that will add the ingredients to the database? I looked at another struts sample app, the one described in the Professional JSP 2nd edition, and it uses the digester in a slightly different way, which I couldn't get to work at all. Anyway any thoughts at all would oh so helpful. Cheers, Hilary
struts-example NoClassFoundException User
I have seen this problem raised several times in the list archives, but have never found a solution. I'm sorry if I am asking something obvious. I started with fresh install of Tomcat 3.2.2 running on a RedHat Linux 6.2 box with Sun jdk 1.3. I got xml parser jar files jaxp.jar and crimson.jar and copied them to $TOMCAT_HOME/lib. I also put in jdbc2_0-stdext.jar. I copied the struts-example.war file into $TOMCAT_HOME/webapps directory. When starting up Tomcat, it fails while loading struts-example with: New org.apache.struts.webapp.example.User Begin event threw exception java.lang.ClassNotFoundException: org.apache.struts.webapp.example.User The struts-documentation war file works fine. I have seen a number of responses indicating that struts.jar located in the CLASSPATH or in $TOMCAT_HOME/lib will cause this error. In my setup, struts.jar is only found in the WEB-INF/lib directory. WEB-INF/classes has the directory hierarcy for org.apache.struts.webapp.example.User If I jar it up and put it into $TOMCAT_HOME/lib, or copy the WEB-INF/classes hierarchy to $TOMCAT_HOME/classes, then I can get around this error and actually get the app to start. But I must be missing something pretty fundamental. It doesn't seem that my WEB-INF/classes or WEB-INF/lib directories are added to the application's context on startup. I tried Tomcat 3.2.3 with the same result. I tried Tomcat 4 (beta 6) and didn't get the error: instead I got a sealing violation with one of the xml parser jar files. I fiddled around with that, too, trying different versions, searching lists, ensuring I didn't have two parser jar files in my CLASSPATH, etc, but didn't get any luckier. Any suggestions would be greatly appreciated. It has been a frustrating weekend... :) Thanks Glenn Heinze [EMAIL PROTECTED] __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: Field level ActionErrors
Sorry, Jason. I don't see anything after your sentence just use this on your jsp page:. (Is it my Eudora problem or the mailing list problem?!) Could you please re-post your message? Thanks. -- John At 07:55 AM 8/7/2001 -0500, you wrote: Will, It's actually pretty easy. When you are generating your errors, i.e.: ActionErrors errors = new ActionErrors(); errors.add(field1, new ActionError(field1.error.message)); That ties the error to a property on your form called field1. Then if you want to display that error message (if it exists) next to that field (or anywhere), just use this on your jsp page: That's about it! -jason -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610
Re: Introspection used in Struts (Was: Bean convention vs. Struts convention)
My understanding is there is a significant performance impact when using reflection to call methods. While the Method.invoke() is reasonably quick, Class.getMethod() lookup is slow (in an order of magnitude). It's actually possible to cache the java.lang.reflect.Method instances after the first lookup. Am I right? Is such caching necessary and does Struts do this caching? -- John At 12:03 PM 8/7/2001 -0700, you wrote: The use of introspection in Struts is totally based on the rules that the JDK implements (in the java.beans.Introspector class). These are in turn based on the naming design patterns in the JavaBeans Specification, which you can grab at: http://java.sun.com/products/javabeans/ Note that the standard JSP tags use exactly the same set of rules. Craig -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610
Re: Introspection used in Struts (Was: Bean convention vs. Strutsconvention)
On Wed, 8 Aug 2001, John Yu wrote: My understanding is there is a significant performance impact when using reflection to call methods. While the Method.invoke() is reasonably quick, Class.getMethod() lookup is slow (in an order of magnitude). My experience has been that reflection processing done by Struts has a vanishingly small impact on overall app performance (although it is definitely more expensive than hard coded method calls). It's actually possible to cache the java.lang.reflect.Method instances after the first lookup. Am I right? Yes, but you don't need to worry about it. Is such caching necessary and does Struts do this caching? Struts already does it (inside the PropertyUtils class). The first time it encounters a particular bean class, Struts executes: BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); PropertyDescriptor descriptors[] = beanInfo.getPropertyDescriptors(); and caches the descriptors[] array. Each PropertyDescriptor already has a direct reference to the appropriate getter and setter Method objects, so they are in effect being cached as well. The Class.getMethod() call is never ever utilized. -- John Craig
RE: Field level ActionErrors
try view source on the message it was a html tag with $lt; html:errors property="field1" /gt; -Original Message-From: John Yu [mailto:[EMAIL PROTECTED]]Sent: Tuesday, August 07, 2001 8:35 PMTo: [EMAIL PROTECTED]Subject: Re: Field level ActionErrorsSorry, Jason. I don't see anything after your sentence "just use this on your jsp page:". (Is it my Eudora problem or the mailing list problem?!) Could you please re-post your message? Thanks.--JohnAt 07:55 AM 8/7/2001 -0500, you wrote: Will,It's actually pretty easy. When you are generating your errors, i.e.:ActionErrors errors = new ActionErrors();errors.add("field1", new ActionError("field1.error.message"));That ties the error to a property on your form called "field1". Then if you want to display that error message (if it exists) next to that field (or anywhere), just use this on your jsp page:That's about it! -jason -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989w: http://www.scioworks.com m: +(65) 9782 9610
RE: Field level ActionErrors
Even I don't understand what I said. Jason's message included a sample html tag html:errors property="field1" of course that is in normal tag brackets . You might be able to see it viewing the source. -Original Message-From: Nick Chalko [mailto:[EMAIL PROTECTED]]Sent: Tuesday, August 07, 2001 9:48 PMTo: '[EMAIL PROTECTED]'Subject: RE: Field level ActionErrors try view source on the message it was a html tag with $lt; html:errors property="field1" /gt; -Original Message-From: John Yu [mailto:[EMAIL PROTECTED]]Sent: Tuesday, August 07, 2001 8:35 PMTo: [EMAIL PROTECTED]Subject: Re: Field level ActionErrorsSorry, Jason. I don't see anything after your sentence "just use this on your jsp page:". (Is it my Eudora problem or the mailing list problem?!) Could you please re-post your message? Thanks.--JohnAt 07:55 AM 8/7/2001 -0500, you wrote: Will,It's actually pretty easy. When you are generating your errors, i.e.:ActionErrors errors = new ActionErrors();errors.add("field1", new ActionError("field1.error.message"));That ties the error to a property on your form called "field1". Then if you want to display that error message (if it exists) next to that field (or anywhere), just use this on your jsp page:That's about it! -jason -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989w: http://www.scioworks.com m: +(65) 9782 9610
RE: Field level ActionErrors
Thanks, Nick. p.s. Even the email source doesn't have the tag... Weird... -- John At 09:48 PM 8/7/2001 -0700, you wrote: try view source on the message it was a html tag with $lt; html:errors property=field1 /gt; -Original Message- From: John Yu [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 8:35 PM To: [EMAIL PROTECTED] Subject: Re: Field level ActionErrors Sorry, Jason. I don't see anything after your sentence just use this on your jsp page:. (Is it my Eudora problem or the mailing list problem?!) Could you please re-post your message? Thanks. -- John At 07:55 AM 8/7/2001 -0500, you wrote: Will, It's actually pretty easy. When you are generating your errors, i.e.: ActionErrors errors = new ActionErrors(); errors.add(field1, new ActionError(field1.error.message)); That ties the error to a property on your form called field1. Then if you want to display that error message (if it exists) next to that field (or anywhere), just use this on your jsp page: That's about it! -jason -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610
Re: Introspection used in Struts (Was: Bean convention vs. Struts convention)
At 09:38 PM 8/7/2001 -0700, you wrote: Struts already does it (inside the PropertyUtils class). The first time it encounters a particular bean class, Struts executes: BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); PropertyDescriptor descriptors[] = beanInfo.getPropertyDescriptors(); and caches the descriptors[] array. Each PropertyDescriptor already has a direct reference to the appropriate getter and setter Method objects, so they are in effect being cached as well. Struts!!! Struts!!! Struts!!! :-) Thanks, Craig. -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610