SV: How to create an include which calls an action: jsp:include page=some action Really need help : The Answer!
What I did is the following. I have a master jsp and in this jsp I inserted the following page. tile:insert controllerUrl=/viewNavigation.do page=/jsp/myJspPage.jsp/ Now there are two important things to consider. First in your action mapping definition in this case viewNavigation.do you must add the redirect=true to the foward attribute. If you do this, your navigation action does not need to return null, if you don't add this attribute, then your action must return null. The problem with the latter, is that you can't call this action (viewNavigation.do) in any other way than using the tile tag, because it will jus be a blank page. Here is my action mapping! action path=/viewNavigation scope=session name=someForm type=something.web.controller..ViewMultiNavigationAction forward name=success path=/jsp/myJspPage.jsp redirect=true / /action On my jsp page it looks like this Jsp start *** Bla bla Bla bla tile:insert controllerUrl=/viewNavigation.do page=/jsp/myJspPage.jsp/ Bla bla Bla bla Jsp end My action does not return null because of the redirect=true forward name=success path=/jsp/myJspPage.jsp redirect=true / Hope this helps Cheers Tommy -Oprindelig meddelelse- Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sendt: 25. februar 2004 21:31 Til: Tommy Holm - TELMORE Emne: SV: How to create an include which calls an action I'm getting the following error. Can you send me an usage example. I wonder if controller action returns jsp to include why should we give page attribute again? tiles:insert page=/cap/capGeneralInfoAction.ecims flush=true /tiles:insert Thanks, Giri. Old message from Tommy ** No currently none of the proposed solutions worked. I am currently looking into the Tiles:insert tag Attributes are page = the jsp page to insert And most importantly there is an controller attribute which should be an action that perhaps prepares the jsp page. Just testing it now - HOLD ON - it works ... Check the tiles:insert tag Alternatively I figured another way to do it, it's very ugly though, you can jsp:include an action that just returns null.It does however set up the bean. Then right after this include on your master jsp, you call another jsp include that just includes a regular jsp, on this jsp you can reference The bean that the first include prepared and work as usual. I admitt the latter solution is very ugly, the tiles way seems to be the way to go! Cheers /Tommy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Subclassing DynaValidatorForm
Paul-J Woodward wrote: Hmm nasty, thinking quickly, I'd guess you have three options: 1. pass the username to the form (dangerous as it's easy to hack) 2. don't display fields the user can't set (again easy to hack) 3. have two copies of the form, one in a session, one in the request. On submission, copy the fields from the request form to the session form if the user has permission to set them, otherwise ignore any changes to the field. Better still, do 2 and 3. I finally managed to address that problem - I didn't had time the last few days.. All solutions I thought about before were quite unsatisfying. I resolved the issue by applying a additional filter on each action. It wraps the request in a new RequestWrapper, which filters all parameters based on a xml-based access list as the example below. form-beans form-bean name=editUserForm form-property name=uid read=self,admin write=userAdmin/ form-property name=password read=self,admin write=self,userAdmin/ ... /form-bean /form-beans I'm using the same structure to display/disable the apropriate formfield (read only means = form will be disabled). If the user doesn't have access to a formfield, the parameter gets replaced by it's original value (taken from a copy of the bean in the session). That added another line of defense to my app.. :) Thanks, Arne Brutschy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to use html:link... with JSTL?
html-el:link page=${mylink} a href=c:url value=${mylink} / or if you're running tc5 then just use the expression language in html:link .. (i think it should work). On 26 Feb 2004, at 08:37, Zsolt Koppany wrote: Hi, how can (should) I use html:link... with JSTL? Zsolt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DynaValidatorForm loses property value
hi, I have changed a DynaActionForm to a DynaValidatorForm. The DynaActionForm email property (the only property on the form) was being displayed in a new popup window. Since I changed to a DynaValidator form it shows the value as blank. I have the Javascript validation working OK. The flow of events is as follows 1. User clicks on Request Email button on main window 2. ShowEmailAction is called that populates emailAddress property. (I have confirmed value is put into form). 3. Pops up new window and shows show_email.jsp. The emailAddress property is blank. struts-config.xml form-bean name=EmailForm type=org.apache.struts.validator.DynaValidatorForm form-property name=emailAddress type=java.lang.String / /form-bean action path=/enquiry/showEmail type=com.cuscal.mmdd.action.cuenquiry.ShowEmailAction name=EmailForm scope=session input=/enquiry/showEmail.do validate=false forward name=success path=com/cuscal/mmdd/jsp/cu_enquiry/show_email.jsp/ /action ShowEmailAction public class ShowEmailAction extends MMDDirectBaseAction { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // logger.debug(Entered ShowEmailAction method); System.out.println(Entered ShowEmailAction method); UserView user = getUserContainer(request).getUserView(); String email = user.getEmail(); DynaValidatorForm emailForm = (DynaValidatorForm) form; // DynaActionForm emailForm = (DynaActionForm) form; emailForm.set(emailAddress, email); System.out.println(@@@email= + emailForm.get(emailAddress)); // This bit works return mapping.findForward(success); } } show_email.jsp .. tags, validator javascript, etc ... html:html HEAD META http-equiv=Content-Type content=text/html; charset=ISO-8859-1 META name=GENERATOR content=IBM WebSphere Studio META http-equiv=Content-Style-Type content=text/css link href=html:rewrite href='/MMDDirectWeb/com/cuscal/mmdd/jsp/cu_enquiry/styles/styles00.css' / rel=stylesheet type=text/css / TITLEemail.jsp/TITLE /HEAD BODY PstrongVerify Email Address/strong/P html:javascript formName=EmailForm / pPlease check/correct/add the email address below where the member's list will be sent/p html:form action=/enquiry/email.do onsubmit=return validateEmailForm(this); !--bean:define name=EmailForm property=emailAddress id=ea type=java.lang.String / -- html:text property=emailAddress size=35/br/ div align=rightp/p a href=# class=button1 onClick=window.close();Cancel/a !--html:link href=../enquiry/email.do styleClass=button1Submit link/html:link -- !--html:link action=/enquiry/email.do styleClass=button1Submit/html:link -- html:submit styleClass=buttonSubmit/html:submit /div /html:form /BODY /html:html So close yet so far. Thanks for any assistance. regards, Ralph Roper Business Technology Services (BTS) Credit Union Services NOTICE The information in this email and or any of the attachments may contain; a. Confidential information of Credit Union Services Corporation (Australia) Limited (CUSCAL) or third parties; and or b. Legally privileged information of CUSCAL or third parties; and or c. Copyright material of CUSCAL or third parties. If you are not an authorised recipient of this email, please contact CUSCAL immediately by return email or by telephone on 61-2-8299 9000 and delete the email from your system. We do not accept any liability in connection with computer virus, data corruption, interruption or any damage generally as a result of transmission of this email. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaValidatorForm loses property value
Perhaps validate=true.. Another point is you don't need to cast DynaValidatorForm in your action, DynaActionForm will do or even DynaBean. When the action servlet see's that validate = true the validate() method is called and errors returned to the view before the action is run. If you have a look at some of the struts 1.0 examples with validation methods in them and then see when validator came onto the screen it starts making sense. On explanation of action forms was that they act like a fire wall between the view and the action, whether fire wall was the best description is debatable but it worked for me at the time. On 26 Feb 2004, at 09:59, RALPH ROPER wrote: hi, I have changed a DynaActionForm to a DynaValidatorForm. The DynaActionForm email property (the only property on the form) was being displayed in a new popup window. Since I changed to a DynaValidator form it shows the value as blank. I have the Javascript validation working OK. The flow of events is as follows 1. User clicks on Request Email button on main window 2. ShowEmailAction is called that populates emailAddress property. (I have confirmed value is put into form). 3. Pops up new window and shows show_email.jsp. The emailAddress property is blank. struts-config.xml form-bean name=EmailForm type=org.apache.struts.validator.DynaValidatorForm form-property name=emailAddress type=java.lang.String / /form-bean action path=/enquiry/showEmail type=com.cuscal.mmdd.action.cuenquiry.ShowEmailAction name=EmailForm scope=session input=/enquiry/showEmail.do validate=false forward name=success path=com/cuscal/mmdd/jsp/cu_enquiry/show_email.jsp/ /action ShowEmailAction public class ShowEmailAction extends MMDDirectBaseAction { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // logger.debug(Entered ShowEmailAction method); System.out.println(Entered ShowEmailAction method); UserView user = getUserContainer(request).getUserView(); String email = user.getEmail(); DynaValidatorForm emailForm = (DynaValidatorForm) form; // DynaActionForm emailForm = (DynaActionForm) form; emailForm.set(emailAddress, email); System.out.println(@@@email= + emailForm.get(emailAddress)); // This bit works return mapping.findForward(success); } } show_email.jsp .. tags, validator javascript, etc ... html:html HEAD META http-equiv=Content-Type content=text/html; charset=ISO-8859-1 META name=GENERATOR content=IBM WebSphere Studio META http-equiv=Content-Style-Type content=text/css link href=html:rewrite href='/MMDDirectWeb/com/cuscal/mmdd/jsp/cu_enquiry/styles/ styles00.css' / rel=stylesheet type=text/css / TITLEemail.jsp/TITLE /HEAD BODY PstrongVerify Email Address/strong/P html:javascript formName=EmailForm / pPlease check/correct/add the email address below where the member's list will be sent/p html:form action=/enquiry/email.do onsubmit=return validateEmailForm(this); !-- bean:define name=EmailForm property=emailAddress id=ea type=java.lang.String / -- html:text property=emailAddress size=35/br/ div align=rightp/p a href=# class=button1 onClick=window.close();Cancel/a !-- html:link href=../enquiry/email.do styleClass=button1Submit link/html:link -- !-- html:link action=/enquiry/email.do styleClass=button1Submit/html:link -- html:submit styleClass=buttonSubmit/html:submit /div /html:form /BODY /html:html So close yet so far. Thanks for any assistance. regards, Ralph Roper Business Technology Services (BTS) Credit Union Services NOTICE The information in this email and or any of the attachments may contain; a. Confidential information of Credit Union Services Corporation (Australia) Limited (CUSCAL) or third parties; and or b. Legally privileged information of CUSCAL or third parties; and or c. Copyright material of CUSCAL or third parties. If you are not an authorised recipient of this email, please contact CUSCAL immediately by return email or by telephone on 61-2-8299 9000 and delete the email from your system. We do not accept any liability in connection with computer virus, data corruption, interruption or any damage generally as a result of transmission of this email. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaValidatorForm loses property value
Try adding 'name' attribute to the html:text tag html:text name=EmailForm property=emailAddress size=35/ The html:form tag will expose (or create a new) the ActionForm associated with the mapping with a value of 'org.apache.struts.taglib.html.BEAN'. This is the default 'name' for html tags if you don't specify one (which you arnt). The action mapping on your form is /enquiry/email.do - not the /enquiry/showEmail that you are showing us in your struts-config. My bet is the mapping for /enquiry/email.do is still in your struts-config.xml associated with a different form - so the html:form tag is creating a new 'empty' form, with no email address and thats what your html:text tag is picking up - not your new form. Niall - Original Message - From: RALPH ROPER [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:59 AM Subject: DynaValidatorForm loses property value hi, I have changed a DynaActionForm to a DynaValidatorForm. The DynaActionForm email property (the only property on the form) was being displayed in a new popup window. Since I changed to a DynaValidator form it shows the value as blank. I have the Javascript validation working OK. The flow of events is as follows 1. User clicks on Request Email button on main window 2. ShowEmailAction is called that populates emailAddress property. (I have confirmed value is put into form). 3. Pops up new window and shows show_email.jsp. The emailAddress property is blank. struts-config.xml form-bean name=EmailForm type=org.apache.struts.validator.DynaValidatorForm form-property name=emailAddress type=java.lang.String / /form-bean action path=/enquiry/showEmail type=com.cuscal.mmdd.action.cuenquiry.ShowEmailAction name=EmailForm scope=session input=/enquiry/showEmail.do validate=false forward name=success path=com/cuscal/mmdd/jsp/cu_enquiry/show_email.jsp/ /action ShowEmailAction public class ShowEmailAction extends MMDDirectBaseAction { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // logger.debug(Entered ShowEmailAction method); System.out.println(Entered ShowEmailAction method); UserView user = getUserContainer(request).getUserView(); String email = user.getEmail(); DynaValidatorForm emailForm = (DynaValidatorForm) form; // DynaActionForm emailForm = (DynaActionForm) form; emailForm.set(emailAddress, email); System.out.println(@@@email= + emailForm.get(emailAddress)); // This bit works return mapping.findForward(success); } } show_email.jsp .. tags, validator javascript, etc ... html:html HEAD META http-equiv=Content-Type content=text/html; charset=ISO-8859-1 META name=GENERATOR content=IBM WebSphere Studio META http-equiv=Content-Style-Type content=text/css link href=html:rewrite href='/MMDDirectWeb/com/cuscal/mmdd/jsp/cu_enquiry/styles/styles00.css' / rel=stylesheet type=text/css / TITLEemail.jsp/TITLE /HEAD BODY PstrongVerify Email Address/strong/P html:javascript formName=EmailForm / pPlease check/correct/add the email address below where the member's list will be sent/p html:form action=/enquiry/email.do onsubmit=return validateEmailForm(this); !-- bean:define name=EmailForm property=emailAddress id=ea type=java.lang.String / -- html:text property=emailAddress size=35/br/ div align=rightp/p a href=# class=button1 onClick=window.close();Cancel/a !-- html:link href=../enquiry/email.do styleClass=button1Submit link/html:link -- !-- html:link action=/enquiry/email.do styleClass=button1Submit/html:link -- html:submit styleClass=buttonSubmit/html:submit /div /html:form /BODY /html:html So close yet so far. Thanks for any assistance. regards, Ralph Roper Business Technology Services (BTS) Credit Union Services NOTICE The information in this email and or any of the attachments may contain; a. Confidential information of Credit Union Services Corporation (Australia) Limited (CUSCAL) or third parties; and or b. Legally privileged information of CUSCAL or third parties; and or c. Copyright material of CUSCAL or third parties. If you are not an authorised recipient of this email, please contact CUSCAL immediately by return email or by telephone on 61-2-8299 9000 and delete the email from your system. We do not accept any liability in connection with computer virus, data corruption, interruption or any damage generally as a result of transmission of this email. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
using ActionForm for transfeering result set data
Thank you the detailed reply. Can we populate ActionForm to populate result set data..How? and then how one can retrieve it in JSP page ..in html table. If anybody has already done it ..I will appreciate if they can send me sample code...else even hint/refrences will do Pradeep Kumar Digital Globalsoft Ltd. (A subsidiary of Hewlett-Packard) -Original Message- From: Khalid K. [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 3:38 AM To: Struts Users Mailing List Subject: Re: data transfer from Action class to jsp page Just to expand on what Max said, 1. create a ActionForm i.e. class MyForm extends ActionForm 2. define attributes that you want to show on the jsp i.e. name, street, city, zip 3. you can optionally define validate() and reset() methods 4. define your form bean in struts-config.xml 5. associate the form bean with your action in struts-config.xml 6. in your action read data from database populate form 7. in jsp access form attributes to display values and if needed let client change it. Khalid Quoting Max Cooper [EMAIL PROTECTED]: Put it in the ActionForm. -Max - Original Message - From: Pradeep, PK [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 6:51 AM Subject: data transfer from Action class to jsp page I have this basic question. Suppose action class calls some business object and fetches some data (say employee detail). How to transfer this data to jsp page which is reached through ActionForward? One way I know is storing the data in session object..is there any better/different way - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Khalid K. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Xhtml tag usage question
I tried to insert the xhtml tag in my pages, but the only way I found is to insert it in each tile that composes my page. It seems it is not sufficient to put it in the template file, or in the page using the template. Is there a better approach ? Any help is appreciated Renato Renato Romano Sistemi e Telematica S.p.A. Calata Grazie - Vial Al Molo Giano 16127 - GENOVA e-mail: [EMAIL PROTECTED] Tel.: 010 2712603 _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 4 Compression Filter
Thanks Navjot. Thats another option I hadn't thought of. Niall - Original Message - From: Navjot Singh [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 5:10 AM Subject: RE: Tomcat 4 Compression Filter put apache in front of tomcat and install mod_gzip with apache. it will do almost everything you can wish for? -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 5:43 PM To: Struts User Jakarta Subject: Tomcat 4 Compression Filter There is a CompressionFilter class shipped with with Tomcat which compresses the ServletResponse that I'm considering using (we have some remote offices which have slow links): http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-4.0/webapps/exampl es/WEB-INF/classes/compressionFilters/CompressionFilter.java?rev=1. 8view=auto It looks OK to me and seems to work fine when I plug it into my app. I'm a bit concerned that its only an example class rather than standard feature of Tomcat. Has anyone used this in a 'live' environment and if so are there any issues or with it or recommendations? Does anyone have any alternatives that they have deployed? Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JavaScript Parameter
First when debuging javascript alert boxes are handy. alert(this.form,'%= val %') or alert(this.form,'c:out value=${val} /') or on tc 5 alert(this.form,'${val}') if that does what you want start debuging the functions by using alert boxes. function myfunction(form,val) { alert(form.name); alert(val); } onclick=myfunction(this.form,'%= val %') if you use double quotes like you seem to be you may have to escape them, generally easier to use ' rather than when calling functions in the html (in the actual script I prefer to stick to as more readable). and so on. You should get to the bottom of your problem soon enough. On 26 Feb 2004, at 05:32, Anirudh Jayanth wrote: Hi, I have a scriptlet % String val=obj.getValue(Key); % I need to use this value to be passed as a javascript parameter inorder to set a property value. html:image pageKey=.. altKey=.. onclick=jsFunction(form,%=val%) / The parameter value is not being passed to jsFunction This works when I use a hardcoded value html:image pageKey=.. altKey=.. onclick=jsFunction(form,1234) / I have tried these variations aswell html:image pageKey=.. altKey=.. onclick=jsFunction(form,%=val%) / html:image pageKey=.. altKey=.. onclick=jsFunction(form,'%=val%') / Cud somebody please tell me the correct way to do this. Regards, Anirudh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Xhtml tag usage question
Unfortunately it saves the xhtml 'flag' in page scope so there isn't much you can do about it. Background: BaseHandlerTag has an isXhtml() method which calls the TagUtils.isXhtml() method which checks the xhtml 'flag' in page scope. I did think a solution would be to override the TagUtils.isXhtml() method to either always return 'true' or check a flag in request scope (which you would have to set some way) - but unfortunately the instance variable for TagUtils is both private and final - so theres no way to extend and implement your own custom TagUtils version in 'vanilla' struts. If you build your own version of struts, you could change TagUtils itself, so maybe thats an option for you - but then every time you take a new struts version you have to re-implement your change. Another alternative is to extend the struts tags to create 'xhtml' versions - all you would have to do is override the isXhtml() method there. For example public class XhtmlTextTag extends TextTag public XhtmlTextTag () { super(); } protected boolean isXhtml() { return true; } } So I think you have a few options: - put the html:xhtml tag in every jsp - build your own version of struts and change TagUtils - extend the struts tags to create xhtml versions Personally, I would go with html:xhtml for now and try to get struts changed so that either the scope of the xhtml flag can be customized or TagUtils can be extended and overriden. Niall - Original Message - From: Renato Romano [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:49 AM Subject: Xhtml tag usage question I tried to insert the xhtml tag in my pages, but the only way I found is to insert it in each tile that composes my page. It seems it is not sufficient to put it in the template file, or in the page using the template. Is there a better approach ? Any help is appreciated Renato Renato Romano Sistemi e Telematica S.p.A. Calata Grazie - Vial Al Molo Giano 16127 - GENOVA e-mail: [EMAIL PROTECTED] Tel.: 010 2712603 _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormBeans: A question of Style
I consider the ActionForms to be part of the view primarily. They should both collect submitted data and provide the JSP (or other view components) with most or all the data they need to render the page (camp 2). I say 'most' only because sometimes custom tags can be useful for getting data for list boxes, etc. All the data that the Action collects, however, should be carried to the JSP in the ActionForm. The alternatives for carrying data from Actions to JSPs for the camp 1 gang are not attractive, in my opinion. Having an Action put a bunch of stuff into the request or session scope creates a lot of coupling between the Action and JSP. The Action must know where to put it and the JSP must know where to find it with that scenario. I prefer to keep the Actions and JSPs loosely coupled by having them both depend on the ActionForm, rather than depending on each other. The Action populates the ActionForm, and the JSP renders it. For complex pages, the ActionForm can be the root of an object graph that contains all the data you need to render the page. Stashing additional info all over the session and request is sloppy by comparison, in my opinion. I think the ActionForm is the root of all view data approach promotes more concentrated thought about the structure of the data, which is a good thing. It provides a more concrete interface between the controller (Action) and view (JSP) components. Maintaining JSPs that get their data from one place is much easier than maintaining JSPs that have to collect, organize, and display data from multiple sources. JSPs that pull data from the ActionForm, stuff stashed in the session, and/or stuff stashed in the request are harder to maintain. Where do I find it? How does it all relate? Yuk! -Max On Thu, 2004-02-26 at 17:57, [EMAIL PROTECTED] wrote: We have 2 camps of thought on the subject of the appropriate use of Struts form beans. Here are the thoughts: Camp 1: Form beans are controller components and should be used only to transport user input data between JSP forms (or across JSP forms) and Action classes. Camp 2: Form beans should be use for what Camp 1 thinks, plus they should also contain all the data a JSP uses to render a page (i.e. All the model data is inserted into the form bean as well as the form data.) Any thoughts? Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with tags and overloaded methods
Just so it's clear, I'm assuming that you have the get method overloaded, with the same method name being used for two different properties (even if you consider them the same conceptual property). I would guess that's always a bad idea. Huh? I thought that's what we were supposed to do for indexed properties. I'm somewhat surprised that it works on one platform with the same appserver, and doesn't on the other. Are they using the same WLS version and JDK version? Hmm..the local server is using JDK 1.3.1_06, and the dev server is using 1.3.1_10. I don't know what WLS is. Hmm...we were warned that 1.3.1_10 was more picky that what we had been using on the dev server in parsing properties. I'll have to look closely at the page that works in both environments with no changes, I thought it was doing the same thing in a couple of places. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: (Fwd) row counts in logic:iterate...
Because ctr is an Integer object - not a int primitive. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 5:13 PM Subject: (Fwd) row counts in logic:iterate... Sorry, my mailer messed up the last one, so here again... newbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. logic:iterate name=dateForm property=raw id=foo indexId=ctr I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? td%= ctr + 1 %/td I would guess: ctr and 1 are added, and is then cast to a string, and then printed in my table column. Then why do i get this error? operator + cannot be applied to java.lang.Integer, int [javac] out.print( ctr + 1 ); It also does not work when I create a new variable with %! int i=0; % , and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp, as ctr + 1??? Rinke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
servlet filters and authentication
Hello, I'm configuring the skeleton of a multi module struts application, and i would like use a filter for the authentication. here is psuedojava (for easier reading) of the filter: public final class AuthFilter implements Filter { public void doFilter(request, response, chain) session = request.getSession(); auth = session.getAttribute(authenticated); if (auth == true) { chain.doFilter(request, response); return; } else { dispatcher = request.getRequestDispatcher(/WEB-INF/jsp/security/login.jsp); dispatcher.forward (request, response); return; } } } I've seen this skeleton suggested in several places on the web. The question i have is this: After the user submits the login form, the request will come through the filter, and since it has not yet been authenticated, it will again forward to the login.jsp. I've thought of a couple of ways to deal with this and would like to get input on these and any other approaches. 1) set the mapping of the filter in web.xml in such a way that it allows the login action through. maybe set all actions to have an extension of .do except the login action, which has an extension of .auth. I don't think this will work for me, because the multi module support of Struts requires extension mapping. I guess i could write a small serlvet that is not in the struts mapping but is in the same context and have it mapped to *.auth 2) check within the above filter to see if the request is for the login action, and if so allow it through. so the if statement above would be: if (auth == true || req.getPath().equals(login.do)) Any comments on these ideas or approaches i haven't listed would be greatly appreciated. dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help converting from session to request scope
Quoting Mark Lowe [EMAIL PROTECTED]: sure i agree .. but I've been wanting to dick around with alternatives to storing in the session for a while (since the request vs session debate). and just wondered if anyone had tried read/writing to a flat file as an alternative. Just remember that it's needless extra work and overhead unless the memory occupancy actually matters. The number of actually matters applications is likely to be a fairly small percentage of the total. Additionally I think that sessions are stored in this way anyway so might be a waste of time. That depends on your container, and how you have it configured. Tomcat, for example, by default only puts sessions in memory unless you're shutting down the app (or the server), in which case it serializes all the session objects to disk. However, you can configure the PersistentManager if you wish, which includes the ability to swap active but idle sessions out to disk (either flat files or to a database) in a manner similar to what operating systems do with active but idle processes. From the developer perspective, the nice thing about this is it's zero extra code -- other than the need to make your session objects Serializable, which is not typically very difficult. But then I imagine that session objects are loaded into memory where using an old school read-write to a flat file might be less greedy. Doing any I-O at all has overhead costs ... if memory is not an issue any such approach is *guaranteed* to make your application slower than leaving the objects in memory. guess its dog food time. Buying RAM is cheaper than paying for developer and testing time :-). So is configuring servers if they support the feature already. Craig McClanahan On 26 Feb 2004, at 15:42, Paul McCulloch wrote: My intuitive response would be that I'd use ram freely and let the O/S worry about paging stuff to disk if it runs out of physical memory. I'd *guess* that the O/S can use disk for paging significantly faster than a Java programmer can via the JVM the O/S. I think that you'd have to run some pretty exhaustive tests in an environment close to your production one to determine which method is more efficient. Personally I'd just spend the money on a bit more ram instead of developer time... Paul -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: 26 February 2004 13:24 To: Struts Users Mailing List Subject: Re: need help converting from session to request scope Niall Any opinions on read and writing to flat files to avoid additional ram use? Or you reckon that the reading and writing would consume similar amounts of ram? I'll get around to trying it when i get a moment. On 26 Feb 2004, at 14:04, Niall Pemberton wrote: Given your scenario, it sounds like a good candidate for a session scoped form. I agree with what Mark Lowe said - usually/often ...theres no more work invloved scoping to request - thats been the case for my app. I would also do what you said in a previous post - which is clean up the session stuff when they navigate away to another part of the app. I'm in the do it in request unless you have good reason(s) to use the session camp - rather than the anti-session camp as it may have appeared in previous threads. Niall - Original Message - From: Paul McCulloch [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 4:13 PM Subject: RE: need help converting from session to request scope My application has an Asset search form. The user can enter many criteria to search on. Most of these criteria themselves are looked up from the database (e.g the Person associated with the Asset search). When the user selects a search criteria (e.g. the Person) I store the DTO for that person on my search form. The view element displays details about that Person on the search form until the search form is cleared. Many requests will be made to find the criteria before the Asset search itself is performed. To do this using a request scope form would require that I transfer all of the details I want to display about that person in hidden inputs on the form. If the details I want to display about a Person change then I'd also need to change the hidden fields. In addition once I ship the application to my customers they may have their own JSP developer show extra prpoerties of the selected Person. So, that's my justification for using session scoped form beans. Any comments gratefully recieved. Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -
RE: JavaScript Parameter
Mozilla has a JavaScript debugger that is very very useful for stepping through the code to see where the error crops up. Worth downloading and learning to use. Has saved many hours time for me I can say! (alerts() are still very useful though. Espcially for bugs that only come up in IE!) -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, 26 February 2004 18:58 To: Struts Users Mailing List Subject: Re: JavaScript Parameter First when debuging javascript alert boxes are handy. alert(this.form,'%= val %') or alert(this.form,'c:out value=${val} /') or on tc 5 alert(this.form,'${val}') if that does what you want start debuging the functions by using alert boxes. function myfunction(form,val) { alert(form.name); alert(val); } onclick=myfunction(this.form,'%= val %') if you use double quotes like you seem to be you may have to escape them, generally easier to use ' rather than when calling functions in the html (in the actual script I prefer to stick to as more readable). and so on. You should get to the bottom of your problem soon enough. On 26 Feb 2004, at 05:32, Anirudh Jayanth wrote: Hi, I have a scriptlet % String val=obj.getValue(Key); % I need to use this value to be passed as a javascript parameter inorder to set a property value. html:image pageKey=.. altKey=.. onclick=jsFunction(form,%=val%) / The parameter value is not being passed to jsFunction This works when I use a hardcoded value html:image pageKey=.. altKey=.. onclick=jsFunction(form,1234) / I have tried these variations aswell html:image pageKey=.. altKey=.. onclick=jsFunction(form,%=val%) / html:image pageKey=.. altKey=.. onclick=jsFunction(form,'%=val%') / Cud somebody please tell me the correct way to do this. Regards, Anirudh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help converting from session to request scope
Given your scenario, it sounds like a good candidate for a session scoped form. I agree with what Mark Lowe said - usually/often ...theres no more work invloved scoping to request - thats been the case for my app. I would also do what you said in a previous post - which is clean up the session stuff when they navigate away to another part of the app. I'm in the do it in request unless you have good reason(s) to use the session camp - rather than the anti-session camp as it may have appeared in previous threads. Niall - Original Message - From: Paul McCulloch [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 4:13 PM Subject: RE: need help converting from session to request scope My application has an Asset search form. The user can enter many criteria to search on. Most of these criteria themselves are looked up from the database (e.g the Person associated with the Asset search). When the user selects a search criteria (e.g. the Person) I store the DTO for that person on my search form. The view element displays details about that Person on the search form until the search form is cleared. Many requests will be made to find the criteria before the Asset search itself is performed. To do this using a request scope form would require that I transfer all of the details I want to display about that person in hidden inputs on the form. If the details I want to display about a Person change then I'd also need to change the hidden fields. In addition once I ship the application to my customers they may have their own JSP developer show extra prpoerties of the selected Person. So, that's my justification for using session scoped form beans. Any comments gratefully recieved. Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT]jsp and version control
Hi We are developing a web project which incudes jsp ,struts etc. we are using VSS for source control, we are sending jar files to the client and each jar file we have a manifest file which has the version number,build number and date, so if there is any error we just ask the version, build and date to track down the source and fix it, But since we cannot bundle all the jsp in jar file, how do we know what source the client have, do we have to include build number etc in each and every jsp we send, or include a jsp with build number, any ideas, how do people keep track of what jsp code is running on client machine. we have different clients running different versions and build Ashish We version control our JSPs through the keyword substitution functionality provided by our source code repository. Every one of our JSPs contain a comment at the top, containing versioning information. For example: %-- $Id:$ --% Is the simplest version. CVS has a keyword ($Name:$ I believe) that inserts the checkout label/tag, if a checkout is performed by label. For example, if you label the current development tree as revision_1_1, and then perform a checkout based on that revision tag (something like cvs checkout -r revision_1_1, then $Name:$ will be replaced with $Name: revision_1_1$. However, I'm not very familiar with VSS (other then the fact that it doesn't scale very well), therefore, I can't tell you how to do this in your environment. Hope this helps JDG -- Jay Glanville - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Removing business logic from Actions
Hi all, Ive seen quite a few web applications employing Struts where business logic is bolted straight in to Action classes. While not-so-bad for small projects, this obviously can 'get out of hand' for large applications - leading to poor maintainability, dependency on the web tier etc etc. So, I got to thinking, what should an application specific struts Action really be doing? My interpretation of a 'standard case' boiled down to the following: * Interpret an ActionForm to produce (a) business value object(s) * Delegate to the 'business' layer to perform some functionality * (Optionally) Interpret result and add elements to request / session to facilitate view (optionally creating a view model from a returned business object) * (Optionall) Interpret result to find an appropriate forward In my (limited) experience, it seems all too easy to extend the actions responsibilities to cover things which should really be accomplished by the business tier. So I got to thinking about ways to 'channel' action development the right way, and thought about a 'MediatorAction'. MediatorAction accomplish the above 4 tasks in a declarative manner (probably using an xml configuration file), and would rely heaviliy on the use of Java Beans - in the same way as the struts custom tags. As a quick example, lets suppose we have this rough action: public class OrderAction extends Action { ... public ActionForward execute(...) { // Stage 1 - create business VO from form and potentially request ProductVO product = createProductRequest(form, request); // Stage 2 - invoke business layer OrderResult result = shop.orderProduct(product); // Interpret result if (result.getStatus().isSuccess()) { // Stage 3 - create view model from result (optional, could just use 'result') OrderDetails orderDetails = result.getDetails(); request.setAttribute(ORDER_VIEW, orderDetails); // Stage 4 - we now know our mapping return mapping.findForward(SUCCESS); } else { // Stage 4 - we now know our mapping return mapping.findForward(FAILURE); } } ... } Lets assume MediatorAction exists. Here is partial configuration to show how the same result could be acheived declaratively: mediatorAction path=/orders/PlaceOrder result property=status.success value=true forward=showOrderDetails export id=orderView property=details scope=request /result result property=status.success value=false forward=failedOrder / /mediatorAction It can be seen that we can query the result of a business operation in an 'nested bean' manner to match a 'result', which in turn defines a forward, and can optionall 'export' (or even remove) objects in a defined scope. This is a simplified example. It may be that we wish to map a business object in to a view model object before exporting it to a scope. E.g, we may have an OrderViewModel which we wish to populate from the result. We would have the ability to specifiy a 'ViewMapper' in the export element which would enable custom conversion from a business object to the exported (view) object. Obviously, a 'BusinessMapper' would be installed to map from the Form / Request to a business object to be provided to the configured business delegate. I think such a combination would enable 'typical' app specific struts actions to be declared easily, and would reduce the chances of business logic creeping in. The 'mappers' would provide the targeted parametization to enable the action to be used in a wide variety of contexts. I would be really grateful for any feedback on this approach. I'd happily develop it further / make it available if people think it would be useful. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem in nested tags- Very Urgent - Please Help
Or use the Commons Collections LazyList which handles this problem automatically. -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:09 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help shirish posted this a few times. if you're scoping to request you'll need a while loop in your getFoo(int index) method public class OrgManagementForm extends ActionForm { private List addressList = new ArrayList(); public Address getAddress(int index) { while(index = addressList.size() ) { this.addressList.add( new Address() ); } return (Address) addressList.get(index); } bla bla. } look like it could be your problem. On 26 Feb 2004, at 14:57, Parthasarathy Kesavaraj wrote: I am having an OrganzationVO inside my form-bean. The OrganzationVO has a collection of AddressVOs. I am using nested tags like this. nested:nest property = orgVO nested:text property=orgID size=10 maxlength=10 styleClass=inputmandtabindex= / nested:iterate id=addressid property=addresses indexId=index nested:text property=company1 size=30 maxlength=30 styleClass=inputmand tabindex= / /nested:iterate /nested:nest while submitting the form I am getting an exception like this. 2004-02-26 18:17:08,133 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. commons.beanutils.BeanUtils - setProperty([EMAIL PROTECTED], orgVO.a ddresses[0].company1, [get populated]) getAddrVOAL--[] Feb 26, 2004 6:17:08 PM IST Error HTTP BEA-101017 [ServletContext(id=1735147,name=gbs,conte xt-path=/gbs)] Root cause of ServletException. java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Property U tils. java:525) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyU tils. java:428) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUt ils.j ava:770) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.ja va:80 1) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProces sor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java :254) at com.puma.gbs.action.RequestProcessor.process(RequestProcessor.java:133) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(S ervle tStubImpl.jav a:1053) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl .java :387) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java :27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction. run(W ebAppServletC ontext.java:6316) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedS ubjec t.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java: 118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServ letCo ntext.java:36 22) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl .java :2569) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) 2004-02-26 18:18:40,616 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. struts.util.RequestUtils - Get module name for path /uma/showOrgDetails.do 2004-02-26 18:18:40,616 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. struts.util.RequestUtils - Module name found: /uma 2004-02-26 18:18:40,616 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. struts.action.RequestProcessor - Processing a 'POST' for path '/showOrgDetails' My OrgVO is like this. public class OrgVO { private ArrayList addresses = new ArrayList();//collection of addressVOs /** * Gets ArrayList of AddressVOs * * @return addrVOAL ArrayList a list of Address VO */
Re: [ot]Re: JavaScript Parameter
Another solution is to to see the source of the page ie-View-source - Original Message - From: Mark Lowe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 3:22 PM Subject: [ot]Re: JavaScript Parameter IE on PC (when i have to test) seems to also like complaining about javascript where it says it doesn't find object but then the script proceed to work anyway. And I thought id'ed document objects were loaded into an array when the page loads to. I seem to recall that you can install a script debugger on windoze but i never really played with it long enough to see if it was useful or not. I haven't played with mozilla js debugger I'll have to give it a go. But the only one available when i used to do a lot of dhtml development was in the old ns4 vs ie4 days and the two doms were too far apart for them to be useful. On 26 Feb 2004, at 13:18, Andrew Hill wrote: Mozilla has a JavaScript debugger that is very very useful for stepping through the code to see where the error crops up. Worth downloading and learning to use. Has saved many hours time for me I can say! (alerts() are still very useful though. Espcially for bugs that only come up in IE!) -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, 26 February 2004 18:58 To: Struts Users Mailing List Subject: Re: JavaScript Parameter First when debuging javascript alert boxes are handy. alert(this.form,'%= val %') or alert(this.form,'c:out value=${val} /') or on tc 5 alert(this.form,'${val}') if that does what you want start debuging the functions by using alert boxes. function myfunction(form,val) { alert(form.name); alert(val); } onclick=myfunction(this.form,'%= val %') if you use double quotes like you seem to be you may have to escape them, generally easier to use ' rather than when calling functions in the html (in the actual script I prefer to stick to as more readable). and so on. You should get to the bottom of your problem soon enough. On 26 Feb 2004, at 05:32, Anirudh Jayanth wrote: Hi, I have a scriptlet % String val=obj.getValue(Key); % I need to use this value to be passed as a javascript parameter inorder to set a property value. html:image pageKey=.. altKey=.. onclick=jsFunction(form,%=val%) / The parameter value is not being passed to jsFunction This works when I use a hardcoded value html:image pageKey=.. altKey=.. onclick=jsFunction(form,1234) / I have tried these variations aswell html:image pageKey=.. altKey=.. onclick=jsFunction(form,%=val%) / html:image pageKey=.. altKey=.. onclick=jsFunction(form,'%=val%') / Cud somebody please tell me the correct way to do this. Regards, Anirudh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem in nested tags- Very Urgent - Please Help
wouldn't mind an example of how to use lazy list if you have one. On 26 Feb 2004, at 15:33, Paul, R. Chip wrote: Or use the Commons Collections LazyList which handles this problem automatically. -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:09 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help shirish posted this a few times. if you're scoping to request you'll need a while loop in your getFoo(int index) method public class OrgManagementForm extends ActionForm { private List addressList = new ArrayList(); public Address getAddress(int index) { while(index = addressList.size() ) { this.addressList.add( new Address() ); } return (Address) addressList.get(index); } bla bla. } look like it could be your problem. On 26 Feb 2004, at 14:57, Parthasarathy Kesavaraj wrote: I am having an OrganzationVO inside my form-bean. The OrganzationVO has a collection of AddressVOs. I am using nested tags like this. nested:nest property = orgVO nested:text property=orgID size=10 maxlength=10 styleClass=inputmandtabindex= / nested:iterate id=addressid property=addresses indexId=index nested:text property=company1 size=30 maxlength=30 styleClass=inputmand tabindex= / /nested:iterate /nested:nest while submitting the form I am getting an exception like this. 2004-02-26 18:17:08,133 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. commons.beanutils.BeanUtils - setProperty([EMAIL PROTECTED], orgVO.a ddresses[0].company1, [get populated]) getAddrVOAL--[] Feb 26, 2004 6:17:08 PM IST Error HTTP BEA-101017 [ServletContext(id=1735147,name=gbs,conte xt-path=/gbs)] Root cause of ServletException. java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Property U tils. java:525) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Property U tils. java:428) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyU t ils.j ava:770) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.j a va:80 1) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProce s sor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.jav a :254) at com.puma.gbs.action.RequestProcessor.process(RequestProcessor.java: 133) at org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run( S ervle tStubImpl.jav a:1053) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImp l .java :387) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.jav a :27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction . run(W ebAppServletC ontext.java:6316) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticated S ubjec t.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java: 118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSer v letCo ntext.java:36 22) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImp l .java :2569) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) 2004-02-26 18:18:40,616 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. struts.util.RequestUtils - Get module name for path /uma/showOrgDetails.do 2004-02-26 18:18:40,616 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. struts.util.RequestUtils - Module name found: /uma 2004-02-26 18:18:40,616 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. struts.action.RequestProcessor - Processing a 'POST' for path '/showOrgDetails' My OrgVO is like this. public class OrgVO { private ArrayList addresses = new ArrayList();//collection of addressVOs /** * Gets ArrayList of AddressVOs * * @return addrVOAL ArrayList a list of Address VO */
Re: [ot]Re: JavaScript Parameter
yeah thanks.. you know, i'd never thought of that.. On 26 Feb 2004, at 15:39, Jim Theodoridis wrote: Another solution is to to see the source of the page ie-View-source - Original Message - From: Mark Lowe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 3:22 PM Subject: [ot]Re: JavaScript Parameter IE on PC (when i have to test) seems to also like complaining about javascript where it says it doesn't find object but then the script proceed to work anyway. And I thought id'ed document objects were loaded into an array when the page loads to. I seem to recall that you can install a script debugger on windoze but i never really played with it long enough to see if it was useful or not. I haven't played with mozilla js debugger I'll have to give it a go. But the only one available when i used to do a lot of dhtml development was in the old ns4 vs ie4 days and the two doms were too far apart for them to be useful. On 26 Feb 2004, at 13:18, Andrew Hill wrote: Mozilla has a JavaScript debugger that is very very useful for stepping through the code to see where the error crops up. Worth downloading and learning to use. Has saved many hours time for me I can say! (alerts() are still very useful though. Espcially for bugs that only come up in IE!) -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, 26 February 2004 18:58 To: Struts Users Mailing List Subject: Re: JavaScript Parameter First when debuging javascript alert boxes are handy. alert(this.form,'%= val %') or alert(this.form,'c:out value=${val} /') or on tc 5 alert(this.form,'${val}') if that does what you want start debuging the functions by using alert boxes. function myfunction(form,val) { alert(form.name); alert(val); } onclick=myfunction(this.form,'%= val %') if you use double quotes like you seem to be you may have to escape them, generally easier to use ' rather than when calling functions in the html (in the actual script I prefer to stick to as more readable). and so on. You should get to the bottom of your problem soon enough. On 26 Feb 2004, at 05:32, Anirudh Jayanth wrote: Hi, I have a scriptlet % String val=obj.getValue(Key); % I need to use this value to be passed as a javascript parameter inorder to set a property value. html:image pageKey=.. altKey=.. onclick=jsFunction(form,%=val%) / The parameter value is not being passed to jsFunction This works when I use a hardcoded value html:image pageKey=.. altKey=.. onclick=jsFunction(form,1234) / I have tried these variations aswell html:image pageKey=.. altKey=.. onclick=jsFunction(form,%=val%) / html:image pageKey=.. altKey=.. onclick=jsFunction(form,'%=val%') / Cud somebody please tell me the correct way to do this. Regards, Anirudh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: using ActionForm for transfeering result set data
Can we populate ActionForm to populate result set data..How? and then how one can retrieve it in JSP page ..in html table. If anybody has already done it ..I will appreciate if they can send me sample code...else even hint/refrences will do Pradeep Kumar Digital Globalsoft Ltd. (A subsidiary of Hewlett-Packard) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
custom validator question
I'm creating a custom validator to enforce a = relationship between 2 date fields and am having a problem. A validator method gets a Field arg for the field with which it's associated in validation.xml, but I need to also get the Field object for the other date field. I need this so that I can get its property name for display in an error message. (I'd also like to be able to get the field's datePattern.) I can't figure out how to do this. Any help would be much appreciated! jim Here's the relevant part of my validation.xml file: form name=ActivityViewForm field property=starting depends=date arg0 key=ActivityViewForm.starting.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var /field field property=ending depends=date,date1LEdate2 arg0 key=ActivityViewForm.ending.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var var var-namedate1/var-name var-valuestarting/var-value /var /field /form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem in nested tags- Very Urgent - Please Help
Note: I think this is likely different in current versions of the commons collections lib, but this works for the version we are dependent on. import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.Factory; import org.apache.commons.collections.ListUtils; // Nonrelevant imports ommitted public class LazyListExampleForm extends ActionForm { private List actionList; public LazyListExampleForm () { Factory factory = new Factory() { public Object create() { return new ActionListBean(); } }; this.actionList = ListUtils.lazyList(new ArrayList(), factory); } // Getter/setters for list omitted } -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:49 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help wouldn't mind an example of how to use lazy list if you have one. On 26 Feb 2004, at 15:33, Paul, R. Chip wrote: Or use the Commons Collections LazyList which handles this problem automatically. -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:09 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help shirish posted this a few times. if you're scoping to request you'll need a while loop in your getFoo(int index) method public class OrgManagementForm extends ActionForm { private List addressList = new ArrayList(); public Address getAddress(int index) { while(index = addressList.size() ) { this.addressList.add( new Address() ); } return (Address) addressList.get(index); } bla bla. } look like it could be your problem. On 26 Feb 2004, at 14:57, Parthasarathy Kesavaraj wrote: I am having an OrganzationVO inside my form-bean. The OrganzationVO has a collection of AddressVOs. I am using nested tags like this. nested:nest property = orgVO nested:text property=orgID size=10 maxlength=10 styleClass=inputmand tabindex= / nested:iterate id=addressid property=addresses indexId=index nested:text property=company1 size=30 maxlength=30 styleClass=inputmand tabindex= / /nested:iterate /nested:nest while submitting the form I am getting an exception like this. 2004-02-26 18:17:08,133 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. commons.beanutils.BeanUtils - setProperty([EMAIL PROTECTED], orgVO.a ddresses[0].company1, [get populated]) getAddrVOAL--[] Feb 26, 2004 6:17:08 PM IST Error HTTP BEA-101017 [ServletContext(id=1735147,name=gbs,conte xt-path=/gbs)] Root cause of ServletException. java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert y U tils. java:525) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Property U tils. java:428) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyU t ils.j ava:770) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.j a va:80 1) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProce s sor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.jav a :254) at com.puma.gbs.action.RequestProcessor.process(RequestProcessor.java: 133) at org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run( S ervle tStubImpl.jav a:1053) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImp l .java :387) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.jav a :27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction . run(W ebAppServletC ontext.java:6316) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticated S ubjec t.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java: 118) at
RE: Problem in nested tags- Very Urgent - Please Help
IIRC, you also need it in reset(): public class LazyListExampleForm extends ActionForm { private List actionList; public LazyListExampleForm () { initLists(); } public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); initLists(); } private void initLists() { Factory factory = new Factory() { public Object create() { return new ActionListBean(); } }; this.actionList = ListUtils.lazyList(new ArrayList(), factory); } // Getter/setters for list omitted } - Hubert --- Paul, R. Chip [EMAIL PROTECTED] wrote: Note: I think this is likely different in current versions of the commons collections lib, but this works for the version we are dependent on. import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.Factory; import org.apache.commons.collections.ListUtils; // Nonrelevant imports ommitted public class LazyListExampleForm extends ActionForm { private List actionList; public LazyListExampleForm () { Factory factory = new Factory() { public Object create() { return new ActionListBean(); } }; this.actionList = ListUtils.lazyList(new ArrayList(), factory); } // Getter/setters for list omitted } -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:49 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help wouldn't mind an example of how to use lazy list if you have one. On 26 Feb 2004, at 15:33, Paul, R. Chip wrote: Or use the Commons Collections LazyList which handles this problem automatically. -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:09 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help shirish posted this a few times. if you're scoping to request you'll need a while loop in your getFoo(int index) method public class OrgManagementForm extends ActionForm { private List addressList = new ArrayList(); public Address getAddress(int index) { while(index = addressList.size() ) { this.addressList.add( new Address() ); } return (Address) addressList.get(index); } bla bla. } look like it could be your problem. On 26 Feb 2004, at 14:57, Parthasarathy Kesavaraj wrote: I am having an OrganzationVO inside my form-bean. The OrganzationVO has a collection of AddressVOs. I am using nested tags like this. nested:nest property = orgVO nested:text property=orgID size=10 maxlength=10 styleClass=inputmand tabindex= / nested:iterate id=addressid property=addresses indexId=index nested:text property=company1 size=30 maxlength=30 styleClass=inputmand tabindex= / /nested:iterate /nested:nest while submitting the form I am getting an exception like this. 2004-02-26 18:17:08,133 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. commons.beanutils.BeanUtils - setProperty([EMAIL PROTECTED], orgVO.a ddresses[0].company1, [get populated]) getAddrVOAL--[] Feb 26, 2004 6:17:08 PM IST Error HTTP BEA-101017 [ServletContext(id=1735147,name=gbs,conte xt-path=/gbs)] Root cause of ServletException. java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert y U tils. java:525) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Property U tils. java:428) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyU t ils.j ava:770) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.j a va:80 1) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProce s sor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.jav a :254) at com.puma.gbs.action.RequestProcessor.process(RequestProcessor.java: 133) at org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at
RE: Java source out of memory
We have enough memory, If I remove some code from JSP Weblogic 8 creates a java source which is 600 to 800 KB, which is too big. Obiviously its trying to create more that one meg when I have the full jsp source. The jsp is as below, its small but has many nested tags and static includes Would like ot know the reason how weblogic tries to create such a big file and how to avoid it? And of course with full jsp src should not give out of memory error while creating java source... %@ page import=org.apache.struts.util.*% %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/pims-bean prefix=pbean % %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-logic prefix=logic % %@ taglib uri=/tags/pims-logic prefix=plogic % %@ taglib uri=/tags/pims-html prefix=phtml % script language=JavaScript src=/js/pimsScript.js/script script language=JavaScript src=/js/validation.js/script script language=JavaScript src=/js/util.js/script %@ include file=../css/style1.jsp % plogic:security formId=pims.forms.common.personEdit/plogic:security plogic:notSecured itemId=0 logic:forward name=notAllowed //plogic:notSecured pbean:define id=localObject name=currentObject type=org.rms.pims.presentation.person.JPerson /pbean:define bean:define id=ignoreSec value=true/ div class=detailTitle div class=subTitle style=Person Update:/div bean:write name=localObject property=firstName/nbsp;bean:write name=localObject property=lastName/ /div html:form action=personEditAction styleId=bodyForm target=_top html:hidden property=prsnId value=%=String.valueOf(localObject.getPrsnId())% /html:hidden html:hidden property=actionParam value=/ html:hidden property=createByPrsnId name=localObject/html:hidden html:hidden property=createDate name=localObject/html:hidden html:hidden property=lastChgByPrsnId name=localObject/html:hidden html:hidden property=lastChgDate name=localObject/html:hidden DIV class=detailOutput table width=90% !-- Summary Info -- %-- Note: imgName = sectionName + Img --% trtd class=sectionTitle valign=middle img id=summaryImg src=/image/tree/minusbox.gif class=linkedImg onClick='toggle(this);' Summary /td /tr trtd div id=summary !-- sectionName-- !-- lastName -- bean:define id=editItem value=false/ plogic:security objectId=form.person.label.lastName ignoreSec=%=ignoreSec% bean:define id=editItem value=true/ div class=detailRowdiv class=labelpbean:message key=form.person.label.lastName//div plogic:stageInd itemId=form.person.label.lastName keyItemValue=%=localObject.getPrsnId()% /plogic:stageInd div class=valuehtml:text size=20 styleClass=pimsText property=lastName name=localObject style=width:150px;//div plogic:staging name=form.person.label.lastName imageSrc=/icon/indicator/request_a_change.gif stageDataInd=false/plogic:staging /div /plogic:security logic:equal name=editItem value=false html:hidden property=lastName name=localObject/ /logic:equal !-- firstName -- bean:define id=editItem value=false/ plogic:security objectId=form.person.label.firstName ignoreSec=%=ignoreSec% bean:define id=editItem value=true/ div class=detailRowdiv class=labelpbean:message key=form.person.label.firstName//div plogic:stageInd itemId=form.person.label.firstName keyItemValue=%=localObject.getPrsnId()% /plogic:stageInd div class=valuehtml:text size=20 styleClass=pimsText property=firstName name=localObject style=width:150px;//div plogic:staging name=form.person.label.firstName imageSrc=/icon/indicator/request_a_change.gif stageDataInd=false/plogic:staging /div /plogic:security logic:equal name=editItem value=false html:hidden property=firstName name=localObject/ /logic:equal !-- middleName -- bean:define id=editItem value=false/ plogic:security objectId=form.person.label.middleName ignoreSec=%=ignoreSec% bean:define id=editItem value=true/ div class=detailRowdiv class=labelpbean:message key=form.person.label.middleName//div plogic:stageInd itemId=form.person.label.middleName keyItemValue=%=localObject.getPrsnId()% /plogic:stageInd
Re: Problem in nested tags- Very Urgent - Please Help
Nice one.. For some reason i thought the Factory would involve more than it does, so i shied away from it. Cheers Mark On 26 Feb 2004, at 15:57, Paul, R. Chip wrote: Note: I think this is likely different in current versions of the commons collections lib, but this works for the version we are dependent on. import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.Factory; import org.apache.commons.collections.ListUtils; // Nonrelevant imports ommitted public class LazyListExampleForm extends ActionForm { private List actionList; public LazyListExampleForm () { Factory factory = new Factory() { public Object create() { return new ActionListBean(); } }; this.actionList = ListUtils.lazyList(new ArrayList(), factory); } // Getter/setters for list omitted } -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:49 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help wouldn't mind an example of how to use lazy list if you have one. On 26 Feb 2004, at 15:33, Paul, R. Chip wrote: Or use the Commons Collections LazyList which handles this problem automatically. -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:09 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help shirish posted this a few times. if you're scoping to request you'll need a while loop in your getFoo(int index) method public class OrgManagementForm extends ActionForm { private List addressList = new ArrayList(); public Address getAddress(int index) { while(index = addressList.size() ) { this.addressList.add( new Address() ); } return (Address) addressList.get(index); } bla bla. } look like it could be your problem. On 26 Feb 2004, at 14:57, Parthasarathy Kesavaraj wrote: I am having an OrganzationVO inside my form-bean. The OrganzationVO has a collection of AddressVOs. I am using nested tags like this. nested:nest property = orgVO nested:text property=orgID size=10 maxlength=10 styleClass=inputmandtabindex= / nested:iterate id=addressid property=addresses indexId=index nested:text property=company1 size=30 maxlength=30 styleClass=inputmand tabindex= / /nested:iterate /nested:nest while submitting the form I am getting an exception like this. 2004-02-26 18:17:08,133 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. commons.beanutils.BeanUtils - setProperty([EMAIL PROTECTED], orgVO.a ddresses[0].company1, [get populated]) getAddrVOAL--[] Feb 26, 2004 6:17:08 PM IST Error HTTP BEA-101017 [ServletContext(id=1735147,name=gbs,conte xt-path=/gbs)] Root cause of ServletException. java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert y U tils. java:525) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert y U tils. java:428) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(Property U t ils.j ava:770) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils. j a va:80 1) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java: 881) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc e s sor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja v a :254) at com.puma.gbs.action.RequestProcessor.process(RequestProcessor.java: 133) at org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run ( S ervle tStubImpl.jav a:1053) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm p l .java :387) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja v a :27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio n . run(W ebAppServletC ontext.java:6316) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate d S ubjec t.java:317) at
ValidatorActionForm cannot generate javascript validation code
It Works great with ValidatorForm but with ValidatorActionForm I can't make it work, this is my code: Struts-config.xml .. action path=/saveProyectoVersiones type=org.itechnology.actions.SaveProyectoVersionesAction name=proyectoForm scope=request input=proyecto_versiones forward name=success path=/editProyectoVersiones.do?action=Create/ forward name=proyecto_versiones path=/proyecto_versiones.jsp/ /action ... validation.xml ... form name=/saveProyectoVersiones field property=descripcionVersion depends=required arg0 key=prompt.descripcion/ /field /form ... and the class ProyectoForm.java .. import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.validator.ValidatorActionForm; import org.apache.struts.action.ActionMapping; public final class ProyectoForm extends ValidatorActionForm { // --- Instance Variables /** * The maintenance action we are performing (Create or Edit). */ private String action = Create; private String index = null; ... and the .jsp file ... html:form action=/saveProyectoVersiones onsubmit=return validateProyectoForm(); html:hidden property=action/ table border=0 width=100% cellspacing=0 cellpadding=0 . /html:form html:javascript formName=proyectoForm dynamicJavascript=true staticJavascript=false/ script language=Javascript1.1 src=staticJavascript.jsp/script /html:html
RE: custom validator question
I guess I wasn't clear (also, I was a bit confused :) My validator is already working, and what you suggest below will get me the property name I need for display in an error msg. But how can I get the datePattern from mySecondDate? At the moment I'm assuming it'll be the same as for myFirstDate, but that's just an assumption... -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 10:18 AM To: Struts Users Mailing List Subject: Re: custom validator question Specify the second field as var field property=myFirstDate depends=date,dateCompare var var-namedatePattern/var-name var-valuedd/MM//var-value /var var var-namecompareDate/var-name var-valuemySecondDate/var-value /var /field Then in your custom validation method: String datePattern = field.getVarValue(datePattern); String compareDateProperty = field.getVarValue(compareDate); String compareDate = ValidatorUtils.getValueAsString(bean, compareDateProperty); Niall - Original Message - From: Anderson, James H [IT] [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 2:54 PM Subject: custom validator question I'm creating a custom validator to enforce a = relationship between 2 date fields and am having a problem. A validator method gets a Field arg for the field with which it's associated in validation.xml, but I need to also get the Field object for the other date field. I need this so that I can get its property name for display in an error message. (I'd also like to be able to get the field's datePattern.) I can't figure out how to do this. Any help would be much appreciated! jim Here's the relevant part of my validation.xml file: form name=ActivityViewForm field property=starting depends=date arg0 key=ActivityViewForm.starting.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var /field field property=ending depends=date,date1LEdate2 arg0 key=ActivityViewForm.ending.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var var var-namedate1/var-name var-valuestarting/var-value /var /field /form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: custom validator question
I wasn't aware of it--I'm using Struts 1.1. I'll check it out. Thanks. -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 10:20 AM To: Struts User Jakarta Subject: Re: custom validator question Also, what about using the existing ValidWhen validation http://jakarta.apache.org/struts/userGuide/dev_validator.html Niall - Original Message - From: Niall Pemberton [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 3:17 PM Subject: Re: custom validator question Specify the second field as var field property=myFirstDate depends=date,dateCompare var var-namedatePattern/var-name var-valuedd/MM//var-value /var var var-namecompareDate/var-name var-valuemySecondDate/var-value /var /field Then in your custom validation method: String datePattern = field.getVarValue(datePattern); String compareDateProperty = field.getVarValue(compareDate); String compareDate = ValidatorUtils.getValueAsString(bean, compareDateProperty); Niall - Original Message - From: Anderson, James H [IT] [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 2:54 PM Subject: custom validator question I'm creating a custom validator to enforce a = relationship between 2 date fields and am having a problem. A validator method gets a Field arg for the field with which it's associated in validation.xml, but I need to also get the Field object for the other date field. I need this so that I can get its property name for display in an error message. (I'd also like to be able to get the field's datePattern.) I can't figure out how to do this. Any help would be much appreciated! jim Here's the relevant part of my validation.xml file: form name=ActivityViewForm field property=starting depends=date arg0 key=ActivityViewForm.starting.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var /field field property=ending depends=date,date1LEdate2 arg0 key=ActivityViewForm.ending.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var var var-namedate1/var-name var-valuestarting/var-value /var /field /form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help converting from session to request scope
PersistentManager was the keyword i needed.. Nice one On 26 Feb 2004, at 17:27, Craig R. McClanahan wrote: Quoting Mark Lowe [EMAIL PROTECTED]: sure i agree .. but I've been wanting to dick around with alternatives to storing in the session for a while (since the request vs session debate). and just wondered if anyone had tried read/writing to a flat file as an alternative. Just remember that it's needless extra work and overhead unless the memory occupancy actually matters. The number of actually matters applications is likely to be a fairly small percentage of the total. Additionally I think that sessions are stored in this way anyway so might be a waste of time. That depends on your container, and how you have it configured. Tomcat, for example, by default only puts sessions in memory unless you're shutting down the app (or the server), in which case it serializes all the session objects to disk. However, you can configure the PersistentManager if you wish, which includes the ability to swap active but idle sessions out to disk (either flat files or to a database) in a manner similar to what operating systems do with active but idle processes. From the developer perspective, the nice thing about this is it's zero extra code -- other than the need to make your session objects Serializable, which is not typically very difficult. But then I imagine that session objects are loaded into memory where using an old school read-write to a flat file might be less greedy. Doing any I-O at all has overhead costs ... if memory is not an issue any such approach is *guaranteed* to make your application slower than leaving the objects in memory. guess its dog food time. Buying RAM is cheaper than paying for developer and testing time :-). So is configuring servers if they support the feature already. Craig McClanahan On 26 Feb 2004, at 15:42, Paul McCulloch wrote: My intuitive response would be that I'd use ram freely and let the O/S worry about paging stuff to disk if it runs out of physical memory. I'd *guess* that the O/S can use disk for paging significantly faster than a Java programmer can via the JVM the O/S. I think that you'd have to run some pretty exhaustive tests in an environment close to your production one to determine which method is more efficient. Personally I'd just spend the money on a bit more ram instead of developer time... Paul -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: 26 February 2004 13:24 To: Struts Users Mailing List Subject: Re: need help converting from session to request scope Niall Any opinions on read and writing to flat files to avoid additional ram use? Or you reckon that the reading and writing would consume similar amounts of ram? I'll get around to trying it when i get a moment. On 26 Feb 2004, at 14:04, Niall Pemberton wrote: Given your scenario, it sounds like a good candidate for a session scoped form. I agree with what Mark Lowe said - usually/often ...theres no more work invloved scoping to request - thats been the case for my app. I would also do what you said in a previous post - which is clean up the session stuff when they navigate away to another part of the app. I'm in the do it in request unless you have good reason(s) to use the session camp - rather than the anti-session camp as it may have appeared in previous threads. Niall - Original Message - From: Paul McCulloch [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 4:13 PM Subject: RE: need help converting from session to request scope My application has an Asset search form. The user can enter many criteria to search on. Most of these criteria themselves are looked up from the database (e.g the Person associated with the Asset search). When the user selects a search criteria (e.g. the Person) I store the DTO for that person on my search form. The view element displays details about that Person on the search form until the search form is cleared. Many requests will be made to find the criteria before the Asset search itself is performed. To do this using a request scope form would require that I transfer all of the details I want to display about that person in hidden inputs on the form. If the details I want to display about a Person change then I'd also need to change the hidden fields. In addition once I ship the application to my customers they may have their own JSP developer show extra prpoerties of the selected Person. So, that's my justification for using session scoped form beans. Any comments gratefully recieved. Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
row counts in logic:iterate...
colorparam0100,0100,0100/paramnewbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. colorparam7F00,,7F00/paramFontFamilyparamCourier New/paramlogic:iteratecolorparam,,/param colorparam,7F00,/paramnamecolorparam,,/param=colorparam,,FF00/paramdateFormcolorparam,,/param colorparam,7F00,/parampropertycolorparam,,/param=colorparam,,FF00/paramrawcolorparam,,/param colorparam,7F00,/paramidcolorparam,,/param=colorparam,,FF00/paramfoocolorparam,,/param colorparam,7F00,/paramindexIdcolorparam,,/param=colorparam,,FF00/paramctrcolorparam,,/param colorparam7F00,,7F00/paramcolorparam,,/param colorparam0100,0100,0100/paramFontFamilyparamArial/param I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? tdboldcolorparam7F00,,/paramFontFamilyparamCourier New/param%=/boldcolorparam0100,0100,0100/param colorparam,,/paramctrcolorparam0100,0100,0100/param colorparam,,/param+colorparam0100,0100,0100/param colorparam,,/param1colorparam0100,0100,0100/param boldcolorparam7F00,,/param%/td /bold/colorFontFamilyparamARIAL/paramI would guess: ctr and 1 are added, and is then cast to a string, and then print it in my table column. Then why do i get this error? colorparam0100,0100,0100/paramFontFamilyparamTimes New Roman/parambiggeroperator + cannot be applied to java.lang.Integer,int [javac] out.print( ctr + 1 ); ^ It also does not work when I create a new variabel with %! int i=0; %, and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp?? RinkeFontFamilyparamArial/paramsmaller - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: (Fwd) row counts in logic:iterate...
Rinke: Your ctr seems to be an *Integer* object and you are using it as an int. So simply say: ctr.intValue() + 1 and you should be ok. Geeta [EMAIL PROTECTED] wrote: Then why do i get this error? operator + cannot be applied to java.lang.Integer, int [javac] out.print( ctr + 1 ); Rinke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: (Fwd) row counts in logic:iterate...
You get the error because, apparently, ctr is an Integer - not an int. Try %= ctr.intValue() + 1 %, if you want to display it using JSTL EL, you'd probably be better off using c:forEach to iterate. -- Voytek Jarnot Quantum materiae materietur marmota monax si marmota monax materiam possit materiari? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 11:13 AM To: [EMAIL PROTECTED] Subject: (Fwd) row counts in logic:iterate... Sorry, my mailer messed up the last one, so here again... newbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. logic:iterate name=dateForm property=raw id=foo indexId=ctr I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? td%= ctr + 1 %/td I would guess: ctr and 1 are added, and is then cast to a string, and then printed in my table column. Then why do i get this error? operator + cannot be applied to java.lang.Integer, int [javac] out.print( ctr + 1 ); It also does not work when I create a new variable with %! int i=0; % , and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp, as ctr + 1??? Rinke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem in nested tags- Very Urgent - Please Help
Hi Thanks for ur replies. But i could not understand what actually is the problem and how lazy list will solve it. This is the first time i am coming across lazy list. can u explain what actually is the problem and how lazy list wil handle the problem With Regards Partha -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:35 PM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help Nice one.. For some reason i thought the Factory would involve more than it does, so i shied away from it. Cheers Mark On 26 Feb 2004, at 15:57, Paul, R. Chip wrote: Note: I think this is likely different in current versions of the commons collections lib, but this works for the version we are dependent on. import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.Factory; import org.apache.commons.collections.ListUtils; // Nonrelevant imports ommitted public class LazyListExampleForm extends ActionForm { private List actionList; public LazyListExampleForm () { Factory factory = new Factory() { public Object create() { return new ActionListBean(); } }; this.actionList = ListUtils.lazyList(new ArrayList(), factory); } // Getter/setters for list omitted } -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:49 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help wouldn't mind an example of how to use lazy list if you have one. On 26 Feb 2004, at 15:33, Paul, R. Chip wrote: Or use the Commons Collections LazyList which handles this problem automatically. -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:09 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help shirish posted this a few times. if you're scoping to request you'll need a while loop in your getFoo(int index) method public class OrgManagementForm extends ActionForm { private List addressList = new ArrayList(); public Address getAddress(int index) { while(index = addressList.size() ) { this.addressList.add( new Address() ); } return (Address) addressList.get(index); } bla bla. } look like it could be your problem. On 26 Feb 2004, at 14:57, Parthasarathy Kesavaraj wrote: I am having an OrganzationVO inside my form-bean. The OrganzationVO has a collection of AddressVOs. I am using nested tags like this. nested:nest property = orgVO nested:text property=orgID size=10 maxlength=10 styleClass=inputmand tabindex= / nested:iterate id=addressid property=addresses indexId=index nested:text property=company1 size=30 maxlength=30 styleClass=inputmand tabindex= / /nested:iterate /nested:nest while submitting the form I am getting an exception like this. 2004-02-26 18:17:08,133 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. commons.beanutils.BeanUtils - setProperty([EMAIL PROTECTED], orgVO.a ddresses[0].company1, [get populated]) getAddrVOAL--[] Feb 26, 2004 6:17:08 PM IST Error HTTP BEA-101017 [ServletContext(id=1735147,name=gbs,conte xt-path=/gbs)] Root cause of ServletException. java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert y U tils. java:525) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert y U tils. java:428) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(Property U t ils.j ava:770) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils. j a va:80 1) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java: 881) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc e s sor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja v a :254) at com.puma.gbs.action.RequestProcessor.process(RequestProcessor.java: 133) at org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
RE: Problem in nested tags- Very Urgent - Please Help
This is a common problem when you have a dynamic number of inputs. The core problem is that nothing in your form that doesn't directly map to an input field in the form will carry on between requests - this is why you often have to include hidden fields to hold data. While there are inputs for the data, there are not for the collections themselves, and thus when you go to set the values of indexed properties, you are trying to get/set records of an empty collection. The LazyList solves this by (I think, haven't checked implementation) creating enough records in the List to make you able to get/set the appropriate record, instead of throwing IndexOutOfBoundsException like most collections will. Basically if you call get(5) on a Lazy List, it will create 6 of your empty objects (using the factory you provide) and return the 6th one, or set them if you had called set(5, obj) instead. Note, this problem does not exist with session scoped forms, so in some cases they are a better solution to using LazyLists or handling the empty collections yourself. -Original Message- From: Parthasarathy Kesavaraj [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 11:24 AM To: 'Struts Users Mailing List' Subject: RE: Problem in nested tags- Very Urgent - Please Help Hi Thanks for ur replies. But i could not understand what actually is the problem and how lazy list will solve it. This is the first time i am coming across lazy list. can u explain what actually is the problem and how lazy list wil handle the problem With Regards Partha -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:35 PM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help Nice one.. For some reason i thought the Factory would involve more than it does, so i shied away from it. Cheers Mark On 26 Feb 2004, at 15:57, Paul, R. Chip wrote: Note: I think this is likely different in current versions of the commons collections lib, but this works for the version we are dependent on. import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.Factory; import org.apache.commons.collections.ListUtils; // Nonrelevant imports ommitted public class LazyListExampleForm extends ActionForm { private List actionList; public LazyListExampleForm () { Factory factory = new Factory() { public Object create() { return new ActionListBean(); } }; this.actionList = ListUtils.lazyList(new ArrayList(), factory); } // Getter/setters for list omitted } -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:49 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help wouldn't mind an example of how to use lazy list if you have one. On 26 Feb 2004, at 15:33, Paul, R. Chip wrote: Or use the Commons Collections LazyList which handles this problem automatically. -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:09 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help shirish posted this a few times. if you're scoping to request you'll need a while loop in your getFoo(int index) method public class OrgManagementForm extends ActionForm { private List addressList = new ArrayList(); public Address getAddress(int index) { while(index = addressList.size() ) { this.addressList.add( new Address() ); } return (Address) addressList.get(index); } bla bla. } look like it could be your problem. On 26 Feb 2004, at 14:57, Parthasarathy Kesavaraj wrote: I am having an OrganzationVO inside my form-bean. The OrganzationVO has a collection of AddressVOs. I am using nested tags like this. nested:nest property = orgVO nested:text property=orgID size=10 maxlength=10 styleClass=inputmand tabindex= / nested:iterate id=addressid property=addresses indexId=index nested:text property=company1 size=30 maxlength=30 styleClass=inputmand tabindex= / /nested:iterate /nested:nest while submitting the form I am getting an exception like this. 2004-02-26 18:17:08,133 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. commons.beanutils.BeanUtils - setProperty([EMAIL PROTECTED], orgVO.a ddresses[0].company1, [get populated]) getAddrVOAL--[] Feb 26, 2004 6:17:08 PM IST Error HTTP BEA-101017 [ServletContext(id=1735147,name=gbs,conte xt-path=/gbs)] Root cause of ServletException. java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method) at
Dynamic number of paramters
Hi, I have a List of objects and for every one of them have its properties in a text field. The size of the List may vary so I don't know how to set the parameters in the ActionForm to use it with the Action class. Any ideas? Thanks, Julio
RE: Problem in nested tags- Very Urgent - Please Help
Thanks Paul and Mark.. But my arraylist of AddrressVOs is not directly inside my form bean. Its inside my OrgVO which is inturn inside my form bean. Can this scenario can be handled by the example u have mentioned below.. With Regards Partha -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:35 PM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help Nice one.. For some reason i thought the Factory would involve more than it does, so i shied away from it. Cheers Mark On 26 Feb 2004, at 15:57, Paul, R. Chip wrote: Note: I think this is likely different in current versions of the commons collections lib, but this works for the version we are dependent on. import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.Factory; import org.apache.commons.collections.ListUtils; // Nonrelevant imports ommitted public class LazyListExampleForm extends ActionForm { private List actionList; public LazyListExampleForm () { Factory factory = new Factory() { public Object create() { return new ActionListBean(); } }; this.actionList = ListUtils.lazyList(new ArrayList(), factory); } // Getter/setters for list omitted } -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:49 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help wouldn't mind an example of how to use lazy list if you have one. On 26 Feb 2004, at 15:33, Paul, R. Chip wrote: Or use the Commons Collections LazyList which handles this problem automatically. -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:09 AM To: Struts Users Mailing List Subject: Re: Problem in nested tags- Very Urgent - Please Help shirish posted this a few times. if you're scoping to request you'll need a while loop in your getFoo(int index) method public class OrgManagementForm extends ActionForm { private List addressList = new ArrayList(); public Address getAddress(int index) { while(index = addressList.size() ) { this.addressList.add( new Address() ); } return (Address) addressList.get(index); } bla bla. } look like it could be your problem. On 26 Feb 2004, at 14:57, Parthasarathy Kesavaraj wrote: I am having an OrganzationVO inside my form-bean. The OrganzationVO has a collection of AddressVOs. I am using nested tags like this. nested:nest property = orgVO nested:text property=orgID size=10 maxlength=10 styleClass=inputmand tabindex= / nested:iterate id=addressid property=addresses indexId=index nested:text property=company1 size=30 maxlength=30 styleClass=inputmand tabindex= / /nested:iterate /nested:nest while submitting the form I am getting an exception like this. 2004-02-26 18:17:08,133 [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache. commons.beanutils.BeanUtils - setProperty([EMAIL PROTECTED], orgVO.a ddresses[0].company1, [get populated]) getAddrVOAL--[] Feb 26, 2004 6:17:08 PM IST Error HTTP BEA-101017 [ServletContext(id=1735147,name=gbs,conte xt-path=/gbs)] Root cause of ServletException. java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert y U tils. java:525) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert y U tils. java:428) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(Property U t ils.j ava:770) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils. j a va:80 1) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java: 881) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc e s sor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja v a :254) at com.puma.gbs.action.RequestProcessor.process(RequestProcessor.java: 133) at org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run ( S ervle tStubImpl.jav
Struts Workflow
Does anyone have any great ideas on creating customizable workflows in Struts? __ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Workflow
Mike, search this list's archives. This was discussed a few days ago.. Regards, Geeta Mike Duffy wrote: Does anyone have any great ideas on creating customizable workflows in Struts? __ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Workflow
You can visit this web: http://www.livinglogic.de/Struts/ Alvaro - Original Message - From: Mike Duffy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 7:08 PM Subject: Struts Workflow Does anyone have any great ideas on creating customizable workflows in Struts? __ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: (Fwd) row counts in logic:iterate...
The + operator is an overloaded operator in Java. Here, within %= % it thinks it is supposed to be concatenating and not adding. So, it cannot be applied to an integer in this case because that operator is being used to concatenate strings. I am going to assume that ctr is an integer. If so, the try the following: %= + (ctr + 1) % This will add the integers first with the second + operator, and then tell the first + operator for concatenation that you are dealing with strings by putting the first. You can also try: %= (ctr + 1) % But my suspicion is that the %= % stuff will have the same problem even without the operator, because the %= % will expect a string. The use of before the (ctr + 1) will signal the applicaiton to change the result of (ctr + 1) to a string for purposes of concatenation. Anyway, something like that, I think. Michael McGrady At 09:13 AM 2/26/2004, you wrote: Sorry, my mailer messed up the last one, so here again... newbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. logic:iterate name=dateForm property=raw id=foo indexId=ctr I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? td%= ctr + 1 %/td I would guess: ctr and 1 are added, and is then cast to a string, and then printed in my table column. Then why do i get this error? operator + cannot be applied to java.lang.Integer, int [javac] out.print( ctr + 1 ); It also does not work when I create a new variable with %! int i=0; % , and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp, as ctr + 1??? Rinke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Workflow
My suggestion is to build your own. This is fairly simple stuff that must be wedded to your own way of coding your site or application that will fit your business requirements. Make it general for use in other places. Create, for example, you own do/undo/redo to work with but independent of the workflow. Also create some token application or use the one that comes with struts. At 10:08 AM 2/26/2004, you wrote: Does anyone have any great ideas on creating customizable workflows in Struts? __ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: row counts in logic:iterate...
First: Please do not send HTML emails to the list. Now to address your question: JSTL makes this easy. c:forEach var=item items=${form.items} varStatus=status tr tdc:out value=${status.count}//td tdc:out value=${item.someValue}//td /tr /c:forEach Using Struts tags: logic:iterate id=item name=form property=items indexId=index tr td%=indexId.intValue() + 1%/td tdbean:write name=item property=someValue//td /tr /logic:iterate robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:05 PM To: [EMAIL PROTECTED] Subject: row counts in logic:iterate... colorparam0100,0100,0100/paramnewbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. colorparam7F00,,7F00/paramFontFamilyparamCourier New/paramlogic:iteratecolorparam,,/param colorparam,7F00,/paramnamecolorparam,,/param=colorparam,,FF00/paramdateForm colorparam,,/param colorparam,7F00,/parampropertycolorparam,,/param=colorparam,,FF00/paramraw colorparam,,/param colorparam,7F00,/paramidcolorparam,,/param=colorparam,,FF00/paramfoocolor param,,/param colorparam,7F00,/paramindexIdcolorparam,,/param=colorparam,,FF00/paramctr colorparam,,/param colorparam7F00,,7F00/paramcolorparam,,/param colorparam0100,0100,0100/paramFontFamilyparamArial/param I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? tdboldcolorparam7F00,,/paramFontFamilyparamCourier New/param%=/boldcolorparam0100,0100,0100/param colorparam,,/paramctrcolorparam0100,0100,0100/param colorparam,,/param+colorparam0100,0100,0100/param colorparam,,/param1colorparam0100,0100,0100/param boldcolorparam7F00,,/param%/td /bold/colorFontFamilyparamARIAL/paramI would guess: ctr and 1 are added, and is then cast to a string, and then print it in my table column. Then why do i get this error? colorparam0100,0100,0100/paramFontFamilyparamTimes New Roman/parambiggeroperator + cannot be applied to java.lang.Integer,int [javac] out.print( ctr + 1 ); ^ It also does not work when I create a new variabel with %! int i=0; %, and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp?? RinkeFontFamilyparamArial/paramsmaller - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with tags and overloaded methods
I've got a FormBean that includes a collection of beans. I have two getters for this collection: one indexed, and one not indexed. The non-indexed one returns the entire collection, the indexed one returns a single member of the collection. The normal arrangement. I use JSTL tags to refer to the unindexed getter: a c:choose ...c:when .. set that tests whether the collection is empty, then a c:forEach... tag that puts the contents on the page. I have a copy of BEA Weblogic on my local machine, for development. In that environment everything works perfectly. Then there's another copy of BEA Weblogic on a Unix box that's available to everybody. That's where I put my WAR file when I've got it working, so others can use it, and find bugs, etc. But the application fails on that public server. It tells me that it is unable to find a value for allItems in object of class ..ItemBeanList. Changing the name of the unindexed getter, so that it's no longer an overloaded function, makes it work. I can't figure out why this works on my desktop and fails on the server. All tld and jar files for the tags are included in the WAR file. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Access message Resource outside web
How to easily access message Resource from a normal java class Which is not a tag or a subclass of any Action And without passing any pageContext... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Workflow
No matter what, I would recommend turning off caching on the struts controller, otherwise you will get anomalies with the back button and workflows. Do this early in your development and testing with QA. -Original Message- From: Michael McGrady [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:42 PM To: Struts Users Mailing List Subject: Re: Struts Workflow My suggestion is to build your own. This is fairly simple stuff that must be wedded to your own way of coding your site or application that will fit your business requirements. Make it general for use in other places. Create, for example, you own do/undo/redo to work with but independent of the workflow. Also create some token application or use the one that comes with struts. At 10:08 AM 2/26/2004, you wrote: Does anyone have any great ideas on creating customizable workflows in Struts? __ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: (Fwd) row counts in logic:iterate...
NEVER MIND. I was wrong about how %= % reads the + operator in this case. The problem is that the value is an Integer rather than an int. I learn something everyday. At 10:38 AM 2/26/2004, you wrote: The + operator is an overloaded operator in Java. Here, within %= % it thinks it is supposed to be concatenating and not adding. So, it cannot be applied to an integer in this case because that operator is being used to concatenate strings. I am going to assume that ctr is an integer. If so, the try the following: %= + (ctr + 1) % This will add the integers first with the second + operator, and then tell the first + operator for concatenation that you are dealing with strings by putting the first. You can also try: %= (ctr + 1) % But my suspicion is that the %= % stuff will have the same problem even without the operator, because the %= % will expect a string. The use of before the (ctr + 1) will signal the applicaiton to change the result of (ctr + 1) to a string for purposes of concatenation. Anyway, something like that, I think. Michael McGrady At 09:13 AM 2/26/2004, you wrote: Sorry, my mailer messed up the last one, so here again... newbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. logic:iterate name=dateForm property=raw id=foo indexId=ctr I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? td%= ctr + 1 %/td I would guess: ctr and 1 are added, and is then cast to a string, and then printed in my table column. Then why do i get this error? operator + cannot be applied to java.lang.Integer, int [javac] out.print( ctr + 1 ); It also does not work when I create a new variable with %! int i=0; % , and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp, as ctr + 1??? Rinke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: row counts in logic:iterate...
Shouldn't that be %= index.intValue() + 1 % instead of using indexId, since you set the index variable to be called index in the iterate tag? -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 11:15 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: row counts in logic:iterate... First: Please do not send HTML emails to the list. Now to address your question: JSTL makes this easy. c:forEach var=item items=${form.items} varStatus=status tr tdc:out value=${status.count}//td tdc:out value=${item.someValue}//td /tr /c:forEach Using Struts tags: logic:iterate id=item name=form property=items indexId=index tr td%=indexId.intValue() + 1%/td tdbean:write name=item property=someValue//td /tr /logic:iterate robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:05 PM To: [EMAIL PROTECTED] Subject: row counts in logic:iterate... colorparam0100,0100,0100/paramnewbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. colorparam7F00,,7F00/paramFontFamilyparamCourier New/paramlogic:iteratecolorparam,,/param colorparam,7F00,/paramnamecolorparam,,/param =colorparam,,FF00/paramdateForm colorparam,,/param colorparam,7F00,/parampropertycolorparam,,/pa ram=colorparam,,FF00/paramraw colorparam,,/param colorparam,7F00,/paramidcolorparam,,/param= colorparam,,FF00/paramfoocolor param,,/param colorparam,7F00,/paramindexIdcolorparam,,000 0/param=colorparam,,FF00/paramctr colorparam,,/param colorcolorparam7F00,,7F00/paramcolorparam,,/par am colorparam0100,0100,0100/paramFontFamilyparamArial/param I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? tdboldcolorparam7F00,,/paramFontFamilyparamCour ier New/param%=/boldcolorparam0100,0100,0100/param colorparam,,/paramctrcolorparam0100,0100,0100/param colorparam,,/param+colorparam0100,0100,0100/param colorparam,,/param1colorparam0100,0100,0100/param boldcolorparam7F00,,/param%/td /bold/colorFontFamilyparamARIAL/paramI would guess: ctr and 1 are added, and is then cast to a string, and then print it in my table column. Then why do i get this error? colorparam0100,0100,0100/paramFontFamilyparamTimes New Roman/parambiggeroperator + cannot be applied to java.lang.Integer,int [javac] out.print( ctr + 1 ); ^ It also does not work when I create a new variabel with %! int i=0; %, and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp?? RinkeFontFamilyparamArial/paramsmaller - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] RE: Memory usage
Viru Bhai, No, You code is not good or optimized. You have problems follwing instructions. Your question is not related to struts and you didn't put OT in the subject. Even if you put OT in subject, It would still be a bad question because that's not what this list is discussing. Primary reason I believe your code is not good and optimized is because you don't have enough knowledge about how to prove it. Most likely your code is as good as the question you asked. You probably want to look at profilers and code coverage tools do you proving. If I was you, I would seriously read a Java book. Maybe a Java optimization book too. Hope This Helps, Pritpal Dhaliwal P.s. Is it Friday yet? -Original Message- From: virupaksha [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 2:46 AM To: Struts Users Mailing List Subject: Memory usage Dear All, I have a requirement, where i need to stop garbage collection, is there any way to implement? Because, I need to judge our code is good and optimized, I need some ray of hope Thanks in advance, Viru
Re: [OT] RE: Memory usage
On Thursday 26 February 2004 20:12, Dhaliwal, Pritpal (HQP) wrote: Now. Still remember when you wrote your first crappy lines you proudly called a 'program'? *That* exactly is what we all started from, considering me: nearly 23 years ago on a little ZX81 box, doing my first steps in Assembler. YMMV. And how I was proud. A long time has passed since then, and I have seens lots of crappy code in- between, but whenever I get proud again about what I've done or achieved since then, one millisecond before I remember how lousy I started once and keep my mouth shut in humility, just in time. This, obviously, is still a lesson you have to learn, but I can tell you: one of many things that separates the good from the possibly-not-so-good is a certain difference in attitude. So it would have sufficed to politely mention that there are tools for testing code efficiency (nowadays) and that this forum may not be the best place to ask for answers. All the rest is rather irrelevant, including your insulting assumptions about code you never saw or the people behind it. You think you're good or better? I tell you: from this mail alone I can tell you have still a long way to go to be regarded as a member of the 'Black Team', and in your obviously long professional career, you certainly have read 'Peopleware' once and know what I'm talking about here. HTH, -- Chris. And never say HTH if you intentionally provide a snake when someone asks you for a fish. Viru Bhai, No, You code is not good or optimized. You have problems follwing instructions. Your question is not related to struts and you didn't put OT in the subject. Even if you put OT in subject, It would still be a bad question because that's not what this list is discussing. Primary reason I believe your code is not good and optimized is because you don't have enough knowledge about how to prove it. Most likely your code is as good as the question you asked. You probably want to look at profilers and code coverage tools do you proving. If I was you, I would seriously read a Java book. Maybe a Java optimization book too. Hope This Helps, Pritpal Dhaliwal P.s. Is it Friday yet? -Original Message- From: virupaksha [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 2:46 AM To: Struts Users Mailing List Subject: Memory usage Dear All, I have a requirement, where i need to stop garbage collection, is there any way to implement? Because, I need to judge our code is good and optimized, I need some ray of hope Thanks in advance, Viru - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: servlet filters and authentication
Forward to logon.do, and have the Action check for four cases: 1. no request parameters, display logon form 2. invalid request parameters, display errors 3. unable to authenticate with valid parameters, display error 4. parameters authenticate, forward to home page Rick DeBay On Thu, 26 Feb 2004 12:06 , David Evans [EMAIL PROTECTED] sent: Hello, I'm configuring the skeleton of a multi module struts application, and i would like use a filter for the authentication. here is psuedojava (for easier reading) of the filter: public final class AuthFilter implements Filter { public void doFilter(request, response, chain) session = request.getSession(); auth = session.getAttribute(authenticated); if (auth == true) { chain.doFilter(request, response); return; } else { dispatcher = request.getRequestDispatcher(/WEB-INF/jsp/security/login.jsp); dispatcher.forward (request, response); return; } } } I've seen this skeleton suggested in several places on the web. The question i have is this: After the user submits the login form, the request will come through the filter, and since it has not yet been authenticated, it will again forward to the login.jsp. I've thought of a couple of ways to deal with this and would like to get input on these and any other approaches. 1) set the mapping of the filter in web.xml in such a way that it allows the login action through. maybe set all actions to have an extension of .do except the login action, which has an extension of .auth. I don't think this will work for me, because the multi module support of Struts requires extension mapping. I guess i could write a small serlvet that is not in the struts mapping but is in the same context and have it mapped to *.auth 2) check within the above filter to see if the request is for the login action, and if so allow it through. so the if statement above would be: if (auth == true || req.getPath().equals(login.do)) Any comments on these ideas or approaches i haven't listed would be greatly appreciated. dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] RE: Memory usage
+1 ATTA - Original Message - From: Christian Bollmeyer [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 11:53 AM Subject: Re: [OT] RE: Memory usage On Thursday 26 February 2004 20:12, Dhaliwal, Pritpal (HQP) wrote: Now. Still remember when you wrote your first crappy lines you proudly called a 'program'? *That* exactly is what we all started from, considering me: nearly 23 years ago on a little ZX81 box, doing my first steps in Assembler. YMMV. And how I was proud. A long time has passed since then, and I have seens lots of crappy code in- between, but whenever I get proud again about what I've done or achieved since then, one millisecond before I remember how lousy I started once and keep my mouth shut in humility, just in time. This, obviously, is still a lesson you have to learn, but I can tell you: one of many things that separates the good from the possibly-not-so-good is a certain difference in attitude. So it would have sufficed to politely mention that there are tools for testing code efficiency (nowadays) and that this forum may not be the best place to ask for answers. All the rest is rather irrelevant, including your insulting assumptions about code you never saw or the people behind it. You think you're good or better? I tell you: from this mail alone I can tell you have still a long way to go to be regarded as a member of the 'Black Team', and in your obviously long professional career, you certainly have read 'Peopleware' once and know what I'm talking about here. HTH, -- Chris. And never say HTH if you intentionally provide a snake when someone asks you for a fish. Viru Bhai, No, You code is not good or optimized. You have problems follwing instructions. Your question is not related to struts and you didn't put OT in the subject. Even if you put OT in subject, It would still be a bad question because that's not what this list is discussing. Primary reason I believe your code is not good and optimized is because you don't have enough knowledge about how to prove it. Most likely your code is as good as the question you asked. You probably want to look at profilers and code coverage tools do you proving. If I was you, I would seriously read a Java book. Maybe a Java optimization book too. Hope This Helps, Pritpal Dhaliwal P.s. Is it Friday yet? -Original Message- From: virupaksha [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 2:46 AM To: Struts Users Mailing List Subject: Memory usage Dear All, I have a requirement, where i need to stop garbage collection, is there any way to implement? Because, I need to judge our code is good and optimized, I need some ray of hope Thanks in advance, Viru - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with tags and overloaded methods
Just so it's clear, I'm assuming that you have the get method overloaded, with the same method name being used for two different properties (even if you consider them the same conceptual property). I would guess that's always a bad idea. I'm somewhat surprised that it works on one platform with the same appserver, and doesn't on the other. Are they using the same WLS version and JDK version? -Original Message- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 10:47 AM To: Struts User List ([EMAIL PROTECTED]) Subject: Problem with tags and overloaded methods I've got a FormBean that includes a collection of beans. I have two getters for this collection: one indexed, and one not indexed. The non-indexed one returns the entire collection, the indexed one returns a single member of the collection. The normal arrangement. I use JSTL tags to refer to the unindexed getter: a c:choose ...c:when .. set that tests whether the collection is empty, then a c:forEach... tag that puts the contents on the page. I have a copy of BEA Weblogic on my local machine, for development. In that environment everything works perfectly. Then there's another copy of BEA Weblogic on a Unix box that's available to everybody. That's where I put my WAR file when I've got it working, so others can use it, and find bugs, etc. But the application fails on that public server. It tells me that it is unable to find a value for allItems in object of class ..ItemBeanList. Changing the name of the unindexed getter, so that it's no longer an overloaded function, makes it work. I can't figure out why this works on my desktop and fails on the server. All tld and jar files for the tags are included in the WAR file. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: servlet filters and authentication
Thank you. I knew i was overlooking something simple. On Thu, 2004-02-26 at 15:12, [EMAIL PROTECTED] wrote: Forward to logon.do, and have the Action check for four cases: 1. no request parameters, display logon form 2. invalid request parameters, display errors 3. unable to authenticate with valid parameters, display error 4. parameters authenticate, forward to home page Rick DeBay On Thu, 26 Feb 2004 12:06 , David Evans [EMAIL PROTECTED] sent: Hello, I'm configuring the skeleton of a multi module struts application, and i would like use a filter for the authentication. here is psuedojava (for easier reading) of the filter: public final class AuthFilter implements Filter { public void doFilter(request, response, chain) session = request.getSession(); auth = session.getAttribute(authenticated); if (auth == true) { chain.doFilter(request, response); return; } else { dispatcher = request.getRequestDispatcher(/WEB-INF/jsp/security/login.jsp); dispatcher.forward (request, response); return; } } } I've seen this skeleton suggested in several places on the web. The question i have is this: After the user submits the login form, the request will come through the filter, and since it has not yet been authenticated, it will again forward to the login.jsp. I've thought of a couple of ways to deal with this and would like to get input on these and any other approaches. 1) set the mapping of the filter in web.xml in such a way that it allows the login action through. maybe set all actions to have an extension of .do except the login action, which has an extension of .auth. I don't think this will work for me, because the multi module support of Struts requires extension mapping. I guess i could write a small serlvet that is not in the struts mapping but is in the same context and have it mapped to *.auth 2) check within the above filter to see if the request is for the login action, and if so allow it through. so the if statement above would be: if (auth == true || req.getPath().equals(login.do)) Any comments on these ideas or approaches i haven't listed would be greatly appreciated. dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with tags and overloaded methods
I reiterate, I believe it's a bad idea to use the same method name for two different property mappings. If you can find some documentation that recommends you do that, I'd like to see it. WLS = WebLogic Server. -Original Message- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:35 PM To: 'Struts Users Mailing List' Subject: RE: Problem with tags and overloaded methods Just so it's clear, I'm assuming that you have the get method overloaded, with the same method name being used for two different properties (even if you consider them the same conceptual property). I would guess that's always a bad idea. Huh? I thought that's what we were supposed to do for indexed properties. I'm somewhat surprised that it works on one platform with the same appserver, and doesn't on the other. Are they using the same WLS version and JDK version? Hmm..the local server is using JDK 1.3.1_06, and the dev server is using 1.3.1_10. I don't know what WLS is. Hmm...we were warned that 1.3.1_10 was more picky that what we had been using on the dev server in parsing properties. I'll have to look closely at the page that works in both environments with no changes, I thought it was doing the same thing in a couple of places. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
mapping an error-page to a Struts Action
I would like to be able to map my 404 errors to a specific Struts Action versus mapping the error directly to a JSP page. However, unless I configure my Struts Action to forward to a Tiles definition I can't seem to get this to work. I am working with Tomcat 5.0.19 on Windows XP. My config files: !-- web.xml -- error-page error-code404/error-code location/404.do/location /error-page !-- struts-config.xml mapping that works -- action path=/404 forward=.error.404 / !-- struts-config.xml mapping that fails -- action path=/404 forward=/404.jsp / If I call the 404.do directly, the page comes up correctly with with either struts-config configuration. If I use the first struts-config configuration, the 404 page is displayed correctly. However, if I use the second struts-config configuration, I get a blank page when a 404 occurs. I give... Please tell me what I am doing wrong. Thanks, Andy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with tags and overloaded methods
Karr, David [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I reiterate, I believe it's a bad idea to use the same method name for two different property mappings. If you can find some documentation that recommends you do that, I'd like to see it. I believe Tim is referring to what is defined in section 8.3.3 of the JavaBeans spec, Indexed properties, which states: - Thus an indexed property foo might be represented by four accessor methods: public Bah[] getFoo(); public void setFoo(Bah a[]); public Bah getFoo(int a); public void setFoo(int a, Bah b); - IMO, what Tim is trying should work. I'd put the failure down to a buggy introspection implementation, although it's possible that dropping in a later version of Commons BeanUtils might work around it. -- Martin Cooper WLS = WebLogic Server. -Original Message- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:35 PM To: 'Struts Users Mailing List' Subject: RE: Problem with tags and overloaded methods Just so it's clear, I'm assuming that you have the get method overloaded, with the same method name being used for two different properties (even if you consider them the same conceptual property). I would guess that's always a bad idea. Huh? I thought that's what we were supposed to do for indexed properties. I'm somewhat surprised that it works on one platform with the same appserver, and doesn't on the other. Are they using the same WLS version and JDK version? Hmm..the local server is using JDK 1.3.1_06, and the dev server is using 1.3.1_10. I don't know what WLS is. Hmm...we were warned that 1.3.1_10 was more picky that what we had been using on the dev server in parsing properties. I'll have to look closely at the page that works in both environments with no changes, I thought it was doing the same thing in a couple of places. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Best Place To Check Session Timeout
In the O'Reilly book, Programming Jakarta Struts, it mentions 2 places to check for session timeout: (1) In a base Action class that all of your other Action classes extend (pg. 45) (2) Extend processPreprocess and over-ride the processPreprocess method. It seems to me that processPreprocess is better than using a base Action because it is further upstream, so needless processing can be avoided. Or is there a situation where doing it in a base Action class is better than in processPreprocess? Thank you, Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: servlet filters and authentication
I'm the primary author of the SecurityFilter project, and the filter logic is a bit more complicated than the code that was posted. Even if you decide not to use SecurityFilter, it is probably worth a look at the doFilter() method. Some issues that you will/may have to deal with: 1. Filter getting executed on forwards (depends on your container). 2. Sending the user back to the page they requested when the login sequence was initiated (a key feature, IMO). 3. Keeping request parameters (both GET and POST) across the login event. 4. Sending the user to an error page when the login fails. 5. Allowing login form and error page requests to be processed without invoking the login sequence. 6. Knowing what to do / where to send the user if they authenticate spontaneously (i.e. when they weren't sent to the login form by your filter). Basically, there's a lot of stuff to deal with even though it seems simple at first. :-) If you can use container-managed security or SecurityFilter, you'll probably save yourself some time that would otherwise be spent dealing with these issues. It is worth investigating the existing solutions before rolling your own. -Max On Thu, 2004-02-26 at 09:20, Robert Taylor wrote: You may want to see if this supports your requirements: https://sourceforge.net/projects/securityfilter/ robert -Original Message- From: David Evans [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:07 PM To: Struts Users Mailing List Subject: servlet filters and authentication Hello, I'm configuring the skeleton of a multi module struts application, and i would like use a filter for the authentication. here is psuedojava (for easier reading) of the filter: public final class AuthFilter implements Filter { public void doFilter(request, response, chain) session = request.getSession(); auth = session.getAttribute(authenticated); if (auth == true) { chain.doFilter(request, response); return; } else { dispatcher = request.getRequestDispatcher(/WEB-INF/jsp/security/login.jsp); dispatcher.forward (request, response); return; } } } I've seen this skeleton suggested in several places on the web. The question i have is this: After the user submits the login form, the request will come through the filter, and since it has not yet been authenticated, it will again forward to the login.jsp. I've thought of a couple of ways to deal with this and would like to get input on these and any other approaches. 1) set the mapping of the filter in web.xml in such a way that it allows the login action through. maybe set all actions to have an extension of .do except the login action, which has an extension of .auth. I don't think this will work for me, because the multi module support of Struts requires extension mapping. I guess i could write a small serlvet that is not in the struts mapping but is in the same context and have it mapped to *.auth 2) check within the above filter to see if the request is for the login action, and if so allow it through. so the if statement above would be: if (auth == true || req.getPath().equals(login.do)) Any comments on these ideas or approaches i haven't listed would be greatly appreciated. dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:text works, bean:write fails
html:text works differently I think. It looks up the bean on the enclosing html:form tag from the action mapping. So in all possiblity your html:text bean:write are fetching from different scopes. also try bean:write name='total' scope='session' property='totalInventory' / and this probably is the default bean:write name='total' scope='request' property='totalInventory' / -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 2:37 PM To: [EMAIL PROTECTED] Subject: Re: html:text works, bean:write fails Tried both cases - no joy. Also tried wrapping the bean:write... tag in logic:present tag: logic:present name='total' property='totalInventory' bean:write name='total' property='totalInventory' ignore='false'/ /logic:present while setting the ignore to 'false'. The page renders, but apparently the bean is not visible in the scope. But, if that is the case, why does it work with the html:text taglib? On Thursday 26 February 2004 14:56, you wrote: The problem loos strange. The only diff i can find is name attribute. try putting name attribute in both cases. also try removing it. may work... With Regards Partha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:text works, bean:write fails
I added the following tag: logic:notPresent name='total' property='totalInventory' Not present /logic:notPresent And I DO get the 'Not present' text. I am still confused; why then does the html:text tag work? Sorry for the posting to myself, but I am hoping for someone to pick up the thread and tell me what a Doofus I am and point me the right way. That may have already happened, but I get the list e-mails in batches and I haven't even seen my own posts yet (just one response that was sent directly to me). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts menu Question
I know, this list is not struts-menu list, but .. at the struts menu example (permissions menu) at SetPermissionsAction.java there is this line: String[] menus = request.getParameterValues(menus); I'd like to know just where they put the menus attribute in a session ?? thanks Daniel S.
Re: html:text works, bean:write fails
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a situation where I have not found a solution in the archives (I'm sure it is there, just don't know the right search), the documents (I have half dozen Struts books, plus the tomcat docs), and Google has not been my friend: I have a simple struts application where if I put the following in the JSP page, it works just fine (other than I don't want a text input field): html:text property='totalInventory' size='20'/ This means Go find the form bean associated with the enclosing HTML form, then look up the property named 'totalInventory' on that form bean, and render the value. but if I put the following: bean:write name='total' property='totalInventory'/ This means Go find the bean (form bean or otherwise) named 'total', then look up the property named 'totalInventory' on that form bean, and render the value. The difference is in the bean that is being referenced. Unless your form bean happens to be named 'total', these two statements are referencing completely different beans. If there is no bean named 'total' in scope, then you would see exactly what you are seeing. -- Martin Cooper it won't render the JSP page (just blank), unless I put ignore='true', in which case the page renders, but I also don't get the output. The taglibs are all referenced for both the struts-html and struts-bean taglibs. I have tried putting different scope references in the bean tag. I have looked at the generated java code and they both appear to show up similarly. I am running Tomcat 5.0.19 with a jk2 connector to Apache2 2.0.48, Sun sdk 1.4.2_03, running on a PIII 866 Mhz, 256MB. Struts 1.1 (downloaded today, release binary). I look in my logs and I can see the bean being properly set (and it does properly display when using the html taglib). I am sure this is outrageously simple, but I spent over a solid day (and night) fighting this and am getting nowhere. Any suggestions/questions welcome (yes, I already considered taking up truck driving instead). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[ANNOUNCE] Struts Console support for IDEA 4.0
I've uploaded a new Struts Console build specifically for IntelliJ IDEA 4.0. You can download it from the download page on my website: http://www.jamesholmes.com/struts/console/download.html Thanks, -James [EMAIL PROTECTED] http://www.jamesholmes.com/struts/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FormBeans: A question of Style
We have 2 camps of thought on the subject of the appropriate use of Struts form beans. Here are the thoughts: Camp 1: Form beans are controller components and should be used only to transport user input data between JSP forms (or across JSP forms) and Action classes. Camp 2: Form beans should be use for what Camp 1 thinks, plus they should also contain all the data a JSP uses to render a page (i.e. All the model data is inserted into the form bean as well as the form data.) Any thoughts? Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with loss form (session scope)
Anyone has experience lost of form that are scoped in session? Thanks -Betty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with loss form (session scope)
Well, sorry for being vague. It's a very vague problem, that's why it's very difficult to explain the details. This only happen to one of my action. I had a list inside a form. And one of the column render a link to the detail page. But I need to do some processing before I redirect to the detail. So I wrote the link to do a form post it back to the caller action. In that case, I can collect some information, at this point, I set up this form bean as session scope. But everytime the post happened, it seems like the form content got wiped out. -Betty -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 7:31 PM To: Struts Users Mailing List Subject: RE: Problem with loss form (session scope) friday Yeh. I like had one, and like I went out to lunch, and it was like a long lunch, and like when I came back my form was like you know totally like gone. In fact like, I couldnt even like you know find my whole session, and I was like whoa! dude - wheres my session?. /friday ;- Perhaps you could be a bit more specific about the problem you encountered? -Original Message- From: Betty Koon [mailto:[EMAIL PROTECTED] Sent: Friday, 27 February 2004 10:09 To: 'Struts Users Mailing List' Subject: Problem with loss form (session scope) Anyone has experience lost of form that are scoped in session? Thanks -Betty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormBeans: A question of Style
Dam - I was in Camp 3: Form beans are View components...but looking in the user guide... Note: While ActionForm beans often have properties that correspond to properties in your Model beans, the form beans themselves should be considered a Controller component. As such, they are able to transfer data between the Model and View layers. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 27, 2004 1:57 AM Subject: FormBeans: A question of Style We have 2 camps of thought on the subject of the appropriate use of Struts form beans. Here are the thoughts: Camp 1: Form beans are controller components and should be used only to transport user input data between JSP forms (or across JSP forms) and Action classes. Camp 2: Form beans should be use for what Camp 1 thinks, plus they should also contain all the data a JSP uses to render a page (i.e. All the model data is inserted into the form bean as well as the form data.) Any thoughts? Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with loss form (session scope)
Thats the problem with sessions, now if you'd done it in request you'd never really have it to loose. If it has to be sessions though either increase the timeout or shorten your lunch break. Niall - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, February 27, 2004 3:30 AM Subject: RE: Problem with loss form (session scope) friday Yeh. I like had one, and like I went out to lunch, and it was like a long lunch, and like when I came back my form was like you know totally like gone. In fact like, I couldnt even like you know find my whole session, and I was like whoa! dude - wheres my session?. /friday ;- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FormBeans: A question of Style
Im with camp 3 then I guess. Way I see it , forms are view components, there to provide an object for both action and JSP to be able to access the state of the screen. (Fields values and other bits of information that are needed to recreate the html, and a place to hold the state of the view (ie: submitted field values) on the server side for the controller (action) to read from) Maybe we should raise an issue in bugzilla against the userguide? Forms have no business transfering stuff from view to model. The model should never have to see an actionForm and should be blissfuly unaware of their very existence. Thats the job of an action to do, taking data from the form, and providing it to the model and vice versa (preferably with some kind of helper classes and perhaps also non-form DTOs involved) -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Friday, 27 February 2004 12:12 To: Struts Users Mailing List Subject: Re: FormBeans: A question of Style Dam - I was in Camp 3: Form beans are View components...but looking in the user guide... Note: While ActionForm beans often have properties that correspond to properties in your Model beans, the form beans themselves should be considered a Controller component. As such, they are able to transfer data between the Model and View layers. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 27, 2004 1:57 AM Subject: FormBeans: A question of Style We have 2 camps of thought on the subject of the appropriate use of Struts form beans. Here are the thoughts: Camp 1: Form beans are controller components and should be used only to transport user input data between JSP forms (or across JSP forms) and Action classes. Camp 2: Form beans should be use for what Camp 1 thinks, plus they should also contain all the data a JSP uses to render a page (i.e. All the model data is inserted into the form bean as well as the form data.) Any thoughts? Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FormBeans: A question of Style
I agree Camp 3. All the text I have read on MVC advise that the business logic should be performed by calling service modules out of the action class. On Fri, 27 Feb 2004, Andrew Hill wrote: Im with camp 3 then I guess. Way I see it , forms are view components, there to provide an object for both action and JSP to be able to access the state of the screen. (Fields values and other bits of information that are needed to recreate the html, and a place to hold the state of the view (ie: submitted field values) on the server side for the controller (action) to read from) Maybe we should raise an issue in bugzilla against the userguide? Forms have no business transfering stuff from view to model. The model should never have to see an actionForm and should be blissfuly unaware of their very existence. Thats the job of an action to do, taking data from the form, and providing it to the model and vice versa (preferably with some kind of helper classes and perhaps also non-form DTOs involved) -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Friday, 27 February 2004 12:12 To: Struts Users Mailing List Subject: Re: FormBeans: A question of Style Dam - I was in Camp 3: Form beans are View components...but looking in the user guide... Note: While ActionForm beans often have properties that correspond to properties in your Model beans, the form beans themselves should be considered a Controller component. As such, they are able to transfer data between the Model and View layers. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 27, 2004 1:57 AM Subject: FormBeans: A question of Style We have 2 camps of thought on the subject of the appropriate use of Struts form beans. Here are the thoughts: Camp 1: Form beans are controller components and should be used only to transport user input data between JSP forms (or across JSP forms) and Action classes. Camp 2: Form beans should be use for what Camp 1 thinks, plus they should also contain all the data a JSP uses to render a page (i.e. All the model data is inserted into the form bean as well as the form data.) Any thoughts? Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with loss form (session scope)
Without seeing your jsp/struts-config.xml/action its a bit of a guessing game. I'm a bit confused by you saying ...at this point, I set up this form bean as session scope. To me this implies your getting a form not in session scope (i.e. request) and saving it yourself in session scope. If that is the case - then maybe thats your problem - if the struts-config.xml says its request, thats where struts will look for it and, if it doesn't exist, it'll set a new one up in request scope (even if you already have one under the same name in session). If I've got it wrong, then maybe you could explain further. I'm also not clear whether your finding out your form has been 'wiped' as soon as you get into your action and before you set it up as session scope or after that when you get to your detail screen. Could you clarify that as well please. Niall - Original Message - From: Betty Koon [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 27, 2004 3:41 AM Subject: RE: Problem with loss form (session scope) Well, sorry for being vague. It's a very vague problem, that's why it's very difficult to explain the details. This only happen to one of my action. I had a list inside a form. And one of the column render a link to the detail page. But I need to do some processing before I redirect to the detail. So I wrote the link to do a form post it back to the caller action. In that case, I can collect some information, at this point, I set up this form bean as session scope. But everytime the post happened, it seems like the form content got wiped out. -Betty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANNOUNCE] Struts 1.2.0 Test Build available
Martin Cooper [EMAIL PROTECTED] wrote: The Struts 1.2.0 Test Build is now available here: Excellent:) http://www.apache.org/~martinc/struts/v1.2.0/ This is the first Struts build being made available following the same test-and-release process that has been used successfully by the Tomcat team for some time. It is *not* an official Apache release. Once feedback has been collected on the stability and general quality of this build, a determination will be made as to whether it should be promoted to Alpha status. Is there a web page that describes the process by which feedback is collected? Thanks, Oswald -- Martin Cooper - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Get better spam protection with Yahoo! Mail
RE: [ANNOUNCE] Struts 1.2.0 Test Build available
Ah I see. Its just the jars, tlds, dtds necessary for a struts app, sans docs. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Friday, 27 February 2004 13:52 To: Struts Users Mailing List Subject: RE: [ANNOUNCE] Struts 1.2.0 Test Build available Cool bananas! Many thanks to the struts team for all the work they have put into this build. :-) Whats the lib archive for? -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED] Sent: Friday, 27 February 2004 13:48 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [ANNOUNCE] Struts 1.2.0 Test Build available The Struts 1.2.0 Test Build is now available here: http://www.apache.org/~martinc/struts/v1.2.0/ This is the first Struts build being made available following the same test-and-release process that has been used successfully by the Tomcat team for some time. It is *not* an official Apache release. Once feedback has been collected on the stability and general quality of this build, a determination will be made as to whether it should be promoted to Alpha status. -- Martin Cooper - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [ANNOUNCE] Struts 1.2.0 Test Build available
Cool bananas! Many thanks to the struts team for all the work they have put into this build. :-) Whats the lib archive for? -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED] Sent: Friday, 27 February 2004 13:48 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [ANNOUNCE] Struts 1.2.0 Test Build available The Struts 1.2.0 Test Build is now available here: http://www.apache.org/~martinc/struts/v1.2.0/ This is the first Struts build being made available following the same test-and-release process that has been used successfully by the Tomcat team for some time. It is *not* an official Apache release. Once feedback has been collected on the stability and general quality of this build, a determination will be made as to whether it should be promoted to Alpha status. -- Martin Cooper - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with loss form (session scope)
friday Yeh. I like had one, and like I went out to lunch, and it was like a long lunch, and like when I came back my form was like you know totally like gone. In fact like, I couldnt even like you know find my whole session, and I was like whoa! dude - wheres my session?. /friday ;- Perhaps you could be a bit more specific about the problem you encountered? -Original Message- From: Betty Koon [mailto:[EMAIL PROTECTED] Sent: Friday, 27 February 2004 10:09 To: 'Struts Users Mailing List' Subject: Problem with loss form (session scope) Anyone has experience lost of form that are scoped in session? Thanks -Betty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:text works, bean:write fails
Tried both cases - no joy. Also tried wrapping the bean:write... tag in logic:present tag: logic:present name='total' property='totalInventory' bean:write name='total' property='totalInventory' ignore='false'/ /logic:present while setting the ignore to 'false'. The page renders, but apparently the bean is not visible in the scope. But, if that is the case, why does it work with the html:text taglib? On Thursday 26 February 2004 14:56, you wrote: The problem loos strange. The only diff i can find is name attribute. try putting name attribute in both cases. also try removing it. may work... With Regards Partha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:text works, bean:write fails
html:text works, indicating the value is present in the formbean. Is your form name total. If so whats the scope of this bean? You could also try % Object total = pageContext.getAttribute(total); // debug statementsto print the value/object type etc. % just to make sure both these tags are accessing the same bean. -jayash -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 1:53 PM To: [EMAIL PROTECTED] Subject: html:text works, bean:write fails I have a situation where I have not found a solution in the archives (I'm sure it is there, just don't know the right search), the documents (I have half dozen Struts books, plus the tomcat docs), and Google has not been my friend: I have a simple struts application where if I put the following in the JSP page, it works just fine (other than I don't want a text input field): html:text property='totalInventory' size='20'/ but if I put the following: bean:write name='total' property='totalInventory'/ it won't render the JSP page (just blank), unless I put ignore='true', in which case the page renders, but I also don't get the output. The taglibs are all referenced for both the struts-html and struts-bean taglibs. I have tried putting different scope references in the bean tag. I have looked at the generated java code and they both appear to show up similarly. I am running Tomcat 5.0.19 with a jk2 connector to Apache2 2.0.48, Sun sdk 1.4.2_03, running on a PIII 866 Mhz, 256MB. Struts 1.1 (downloaded today, release binary). I look in my logs and I can see the bean being properly set (and it does properly display when using the html taglib). I am sure this is outrageously simple, but I spent over a solid day (and night) fighting this and am getting nowhere. Any suggestions/questions welcome (yes, I already considered taking up truck driving instead). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Access message Resource outside web
Return Receipt Your Access message Resource outside web document : was Lee Dickenson/VIC/NAB/NAG_AP received by: at: 27/02/2004 09:19:11 AM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DynaValidatorForm loses property value
Niall, I gave that a shot but still no good. I do think you are on the right track though. In my main window I have my form action associated to the CUEnquiryQueryForm. I pop up the window using a html:link tag that calls the ShowEmailAction that populates the EmailForm form. I would think that if the EmailForm was then displayed in my pop-up show_email.jsp page everything would be OK. NEW FLASH!! I was fiddling around with struts-config.xml and changed the input property to the JSP page show_email.jsp instead of the Action .do path. Now looks like action path=/enquiry/showEmail type=com.cuscal.mmdd.action.cuenquiry.ShowEmailAction name=EmailForm scope=request input=com/cuscal/mmdd/jsp/cu_enquiry/show_email.jsp validate=false forward name=success path=com/cuscal/mmdd/jsp/cu_enquiry/show_email.jsp/ /action This change was done in conjunction with your idea to add the name property to my html:text tag. I thought the input property would only be activated upon the validation failing but there you go. Looks like I owe you another beer ;) Thanks to Mark for his insight as well. Ralph -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Thursday, 26 February 2004 9:09 PM To: Struts Users Mailing List Subject: Re: DynaValidatorForm loses property value Try adding 'name' attribute to the html:text tag html:text name=EmailForm property=emailAddress size=35/ The html:form tag will expose (or create a new) the ActionForm associated with the mapping with a value of 'org.apache.struts.taglib.html.BEAN'. This is the default 'name' for html tags if you don't specify one (which you arnt). The action mapping on your form is /enquiry/email.do - not the /enquiry/showEmail that you are showing us in your struts-config. My bet is the mapping for /enquiry/email.do is still in your struts-config.xml associated with a different form - so the html:form tag is creating a new 'empty' form, with no email address and thats what your html:text tag is picking up - not your new form. Niall - Original Message - From: RALPH ROPER [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:59 AM Subject: DynaValidatorForm loses property value hi, I have changed a DynaActionForm to a DynaValidatorForm. The DynaActionForm email property (the only property on the form) was being displayed in a new popup window. Since I changed to a DynaValidator form it shows the value as blank. I have the Javascript validation working OK. The flow of events is as follows 1. User clicks on Request Email button on main window 2. ShowEmailAction is called that populates emailAddress property. (I have confirmed value is put into form). 3. Pops up new window and shows show_email.jsp. The emailAddress property is blank. struts-config.xml form-bean name=EmailForm type=org.apache.struts.validator.DynaValidatorForm form-property name=emailAddress type=java.lang.String / /form-bean action path=/enquiry/showEmail type=com.cuscal.mmdd.action.cuenquiry.ShowEmailAction name=EmailForm scope=session input=/enquiry/showEmail.do validate=false forward name=success path=com/cuscal/mmdd/jsp/cu_enquiry/show_email.jsp/ /action ShowEmailAction public class ShowEmailAction extends MMDDirectBaseAction { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // logger.debug(Entered ShowEmailAction method); System.out.println(Entered ShowEmailAction method); UserView user = getUserContainer(request).getUserView(); String email = user.getEmail(); DynaValidatorForm emailForm = (DynaValidatorForm) form; // DynaActionForm emailForm = (DynaActionForm) form; emailForm.set(emailAddress, email); System.out.println(@@@email= + emailForm.get(emailAddress)); // This bit works return mapping.findForward(success); } } show_email.jsp .. tags, validator javascript, etc ... html:html HEAD META http-equiv=Content-Type content=text/html; charset=ISO-8859-1 META name=GENERATOR content=IBM WebSphere Studio META http-equiv=Content-Style-Type content=text/css link href=html:rewrite href='/MMDDirectWeb/com/cuscal/mmdd/jsp/cu_enquiry/styles/styles00.css' / rel=stylesheet type=text/css / TITLEemail.jsp/TITLE /HEAD BODY PstrongVerify Email Address/strong/P html:javascript formName=EmailForm / pPlease check/correct/add the email address below where the member's list will be sent/p html:form action=/enquiry/email.do onsubmit=return validateEmailForm(this); !-- bean:define name=EmailForm property=emailAddress id=ea type=java.lang.String / -- html:text property=emailAddress size=35/br/ div align=rightp/p a href=# class=button1 onClick=window.close();Cancel/a !-- html:link href=../enquiry/email.do styleClass=button1Submit link/html:link -- !-- html:link action=/enquiry/email.do styleClass=button1Submit/html:link --
html:text works, bean:write fails
I have a situation where I have not found a solution in the archives (I'm sure it is there, just don't know the right search), the documents (I have half dozen Struts books, plus the tomcat docs), and Google has not been my friend: I have a simple struts application where if I put the following in the JSP page, it works just fine (other than I don't want a text input field): html:text property='totalInventory' size='20'/ but if I put the following: bean:write name='total' property='totalInventory'/ it won't render the JSP page (just blank), unless I put ignore='true', in which case the page renders, but I also don't get the output. The taglibs are all referenced for both the struts-html and struts-bean taglibs. I have tried putting different scope references in the bean tag. I have looked at the generated java code and they both appear to show up similarly. I am running Tomcat 5.0.19 with a jk2 connector to Apache2 2.0.48, Sun sdk 1.4.2_03, running on a PIII 866 Mhz, 256MB. Struts 1.1 (downloaded today, release binary). I look in my logs and I can see the bean being properly set (and it does properly display when using the html taglib). I am sure this is outrageously simple, but I spent over a solid day (and night) fighting this and am getting nowhere. Any suggestions/questions welcome (yes, I already considered taking up truck driving instead). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory usage
On Wednesday 25 February 2004 11:45, virupaksha wrote: Dear All, I have a requirement, where i need to stop garbage collection, is there any way to implement? Because, I need to judge our code is good and optimized, I need some ray of hope The thing you're asking for is possibly a Profiler which gathers statistics about which parts of your code might be performance bottlenecks and should be optimized first. There are numerous solutions for this task available today, so better ask Google. Then, - just to note - one of the premier influences on perfor- mance is the overall application design. If you have databases or other kinds of backends included, which I presume, one of the typical performance bottlenecks is a suboptimal way to access them. A single query that doesn't perform right can well keep your entire application hanging for an indeter- minable amount of time. Generally: if you experience per- formance problems of some kind, the strategy should be to find out *what exactly is slow* first. If you get hold of the possible weak points, optimize these first. In a larger-scaled application, there are always parts that are coded suboptimal, but without a noticeable impact on overall performance. Then, there are some critical 'hotspots' which get executed numerous times (a suboptimally coded loop, for example) or functions that are heavily used. Such are the spots you have to look for. Telling from experience, most applications are quite forgiving when it comes to 'slow' code that could be done better, but there are always 'critical' parts where optimization really pays off. So in the end, it's usually kind of a mix. If you can't tell the hotspots 'manually' by knowing them from your application design, you can fall back to 'Tools'. Tools, though, are just tools and don't spare you from the arduous task of analyzing your app's performance. It's always you who has to do the real work. That said, there are different possible strategies to address performance problems. One of the most important is to 'dumbly' log execution times at certain stages in your code. If your Java code might be a culprit in the end, use a profiler to determine what's causing delays there. Focus on the 'hotspots' then. But remember: there was a time when there were no such 'tools', so people had to live without them. And did. If you use Oracle JDeveloper 9i/10g, there's a built-in profiler in this IDE plus a feature named 'Code Coach' which helps avoiding the most common mistakes. Note that both require the Oracle VM and therefore run only under Windows. Thanks in advance, Viru HTH, -- Chris. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: treeview
On Wednesday 25 February 2004 18:31, Daniel wrote: I need make a treeview of some information retrived from database and make a dual list with this treeview, someone knows where there is some example or something like this. This has been discussed before, and IIRC I've posted a longer article on this matter some time ago. Your options are to 1. use the nested tags (check out the tutorials at www.keyboardmonkey.com) 2. use a tag library that provides a TreeView tag 3. use a JavaScript implementation populated by Java code. For the details, I better refer to the list archives here for sake of brevity. HTH, -- Chris. Obrigado Daniel S. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Default locale gets intermixed with other locales
Hi Paul, I'm sorry, I must have overlooked your reply. I'll give your suggestion a try, but unfortunately it will take a few weeks until I can say if it works or not :-) I just wonder what will happen with other locales than en, de and sv, they will still get the default locale and probably get mixed with another locale as well. I never understood that it was always only the de locale that was polluting the default one. It always starts with only one of the pages , and over time it becomes more and more until the whole site is in German eventhough the browser sends another locale than de. Anyway, I have decided to ask my provider to switch from Tomcat 4 to 5, and then I want to use JSTL as it has been suggested in this mailinglist. Maybe it's a Tomcat bug, could that be? It's version 4.1.10 I think. Best Regards Torsten Paul McCulloch wrote: I think I found the same problem some time ago. I can't remember what the underlying issue was (maybe mixing the struts jstl ii18n tags?), but the solution was to create an explicit bundle for the default locale - I have my build scripts copy Application.properties to Application_en.properties. hth, Paul -Original Message- From: Torsten Römer [mailto:[EMAIL PROTECTED] Sent: 13 February 2004 20:57 To: [EMAIL PROTECTED] Subject: Default locale gets intermixed with other locales Hello, I have made a quite simple web application using Struts 1.1 and Tiles, running on Tomcat 4.1.10. I have internationalized it using the html:html locale=true and the bean:message key=/ tags. I have created three message bundles, one default (English), one German and one Swedish. It works as expected. German visitors get German pages, Swedish users Swedish pages and everybody else English pages. But after some weeks uptime there is a strange effect: When the default locale is used where all pages should be English, some pages show up in German. Often it's only the jsp placed in one tile which shows the wrong language, sometimes the whole page. After a restart of Tomcat the problem is solved. Has anybody ever experienced something similar? What could be wrong? Thanks in advance! Torsten - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: servlet filters and authentication
We overrode the execute method on our BaseAction to call a protected executeSessionAuthorization which by default just checks for user to be logged in. Results of the executeSessionAuthorization are thrown as exceptions (if okay, no exception). To determine if the executeSessionValidation gets called, our BaseActionMapping has a property called secure which defaults to true. public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // if we are using a SmoActionMapping if (mapping instanceof SmoActionMapping) { SmoActionMapping sam = (SmoActionMapping) mapping; // should we validate the session? if (sam.isSecure()) { executeSessionAuthorization(request); } if (sam.isBoxStatus()) { executeBoxStatus(); } // see if we know what method to call String execute = (sam.getExecute() == null) ? executeInternal : sam.getExecute(); return this.dispatchMethod(mapping, form, request, response, execute); } // if we get here, then let the super take control return super.execute(mapping, form, request, response); } Child actions, based on modules can override the executeSessionAuthorization to do additional checking for specific user permissions flags, etc. Some of our logic got pretty complex for permissions and this worked extremely well for what we were trying to accomplish. -Jake -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: None To: Struts Users Mailing List Subject: Re: servlet filters and authentication Forward to logon.do, and have the Action check for four cases: 1. no request parameters, display logon form 2. invalid request parameters, display errors 3. unable to authenticate with valid parameters, display error 4. parameters authenticate, forward to home page Rick DeBay On Thu, 26 Feb 2004 12:06 , David Evans [EMAIL PROTECTED] sent: Hello, I'm configuring the skeleton of a multi module struts application, and i would like use a filter for the authentication. here is psuedojava (for easier reading) of the filter: public final class AuthFilter implements Filter { public void doFilter(request, response, chain) session = request.getSession(); auth = session.getAttribute(authenticated); if (auth == true) { chain.doFilter(request, response); return; } else { dispatcher = request.getRequestDispatcher(/WEB-INF/jsp/security/login.jsp); dispatcher.forward (request, response); return; } } } I've seen this skeleton suggested in several places on the web. The question i have is this: After the user submits the login form, the request will come through the filter, and since it has not yet been authenticated, it will again forward to the login.jsp. I've thought of a couple of ways to deal with this and would like to get input on these and any other approaches. 1) set the mapping of the filter in web.xml in such a way that it allows the login action through. maybe set all actions to have an extension of .do except the login action, which has an extension of .auth. I don't think this will work for me, because the multi module support of Struts requires extension mapping. I guess i could write a small serlvet that is not in the struts mapping but is in the same context and have it mapped to *.auth 2) check within the above filter to see if the request is for the login action, and if so allow it through. so the if statement above would be: if (auth == true || req.getPath().equals(login.do)) Any comments on these ideas or approaches i haven't listed would be greatly appreciated. dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: row counts in logic:iterate...
Dohhh! You are correct. I mistyped :) robert -Original Message- From: Paul, R. Chip [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 2:11 PM To: 'Struts Users Mailing List' Subject: RE: row counts in logic:iterate... Shouldn't that be %= index.intValue() + 1 % instead of using indexId, since you set the index variable to be called index in the iterate tag? -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 11:15 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: row counts in logic:iterate... First: Please do not send HTML emails to the list. Now to address your question: JSTL makes this easy. c:forEach var=item items=${form.items} varStatus=status tr tdc:out value=${status.count}//td tdc:out value=${item.someValue}//td /tr /c:forEach Using Struts tags: logic:iterate id=item name=form property=items indexId=index tr td%=indexId.intValue() + 1%/td tdbean:write name=item property=someValue//td /tr /logic:iterate robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:05 PM To: [EMAIL PROTECTED] Subject: row counts in logic:iterate... colorparam0100,0100,0100/paramnewbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. colorparam7F00,,7F00/paramFontFamilyparamCourier New/paramlogic:iteratecolorparam,,/param colorparam,7F00,/paramnamecolorparam,,/param =colorparam,,FF00/paramdateForm colorparam,,/param colorparam,7F00,/parampropertycolorparam,,/pa ram=colorparam,,FF00/paramraw colorparam,,/param colorparam,7F00,/paramidcolorparam,,/param= colorparam,,FF00/paramfoocolor param,,/param colorparam,7F00,/paramindexIdcolorparam,,000 0/param=colorparam,,FF00/paramctr colorparam,,/param colorcolorparam7F00,,7F00/paramcolorparam,,/par am colorparam0100,0100,0100/paramFontFamilyparamArial/param I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? tdboldcolorparam7F00,,/paramFontFamilyparamCour ier New/param%=/boldcolorparam0100,0100,0100/param colorparam,,/paramctrcolorparam0100,0100,0100/param colorparam,,/param+colorparam0100,0100,0100/param colorparam,,/param1colorparam0100,0100,0100/param boldcolorparam7F00,,/param%/td /bold/colorFontFamilyparamARIAL/paramI would guess: ctr and 1 are added, and is then cast to a string, and then print it in my table column. Then why do i get this error? colorparam0100,0100,0100/paramFontFamilyparamTimes New Roman/parambiggeroperator + cannot be applied to java.lang.Integer,int [javac] out.print( ctr + 1 ); ^ It also does not work when I create a new variabel with %! int i=0; %, and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp?? RinkeFontFamilyparamArial/paramsmaller - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: servlet filters and authentication
You may want to see if this supports your requirements: https://sourceforge.net/projects/securityfilter/ robert -Original Message- From: David Evans [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:07 PM To: Struts Users Mailing List Subject: servlet filters and authentication Hello, I'm configuring the skeleton of a multi module struts application, and i would like use a filter for the authentication. here is psuedojava (for easier reading) of the filter: public final class AuthFilter implements Filter { public void doFilter(request, response, chain) session = request.getSession(); auth = session.getAttribute(authenticated); if (auth == true) { chain.doFilter(request, response); return; } else { dispatcher = request.getRequestDispatcher(/WEB-INF/jsp/security/login.jsp); dispatcher.forward (request, response); return; } } } I've seen this skeleton suggested in several places on the web. The question i have is this: After the user submits the login form, the request will come through the filter, and since it has not yet been authenticated, it will again forward to the login.jsp. I've thought of a couple of ways to deal with this and would like to get input on these and any other approaches. 1) set the mapping of the filter in web.xml in such a way that it allows the login action through. maybe set all actions to have an extension of .do except the login action, which has an extension of .auth. I don't think this will work for me, because the multi module support of Struts requires extension mapping. I guess i could write a small serlvet that is not in the struts mapping but is in the same context and have it mapped to *.auth 2) check within the above filter to see if the request is for the login action, and if so allow it through. so the if statement above would be: if (auth == true || req.getPath().equals(login.do)) Any comments on these ideas or approaches i haven't listed would be greatly appreciated. dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
(Fwd) row counts in logic:iterate...
Sorry, my mailer messed up the last one, so here again... newbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. logic:iterate name=dateForm property=raw id=foo indexId=ctr I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? td%= ctr + 1 %/td I would guess: ctr and 1 are added, and is then cast to a string, and then printed in my table column. Then why do i get this error? operator + cannot be applied to java.lang.Integer, int [javac] out.print( ctr + 1 ); It also does not work when I create a new variable with %! int i=0; % , and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp, as ctr + 1??? Rinke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JavaScript Parameter
Hi, The solution that Randy suggested works perfectly. Another possible solution is to use the scriptlet as a declaration. ie %! String val=obj.getValue(Key); % Then val can be used within the javascript function directly without have to pass it as a parameter. Ie Function jsFunction() { alert(%= val%); } Thanks n Regards. Anirudh Jayanth SysArris Software 120A, Elephant Rock Road, 3rd Block, Jayanagar, Bangalore - 560011 Tel: 6655165 / 052 [ ext - 244 ] [EMAIL PROTECTED] -Original Message- From: Randy Dillon [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:27 PM To: Struts Users Mailing List Subject: RE: JavaScript Parameter Have you tried: input type=hidden value=%=val% name=htmlVal / html:image pageKey=.. altKey=.. onclick=jsFunction(form,htmlVal) / :- -Original Message- :- From: Anirudh Jayanth [mailto:[EMAIL PROTECTED] :- Sent: Wednesday, February 25, 2004 10:32 PM :- To: 'Struts Users Mailing List' :- Subject: JavaScript Parameter :- :- :- Hi, :- I have a scriptlet :- % String val=obj.getValue(Key); % :- I need to use this value to be passed as a javascript :- parameter inorder :- to set a property value. :- :- html:image pageKey=.. altKey=.. :- onclick=jsFunction(form,%=val%) / :- The parameter value is not being passed to jsFunction :- :- This works when I use a hardcoded value :- html:image pageKey=.. altKey=.. :- onclick=jsFunction(form,1234) :- / :- :- I have tried these variations aswell :- html:image pageKey=.. altKey=.. :- onclick=jsFunction(form,%=val%) / :- html:image pageKey=.. altKey=.. :- onclick=jsFunction(form,'%=val%') / :- :- Cud somebody please tell me the correct way to do this. :- Regards, :- Anirudh :- :- :- :- :- :- - :- To unsubscribe, e-mail: [EMAIL PROTECTED] :- For additional commands, e-mail: [EMAIL PROTECTED] :- :- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: custom validator question
I had a custom validator 'futureDate' for which I needed to pass in a date and time which were 2 different form fields, to check that the date was in the future. I passed 2 different values into a custom parameter using two args and vars: form name=form field property=emailDate depends=required, mask, futureDate msg name=mask key=errors.invalid/ arg0 key=form.emailDate/ arg1 key=form.emailTime/ var var-namemask/var-name var-value${dateMask}/var-value /var var var-nametime/var-name var-valueemailTime/var-value /var /field /form In the custom validator I retrieved the two values using: public static boolean validateDate(Object bean, ValidatorAction va, Field field, ActionErrors errors, HttpServletRequest request) { String value; if (isString(bean)) { value = (String) bean; } else { value = ValidatorUtil.getValueAsString(bean, field.getProperty()); } String propertyTime = field.getVarValue(time); String valueTime = ValidatorUtil.getValueAsString(bean, propertyTime); . . . . . Hope this helps Claire -Original Message- From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED] Sent: 26 February 2004 14:54 To: [EMAIL PROTECTED] Subject: custom validator question I'm creating a custom validator to enforce a = relationship between 2 date fields and am having a problem. A validator method gets a Field arg for the field with which it's associated in validation.xml, but I need to also get the Field object for the other date field. I need this so that I can get its property name for display in an error message. (I'd also like to be able to get the field's datePattern.) I can't figure out how to do this. Any help would be much appreciated! jim Here's the relevant part of my validation.xml file: form name=ActivityViewForm field property=starting depends=date arg0 key=ActivityViewForm.starting.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var /field field property=ending depends=date,date1LEdate2 arg0 key=ActivityViewForm.ending.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var var var-namedate1/var-name var-valuestarting/var-value /var /field /form E-mail is an informal method of communication and may be subject to data corruption, interception and unauthorised amendment for which Digital Bridges Ltd will accept no liability. Therefore, it will normally be inappropriate to rely on information contained on e-mail without obtaining written confirmation. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: custom validator question
Also, what about using the existing ValidWhen validation http://jakarta.apache.org/struts/userGuide/dev_validator.html Niall - Original Message - From: Niall Pemberton [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 3:17 PM Subject: Re: custom validator question Specify the second field as var field property=myFirstDate depends=date,dateCompare var var-namedatePattern/var-name var-valuedd/MM//var-value /var var var-namecompareDate/var-name var-valuemySecondDate/var-value /var /field Then in your custom validation method: String datePattern = field.getVarValue(datePattern); String compareDateProperty = field.getVarValue(compareDate); String compareDate = ValidatorUtils.getValueAsString(bean, compareDateProperty); Niall - Original Message - From: Anderson, James H [IT] [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 2:54 PM Subject: custom validator question I'm creating a custom validator to enforce a = relationship between 2 date fields and am having a problem. A validator method gets a Field arg for the field with which it's associated in validation.xml, but I need to also get the Field object for the other date field. I need this so that I can get its property name for display in an error message. (I'd also like to be able to get the field's datePattern.) I can't figure out how to do this. Any help would be much appreciated! jim Here's the relevant part of my validation.xml file: form name=ActivityViewForm field property=starting depends=date arg0 key=ActivityViewForm.starting.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var /field field property=ending depends=date,date1LEdate2 arg0 key=ActivityViewForm.ending.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var var var-namedate1/var-name var-valuestarting/var-value /var /field /form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: custom validator question
Specify the second field as var field property=myFirstDate depends=date,dateCompare var var-namedatePattern/var-name var-valuedd/MM//var-value /var var var-namecompareDate/var-name var-valuemySecondDate/var-value /var /field Then in your custom validation method: String datePattern = field.getVarValue(datePattern); String compareDateProperty = field.getVarValue(compareDate); String compareDate = ValidatorUtils.getValueAsString(bean, compareDateProperty); Niall - Original Message - From: Anderson, James H [IT] [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 2:54 PM Subject: custom validator question I'm creating a custom validator to enforce a = relationship between 2 date fields and am having a problem. A validator method gets a Field arg for the field with which it's associated in validation.xml, but I need to also get the Field object for the other date field. I need this so that I can get its property name for display in an error message. (I'd also like to be able to get the field's datePattern.) I can't figure out how to do this. Any help would be much appreciated! jim Here's the relevant part of my validation.xml file: form name=ActivityViewForm field property=starting depends=date arg0 key=ActivityViewForm.starting.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var /field field property=ending depends=date,date1LEdate2 arg0 key=ActivityViewForm.ending.displayname/ var var-namedatePatternStrict/var-name var-valueMM/dd//var-value /var var var-namedate1/var-name var-valuestarting/var-value /var /field /form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JavaScript Parameter
Have you tried: input type=hidden value=%=val% name=htmlVal / html:image pageKey=.. altKey=.. onclick=jsFunction(form,htmlVal) / :- -Original Message- :- From: Anirudh Jayanth [mailto:[EMAIL PROTECTED] :- Sent: Wednesday, February 25, 2004 10:32 PM :- To: 'Struts Users Mailing List' :- Subject: JavaScript Parameter :- :- :- Hi, :- I have a scriptlet :- % String val=obj.getValue(Key); % :- I need to use this value to be passed as a javascript :- parameter inorder :- to set a property value. :- :- html:image pageKey=.. altKey=.. :- onclick=jsFunction(form,%=val%) / :- The parameter value is not being passed to jsFunction :- :- This works when I use a hardcoded value :- html:image pageKey=.. altKey=.. :- onclick=jsFunction(form,1234) :- / :- :- I have tried these variations aswell :- html:image pageKey=.. altKey=.. :- onclick=jsFunction(form,%=val%) / :- html:image pageKey=.. altKey=.. :- onclick=jsFunction(form,'%=val%') / :- :- Cud somebody please tell me the correct way to do this. :- Regards, :- Anirudh :- :- :- :- :- :- - :- To unsubscribe, e-mail: [EMAIL PROTECTED] :- For additional commands, e-mail: [EMAIL PROTECTED] :- :- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help converting from session to request scope
sure i agree .. but I've been wanting to dick around with alternatives to storing in the session for a while (since the request vs session debate). and just wondered if anyone had tried read/writing to a flat file as an alternative. Additionally I think that sessions are stored in this way anyway so might be a waste of time. But then I imagine that session objects are loaded into memory where using an old school read-write to a flat file might be less greedy. guess its dog food time. On 26 Feb 2004, at 15:42, Paul McCulloch wrote: My intuitive response would be that I'd use ram freely and let the O/S worry about paging stuff to disk if it runs out of physical memory. I'd *guess* that the O/S can use disk for paging significantly faster than a Java programmer can via the JVM the O/S. I think that you'd have to run some pretty exhaustive tests in an environment close to your production one to determine which method is more efficient. Personally I'd just spend the money on a bit more ram instead of developer time... Paul -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: 26 February 2004 13:24 To: Struts Users Mailing List Subject: Re: need help converting from session to request scope Niall Any opinions on read and writing to flat files to avoid additional ram use? Or you reckon that the reading and writing would consume similar amounts of ram? I'll get around to trying it when i get a moment. On 26 Feb 2004, at 14:04, Niall Pemberton wrote: Given your scenario, it sounds like a good candidate for a session scoped form. I agree with what Mark Lowe said - usually/often ...theres no more work invloved scoping to request - thats been the case for my app. I would also do what you said in a previous post - which is clean up the session stuff when they navigate away to another part of the app. I'm in the do it in request unless you have good reason(s) to use the session camp - rather than the anti-session camp as it may have appeared in previous threads. Niall - Original Message - From: Paul McCulloch [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 4:13 PM Subject: RE: need help converting from session to request scope My application has an Asset search form. The user can enter many criteria to search on. Most of these criteria themselves are looked up from the database (e.g the Person associated with the Asset search). When the user selects a search criteria (e.g. the Person) I store the DTO for that person on my search form. The view element displays details about that Person on the search form until the search form is cleared. Many requests will be made to find the criteria before the Asset search itself is performed. To do this using a request scope form would require that I transfer all of the details I want to display about that person in hidden inputs on the form. If the details I want to display about a Person change then I'd also need to change the hidden fields. In addition once I ship the application to my customers they may have their own JSP developer show extra prpoerties of the selected Person. So, that's my justification for using session scoped form beans. Any comments gratefully recieved. Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: need help converting from session to request scope
My intuitive response would be that I'd use ram freely and let the O/S worry about paging stuff to disk if it runs out of physical memory. I'd *guess* that the O/S can use disk for paging significantly faster than a Java programmer can via the JVM the O/S. I think that you'd have to run some pretty exhaustive tests in an environment close to your production one to determine which method is more efficient. Personally I'd just spend the money on a bit more ram instead of developer time... Paul -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: 26 February 2004 13:24 To: Struts Users Mailing List Subject: Re: need help converting from session to request scope Niall Any opinions on read and writing to flat files to avoid additional ram use? Or you reckon that the reading and writing would consume similar amounts of ram? I'll get around to trying it when i get a moment. On 26 Feb 2004, at 14:04, Niall Pemberton wrote: Given your scenario, it sounds like a good candidate for a session scoped form. I agree with what Mark Lowe said - usually/often ...theres no more work invloved scoping to request - thats been the case for my app. I would also do what you said in a previous post - which is clean up the session stuff when they navigate away to another part of the app. I'm in the do it in request unless you have good reason(s) to use the session camp - rather than the anti-session camp as it may have appeared in previous threads. Niall - Original Message - From: Paul McCulloch [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 4:13 PM Subject: RE: need help converting from session to request scope My application has an Asset search form. The user can enter many criteria to search on. Most of these criteria themselves are looked up from the database (e.g the Person associated with the Asset search). When the user selects a search criteria (e.g. the Person) I store the DTO for that person on my search form. The view element displays details about that Person on the search form until the search form is cleared. Many requests will be made to find the criteria before the Asset search itself is performed. To do this using a request scope form would require that I transfer all of the details I want to display about that person in hidden inputs on the form. If the details I want to display about a Person change then I'd also need to change the hidden fields. In addition once I ship the application to my customers they may have their own JSP developer show extra prpoerties of the selected Person. So, that's my justification for using session scoped form beans. Any comments gratefully recieved. Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help converting from session to request scope
Sorry, not had to do it in a web app, and where I have done it - memory wasn't an issue. I don't know any more than using the buffered input/output streams performance wise. I'm still on java 1.3.1, but they have done quite a bit on IO in 1.4, maybe theres help there http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html Also there is an IO package in commons - doesn't seem to have anything performance wise for reading - but there is a DeferredFileOutputStream which stores in memory until a specified threshold is reached - how that differs from a BufferedOutputStream I can't really see. http://jakarta.apache.org/commons/io/ http://jakarta.apache.org/commons/io/apidocs/index.html Anyway, this might be an issue for me soon, so I hope someone else jumps in that has experience. Niall - Original Message - From: Mark Lowe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 26, 2004 1:24 PM Subject: Re: need help converting from session to request scope Niall Any opinions on read and writing to flat files to avoid additional ram use? Or you reckon that the reading and writing would consume similar amounts of ram? I'll get around to trying it when i get a moment. On 26 Feb 2004, at 14:04, Niall Pemberton wrote: Given your scenario, it sounds like a good candidate for a session scoped form. I agree with what Mark Lowe said - usually/often ...theres no more work invloved scoping to request - thats been the case for my app. I would also do what you said in a previous post - which is clean up the session stuff when they navigate away to another part of the app. I'm in the do it in request unless you have good reason(s) to use the session camp - rather than the anti-session camp as it may have appeared in previous threads. Niall - Original Message - From: Paul McCulloch [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 4:13 PM Subject: RE: need help converting from session to request scope My application has an Asset search form. The user can enter many criteria to search on. Most of these criteria themselves are looked up from the database (e.g the Person associated with the Asset search). When the user selects a search criteria (e.g. the Person) I store the DTO for that person on my search form. The view element displays details about that Person on the search form until the search form is cleared. Many requests will be made to find the criteria before the Asset search itself is performed. To do this using a request scope form would require that I transfer all of the details I want to display about that person in hidden inputs on the form. If the details I want to display about a Person change then I'd also need to change the hidden fields. In addition once I ship the application to my customers they may have their own JSP developer show extra prpoerties of the selected Person. So, that's my justification for using session scoped form beans. Any comments gratefully recieved. Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]