Re: Multibox problem when defaulted all on
I'm still a little hazy on when reset is called on forms, but you may want to try moving marketing = marketingItems; to the forms constructor, so when the form is created the first time its holding the default values. And inside the reset method: marketing = null; -David - Original Message - From: Wiebe de Jong [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 1:14 PM Subject: Multibox problem when defaulted all on I am having a problem with multibox. I need to have a set of checkboxes to default on in my form. I found and followed Ted Husted's Struts Tip #7 http://husted.com/struts/tips/007.html - Use Multibox to manage checkboxes and everything works well, except in one condition explained below. When everything is defaulted on, and the user checks off the boxes but leaves at least one checked on, everything works as planned. However, if all the boxes are defaulted on (as in the code below) and the user checks all the boxes off, the marketing array is not updated. In this case, the form ends up telling me that the checkboxes are all on. How do I get it to work properly in this situation? - Form: public void reset(ActionMapping mapping, HttpServletRequest request) { ... marketing = marketingItems; } private String[] marketing = {}; private String[] marketingItems = {accountHolder,user2,user3,user4,user5}; public String[] getMarketing() { return this.marketing; } public void setMarketing(String[] marketing) { this.marketing = marketing; } - Jsp: html:multibox property=marketing value=accountHolder styleClass=form/ ... html:multibox property=marketing value=user2 styleClass=form/ ... html:multibox property=marketing value=user3 styleClass=form/ ... html:multibox property=marketing value=user4 styleClass=form/ ... html:multibox property=marketing value=user5 styleClass=form/ - Action: String[] marketing = form.getMarketing(); log.debug(marketing + marketing.length); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multibox problem when defaulted all on
Actually according to Ted inside the reset method your code should be: marketing = new String[] {}; HTH, David - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 1:22 PM Subject: Re: Multibox problem when defaulted all on I'm still a little hazy on when reset is called on forms, but you may want to try moving marketing = marketingItems; to the forms constructor, so when the form is created the first time its holding the default values. And inside the reset method: marketing = null; -David - Original Message - From: Wiebe de Jong [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 1:14 PM Subject: Multibox problem when defaulted all on I am having a problem with multibox. I need to have a set of checkboxes to default on in my form. I found and followed Ted Husted's Struts Tip #7 http://husted.com/struts/tips/007.html - Use Multibox to manage checkboxes and everything works well, except in one condition explained below. When everything is defaulted on, and the user checks off the boxes but leaves at least one checked on, everything works as planned. However, if all the boxes are defaulted on (as in the code below) and the user checks all the boxes off, the marketing array is not updated. In this case, the form ends up telling me that the checkboxes are all on. How do I get it to work properly in this situation? - Form: public void reset(ActionMapping mapping, HttpServletRequest request) { ... marketing = marketingItems; } private String[] marketing = {}; private String[] marketingItems = {accountHolder,user2,user3,user4,user5}; public String[] getMarketing() { return this.marketing; } public void setMarketing(String[] marketing) { this.marketing = marketing; } - Jsp: html:multibox property=marketing value=accountHolder styleClass=form/ ... html:multibox property=marketing value=user2 styleClass=form/ ... html:multibox property=marketing value=user3 styleClass=form/ ... html:multibox property=marketing value=user4 styleClass=form/ ... html:multibox property=marketing value=user5 styleClass=form/ - Action: String[] marketing = form.getMarketing(); log.debug(marketing + marketing.length); - 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: Multibox problem when defaulted all on
I don't think I explained myself quite clearly. WORKS: All the checkboxes on the form default to on. WORKS: User leaves all checkboxes on. WORKS: User turns some of the checkboxes off. DOESN'T WORK: User turns all of the checkboxes off. In the last situation, the form reports to the action that the marketing array still has the value of {accountHolder, user2, user3, user4, user5}, even though the user turned all the checkboxes off. This is because when nothing is selected, nothing gets sent to the form to be populated, so assuming your form is in session scope, whatever you had in there when it was rendered, is still in there. That's why inside the reset method of the form you need to empty that string array. That way if there are value submitted they will be populated, and if there are none, it will stay at none. -David Wiebe -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 12:28 PM To: Struts Users Mailing List Subject: Re: Multibox problem when defaulted all on Actually according to Ted inside the reset method your code should be: marketing = new String[] {}; HTH, David - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 1:22 PM Subject: Re: Multibox problem when defaulted all on I'm still a little hazy on when reset is called on forms, but you may want to try moving marketing = marketingItems; to the forms constructor, so when the form is created the first time its holding the default values. And inside the reset method: marketing = null; -David - Original Message - From: Wiebe de Jong [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 1:14 PM Subject: Multibox problem when defaulted all on I am having a problem with multibox. I need to have a set of checkboxes to default on in my form. I found and followed Ted Husted's Struts Tip #7 http://husted.com/struts/tips/007.html - Use Multibox to manage checkboxes and everything works well, except in one condition explained below. When everything is defaulted on, and the user checks off the boxes but leaves at least one checked on, everything works as planned. However, if all the boxes are defaulted on (as in the code below) and the user checks all the boxes off, the marketing array is not updated. In this case, the form ends up telling me that the checkboxes are all on. How do I get it to work properly in this situation? - Form: public void reset(ActionMapping mapping, HttpServletRequest request) { ... marketing = marketingItems; } private String[] marketing = {}; private String[] marketingItems = {accountHolder,user2,user3,user4,user5}; public String[] getMarketing() { return this.marketing; } public void setMarketing(String[] marketing) { this.marketing = marketing; } - Jsp: html:multibox property=marketing value=accountHolder styleClass=form/ ... html:multibox property=marketing value=user2 styleClass=form/ ... html:multibox property=marketing value=user3 styleClass=form/ ... html:multibox property=marketing value=user4 styleClass=form/ ... html:multibox property=marketing value=user5 styleClass=form/ - Action: String[] marketing = form.getMarketing(); log.debug(marketing + marketing.length); - 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: Something after RequestProcessor adding extra / to URL?
Wendy, Not certain where the trailing / is coming from, but I believe as soon as it encounters the ? everything past there is considered parameters, so basically if you seperate everything left of the ? and its a working url, great. And in essence http://www.blah.com is the same as http://www.blah.com/. HTH, David - Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 4:08 PM Subject: Something after RequestProcessor adding extra / to URL? In the Action, I have: log.info(redirecting to: +redirectURL); return new ActionForward( redirectURL, true ); The logs say: 15:53:45,640 - INFO edu.asu.vpia.struts.HarrisLoginAction - redirecting to: http://www.example.com?user=0123456 15:53:45,640 - DEBUG org.apache.struts.action.RequestProcessor - processForwardConfig(ForwardConfig[name=null,path=http://www.example.com ?user=0123456,redirect=true,contextRelative=false]) So I'm pretty sure there is no / after example.com, but what I see in the browser is: http://www.example.com/?user=0123456 Does anyone know where the extra '/' is coming from, or if it matters at all? -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - 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]
Tomcat and matching actions
Hey all.. I have experienced some really stupid behavior of tomcat/struts when combined.. let me explain. In web.xml if you map *.do to the struts action servlet you are able to match actions with paths, ie /blah/something.do correctly gets matched to /blah/something (the .do gets stripped.. still don't understand why) But what really irks me is I need to do some directory matching, ie in web.xml i have /getDocument/* mapped to the struts servlet. But in my struts config I cannot match /getDocument/**, the only way I can match is based on file extensions because the /getDocument/ gets stripped, so im forced to matching *.pdf, *.zip.. etc! Is there some way to fix this?? Or a suitable good alternative? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles attributes problem
First the sample code: XML defintion: definition name=.default path=/tiles/layouts/base.jsp put name=header value=/tiles/header.jsp/ put name=menu value=.menu.main/ put name=body value=${body}/ put name=footer value=/tiles/footer.jsp/ put name=logon value=/tiles/logon.jsp/ put name=title value=CMC/FLEX Sales Web/ put name=messages value=/tiles/messages.jsp/ put name=path value={path}/ /definition my editUsers.jsp %@ taglib uri=struts-tiles.tld prefix=tiles % tiles:insert definition=.default controllerUrl=/admin/editUsers.do flush=true tiles:put name=path value=/admin/userManagement/ tiles:put name=menu value=.menu.prospect/ tiles:put name=body value=/WEB-INF/apps/admin/editUsers.jsp/ /tiles:insert Now here's the problem, my controller action basically prepares its view by doing some logic and placing things in the request etc. My editUsers.jsp (the body content one) relies on the tiles attribute path for links to other webpages. This is the crazy thing, if i set my TilesAction (editUsers.do) to return null as its actionForward somehow the tiles context does not get passed to my editUsers.jsp!! However if I DO return an actionForward its fine! What the heck is up with that? Having to return an actionForward defeats the purpose OF the tile does it not?? Any ideas? (PS the way I found out it works if I specify a forward was in my struts-config i set success as the forward to /WEB-INF/apps/admin/editUsers.jsp... but that obviously messed up my whole definition by not using anything but that content page) Thank in advance, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Starting time-consuming jobs early
You ought to be able to make a struts plugin or a servlet thats loaded by your webserver that starts a thread that watches for a certain time each week then wakes up and does stuff.. -David - Original Message - From: Andy Engle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 01, 2004 1:53 PM Subject: Starting time-consuming jobs early Hi all, It looks like I am going to be involved with a project where the goal is to gather a bunch of product information from multiple databases, and then mix-n-match (a highly-technical term there) all that data to ultimately generate some metrics charts. It seems that making this a web application would be good here becuase several groups within this company X can then share this information. But since it will take so long to get the results, I'm wondering if there is some sort of way using servlets or whatever that I can have this job kick off at maybe midnight on Friday night so that all the data will be freshly available on Monday morning when it would be needed. I've considered maybe using a cron job to fire off a Perl script to do all the work, and then load the database with the data that would be replaced each week. But, I'd be interested in knowing if I could have it setup some slick way with Struts/Servlets/etc. Thanks, Andy - 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]
Encode/Encrypt url parameters?
Hi I was wondering if there are any easy to use Java classes or otherwise that could be used to encrypt or encode url parameters? Basically what I want to do is this: Action (encodes the url parameters, puts them into the request object) - forwards to jsp containing a link that grabs those parameters from the request - click link takes you to an Action that decodes and uses them. The parameters are to files on our site.. its no big deal because they are in the web-inf directory and unaccessable from the web but I'd rather hide them from the surfers anyway. Is there any good way to do this? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Encode/Encrypt url parameters?
Aye Encrypt is exactly what I'm needing to do. Thanks! -David - Original Message - From: Dhaliwal, Pritpal (HQP) [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, February 24, 2004 6:04 PM Subject: RE: Encode/Encrypt url parameters? I think you really mean encrypt.. Not just code and decode.. Look at this: http://javaalmanac.com/egs/javax.crypto/DesFile.html URLDecoder is and URLEncoder is put put those %20 instead of space in the URL I think.. Doesn't really add any security to what is URLEncoded. I guess you can get the encrypted value.. URLEncode it.. Put it as a hidden parameter. Then decrypt it when you get back.. The little tutorial/code I linked should help you. Pritpal Dhaliwal -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 24, 2004 4:42 PM To: Struts Users Mailing List Subject: Re: Encode/Encrypt url parameters? David: It's been a real long day and my brain's fuzzing over.. but I'm assuming you know all about java.net.URLDecoder and java.net.URLEncoder..? geeta David Erickson wrote: Hi I was wondering if there are any easy to use Java classes or otherwise that could be used to encrypt or encode url parameters? Basically what I want to do is this: Action (encodes the url parameters, puts them into the request object) - forwards to jsp containing a link that grabs those parameters from the request - click link takes you to an Action that decodes and uses them. The parameters are to files on our site.. its no big deal because they are in the web-inf directory and unaccessable from the web but I'd rather hide them from the surfers anyway. Is there any good way to do this? Thanks, David - 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: REPOST: How to avoid bean:writeto print null on the screen
You could always extend that tag class to look for null and if found print instead of printing null as it currently does. HTH, David - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 23, 2004 1:46 AM Subject: REPOST: How to avoid bean:writeto print null on the screen Hi, I am using bean:write in a lot of places in my jsp's, Whenever the form bean property is null It prints null on the screen, I was hoping if there could be some way in which I can force all null values to be printed as in my jsp's. I have tried giving initial= in my form property but If my Data Holder object contains null and I set it to the form bean then it still prints null. I know one way of achieving this is using logic:present every where but that's a huge amount change in jsp's we have 150 of them, If anybody can suggest a shortcut It would be of a great help Any help is greatly appreciated Regards Anant Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - 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: Persisting Messages/Errors when redirect=true
Ya I'd be interested to see your code if at all possible =) Thanks, David - Original Message - From: Hubert Rabago [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 09, 2004 7:49 PM Subject: Re: Persisting Messages/Errors when redirect=true There's no built-in support for this at the moment. I add code to my projects to add that support. I can share the code with you if you want. - Hubert --- David Erickson [EMAIL PROTECTED] wrote: Is it possible to persist Messages/Errors around your site through the request when setting redirect=true on an action mapping? An example I have right now is I have a delete action that forwards to a listContacts.do action on success.. however its persisting url parameters from my delete request that is interfering with my listcontacts action. If i set redirect='true' though it empties my request =(. Help! Thanks -David (Plus I can't be the only one forwarding from action-action.. and it gets really annoying seeing the old action url listed in the url even though your on a new one) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - 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: ActionErrors deprecated?
Can we expect to have struts 1.2 fully moved over to using solely html:messages? Including all the validate methods on actions etc? -David - Original Message - From: Hubert Rabago [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 09, 2004 1:32 PM Subject: RE: ActionErrors deprecated? It's the new and improved way to display messages on your pages. html:errors/ sometimes needed html markup on the message resources file to format the messages properly. The new html:messages tag gives the JSP full control over formatting, which is where it should be. --- Slattery, Tim - BLS [EMAIL PROTECTED] wrote: in jsp use this: html:text property=foo/ struts-html:messages id=error property=foo struts-bean:write name=error/ /struts-html:messages Maybe I'm dumb, but I can't make any sense of this. Use it for what? -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - 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]
Persisting Messages/Errors when redirect=true
Is it possible to persist Messages/Errors around your site through the request when setting redirect=true on an action mapping? An example I have right now is I have a delete action that forwards to a listContacts.do action on success.. however its persisting url parameters from my delete request that is interfering with my listcontacts action. If i set redirect='true' though it empties my request =(. Help! Thanks -David (Plus I can't be the only one forwarding from action-action.. and it gets really annoying seeing the old action url listed in the url even though your on a new one) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Examining Response Headers
Filters + Eclipse + Debug? -David - Original Message - From: Robert Taylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 06, 2004 11:44 AM Subject: [OT] Examining Response Headers Sorry for the OT post, but Googling and searching the mailing list archives are not producing much. I may not be asking the right question though. Anyhow, I need a tool (free) to examine the request and response headers. Any suggestions? robert - 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-menu from action
You would probably have to do that coding yourself to handle that.. what we implemented is ALL our menus are stored in menu-config.xml and each one has assigned a 'roll' to it and if the user has the roll the menu is shown.. etc -David - Original Message - From: Vijay Kandy [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 2:43 PM Subject: struts-menu from action Hello All, I was going through examples of struts-menu and it looks like the menu items are read from menu-config.xml. Is it possible to populate these items an Action class? I would like to get these from Action because the menu items are stored in a database and are retrieved based on whos logged in. Sincerely, Vijay Kandy - 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]
Validator-How to put the fields value in the resulting error message?
Hey all, still new with the validator.. I'm using the emailAddress validator and I just want it to put the value of the field in the error message if its not valid.. ie: blah!blah.com is not a valid email address. however I can't seem to make that happen.. here's what I've tried: form name=/getPassword field property=userName depends=required arg0 key=User Name resource=false/ /field field property=emailAddress depends=required,email arg0 key=${emailAddress} resource=false/ /field /form and in my properties file errors.email=li{0} is an invalid e-mail address./li Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean:write
Greg: you could alternatively use the JSTL Core tags, if the bean is null it doesn't write anything I believe. The format is c:out value=${yourbean}/ otherwise if you really want to use bean:write you could enclose it in a logic:notEmpty name=mybean property=bean property/logic:notEmpty or just logic:notEmpty name=mybean/logic:notEmpty HTH -David - Original Message - From: Gregory F. March [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, January 30, 2004 12:22 PM Subject: bean:write I haven't been able to confirm this first hand, but one of my team members (who is not on this list) is trying to do a bean:write. The problem is that sometimes, the bean that is being displayed is null. My question is what is the proper way to handle this? We tried to play with the ignore=true attribute for been:write should handle this, but it doesn't appear to work. We could do a logic:ifPresent (or whatever that tag is), but if we had to do it in a bunch of places, it could make things ugly. Any help would be appreciated... Thanks! /greg -- Gregory F. March-=-http://www.gfm.net:81/~march-=- AIM:GfmNet - 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: bean:write
What type of formatting are you looking to do? -David - Original Message - From: Gregory F. March [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, January 30, 2004 1:42 PM Subject: Re: bean:write On Jan 30, 2004, David Erickson [EMAIL PROTECTED] wrote: |Greg: you could alternatively use the JSTL Core tags, if the bean is null it |doesn't write anything I believe. The format is c:out |value=${yourbean}/ | |otherwise if you really want to use bean:write you could enclose it in a |logic:notEmpty name=mybean property=bean property/logic:notEmpty or |just logic:notEmpty name=mybean/logic:notEmpty David, Thanks for the response. This would be the perfect solution (thank goodness for emacs macros!) except we use the format attribute in many places. Not being a jstl expert, is there an option for formatting? Thanks, /greg -- Gregory F. March-=-http://www.gfm.net:81/~march-=- AIM:GfmNet - 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: bean:write
Greg the answer to your question is yes, jstl has a fmt: tag library for formatting text.. Good luck though, I've many times thought about extending that bean to check for null as well :) -David - Original Message - From: Gregory F. March [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, January 30, 2004 2:54 PM Subject: Re: bean:write On Jan 30, 2004, David Erickson [EMAIL PROTECTED] wrote: |What type of formatting are you looking to do? We are formatting dates, currency, and numbers. I think we will extend the bean:write in a custom tag and just check for null ourselves - very minimal code change this way (which is important for us at this stage). Thanks, /greg -- Gregory F. March-=-http://www.gfm.net:81/~march-=- AIM:GfmNet - 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: JSP to static html...
I don't know the layouts of your jsps or what you are doing in them.. but JSP's are inherently non-static because they use runtime expressions to generate the html, and that can change on a per request basis. If you are using strictly html and no RT expressions or tags or anything I don't see why you couldnt just rename the extension from jsp to html and save it wherever you want. -David - Original Message - From: Jacob Wilson [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, January 23, 2004 12:30 PM Subject: JSP to static html... Hi All... I have a specific requirement in my project... I want to convert the JSP pages to static html pages and save them in a local directory... How do I achieve this functionality??? Any suggestions appreciated. Thanks much. -Jacob - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: New to struts, having an issue
Bret, I'm using execute in all of my actions. You are implementing the execute action properly in your viewDataAction action class correct? Also you are properly extending Action? Posting some source code might help. -David - Original Message - From: Bret Kumler [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, January 13, 2004 3:09 PM Subject: New to struts, having an issue Guys. I'm using JBOSS 3.2.3, struts 1.1. When I try to execute my action I get the following on my server stdout. I thought this was depricated and to use execute() java.lang.UnsupportedOperationException: Method perform() not yet implemented. at com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces sor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR ealm.java:220) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2 46) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStat sValve.java:76) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci ationValve.java:65) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
[OT] Question about CSS inheritance/cascading
Hey I am using CSS like most everyone, I was wondering if its possible to apply multiple styles to a single element? IE I have a table cell, in my CSS it automatically receives this style: TD { color : #00; font-family: Arial, Verdana, Times; font-size: 10pt; } and by specifying class=Blue I can make it change the text color: .Blue{ color: #323299; } however I'd also like to add a bottom border element to it ie: .BlueThinBottomBorder { border-bottom: 1px solid #323299; } Is it possible within the class= to specify multiple style sheets to apply and if so how? (The idea is to keep me from having to make a BlueTextBlueThinBottomBorder style) Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Question about CSS inheritance/cascading
Answered my own question... class=Blue BlueThinBorder =) -David - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Mailing List [EMAIL PROTECTED] Sent: Friday, January 09, 2004 12:54 PM Subject: [OT] Question about CSS inheritance/cascading Hey I am using CSS like most everyone, I was wondering if its possible to apply multiple styles to a single element? IE I have a table cell, in my CSS it automatically receives this style: TD { color : #00; font-family: Arial, Verdana, Times; font-size: 10pt; } and by specifying class=Blue I can make it change the text color: .Blue{ color: #323299; } however I'd also like to add a bottom border element to it ie: .BlueThinBottomBorder { border-bottom: 1px solid #323299; } Is it possible within the class= to specify multiple style sheets to apply and if so how? (The idea is to keep me from having to make a BlueTextBlueThinBottomBorder style) Thanks, David - 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] Oldest Language
If your religious its Ademic, the language spoken by adam. -David - Original Message - From: Ramadoss Chinnakuzhandai [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 08, 2004 11:49 AM Subject: [OT] Oldest Language Hi, If anyone of you might be wizard of liguistics facts...may I know the worlds oldest language? my apology for posting other topic..thought some one is out there to answer. -R - 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] hibernate jndi
Mark, I had initially setup my hibernate to try and bind to a JNDI name created by tomcat in the server.xml and it failed to work with that, I ended up setting up hibernate to create its own JNDI name put its SessionFactory there. Then I used a Filter based plugin to give out session's and close them as needed. I'd imagine you could have your own servlet put hibernate into a JNDI name and as long as that name is available to the other webapps they could have plugins to grab sessions from that SessionFactory. -David - Original Message - From: Mark Lowe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 4:20 AM Subject: [ot] hibernate jndi Has anyone any words of wisdom when it comes to configuring a jndi service for hibernated classes that ideally only runs a service from a webapp? I've been using the hibernate plugin which tends to fall over daily. Ideally a servlet that's fired up via web.xml rather than a struts plugin could prove more reliable. I've used this approach with torque in the past albeit not using jndi. I'd prefer not to configure the service via server.xml as I don't need the service to be global but rather contain the service to a specific webapp or two. Cheers Mark - 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]
Dependent Drop Down Boxes
Hi I was wondering if anyone knew of any taglibraries or javascript related code that is meant to handle dependent drop down boxes. IE your choice in drop down box 1 choses the options you get in drop down box 2. Ideally this would not require a refresh of the browser. An example of this is carpoint.msn.com where you chose the vehicle manufacturer and in the next box it shows you only cars made by that manufacturer. They are using javascript coded in house... I was wondering if there is an open source project or solution to work with this. Thanks! -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dependent Drop Down Boxes
Thanks Paul =) -David - Original Message - From: Paul McCulloch [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 11:07 AM Subject: RE: Dependent Drop Down Boxes Have a look at http://www.mattkruse.com/javascript/dynamicoptionlist/ Paul -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: 07 January 2004 18:00 To: Struts Mailing List Subject: Dependent Drop Down Boxes Hi I was wondering if anyone knew of any taglibraries or javascript related code that is meant to handle dependent drop down boxes. IE your choice in drop down box 1 choses the options you get in drop down box 2. Ideally this would not require a refresh of the browser. An example of this is carpoint.msn.com where you chose the vehicle manufacturer and in the next box it shows you only cars made by that manufacturer. They are using javascript coded in house... I was wondering if there is an open source project or solution to work with this. Thanks! -David - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Best Practice: Dealing with null inner objects within forms
Ok well I've been fighting this problem for months now and have never really figured out the best way to deal with it. I'll give a short description hopefully it makes sense: public class Parent { private String firstname; private String lastname; private Address address; .. getters/setters etc. } Ok now my form object basically just has a getter/setter for a Parenty object. Within my jsp I want to use html:text elements for parent.firstname, parent.lastname, AND parent.address.street, parent.address.city, parent.address.state, etc. Now the problem is address has the potential to be loaded as null from the database if an address record is not tied to the parent. So in that case my jsp will throw a null pointer exception because it tried to initialize the text element from a null'd variable member. But even if there is no record for that I want to be able to edit the field and add one if its submitted. This doesn't pose a problem for firstname/lastname because the parent object will never be null. The alternatives that I can see to solve this: 1) Use logic:notEmpty tags to display the textbox as long as there is a record, but if theres not the user won't be able to edit on that page, so that doesn't really solve the problem 2) Within my parent object in its constructor initialize any member object. IE: public Parent () { address = new Address() } 3) Within the form's constructor make sure all of its member variables variables are non null. IE: public myActionForm() { parent.setAddress(new Address()); } I don't like this though because that requires me to edit the form everytime I change ANY of the objects contained therein. 4) ?? I hope that was clear.. any alternatives or what is everyone else doing to deal with this problem? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wrapping request - OT
Couldn't anything you would possible stick in the wrapped request be placed into the request attributes? -David - Original Message - From: Grassi Fabio [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 11:49 AM Subject: Wrapping request - OT Is there something fundamentally wrong in wrapping the request object that a Filter receives and pasing on the wrapping object? I would like to add some parameters to the original request. Thank for your comments. Fabio. Ai sensi della Legge 675/96, si precisa che le informazioni contenute in questo messaggio sono riservate ed a uso esclusivo del destinatario. Qualora il messaggio in parola Le fosse pervenuto per errore, la preghiamo di eliminarlo senza copiarlo e di non inoltrarlo a terzi, dandocene gentilmente comunicazione. Grazie.BRBRThis message, for the law 675/96 may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Its Safe to use the Action.ERROR_KEY ?
I don't see why not.. considering Action.ERROR_KEY is a static so if it ever changes your already referencing the new location. -David - Original Message - From: José Gustavo Zagato [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, January 06, 2004 11:17 AM Subject: Its Safe to use the Action.ERROR_KEY ? Hi Folks ! I'd like to know if is a good practice to use the Action.ERROR_KEY to access the errors at the request. I just want to check if error already exists on the request. Thank's ! José Gustavo Zagato Rosa System Analyst - Atos Origin [EMAIL PROTECTED] -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: terça-feira, 6 de janeiro de 2004 13:54 To: Struts Users Mailing List Subject: Re: server hangs after finite number of requests Heather: Check any jdbc code you have. If you don't close statements/result sets and/or release connections that you have opened, then this sort of thing can happen. Regards, Geeta Manfred Wolff wrote: Heather. Have you studied the tomcat logs? Manfred Wolff Heather Marie Buch wrote: Hi all, If I submit the same page more than 8 times, my server dies and I have to restart. For example, the first 8 times I enter the wrong password, struts will simply return me to my original form with an error message. However, the 9th time - the server hangs. This also occurs if I enter the correct password, then press the back button and return to the original login screen and submit again. I can only repeat this 8 times. The server hangs on the 9th try. I am using: tomcat 4.1.12 httpd 2.0.43 mysql 3.23.53 struts 1.1 I am not even sure if this is a struts problem. I suspect it is because I tried that back button trick with a plain old servlet, and I was able to do it more than 9 times. Any help would be greatly appreciated! My boss wants users to be able to try passwords more than 9 times! Thanks, Heather Buch - 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: weird
It looks to me like in your admin.jsp file you have something like logic:empty logic:redirect /logic:redirect /logic:empty Something is wrong with your redirect tag.. make sure you are giving it the correct parameters that are required etc... when all else fails use a debugger and find out where exactly the null pointer exception is coming from in the code. -David - Original Message - From: Otávio Augusto [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 05, 2004 3:03 PM Subject: weird please, i got a weird problem with struts. I haven't done anything different from what i do hundres of times a day: edit something in an Action or FormAction file, change small things in a jsp...ant build, shutdown, startup...well, no matter what i do, it has never given me any problem. But sundenly all the browser returns to me is a tomcat erros messagem like this: java.lang.NullPointerException at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:521) at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436) at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:396) at org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:294) at org.apache.jsp.admin_jsp._jspx_meth_logic_redirect_0(admin_jsp.java:153) at org.apache.jsp.admin_jsp._jspx_meth_logic_empty_0(admin_jsp.java:130) at org.apache.jsp.admin_jsp._jspService(admin_jsp.java:86) this message comes from a page where i have a logic:empty tag. it used to work just as i expected. but even the logon page does not work. it has nothing more than two fields and.. well, the last time i touched this page was one week ago. it does not work any more ;( This is the error i get when trying to access the logon page: org.apache.jasper.JasperException: Cannot find ActionMappings or ActionFormBeans collection at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 54) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) I've already checked if any file is missing...but everything is there. just like 5 minutes ago, when everything was working fine. What may be the problem?? Please, if someone can help me, do it. If i don't solve this, i'll be stuck in my tasks. Otávio Augusto - 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: Still having problems with File upload (multipart-formdata)
construktor ;P - Original Message - From: Matthias Wessendorf [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, December 30, 2003 9:29 AM Subject: RE: Still having problems with File upload (multipart-formdata) Hi Patrick, okay attched is my class it offers only two methods. soon more... perhaps ;-) one stores a form-file to a place, defined in a PROPERTIES-File under uploadPath-KEY the other stores the file to a place which is the second-parameter ;-) both methods are static. The class has only a private Construktor, so it is final... :-) With String placeString = getServlet().getServletContext().getRealPath(/); you get the Path of your Struts-App like: C:\Tomcat\webapps\myStrutsApp so you could use the second like: UploadFile.saveFile(myFormFile, placeString); your file is then in root. hope this is what you needed. greetings matthias -Original Message- From: Patrick Scheuerer [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 30, 2003 5:15 PM To: Struts Users Mailing List Subject: Re: Still having problems with File upload (multipart-formdata) Matthias Wessendorf wrote: Hi Patrick, you want to get the path of /myapp like C:\Tomcat\webapps\myapp or? That's exactly what i was trying to do! in an actionClass you now want to store in placeString\uploaddir isn´t it? Right again :-) i wrote an Util-Class which managed the storage in my action. one parameter is the formfile the other the placeToStore. you can get it, if you want... That would be wonderful! Thank you very much for your help! Patrick - 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: doubt
What kind of problem are you referring to with lazy instantiation? You can disable or enable it.. but if you have big lists of items that you may or may not use its good to leave it on.. -David - Original Message - From: Otávio Augusto [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, December 24, 2003 1:16 PM Subject: doubt hi all Maybe this is an inapropriate place to ask that, but i'm gonna take the risk anyway. I imagine there are users who work with Struts and Hibernate, just like i do (i haven't found any hibernate's discussion list, so i'm posting this question here). is someone has ever had the lazy instantiation problem when working whith Struts + Hibernate, please, notice me. Thanks a lot, and, again, pardon if that was not polite. Otávio Augusto - 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: Example of a non-threadsafe Action?
Thanks for the heads up, I havn't been using any 'instance' variables.. but I was getting a little confused reading about all the woe's of threads and why my stuff appeared to be working =) Makes more sense now. thanks! -David - Original Message - From: Craig R. McClanahan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, December 22, 2003 12:35 PM Subject: Re: Example of a non-threadsafe Action? Quoting David Erickson [EMAIL PROTECTED]: Hey I have been reading a lot about threading lately from the JLS and otherwise.. but my question is what would be an example of a non-threadsafe action? Struts manual said that only one instance of an action exists in the JVM.. and when I run an action each thread creates its own versions of all the variables within the action correct? More precisely, you get per-thread *local* variables (i.e. those defined inside a method). If you use *instance* variables (those defined in the class, rather than inside the method, there is only one copy of those variables -- and you get in trouble if you use those variables to store information that is specific to a particular request. So assuming I'm not accessing some outside 'global' variable, everything is inherintly threadsafe right? If anyone can give me an example of what 'not' to do that would help tremendously. thanks, David Consider the LogonAction class in the struts-example app. Note that the username and password variables are defined inside the execute() method, so they are local variables (and therefore have a copy per thread). What would happen to your logon processing if you moved those variable declarations to be outside the method instead of inside? Then, if you had two people logging on at the same time, the single copy of the username and password variables would be at risk for getting scribbled on by the second user. The most important rule for thread safety is to use local variables to store anything that is specific to a particular request (using instance variables to store read-only copies of things needed by multiple requests, on the other hand, is fine). Craig - 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]
Dynamic Errors with/Action Error?
Is it possible to create any kind of a Dynamic Error using the ActionErrors framework? IE put a $1 or something in the application.properties file on the error you want to use then parse and replace it? Gets annoying having to make a zillion static errors to display. Cheers, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts HTML tag rewriting url wrong
Hi all, I'm using the html struts tags to do some url writing for me, with forms etc. I have tomcat setup to listen on port 8080, but its proxyPort attribute is set as 80, and i have forwarding on the machine so requests come in on 80 get routed to 8080. Then whenever you call request.getServerPort() it reports 80 so the requests stay correct. However I have just noticed that the struts tags are writing in :8080 as the server port! Any idea what method they are calling to get that as the port? Or how I can correct this? I took a look at the tag source but didn't see much.. Thanks in advance, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts HTML tag rewriting url wrong
Ya thats how my test env is setup as well.. but in a linux environment that requires running tomcat under root access.. I'd rather avoid that so I have a tomcat user setup to run it, with the side effect it can only bind to ports 1024. -David - Original Message - From: Brice Ruth [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 12:10 PM Subject: Re: Struts HTML tag rewriting url wrong Any reason why you can't setup Tomcat to listen on port 80, instead of forwarding the requests? That's how my dev/test env is setup, and it seems to do the trick :) David Erickson wrote: Hi all, I'm using the html struts tags to do some url writing for me, with forms etc. I have tomcat setup to listen on port 8080, but its proxyPort attribute is set as 80, and i have forwarding on the machine so requests come in on 80 get routed to 8080. Then whenever you call request.getServerPort() it reports 80 so the requests stay correct. However I have just noticed that the struts tags are writing in :8080 as the server port! Any idea what method they are calling to get that as the port? Or how I can correct this? I took a look at the tag source but didn't see much.. Thanks in advance, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - 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: Dynamic Errors with/Action Error?
Martin, Bingo, just what I was looking for, thanks! -David - Original Message - From: Martin Gainty [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 5:10 PM Subject: Re: Dynamic Errors with/Action Error? David try this solution From Gogeneni Pratima: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(view.construction.error, e.getMessage())); in the application.properties you should have: view.construction.error=liCould not construct view because: {0}/li e.getMessage() is substituted instead of {0} Makes sense? -Martin - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Mailing List [EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 11:33 AM Subject: Dynamic Errors with/Action Error? Is it possible to create any kind of a Dynamic Error using the ActionErrors framework? IE put a $1 or something in the application.properties file on the error you want to use then parse and replace it? Gets annoying having to make a zillion static errors to display. Cheers, David - 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: Form and Pass the Form to the Business Tier
However, I have to supply a number of additional properties for the business tier to process. For example, the property threadType is to be assigned to zero manually and the property parentPostID is to be found from another class, how do I code them in the form bean? Do I use get methods shown below (without set methods)? public int getThreadType() { return 0; } This is fine I assume. public int getParentPostID() { return ParamUtil.getParameterInt( request, parent ); } This wouldn't work properly. I would make a setter for parentPostID and in the jsp write something like: html:hidden name=yourformname property=parentPostID value=%= request.getParameter(parent)%/ HTH, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form and Pass the Form to the Business Tier
Thank you for your response. According to my understanding of your advice, if I want to pass a hidden field from JSP to a form bean, I must have name=myFormName in the JSP's html:hidden tag? Please confirm. From the docs: The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR). I always put it as good practice. Another additional property that is to be assigned a value in my form bean is now with Timestamp type. Do I code this way in my form bean class? Please confirm: pubic Timestamp getNow() { return DateUtil.getCurrentGMTTimestamp(): } Ya that looks fine. -David -Caroline --- David Erickson [EMAIL PROTECTED] wrote: However, I have to supply a number of additional properties for the business tier to process. For example, the property threadType is to be assigned to zero manually and the property parentPostID is to be found from another class, how do I code them in the form bean? Do I use get methods shown below (without set methods)? public int getThreadType() { return 0; } This is fine I assume. public int getParentPostID() { return ParamUtil.getParameterInt( request, parent ); } This wouldn't work properly. I would make a setter for parentPostID and in the jsp write something like: html:hidden name=yourformname property=parentPostID value=%= request.getParameter(parent)%/ HTH, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - 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]
Example of a non-threadsafe Action?
Hey I have been reading a lot about threading lately from the JLS and otherwise.. but my question is what would be an example of a non-threadsafe action? Struts manual said that only one instance of an action exists in the JVM.. and when I run an action each thread creates its own versions of all the variables within the action correct? So assuming I'm not accessing some outside 'global' variable, everything is inherintly threadsafe right? If anyone can give me an example of what 'not' to do that would help tremendously. thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts, hibernate, datasources .... so lost
Rich I know how you feel. I just dealt with nearly the same problems the other day. I for the life of me could not get Hibernate to bind to my JNDI datasource.. so I bailed on that and in my hibernate.cfg.xml I just had it setup the datasource and manage it from there: hibernate-configuration session-factory name=salesweb:/hibernate/SessionFactory property name=dialectnet.sf.hibernate.dialect.MySQLDialect/property property name=show_sqltrue/property property name=connection.usernameuser/property property name=connection.passwordpass/property property name=connection.urljdbc:mysql://192.168.0.104:3306/salesweb/property property name=connection.driver_classcom.mysql.jdbc.Driver/property property name=use_outer_jointrue/property property name=transaction.factory_classnet.sf.hibernate.transaction.JDBCTransactio nFactory/property property name=dbcp.minIdle1/property /session-factory /hibernate-configuration etc. So what hibernate does when you build its config is load up a JNDI name and bind its session to that at salesweb:/hibernate/SessionFactory. Then I am using the hibernateFilter which the first run through will build that config and also store a static instance of the factory within that class. The reason its important to use the filter (to my understanding) is this: User requests a webpage, goes to struts action, action calls getSession() from the hibernatefilter, it binds that session to the current executing thread and ships it to the action. Action loads the requested items, perhaps the item has a collection that is loaded lazily, so it doesnt actually get loaded in the action. Action finishes and forwards to view (Note this is in the same thread!!), the view is a jsp that wants to render that lazily loaded collection. Well if you closed the session in your action this would fail. but because the session is still maintained until the request is fully finished it succeeds. Make sense? Anyway thats my understanding, I could be flawed =) Good luck! -David - Original Message - From: Rich Garabedian [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 19, 2003 7:35 AM Subject: struts, hibernate, datasources so lost After spending days on the net and the mailing lists I find something is just not getting through to me. I feel that what I'm doing is conceptually simple; yet I can't seem to actually implement any of it. I think I have a rudimentary understanding of how to integrate Hibernate into Struts, but I'm unsure on a few points. First the datasource. I'm trying to set up a default data source that all web applications can use. I use container based authentication and I want my realm to use it as well. Trolling these lists showed me a solution that does work with my realm (XML fragments follow below). But when I try to use that same datasource with Hibernate, my web application fails to load and I get the following error: SEVERE: Could not find datasource: java:comp/env/jdbc/prospectingDB javax.naming.NameNotFoundException: Name jdbc is not bound in this Context Here are the XML fragments from server.xml. First, I set up a global resource: GlobalNamingResources Resource name = jdbc/prospectingDB auth = Container scope = Shareable type = javax.sql.DataSource/ ResourceParams name=jdbc/prospectingDB ... Usual parameters go here Right under the engine tag I define my realm. This works for my container based auth Engine name=Catalina defaultHost=localhost debug=10 Realm className = org.apache.catalina.realm.DataSourceRealm debug = 99 dataSourceName = jdbc/prospectingDB userTable = auth_roles_view userNameCol= email userCredCol= pwd userRoleTable = auth_roles_view roleNameCol= role/ Then I set up a resource link in the default context: DefaultContext ResourceLink name = jdbc/prospectingDB global = jdbc/prospectingDB type = javax.sql.DataSource / /DefaultContext As I said, that all seems to work. But Hibernate bails: hibernate-configuration session-factory name=prospecting/hibernate/SessionFactory property name=connection.datasourcejava:comp/env/jdbc/prospectingDB/property property name=show_sqlfalse/property property name=dialectnet.sf.hibernate.dialect.PostgreSQLDialect/property mapping resource=Employee.hbm.xml/ /session-factory /hibernate-configuration I can't seem to figure out why. If I change the server.xml to define the datasource in my web-app context, then I get problems with container based authentication not finding the datasource?? ... and speaking of Hibernate, I think I figured out how to use the HibernatePlugIn. I use that to set-up a Hibernate session factory on web app instantiation. But what I'm not 100% sure on is why I need to set-up a filter to implement the open session in view pattern. One of the examples I
Re: struts, hibernate, datasources .... so lost
Rich, Ya the binding thing with JNDI and tomcat is messed up.. for some reason I've read its Read Only.. but the strange thing is I WAS able to get it working when I bound to that resource from a static class, but as soon as I used a filter or a struts plugin it no longer worked.. really lame. Regarding what happens after you load something from Hibernate. I'm still learning this myself, but I assume if you don't load ANYTHING lazily then you should be able to do anything with that variable and have no worries. However if you have an object that contains say a set of other objects, ie a team with a set of players, and set it to lazy loading, meaning when you load team 1, the players arent loaded until you call, getPlayers(), then at that point hibernate is still bound to your variable and will load that from the db assuming the session you initially loaded the team with is still open. Make sense? The way it works is hibernate has its own classes inherited from set/list/map etc that handle that.. and it uses those when you load sets. -David - Original Message - From: Rich Garabedian [EMAIL PROTECTED] To: 'David Erickson' [EMAIL PROTECTED] Sent: Friday, December 19, 2003 11:12 AM Subject: RE: struts, hibernate, datasources so lost David, David, thanks so much for your note. I guess I'll try having Hibernate setup the datasource if I can't get it to work they way I'm trying now. Doing that really bothers me though. I thought datasources were supposed to allow us to configure a single point of entry and then just use the logical name everywhere ... and not to have to worry about anything else. Need to change your database? Just look in one location and change - easy as pie. Yeah, right. Configuring a JDBC realm for authentication, and then a datasource in an entirely different file just seems plain backwards to me. Grrrh. Sorry, I'm really frustrated right now. I spent hours trying to determine why my web app was crashing on load. Come to find out, ehcache.jar is required (at least it seems to be for me). Even though the hibernate lib/readme says it's optional. (I can't find anywhere where I specify cache useage). The explanation below helps clear things up, but there still is one thing I really don't understand. If, in my action, I use hibernate to grab something from the data layer and store it in a local variable ... don't I know hold that data in my hands. If the session closes now, then who cares? I've already copied it into a local variable and can do what I please with it. Right? Dunno, I'm sure that last question readily shows my ignorance of how the entire processes works :-) -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Friday, December 19, 2003 1:00 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: struts, hibernate, datasources so lost Rich I know how you feel. I just dealt with nearly the same problems the other day. I for the life of me could not get Hibernate to bind to my JNDI datasource.. so I bailed on that and in my hibernate.cfg.xml I just had it setup the datasource and manage it from there: hibernate-configuration session-factory name=salesweb:/hibernate/SessionFactory property name=dialectnet.sf.hibernate.dialect.MySQLDialect/property property name=show_sqltrue/property property name=connection.usernameuser/property property name=connection.passwordpass/property property name=connection.urljdbc:mysql://192.168.0.104:3306/salesweb/property property name=connection.driver_classcom.mysql.jdbc.Driver/property property name=use_outer_jointrue/property property name=transaction.factory_classnet.sf.hibernate.transaction.JDBCTransa ct io nFactory/property property name=dbcp.minIdle1/property /session-factory /hibernate-configuration etc. So what hibernate does when you build its config is load up a JNDI name and bind its session to that at salesweb:/hibernate/SessionFactory. Then I am using the hibernateFilter which the first run through will build that config and also store a static instance of the factory within that class. The reason its important to use the filter (to my understanding) is this: User requests a webpage, goes to struts action, action calls getSession() from the hibernatefilter, it binds that session to the current executing thread and ships it to the action. Action loads the requested items, perhaps the item has a collection that is loaded lazily, so it doesnt actually get loaded in the action. Action finishes and forwards to view (Note this is in the same thread!!), the view is a jsp that wants to render that lazily loaded collection. Well if you closed the session in your action this would fail. but because the session is still maintained until the request is fully finished it succeeds. Make sense? Anyway thats my
[OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help!
So we are migrating our app from debugging with System.out.. (dont laugh.. even though I do).. to debugging it with Sysdeo's Eclipse plugin. However we have run into a showstopping snag unless we can get it resolved. Eclipse is set to compile everything from /web/WEB-INF/src into /web/WEB-INF/classes as it should so tomcat can run correctly and see the files. However we have configuration and other files also in /web/WEB-INF/classes.. and when eclipse rebuilds the project it 'cleans' that directory by deleting everything then compiling the source back into there. Can this be stopped? Or what is everyone else doing regarding this? I'm sure I can't be the only one with this problem. Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help!
Matt, Thanks! #2 works great. Another quick question to fire off if anyone knows.. I want to keep that classes directory out of cvs, i have a .cvsignore file in the root of my project, by putting classes in there is that enough to accomplish this? Would that filter out any other potential directories named classes as well? If so I just won't make any with that name =) -David - Original Message - From: Matt Bathje [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 12:52 PM Subject: Re: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help! David - there are 2 options for this that I can think of: 1. In your project settings in eclipse, in the java compiler category, go to the build path tab and uncheck the clean output folders on full build setting 2. Put your configuration/other files into the /src directory. When eclipse builds, it will copy the files over to the classes directory. (note: if this doesn't work there may be a setting that turns it on, but I couldn't find one, and don't remember ever setting it...) I prefer situation 2 myself. Matt Bathje - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 1:42 PM Subject: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help! So we are migrating our app from debugging with System.out.. (dont laugh.. even though I do).. to debugging it with Sysdeo's Eclipse plugin. However we have run into a showstopping snag unless we can get it resolved. Eclipse is set to compile everything from /web/WEB-INF/src into /web/WEB-INF/classes as it should so tomcat can run correctly and see the files. However we have configuration and other files also in /web/WEB-INF/classes.. and when eclipse rebuilds the project it 'cleans' that directory by deleting everything then compiling the source back into there. Can this be stopped? Or what is everyone else doing regarding this? I'm sure I can't be the only one with this problem. Thanks, David - 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: struts, hibernate, datasources .... so lost
That code should work assuming your object is fully loaded by the time it gets to the view and no longer needs the session. Also I would use Transactions in your code even on simple query's.. that was the advice given on hibernate's site. ie: Transaction tx = session.beginTransaction(). then tx.commit() when done or rollback or whatever. Also I don't know what you are using as your log manager but using log4j when I get a hibernate error I also send it the exception and it prints a stack trace for me which gives more information on what went wrong. Can't say that I've seen that behavior with tomcat myself =).. I have a whole other can of worms I've had to deal with involving that... -David - Original Message - From: Rich Garabedian [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, December 19, 2003 2:10 PM Subject: RE: struts, hibernate, datasources so lost I think that makes sense. So basically you are saying I HAVE to implement the filter and doing something like this: try { Context ctx = new InitialContext(); SessionFactory sf = (SessionFactory)ctx.lookup(prospecting/hibernate/SessionFactory); Session session = sf.openSession(); Query query = session.createQuery(select e.pwd from com.autorevenue.prospecting.hibernate.Employee e where e.email = :email); query.setString(email, email); e = (Employee)query.uniqueResult(); if( e != null) { password = e.getPwd(); } session.close(); } catch(Exception exc) { servlet.log(Hibernate error + exc.getMessage()); } Won't work?? I've made some progress, I think. Log output shows Hibernate is returning a value for a given query but the code above keeps throwing an exception that is simply Hibernate error null Perhaps I'm getting that because I'm not using the filter yet? Another frustrating thing is that my container based auth stopped working. Keep getting Name jdbc is not bound in this Context. Have to play with that some more. Another weird thing. Copying a new war to the war directory and having Tomcat reload my war doesn't seem to work anymore. I mean, it does load, but when it does changes to the Hibernate config aren't updated. Only way, so far, to see changes has been to shutdown server, deleted war filed and war directory, copy new war file to webapp directory, and restart. Does the same thing happen to anyone else? -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Friday, December 19, 2003 1:31 PM To: [EMAIL PROTECTED] Subject: Re: struts, hibernate, datasources so lost Rich, Ya the binding thing with JNDI and tomcat is messed up.. for some reason I've read its Read Only.. but the strange thing is I WAS able to get it working when I bound to that resource from a static class, but as soon as I used a filter or a struts plugin it no longer worked.. really lame. Regarding what happens after you load something from Hibernate. I'm still learning this myself, but I assume if you don't load ANYTHING lazily then you should be able to do anything with that variable and have no worries. However if you have an object that contains say a set of other objects, ie a team with a set of players, and set it to lazy loading, meaning when you load team 1, the players arent loaded until you call, getPlayers(), then at that point hibernate is still bound to your variable and will load that from the db assuming the session you initially loaded the team with is still open. Make sense? The way it works is hibernate has its own classes inherited from set/list/map etc that handle that.. and it uses those when you load sets. -David - Original Message - From: Rich Garabedian [EMAIL PROTECTED] To: 'David Erickson' [EMAIL PROTECTED] Sent: Friday, December 19, 2003 11:12 AM Subject: RE: struts, hibernate, datasources so lost David, David, thanks so much for your note. I guess I'll try having Hibernate setup the datasource if I can't get it to work they way I'm trying now. Doing that really bothers me though. I thought datasources were supposed to allow us to configure a single point of entry and then just use the logical name everywhere ... and not to have to worry about anything else. Need to change your database? Just look in one location and change - easy as pie. Yeah, right. Configuring a JDBC realm for authentication, and then a datasource in an entirely different file just seems plain backwards to me. Grrrh. Sorry, I'm really frustrated right now. I spent hours trying to determine why my web app was crashing on load. Come to find out, ehcache.jar is required (at least it seems to be for me). Even though the hibernate lib/readme says it's optional. (I can't find anywhere where I specify cache useage). The explanation below
Re: Are httpSessions thread safe?
Another question along the same vein.. each httpRequest that comes into say Tomcat is given a seperate thread to operate under correct? -David - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, December 18, 2003 1:09 AM Subject: RE: Are httpSessions thread safe? The sessions essentially just a sort of Map. Access to it may be threadsafe, but the stuff thats in it is another matter entirely. Multiple requests associated with the same session will execute simultaneously. If you have 1 threads playing with the same unsafe object (which you just happened to pull out of the session) then of course you will need to synchronise their access to it externally. ie: Garthop unsafeObject = (Garthop)session.getAttribute(THE_GARTHOP); synchronized(unsafeObject) { garthop.nargle(); } -Original Message- From: Joe Hertz [mailto:[EMAIL PROTECTED] Sent: Thursday, 18 December 2003 15:56 To: 'Struts Users Mailing List' Subject: Are httpSessions thread safe? Not sure how OT this question is. My current plan (unless this is bad for some reason, but if so, Ted H should change his example app :-) is to stash the hibernate Session for a user into his httpSession, and reuse it on each request. A Hibernate Session instance isn't threadsafe. I imagine if two really quick http requests got generated out of the same browser, all hell could break out. I guess I want to know if mortals like me need to worry about this. Does Struts (or the Servlet container FAIK) prevent this from occuring, or do I need to ensure this doesn't happen? If so, how? With a token or is there a better strategy? TIA -Joe - 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: Are httpSessions thread safe?
That second one actually works great, 43.html. Since each request is running in its own thread it has the possiblity to create a new hibernate session for every request, but it only creates it if you call the getSession method on the filter. And at the end of the request that session is destroyed. -David - Original Message - From: Joe Hertz [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, December 18, 2003 10:20 AM Subject: RE: Are httpSessions thread safe? I saw these. I just had this grand idea of minimizing the Hibernate connections by doing what Ted did in his example -- not actually discarding a user's Hibernate Session until his httpSession expired. I've never messed with ThreadLocals before but I suspect that the attempt to put a ThreadLocal into a httpSession I suspect would be funny to watch. -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 11:45 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: Are httpSessions thread safe? Poked aroung on the Hibernate site for a few minutes and found these: http://www.hibernate.org/42.html http://www.hibernate.org/43.html Quoting Joe Hertz [EMAIL PROTECTED]: Yuck. And may I say, Yuck, again? It's not the Session object per se, as much as it is the particular attribute I want to store there. It does strike me that the storage of a Hibernate Session in the httpSession is a fairly common thing, so I doubt this bites people very often. It does seem to have the potential to do so. In the real world why is this not too big of a deal? Or should it be considered one? I suppose that unless you've got time consuming requests, or the user hits some button on the browser twice in rapid succession, it's probably okay. A token could effectively prevent this type of condition I suppose. -J -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 11:12 AM To: Struts Users Mailing List Subject: RE: Are httpSessions thread safe? Synchronizing on the session object may cause you all sorts of grief...or it may not. It all depends on your container. The spec makes no guarantees about the identity of the object returned by methods like PageContext.getSession or HttpServletRequest.getSession. For example, here's a test JSP: %@ page contentType=text/plain % % out.println(session: + session); out.println(pageContext.getSession: + pageContext.getSession()); out.println(request.getSession: + request.getSession(false)); out.println(request.getSession: + request.getSession(false)); % Here's the output from TC 4.1.24: session: [EMAIL PROTECTED] pageContext.getSession: [EMAIL PROTECTED] request.getSession: [EMAIL PROTECTED] request.getSession: [EMAIL PROTECTED] And that's just within the same thread! I'm pretty sure TC 4.1.29 does return the same instance, but just remember it's not guaranteed. Quoting Joe Germuska [EMAIL PROTECTED]: At 4:09 PM +0800 12/18/03, Andrew Hill wrote: The sessions essentially just a sort of Map. Access to it may be threadsafe, but the stuff thats in it is another matter entirely. Multiple requests associated with the same session will execute simultaneously. There's nothing in the specs that guarantee threadsafe access to session attributes. A pattern I've become quite fond of is to create a single object (we call it a shell, analogous to an operating system shell) which encapsulates everything you want in session context for a given user; then put just this object into session scope, and use methods on it to do everything else. This helps you apply synchronization where appropriate. There's still a risk of a race condition involving the initial creation of the shell (assuming you do something like check the session to see if there's a value under the key you use for the shell) -- you can put that in a block synchronized on the session object: MyAppShell shell = null; synchronized (session) { shell = (MyAppShell) session.getAttribute(SHELL_KEY); if (shell == null) { shell = new MyAppShell (); session.setAttribute(SHELL_KEY, shell); } } If the shell concept seems like high overhead to you, you can still synchronize accesses on the session object along those lines; you may just have more trouble keeping track of all the places it needs to happen. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com We want beef in dessert if
Re: Are httpSessions thread safe?
Well what that plugin does is IF you request a session from it, it binds a Hibernate Session to your current executing thread. thus if you are using actions, anywhere in that action and in the resulting jsp the same session is used if you requested it again. And on requests for images or whatever since its never requested it doesn't get created. If you are using a connection pool like DBCP or something it shouldnt be a problem at all. -David - Original Message - From: Joe Hertz [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, December 18, 2003 10:41 AM Subject: RE: Are httpSessions thread safe? I guess creating Hibernate Sessions and Destroying them on every request isn't as bad as I imagine it is? I figured creating the session when the user showed up, destroying it when his httpSession expired, and reconnecting/disconnecting on each request was strictly better. I guess doing this isn't quite worth the effort? No one else seems to mind :) -Joe -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 12:27 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: Are httpSessions thread safe? That second one actually works great, 43.html. Since each request is running in its own thread it has the possiblity to create a new hibernate session for every request, but it only creates it if you call the getSession method on the filter. And at the end of the request that session is destroyed. -David - Original Message - From: Joe Hertz [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, December 18, 2003 10:20 AM Subject: RE: Are httpSessions thread safe? I saw these. I just had this grand idea of minimizing the Hibernate connections by doing what Ted did in his example -- not actually discarding a user's Hibernate Session until his httpSession expired. I've never messed with ThreadLocals before but I suspect that the attempt to put a ThreadLocal into a httpSession I suspect would be funny to watch. -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 11:45 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: Are httpSessions thread safe? Poked aroung on the Hibernate site for a few minutes and found these: http://www.hibernate.org/42.html http://www.hibernate.org/43.html Quoting Joe Hertz [EMAIL PROTECTED]: Yuck. And may I say, Yuck, again? It's not the Session object per se, as much as it is the particular attribute I want to store there. It does strike me that the storage of a Hibernate Session in the httpSession is a fairly common thing, so I doubt this bites people very often. It does seem to have the potential to do so. In the real world why is this not too big of a deal? Or should it be considered one? I suppose that unless you've got time consuming requests, or the user hits some button on the browser twice in rapid succession, it's probably okay. A token could effectively prevent this type of condition I suppose. -J -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 11:12 AM To: Struts Users Mailing List Subject: RE: Are httpSessions thread safe? Synchronizing on the session object may cause you all sorts of grief...or it may not. It all depends on your container. The spec makes no guarantees about the identity of the object returned by methods like PageContext.getSession or HttpServletRequest.getSession. For example, here's a test JSP: %@ page contentType=text/plain % % out.println(session: + session); out.println(pageContext.getSession: + pageContext.getSession()); out.println(request.getSession: + request.getSession(false)); out.println(request.getSession: + request.getSession(false)); % Here's the output from TC 4.1.24: session: [EMAIL PROTECTED] pageContext.getSession: [EMAIL PROTECTED] request.getSession: [EMAIL PROTECTED] request.getSession: [EMAIL PROTECTED] And that's just within the same thread! I'm pretty sure TC 4.1.29 does return the same instance, but just remember it's not guaranteed. Quoting Joe Germuska [EMAIL PROTECTED]: At 4:09 PM +0800 12/18/03, Andrew Hill wrote: The sessions essentially just a sort of Map. Access to it may be threadsafe, but the stuff thats in it is another matter entirely. Multiple requests associated with the same session will execute
Re: Plea for help w/Struts-Hibernate Plugin that has it working!
Excellent I will give that a try. What I was hoping to do was maintain one JDNI location for my database, but I will definitly try this out. Thanks! -David - Original Message - From: David Friedman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 6:34 PM Subject: RE: Plea for help w/Struts-Hibernate Plugin that has it working! David, There is an alternative Struts/Hibernate/JNDI combination. All of it hinges on one file: hibernate.cfg.xml. It doesn't require any changes to server.xml or web.xml and works (at the very least) for me on Struts v1.0 v1.1 with Hibernate v2.0.3 V2.1beta6 under Tomcat 4.1.24 through 4.1.29. * Use a hibernate.cfg.xml file like so (passwords changed and pardon my MySQL slant) ?xml version='1.0' encoding='utf-8'? !DOCTYPE hibernate-configuration PUBLIC -//Hibernate/Hibernate Configuration DTD 2.0//EN http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd; hibernate-configuration session-factory name=dgf:/hibernate/SessionFactory property name=dialectnet.sf.hibernate.dialect.MySQLDialect/property property name=connection.usernameAA/property property name=connection.passwordBB/property property name=connection.urljdbc:mysql://localhost:3306/authors/property property name=connection.driver_classcom.mysql.jdbc.Driver/property property name=show_sqltrue/property property name=use_outer_jointrue/property property name=transaction.factory_classnet.sf.hibernate.transaction.JDBCTransactio nFactory/property property name=dbcp.minIdle1/property !-- Optional, I use this but it requires an opensymphony.org download of OSCache property name=cache.use_query_cachetrue/property property name=cache.provider_classnet.sf.hibernate.cache.OSCacheProvider/property -- !-- insert any mapping file so you don't need to hardcode adding classes or adding files in a Java class -- mapping resource=hibernate/Misc.hbm.xml/ /session-factory /hibernate-configuration The JNDI location is set in the session-factory tag using the 'name=' attribute. Whatever name you choose, DO NOT use anything starting java:comp/env as that is read-only in Tomcat and will NOT work. I made up a context named dgf:/hibernate/SessionFactory and was pleasantly surprised when hibernate created the context for me and stored the SessionFactory within it so I could us it in JNDI context lookups after I got the InitialContext and performed a ' SessionFactory sf = (SessionFactory) context.lookup(dgf:/hibernate/SessionFactory);'. I see you want to use DBCP. As long as you set a minimum of 1 dbcp property, hibernate will detect you want to use DBCP as your connection pool. Feel free to set more than one DBCP property or even to use something other than dbcp.minIdle as in my working example above. Hibernate can work with other connection pools. I recommend avoiding C3P0 as it can't shutdown (eats up memory unless you fully shutdown the JVM [i.e. TOMCAT] and restart). A Beta C3P0 allows shutdown of a C3P0 pool, but the last time I checked, the Hibernate controlling class for C3P0 pooling still had an empty finalize() and never actually shutdown my C3P0 pool. Regards, David -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 7:20 PM To: Struts Mailing List Subject: Plea for help w/Struts-Hibernate Plugin that has it working! For some reason I just cannot make the Struts-Hibernate plugin work.. I can't make the Struts-Hibernate Listener work either. Here is the link to class I am trying to use: http://www.hibernate.org/133.html Here is the error I get without fail every time.. now note that this jndi connection WORKS fine when I use the HibernateUtil class, or when I use my own JDNI tests. Error: 2003-12-16 17:10:31,452 [DEBUG] impl.SessionImpl - opened session 2003-12-16 17:10:31,468 [DEBUG] transaction.JDBCTransaction - begin 2003-12-16 17:10:31,484 [DEBUG] util.JDBCExceptionReporter - SQL Exception java.sql.SQLException: Cannot load JDBC driver class 'null' at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav a:529) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3 12) at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(Datas ourceConnectionProvider.java:59) at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:262) at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3155) at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3138) at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:40) My setup: tomcat_home\common\lib contains: commons-dbcp.jar commons-pool.jar jdbc2_0-stdext.jar jndi.jar mysql-connector-java
Strategy for out of date items through forms using hibernate?
Hi I am using Struts with Hibernate in a webapplication.. we are using forms etc. The problem I am currently trying to decide how to handle is thus: Assume user 1 loads up an object in a form and is modifying it. Assume user 2 loads up the same object in a form and is also modifying it. User 1 submits the modified object. User 2 also submits the object, however his is out of date and I would like the webapp to tell him that and show the differences that exist. What is the best way to use hibernate to deal with this? What I have attempted is using the built in timestamp feature in MySQL, I have a field in my object that is timestamp but does not insert or update, thus mysql controls its value. Then when the user submits the object I loaded another copy of that object from the DB and tried to compare their dates.. however this gave me an error saying: net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 1, of class: cmcflex.salesweb.model.prospect.Prospect because of the object I loaded to compare. What do do? Is there a better strategy for tackling this? I tried using the actual timestamp in the properties for my object, but then when I tried to submit the object the generated sql said when id=? AND timestamp=? meaning it would not update if the timestamp is different, and I'm unsure if I could even determine if it did or did not update. Thanks in advance, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strategy for out of date items through forms using hibernate?
I have done this. Hibernate supports versioning (using a version number column), if you use this Hibernate can make sure the changes are not overwritten. The basic process is: 1. Hibernate session A loads object A1 (with identifier 1234) 2. Hibernate session B loads object B1 (also with identifier 1234) 3. Session A modifies object A1 and saves it 4. B modifies object B1 and attempts to save it 5. Hibernate will detect the version number for the object has changed and generate an exception (StaleObjectStateException) 6. Catch this exception, close the hibernate session, return an error message to the user using ActionErrors etc I also have a refresh button so that at any time the user can press refresh which reloads the object from hibernate so it is up to date. When I return my stale object error I also allow the user to either refresh (loses the users changes), cancel (do nothing, return to parent menu), or overwrite. Overwrite can attempt to overwrite the changes by reloading the new object, but use the posted field changes to update and then save the object. Yes I figured this out just barely, rather I used timestamp instead of version (are there any drawbacks to that?). I am interested in doing exactly what you did, but how did you go about overwriting the things that have been changed? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Best way to parse a String and replace line feeds with br for html?
Situation: using the html:textarea element tag to enter notes on an object, thats getting persisted as a blob in our database. I would like to be able to output this to html with the same formatting.. ie the line feeds work. Whats the best way to do this? I tried the jstl:core c:out tag and it didnt work (did not goto the next line), tried the struts bean:write tag same problem. Is there another struts tag library I can use? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best way to parse a String and replace line feeds with br for html?
Barett: Thanks for the tips.. I completely forgot about #1, and I think I will implement #2 as it doesn't require me modifying my object at all. Thanks! -David - Original Message - From: Barett McGavock [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Cc: 'David Erickson' [EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 5:18 PM Subject: RE: Best way to parse a String and replace line feeds with br for html? Thoughts: 1) Assuming that you have a separate value object to carry this item to the view, try replacing any \n with br in the action. 2) Have you also considered using the pre HTML tag? B -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 5:05 PM To: Struts Mailing List Subject: Best way to parse a String and replace line feeds with br for html? Situation: using the html:textarea element tag to enter notes on an object, thats getting persisted as a blob in our database. I would like to be able to output this to html with the same formatting.. ie the line feeds work. Whats the best way to do this? I tried the jstl:core c:out tag and it didnt work (did not goto the next line), tried the struts bean:write tag same problem. Is there another struts tag library I can use? Thanks, David - 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]
iBatis DAO + Hibernate?
We're needing to roll out DAO and ORM in our webapp... been evaluating hibernate and it looks awesome, but we'd like to insulate our app from that, has anyone tried using iBatis' DAO layer then plugging hibernate underneath that? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] iBatis DAO + Hibernate?
What I'm trying to get away from is having to write an implementation of a factory for each of my POJO's.. ie having something to load it, save it, basically to interact with hibernate. And it looked like iBatis can do that well.. are there other alternatives? -David - Original Message - From: Hookom, Jacob [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 9:38 AM Subject: [OT] iBatis DAO + Hibernate? It seems kind of moot to use iBatis DAO over Hibernate. You are better off rolling out something to the tune of Sun's DAO spec. We use the DAO with the same kind of behavior as iBatis. Depending on the app, we will make additional methods on the DAO that are specific to the use-case or you can call them up in getMethod(by name). -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 10:41 AM To: Struts Mailing List Subject: iBatis DAO + Hibernate? We're needing to roll out DAO and ORM in our webapp... been evaluating hibernate and it looks awesome, but we'd like to insulate our app from that, has anyone tried using iBatis' DAO layer then plugging hibernate underneath that? -David - 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: iBatis DAO + Hibernate?
Ok so if I chose to use solely hibernate would there be anything wrong with putting code like this into my action?: factory = (SessionFactory)request.getSession().getServletContext().getAttribute(Hibern atePlugIn.SESSION_FACTORY_KEY); session = factory.openSession(); Transaction tx = session.beginTransaction(); myProspect = (Prospect)session.get(Prospect.class, id); tx.commit(); session.close(); Ultimately I'll have to build some kind of a util class to handle giving me sessions etc.. but in the short term for testing is this proper? Thanks, David - Original Message - From: Larry Meadors [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 10:17 AM Subject: Re: iBatis DAO + Hibernate? I am working in an environment where we are mixing the two. My advice to you is to *not* do it. Pick one and use it as it was intended to be used. I personally prefer iBATIS. It is very simple; it plays well with existing databases; it allows you the flexibility, commodity and performance tuning of sql; it provides object wrappers for your data. All while staying in your DAO and out of your application. From my experience, if you are using hibernate, you write hibernate applications, not java applications that use hibernate - even if you try to wrap it so that it is not used directly. Trust me, we did. If you are willing to accept that, hibernate may work for you. Some other factors to consider: - How many developers know hql vs sql? - How much time will it take for a new person to learn the idiosyncrasies of the tool (and they both have them)? Larry [EMAIL PROTECTED] 12/16/03 9:40 AM We're needing to roll out DAO and ORM in our webapp... been evaluating hibernate and it looks awesome, but we'd like to insulate our app from that, has anyone tried using iBatis' DAO layer then plugging hibernate underneath that? -David - 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: [OT] RE: iBatis DAO + Hibernate?
If you look towards the very end of the PDF it describes the DAO Wendy. -David - Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 3:35 PM Subject: [OT] RE: iBatis DAO + Hibernate? From: Ted Husted [mailto:[EMAIL PROTECTED] You might be confiusing the iBATIS SqlMaps framework with the seperate and distict iBATIS DAO framework. The DAO framework is not linked to SqlMaps and should work with anything. Otherwise, it could not be a DAO framework, since the whole idea is that you can change persistence implementations. Do you have a link to the iBATIS DAO framework? All I can find is this: http://www.ibatis.com/common/download.html (iBATIS DB Layer) but the pdf is all about SqlMap. Specifically, I'm looking for a DAO framework that does NOT assume JDBC. I've already written my own, I just followed the J2EE Data Access Objects pattern/blueprint, but I'd like to see if I can crib some additional features and generally see if I can improve mine. Thanks, -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - 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]
Plea for help w/Struts-Hibernate Plugin that has it working!
For some reason I just cannot make the Struts-Hibernate plugin work.. I can't make the Struts-Hibernate Listener work either. Here is the link to class I am trying to use: http://www.hibernate.org/133.html Here is the error I get without fail every time.. now note that this jndi connection WORKS fine when I use the HibernateUtil class, or when I use my own JDNI tests. Error: 2003-12-16 17:10:31,452 [DEBUG] impl.SessionImpl - opened session 2003-12-16 17:10:31,468 [DEBUG] transaction.JDBCTransaction - begin 2003-12-16 17:10:31,484 [DEBUG] util.JDBCExceptionReporter - SQL Exception java.sql.SQLException: Cannot load JDBC driver class 'null' at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav a:529) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3 12) at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(Datas ourceConnectionProvider.java:59) at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:262) at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3155) at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3138) at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:40) My setup: tomcat_home\common\lib contains: commons-dbcp.jar commons-pool.jar jdbc2_0-stdext.jar jndi.jar mysql-connector-java-3.0.8-stable-bin.jar hibernate2.jar etc Server.xml: DefaultContext Resource name=jdbc/Salesweb auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/Salesweb parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valuemyuser/value /parameter parameter namepassword/name valuemypass/value /parameter parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://192.168.0.104:3306/salesweb?autoReconnect=true/value /parameter /ResourceParams /DefaultContext web.xml: resource-ref descriptionSalesweb Database Connection/description res-ref-namejdbc/Salesweb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref hibernate.cfg.xml: hibernate-configuration session-factory property name=connection.datasourcejava:comp/env/jdbc/Salesweb/property property name=show_sqltrue/property property name=dialectnet.sf.hibernate.dialect.MySQLDialect/property !-- Mapping files -- mapping resource=Prospect.hbm.xml/ /session-factory /hibernate-configuration Thanks for any help in advance!!! -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Indexed ArrayList Properties.. quick question
So I've been doing Indexed Arraylist Properties for awhile now but when I tried to add some more to my form I'm a little miffed. Here's the array List code in my form: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Indexed Array List Properties (Repost)
So I've been doing Indexed Arraylist Properties for awhile now but when I tried to add some more to my form I'm a little miffed. Here's the array List code in my form: private ArrayList forumGroups = new ArrayList(); now its a request scoped form, so I know I need a method that looks like this: public ForumGroupLine getForumGroup(int index) { while (index = this.forumGroups.size()) this.forumGroups.add(new ForumGroupLine()); return (ForumGroupLine) this.forumGroups.get(index); } However I can't figure out what to name it! is the method supposed to be named getForumGroup? How does struts determine what to call to just get a singular item from an array list? On my other stuff my Arraylist was named roles and my method for getting a single one was just getRole.. Thanks in advance, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Solved - Re: Indexed Array List Properties (Repost)
Once again solved my own problem minutes after posting about it.. lol.. anyway for anyone else that searches this down the road. It is ESSENTIAL in your form that your method for getting one element from the list your iterating over matches your variable name in the jsp your using or what not. Example: logic:iterate name=userForm property=forumGroups id=forumGroup trtd width=1%html-el:checkbox name=forumGroup property=available indexed=true//td td width=25% nowraphtml-el:hidden name=forumGroup property=id indexed=true write=false/ html-el:hidden name=forumGroup property=name indexed=true write=true//td tdhtml-el:hidden name=forumGroup property=description indexed=true write=true//td/tr /logic:iterate notice my arraylist is named forumGroups, and each object in that array is assigned as forumGroup. Therefore my method in the form that takes the index as its parameter to return that object from the arraylist MUST be named getForumGroup(int index). -David - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Mailing List [EMAIL PROTECTED] Sent: Monday, November 03, 2003 4:12 PM Subject: Indexed Array List Properties (Repost) So I've been doing Indexed Arraylist Properties for awhile now but when I tried to add some more to my form I'm a little miffed. Here's the array List code in my form: private ArrayList forumGroups = new ArrayList(); now its a request scoped form, so I know I need a method that looks like this: public ForumGroupLine getForumGroup(int index) { while (index = this.forumGroups.size()) this.forumGroups.add(new ForumGroupLine()); return (ForumGroupLine) this.forumGroups.get(index); } However I can't figure out what to name it! is the method supposed to be named getForumGroup? How does struts determine what to call to just get a singular item from an array list? On my other stuff my Arraylist was named roles and my method for getting a single one was just getRole.. Thanks in advance, David - 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: Eclipse + Ant + precompile - Tomcat
We currently have an ant function that just builds the directory structure of a deployed webapp then points tomcat at that build directory.. is there anyway to precompile the jsps in this situation without creating a war? And how does tomcat know to goto the precompiled files when a request for the actual jsp comes in? thanks, David - Original Message - From: Ruth, Brice [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 31, 2003 10:45 AM Subject: Re: Eclipse + Ant + precompile - Tomcat Thanks for the pointer to your blog, between that and the example provided by the Tomcat docs, I was able to get what I was looking for - fully automated pre-compiling deploying. Excellent! Holman, Cal wrote: I am using tomcat 5.0.12 and struts 1.1 with tiles and have been successful in precompiling. The tomcat documentation has a pretty good example. The hard part is translating someone else's directory structure into yours to apply all the examples. I posted my solution to my web site at http://www.calandva.com/holmansite/do/blog/blogging I also use Eclipse for development but due to the number of steps and substitution in the various output xml and properties files still create the final product with ant - invoked in Eclipse or externally. Not sure I explained it well enough and I left off my compile and war targets - let me know if you have questions. Cal -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Friday, October 31, 2003 10:14 To: Struts Users Mailing List Subject: Eclipse + Ant + precompile - Tomcat I've been doing some googling on having a webapp precompiled when deployed to Tomcat via an Ant task and I'm a bit intimidated with what's involved. Has anyone out there done this? Right now, I have an Ant build setup as an external build in Eclipse that does a variety of things, including building, packing up my WAR, and installing this WAR to Tomcat using the catalina-ant install command that uses the management URL and an external context file to install the webapp in a (local) running Tomcat instance. I'd like to follow-up the install with a directive to Tomcat to precompile the JSPs in the web application - does anyone have an Ant task that I could adapt to this purpose that they'd be willing to share? Thanks! -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Learn more about Paymentech's payment processing services at www.paymentech.com THIS MESSAGE IS CONFIDENTIAL. This e-mail message and any attachments are proprietary and confidential information intended only for the use of the recipient(s) named above. If you are not the intended recipient, you may not print, distribute, or copy this message or any attachments. If you have received this communication in error, please notify the sender by return e-mail and delete this message and any attachments from your computer. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - 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: Eclipse + Ant + precompile - Tomcat
What values are expected to go into jasper2 validateXml=false uriroot=/salesweb webXmlFragment=${WEB-INF.dir}/generated_web.xml outputDir=${WEB-INF.dir}/src / the uriroot, webXMLFragment, and outputDir? Are they the full path names on the local file system? like c:\whatever or /home/whatever or is it web context path stuff like /salesweb/WEB-INF or whatever? Thanks David - Original Message - From: Ruth, Brice [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 31, 2003 12:42 PM Subject: Re: Eclipse + Ant + precompile - Tomcat Yep, the same setup works in that situation - and the way Tomcat knows to use the precompiled JSPs is that special entries for each of the servlets generated from jasper (the JSP compiler) are entered into the web.xml file (this, of course, can be automated). David Erickson wrote: We currently have an ant function that just builds the directory structure of a deployed webapp then points tomcat at that build directory.. is there anyway to precompile the jsps in this situation without creating a war? And how does tomcat know to goto the precompiled files when a request for the actual jsp comes in? thanks, David - Original Message - From: Ruth, Brice [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 31, 2003 10:45 AM Subject: Re: Eclipse + Ant + precompile - Tomcat Thanks for the pointer to your blog, between that and the example provided by the Tomcat docs, I was able to get what I was looking for - fully automated pre-compiling deploying. Excellent! Holman, Cal wrote: I am using tomcat 5.0.12 and struts 1.1 with tiles and have been successful in precompiling. The tomcat documentation has a pretty good example. The hard part is translating someone else's directory structure into yours to apply all the examples. I posted my solution to my web site at http://www.calandva.com/holmansite/do/blog/blogging I also use Eclipse for development but due to the number of steps and substitution in the various output xml and properties files still create the final product with ant - invoked in Eclipse or externally. Not sure I explained it well enough and I left off my compile and war targets - let me know if you have questions. Cal -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Friday, October 31, 2003 10:14 To: Struts Users Mailing List Subject: Eclipse + Ant + precompile - Tomcat I've been doing some googling on having a webapp precompiled when deployed to Tomcat via an Ant task and I'm a bit intimidated with what's involved. Has anyone out there done this? Right now, I have an Ant build setup as an external build in Eclipse that does a variety of things, including building, packing up my WAR, and installing this WAR to Tomcat using the catalina-ant install command that uses the management URL and an external context file to install the webapp in a (local) running Tomcat instance. I'd like to follow-up the install with a directive to Tomcat to precompile the JSPs in the web application - does anyone have an Ant task that I could adapt to this purpose that they'd be willing to share? Thanks! -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Learn more about Paymentech's payment processing services at www.paymentech.com THIS MESSAGE IS CONFIDENTIAL. This e-mail message and any attachments are proprietary and confidential information intended only for the use of the recipient(s) named above. If you are not the intended recipient, you may not print, distribute, or copy this message or any attachments. If you have received this communication in error, please notify the sender by return e-mail and delete this message and any attachments from your computer. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - 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] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL
Re: Eclipse + Ant + precompile - Tomcat
Ok I solved that question its looking for an exact directory. But now I'm getting this error when trying to build: java.lang.NoClassDefFoundError: org/apache/xerces/impl/XMLNSDocumentScannerImpl$NSContentDispatcher And I made sure that my path has the newest versions of the xerces jars... any ideas? Here is my build file target name=jspc delete dir=${WEB-INF.dir}/src/ taskdef name=jasper2 classname=org.apache.jasper.JspC classpath id=jspc.classpath pathelement location=${java.home}/../lib/tools.jar/ fileset dir=${tomcat.home}/server/lib include name=*.jar/ /fileset fileset dir=${tomcat.home}/common/lib include name=*.jar/ /fileset fileset dir=${basedir}/web/WEB-INF/lib include name=*.jar/ /fileset /classpath /taskdef mkdir dir=${WEB-INF.dir}/src/ jasper2 validateXml=false uriroot=c:\projects\salesweb\build webXmlFragment=c:\projects\salesweb\uild\WEB-INF\generated_web.xml outputDir=c:\projects\salesweb\uild\WEB-INF\src / /target the xerces jars are in eveyr one of the fileset include dirs.. what gives? -David - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 31, 2003 1:10 PM Subject: Re: Eclipse + Ant + precompile - Tomcat What values are expected to go into jasper2 validateXml=false uriroot=/salesweb webXmlFragment=${WEB-INF.dir}/generated_web.xml outputDir=${WEB-INF.dir}/src / the uriroot, webXMLFragment, and outputDir? Are they the full path names on the local file system? like c:\whatever or /home/whatever or is it web context path stuff like /salesweb/WEB-INF or whatever? Thanks David - Original Message - From: Ruth, Brice [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 31, 2003 12:42 PM Subject: Re: Eclipse + Ant + precompile - Tomcat Yep, the same setup works in that situation - and the way Tomcat knows to use the precompiled JSPs is that special entries for each of the servlets generated from jasper (the JSP compiler) are entered into the web.xml file (this, of course, can be automated). David Erickson wrote: We currently have an ant function that just builds the directory structure of a deployed webapp then points tomcat at that build directory.. is there anyway to precompile the jsps in this situation without creating a war? And how does tomcat know to goto the precompiled files when a request for the actual jsp comes in? thanks, David - Original Message - From: Ruth, Brice [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 31, 2003 10:45 AM Subject: Re: Eclipse + Ant + precompile - Tomcat Thanks for the pointer to your blog, between that and the example provided by the Tomcat docs, I was able to get what I was looking for - fully automated pre-compiling deploying. Excellent! Holman, Cal wrote: I am using tomcat 5.0.12 and struts 1.1 with tiles and have been successful in precompiling. The tomcat documentation has a pretty good example. The hard part is translating someone else's directory structure into yours to apply all the examples. I posted my solution to my web site at http://www.calandva.com/holmansite/do/blog/blogging I also use Eclipse for development but due to the number of steps and substitution in the various output xml and properties files still create the final product with ant - invoked in Eclipse or externally. Not sure I explained it well enough and I left off my compile and war targets - let me know if you have questions. Cal -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Friday, October 31, 2003 10:14 To: Struts Users Mailing List Subject: Eclipse + Ant + precompile - Tomcat I've been doing some googling on having a webapp precompiled when deployed to Tomcat via an Ant task and I'm a bit intimidated with what's involved. Has anyone out there done this? Right now, I have an Ant build setup as an external build in Eclipse that does a variety of things, including building, packing up my WAR, and installing this WAR to Tomcat using the catalina-ant install command that uses the management URL and an external context file to install the webapp in a (local) running Tomcat instance. I'd like to follow-up the install with a directive to Tomcat to precompile the JSPs in the web application - does anyone have an Ant task that I could adapt to this purpose that they'd be willing to share? Thanks! -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Learn more about Paymentech's payment processing services at www.paymentech.com
Re: Tiles Redirect Bug on a per Tile basis? Help!
Adam, Essentially I just want to display a different content in that area of my layout. And I considered using a jsp:include, but by the point the logic determines that a different page needs to be in that spot it has already loaded a bunch of JSP variables and stuff into the page, by including another page with variables potentially the same would it mess everything up? Also for example was: if (x condition is met) { % jsp:include blah.jsp % return; } % Would that return successfully quit running any logic from my original jsp? Thanks, David - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, October 30, 2003 1:14 AM Subject: Re: Tiles Redirect Bug on a per Tile basis? Help! On 10/29/2003 11:52 PM David Erickson wrote: Ya sorry that is a hard question.. here let me give more explanation: definition name=.Default path=/tiles/layouts/base.jsp put name=header value=/tiles/header.jsp/ put name=menu value=${menu}/ put name=body value=${body}/ put name=footer value=/tiles/footer.jsp/ put name=logon value=/tiles/logon.jsp/ put name=title value=Sales Web/ put name=messages value=/tiles/messages.jsp/ /definition definition name=.Forum extends=.Default put name=body value=/forum/index.jsp/ put name=menu value=.menu.Forum/ /definition These are my two tile definitions in my tiles-defs.xml file. I call a jsp file, for example test.jsp it contains: %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % tiles:insert definition=.Forum flush=true tiles:put name=body value=/forum/test-.jsp/ /tiles:insert (which is basically just a way to call a definition without using a struts action for right now) The above fills everything into our page layout and overrides body with test-.jsp. Now test-.jsp goes into the body slot, the main area on the page. I do some logic in it and determine, before its rendered, that the user is not logged in or whatever else, and instead of it going into the body area it needs to redirect to another page to fill that slot. However when I try that the body area just comes up blank. And thats just using: url = response.encodeRedirectURL(request.getContextPath() + /forum/transition.jsp); response.sendRedirect(url); return; I know the above redirect code works, because when I put it in a .jsp that does not includes our tiles layout it works fine. It's not clear whether you want to do a redirect to take the user to a different page, which is what I assumed from your first message, or whether you want to stay on that page and just have different content in your body slot. If you only need different content, why do a redirect? Why can't you just do a straight jsp:include? Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Redirect Bug on a per Tile basis? Help!
Adam, I agree with you.. I'm not a big fan of logic in jsps other than minimal stuff, but in this circumstance we are retooling a jsp based forum and eventually will port it to struts but at the moment time is scarce. I was able to make it work using the jsp:include pageblah/ tag. I found some interesting stuff with it though. The page url is relative to your context. So if my context was /salesweb, and i wanted the page at /salesweb/forum/transition-.jsp I would need to send it /forum/transition-.jsp. Also when I tried jsp:include page%= request.getContextPath() %/forum/transition-.jsp/ I would get a compile error (this was before I figured out it was context relative), however jsp:include page%= StringNameHere %/ would work. Very odd. I just wish the original redirect would work, so my code doens't look all sloppy ;) Thanks Adam, David - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, October 30, 2003 1:30 PM Subject: Re: Tiles Redirect Bug on a per Tile basis? Help! On 10/30/2003 07:01 PM David Erickson wrote: Adam, Essentially I just want to display a different content in that area of my layout. And I considered using a jsp:include, but by the point the logic determines that a different page needs to be in that spot it has already loaded a bunch of JSP variables and stuff into the page, by including another page with variables potentially the same would it mess everything up? Also for example was: if (x condition is met) { % jsp:include blah.jsp % return; } % Would that return successfully quit running any logic from my original jsp? Regarding the variables getting messed up: there are 2 types of includes - I think the one you have used above would be OK. There is also the straight @% include file= %. Again though JSP is not my forte. I'm not sure whether the return would end the JSP. A check in the compiled JSP file would show you. I never do too much logic in my JSPs so I'm not too hot on that. Perhaps you should make an else {} that encompasses the whole of the rest of the JSP. Horrible, but I take it you are modifying existing code, so it might be the easiest way. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Redirect Bug on a per Tile basis? Help!
Ya I wish I knew why the redirects inside a tile aren't working.. theoretically they should unless there is a specific reason they were coded not too... but nobody else seems to know either :p -David - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, October 30, 2003 4:09 PM Subject: Re: Tiles Redirect Bug on a per Tile basis? Help! On 10/30/2003 11:26 PM David Erickson wrote: I was able to make it work using the jsp:include pageblah/ tag. I found some interesting stuff with it though. The page url is relative to your context. So if my context was /salesweb, and i wanted the page at /salesweb/forum/transition-.jsp I would need to send it /forum/transition-.jsp. Also when I tried jsp:include page%= request.getContextPath() %/forum/transition-.jsp/ I would get a compile error (this was before I figured out it was context relative), however jsp:include page%= StringNameHere %/ would work. Very odd. I just wish the original redirect would work, so my code doens't look all sloppy ;) Nobody else has jumped in on this thread to say anything different, but I don't actually claim that the tiles redirect can't work. Originally I thought you wanted the whole lot to redirect, not just the tile, which I know will work. I just don't know enough about the internal Tiles machinations. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Redirect Bug on a per Tile basis? Help!
Ya sorry that is a hard question.. here let me give more explanation: definition name=.Default path=/tiles/layouts/base.jsp put name=header value=/tiles/header.jsp/ put name=menu value=${menu}/ put name=body value=${body}/ put name=footer value=/tiles/footer.jsp/ put name=logon value=/tiles/logon.jsp/ put name=title value=Sales Web/ put name=messages value=/tiles/messages.jsp/ /definition definition name=.Forum extends=.Default put name=body value=/forum/index.jsp/ put name=menu value=.menu.Forum/ /definition These are my two tile definitions in my tiles-defs.xml file. I call a jsp file, for example test.jsp it contains: %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % tiles:insert definition=.Forum flush=true tiles:put name=body value=/forum/test-.jsp/ /tiles:insert (which is basically just a way to call a definition without using a struts action for right now) The above fills everything into our page layout and overrides body with test-.jsp. Now test-.jsp goes into the body slot, the main area on the page. I do some logic in it and determine, before its rendered, that the user is not logged in or whatever else, and instead of it going into the body area it needs to redirect to another page to fill that slot. However when I try that the body area just comes up blank. And thats just using: url = response.encodeRedirectURL(request.getContextPath() + /forum/transition.jsp); response.sendRedirect(url); return; I know the above redirect code works, because when I put it in a .jsp that does not includes our tiles layout it works fine. Help! -David - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 3:43 PM Subject: Re: Tiles Redirect Bug on a per Tile basis? Help! On 10/29/2003 11:04 PM David Erickson wrote: Bug description: Using tiles to handle our webpage. I have an individual tile which is a jsp that does some logic on our forums, if a certain situation occurs that tile when loaded will attempt to redirect to a error page. However this does not work. Instead where that tile should be it just comes up blank. I have also tried getting the request dispatcher and forwarding if that error occurs but it says that the response has been commited and throws an exception.. so how in the world am I supposed to insert a different page there if this condition comes up! That is a demanding question. The problem is that the outer-most Tile controls its child Tiles. This is a complete stab in the dark but try writing the redirect URL into the request attributes, and then at the end of the outermost Tile, check to see if there is a non-null value, and if so, do the redirect there. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Cannot redirect within Tiles?
Essentially I have a tile that includes a bunch of little jsps. Actually I am integrating Yazd messageboard into our app. But anyway it posts to itself (has the logic to do so) and if the post is successful it does a response.sendRedirect to another page instead of displaying itself again. Well I'm not getting any errors on it sending the redirect, but when the page loads its just empty in the spot where the redirected jsp should display. Anyone else experiencing this or able to accomplish it? thanks -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Getting a url inputstream from within an action loses the session?
Hi everyone, I'm doing some xml and xsl transformations within one of my actions, and the action needs to get an inputstream or some type of reader on a url for the xml and xsl, however when I request those URLS it goes through our filter and gets denied because the request is somehow outside of the session scope of the logged in user! The code I was using : SAXSource saxSrc = new SAXSource(new InputSource(myUrl.openStream())); very simple.. our login management information is stored in the session, but when this url is requested on our system from within an action that session information does not propogate to the filter so when the filter checks the session for a user its not there. Any ideas? thanks! David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
log4j configuration question
A couple quick questions: 1) Using tomcat is it possible to configure log4j to only be functional for your particular webapp? Because I put the log4j jar into my web-inf/lib directory, built a log4j.properties and put it in /web-inf/classes and set log4j's rootlogger to debug and got log messages from tns of stuff that I certainly hadn't setup to log.. just wondering. 2) I'd like to keep my log files potentially in my /web-inf/logs directory, however how can I get a handle on the realpath to that directory from the config file if I don't know where the deployed path would be?! I'm assuming I'd have to do that programmatically after the config file loads and that could be a major PITA if there are lots of log files correct? Some help and guidance in this direction would be appreciated. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Passing information from action to action
Hi I am chaining to actions together, I have one that displays a form and if you submit it calls the modify action then forwards straight back to the action that displays the form. Is there anyway for me to pass variables inbetween the modify-display action other than using the session? I tried using the request but for some reason even though I set an item in the request in modify it doesn't change the value that the display action sees. Thanks! David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Passing information from action to action
To further clarify what seems to be my problem. Display action sets begRecord and endRecord attributes in the request - JSP renders a form - submitted form goes to Modify Action - modify action tries to put something in begRecord and endRecord, appears to be ok - forwards to display action, display action sees the same values in its request object that were originally set by itself earlier. Talk about weird?! -David - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Mailing List [EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:10 PM Subject: Passing information from action to action Hi I am chaining to actions together, I have one that displays a form and if you submit it calls the modify action then forwards straight back to the action that displays the form. Is there anyway for me to pass variables inbetween the modify-display action other than using the session? I tried using the request but for some reason even though I set an item in the request in modify it doesn't change the value that the display action sees. Thanks! David - 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: Passing information from action to action
Eep I believe I may be performing a cardinal sin. Currently its whatever the default is set to.. how would I change it to a redirecting forward? I tried using forward = mapping.findForward(success); then doing forward.setRedirect(true); and it gave me some kind of config frozen error.. help! =) -David - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:22 PM Subject: RE: Passing information from action to action Is that an african or european swallow? umm... I mean is that a redirecting or non-redirecting forward from the modify to the display action? If redirecting then of course request attributes are lost. If non-redirecting, then you are performing the evil sin of action chaining and the gods of struts shall surely punish you by running your request through the request processor a second time - one of the the many results of which is that your actionform is reset and repopulated from the submit data. -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Friday, 19 September 2003 05:11 To: Struts Mailing List Subject: Passing information from action to action Hi I am chaining to actions together, I have one that displays a form and if you submit it calls the modify action then forwards straight back to the action that displays the form. Is there anyway for me to pass variables inbetween the modify-display action other than using the session? I tried using the request but for some reason even though I set an item in the request in modify it doesn't change the value that the display action sees. Thanks! David - 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: Passing information from action to action
Excellent.. that worked great. Is there any evilness to having redirect false if the related actions do not have forms? thanks -David - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:31 PM Subject: RE: Passing information from action to action In the struts config for the forward you can write forward name=bob redirect=true path=/scooby.do/ Or if you want to do it in code in your action you can create a new forward instance to return (which is also useful if you want to decorate the url with extra parameters): ActionForward f = mapping.findForward(bob); f = new ActionForward( f.getPath(), true); return f; -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Friday, 19 September 2003 05:28 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: Passing information from action to action Eep I believe I may be performing a cardinal sin. Currently its whatever the default is set to.. how would I change it to a redirecting forward? I tried using forward = mapping.findForward(success); then doing forward.setRedirect(true); and it gave me some kind of config frozen error.. help! =) -David - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:22 PM Subject: RE: Passing information from action to action Is that an african or european swallow? umm... I mean is that a redirecting or non-redirecting forward from the modify to the display action? If redirecting then of course request attributes are lost. If non-redirecting, then you are performing the evil sin of action chaining and the gods of struts shall surely punish you by running your request through the request processor a second time - one of the the many results of which is that your actionform is reset and repopulated from the submit data. -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Friday, 19 September 2003 05:11 To: Struts Mailing List Subject: Passing information from action to action Hi I am chaining to actions together, I have one that displays a form and if you submit it calls the modify action then forwards straight back to the action that displays the form. Is there anyway for me to pass variables inbetween the modify-display action other than using the session? I tried using the request but for some reason even though I set an item in the request in modify it doesn't change the value that the display action sees. Thanks! David - 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]
Populating Indexed Forms Bug?
I'm getting an error populating indexed properties.. I'm wondering if its a bug in struts.. has anyone else experienced this? Explanation: Exception javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) Root Cause java.lang.IllegalArgumentException: No bean specified at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUti ls.java:837) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) Jsp Code: html-el:form action=/modifyFlexReferencesQuery.do html-el:hidden name=testForm property=begRecord/ html-el:hidden name=testForm property=endRecord/ logic:iterate name=testForm property=flexReferenceLines id=flexReferenceLine html-el:hidden name=flexReferenceLine property=flexReference.id indexed=true write=true/ --- Offending Line Meanwhile the next line works fine: html-el:checkbox name=flexReferenceLine property=selected indexed=true/ My Form has the required: public FlexReferenceLine getFlexReferenceLine(int index) { while (index = this.flexReferenceLines.size()) this.flexReferenceLines.add(new FlexReferenceLine()); return (FlexReferenceLine) this.flexReferenceLines.get(index); } and the FlexReferenceLine object has a getter and setter for flexReference.. and the flexReference object has a getter and setter for ID... very puzzling. Anyone ran into this before? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Populating Indexed Forms Bug?
Solved my problem.. in my FlexReferenceLine object I needed to change my declaration for the private FlexReference flexReference; to private FlexReference flexReference = new FlexReference(); -David - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Mailing List [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 4:03 PM Subject: Populating Indexed Forms Bug? I'm getting an error populating indexed properties.. I'm wondering if its a bug in struts.. has anyone else experienced this? Explanation: Exception javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) Root Cause java.lang.IllegalArgumentException: No bean specified at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUti ls.java:837) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) Jsp Code: html-el:form action=/modifyFlexReferencesQuery.do html-el:hidden name=testForm property=begRecord/ html-el:hidden name=testForm property=endRecord/ logic:iterate name=testForm property=flexReferenceLines id=flexReferenceLine html-el:hidden name=flexReferenceLine property=flexReference.id indexed=true write=true/ --- Offending Line Meanwhile the next line works fine: html-el:checkbox name=flexReferenceLine property=selected indexed=true/ My Form has the required: public FlexReferenceLine getFlexReferenceLine(int index) { while (index = this.flexReferenceLines.size()) this.flexReferenceLines.add(new FlexReferenceLine()); return (FlexReferenceLine) this.flexReferenceLines.get(index); } and the FlexReferenceLine object has a getter and setter for flexReference.. and the flexReference object has a getter and setter for ID... very puzzling. Anyone ran into this before? - 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 struts with filters
Check this link: http://www-106.ibm.com/developerworks/java/library/j-tomcat/ We parse the requested url to get the action name.. then perform matching on the logged in user to see if he has permission to that action or whatever resource it may be. -David - Original Message - From: as as [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 11:59 AM Subject: using struts with filters Hi, I am trying to use filters for login authentication using Jakarta struts framework with Tomcat. Has anyone done this earlier...any helpful tutorial/pointers/website... Thanks, Samy - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic links, Tiles and Actions
The usage of the Tiles Controller Actions are essentially to perform logic on a per tile basis.. so yes you could have a TilesAction for each of your tiles and inside each it could query the database, get the required information and push it into the tiles context, from which your jsp could get that data and display it. -David - Original Message - From: Barry Volpe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 4:46 PM Subject: Dynamic links, Tiles and Actions Let's say I have several groups of links grouped as tiles. The displayed links will be dynamic based on the current state of the database. I have read what may be a possible solution: Tiles Controller feature here is an article: http://www.theserverside.com/resources/article.jsp?l=Tiles101 If I am understanding correctly it would not be good practice to query the database (Mysql by the way) directly from my JSP. (Not sure how to do this anyway - tags etc). Could I use multiple forms (with an action for each) on one JSP? What is the common solution? Having a page which may for example have several form controls and links that require querying the database and would be dynamic? Several queries will be required to be performed at the same time for one jsp view. Thanks, Barry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Java Class to match US state abbreviations with their full name?
Just wondering if anyone offhand knew of a open source java class for matching state abbreviations with their full name.. I could write something to do it myself easily enough but I'm not encredibly interested in doing it =) Thanks David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Java Class to match US state abbreviations with their full name?
Thanks a bunch =) - Original Message - From: Matt Raible [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Monday, September 15, 2003 3:18 PM Subject: RE: [OT] Java Class to match US state abbreviations with their full name? http://tinyurl.com/ngnc HTH, Matt -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Monday, September 15, 2003 3:07 PM To: Struts Mailing List Subject: [OT] Java Class to match US state abbreviations with their full name? Just wondering if anyone offhand knew of a open source java class for matching state abbreviations with their full name.. I could write something to do it myself easily enough but I'm not encredibly interested in doing it =) Thanks David - 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]
Valid Regexp for MM/dd/yyyy matching in a string?
Here is what I came up with.. I don't know if its valid or not but I'd like it to match a date in the format MM/dd/ for parsing. var-namemask/var-name var-value^[0-1]{1}[0-9]{1}/[0-3]{1}[0-9]{1}/[1-2]{1}[0-9]{3}$/var-value Thanks! -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward back to including page
I'm a little confused, but when you submit the form the target should be an action and couldnt you just do the processing within that action and if its successful forward back to the page that includes the form? - Original Message - From: Siggelkow, Bill [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 03, 2003 2:19 PM Subject: How to forward back to including page I have an included page (included using c:import) that contains a form. If the form processes successfully I want to return back to the original including page. Is there a clean way of doing this? The problem I have is that my action for the included page does not know anything about the page that includes it. Maybe I could use pass a request attribute that specifies the original URL or action? Any ideas? Bill Siggelkow 678.579.6458 Mirant http://www.mirant.com - 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]
Weird messages sent to tomcat from struts tags
Hi all was just looking at what we are logging and we are getting a bunch of stuff from struts tags it appears.. but I do not know what is causing it, here is what we get in tomcat's console: Sep 2, 2003 3:19:56 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='com.fgm.web.menu.displayer.DisplayerStrings', return Null=true Sep 2, 2003 3:20:10 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='com.fgm.web.menu.displayer.DisplayerStrings', return Null=true Sep 2, 2003 3:20:11 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnN ull=true Sep 2, 2003 3:21:09 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='com.fgm.web.menu.displayer.DisplayerStrings', return Null=true and we get at least 1 to 2 of those per page load.. we are using tiles.. any idea on what this means or how i can get rid of it? thanks! -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate
logic:iterate name=editResourceAttributesForm property=indexedBeans id=indexedBean bean:write name=indexedBean property=id /logic:iterate This will use the editResourceAttributesForm bean and retrieve the arraylist named indexedBeans from it, then will iterate through the list putting each element in the arraylist into the variable named indexedBean. then inside the tags I output the id property of indexedBean. -Good Luck David - Original Message - From: Ian Joyce [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 29, 2003 1:56 PM Subject: logic:iterate Hi, Can someone give me an example of how to iterate over an ArrayList of Strings using the iterate logic tag? Thanks - 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]
Struts Tag Question
Here is the code I'm trying to get to work: html-el:link href=javascript:Start(${indexedBean.id})test/html-el:link/ but what I need are double quotes around the ${indexedBean.id} part. I've tried using both quot; and \ both seem to not work because the link ends up stopping at wherever I insert that at.. for example if I try: html-el:link href=javascript:Start(\${indexedBean.id})test/html-el:link the link when moused over shows: javascript:Start( same thing if I try quot; instead of \ any ideas? Thanks! -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Validator and Hidden Field
As far as I was aware validating a hidden field is the exact same as validating any other field.. just make sure the name of the field in your html:hidden corresponds to a setter method in your form. Then create your own validate function within the form to check the variable is correct.. -David - Original Message - From: Octavia Yung [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 4:13 PM Subject: Struts Validator and Hidden Field Hi Everyone, I was wondering if it is possible to validate a hidden field using the Struts Validator framework. If so, an example would be extremely helpful. Thanks in advance! Octavia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL API docs?
fmt:message key=contextHeader/ I believe. - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 4:30 PM Subject: Re: JSTL API docs? Basically what I wanted to find out is what the jstl equivalent of bean:message name=contextHeader / would be? Adam On 08/29/2003 12:22 AM Adam Hardy wrote: I can't find the docs for JSTL anywhere. I mean the API, like the API for the struts taglibs bean:, html: etc with every tag and it's required and optional attributes and a brief desc. I've looked all over jakarta and sun, and not found anything. I downloaded the jakarta taglibs and they have it for all their taglibs, but not for the JSTL standard taglib. I guess this is a taglibs mailing list question, but I've searched their archives and not found any mention of hundreds of people groping around in the dark for the API docs. I kind of looked in the J2EE api at sun but couldn't see anything. I've now downloaded sun's java webservices developer pack or whatever it is, and am looking at the xml for the tld. Is there anything better? thanks Adam -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - 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 Checkboxes using logic:iterate
I am assuming you are using this form in a session scope then.. check back through the archives on the reset function of the form there have been numerous posts within the last few weeks on this topic.. Essentially what happens is that if you deselect a checkbox and then submit the form, nothing is submitted for that checkbox, the only values that are submitted are when the checkbox is clicked and it submits true or on or whatever you tell it to submit. If the form is request scope its already gone and the values are initialized to blank anyway so its no problem. But in Session youll typically have to work with the reset function of the form.. I haven't worked with it though so check the archives. -David - Original Message - From: Raghu.Ramakrishnan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, August 22, 2003 11:35 AM Subject: Problem with Checkboxes using logic:iterate Hi, I have one issue, that is I have some checkboxes within my logic:iterate, and 1) When the user clicks on the checkbox, the property corresponding to the checkbox is set to 'on'. 2) When the user de-clicks the checkbox(removes the check), the checkbox is still set to 'on', how do we reset the checkbox... My code is as follows: logic:iterate name=WorkQueueForm property=workQueueArrList indexId=clmIdx id=indexBean type=com.tgt.dist.icl.formbeans.WorkQueueBean html:select name=indexBean property=updtClaimStatus indexed=true html:option value=nbsp;/html:option html:option value=PP/html:option html:option value=WW/html:option html:option value=AA/html:option html:option value=MM/html:option html:option value=CC/html:option /html:select html:checkbox name=indexBean property=updtClaimPriority indexed=true/html:checkbox /logic:iterate WorkQueueForm is the Form Bean workQueueArrList is a property of the WorkQueue Form Bean which contains WorkQueue Beans. I would be obliged if you could let us know how to reset the checkbox, when the user Deselects the checkbox, the checkbox property in the WorkQeue Bean should be reset to null. Thanks, Raghu -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 10:45 AM To: Struts Users Mailing List Subject: Re: struts test info http://strutstestcase.sourceforge.net/ -Dan - Original Message - From: ronanoc [EMAIL PROTECTED] To: Struts List [EMAIL PROTECTED] Sent: Friday, August 22, 2003 6:13 AM Subject: struts test info Can anyone point me in the direction of good examples and info about using/writing Struts tests other than the documentation that comes with Struts test it self...? Thanks in advance. Ron. Always ready to Discotogogo - 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] -Original Message- From: atta-ur rehman [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 5:56 PM To: Struts Users Mailing List Subject: [OT] Tree Stucture in STRUTS hi all, excuse me if this sounds off topic! can somebody please point to some references on how to incorporate a dynamically built tree-like structure in a struts app? can struts-menu be used for this purpose? any other suggestions? thanks. ATTA - 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]
Quick Java question..
Hey as I've been building my actions I was thinking it could be useful for me to have a method that does some database querying, but I would like to give the user the ability to narrow down that query with as many input fields as he needs. Is there a way to write a method that takes a non-set amount of arguments? (Other than just passing the method a growable array.. which is a viable alternative) Ie public String myfunction(String a, String b, String c on down the line indefinitly) ? I thought I had seen this done somewhere somehow but I may be wrong. Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Adding to a Tiles Definition at runtime?
Is there any possible way to add additional variables to a tiles definition at runtime or to modify them? IE here is a definition: definition name=.menu.Software path=/tiles/menu.jsp putList name=menus add value=Home/ add value=SW1/ add value=SW2/ add value=SW3/ add value=SW4/ add value=SW5/ add value=SW6/ /putList /definition And then my menu jsp iterates through that list of menus adding them. The problem is I need a seperate tiles definition for every possible menu configuration, and then if I want an action that forwards to a definition that could show different menus.. etc etc it gets to be a pain. So would it be possible to change whats in that list or add to that list in my action before I forward to a tiles def? *Shrug just trying to get some ideas together here*. If that is not possible then my next question is in my baselayout.jsp I have the tiles:insert attribute=menu/ tag. In which scope does it search for a variable named menu? and if i changed that to tiles:insert attribute=$menu/ or something of that nature could it change at runtime based on something in my request/or session scope? Thanks in advance! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Adding to a tiles definition at runtime?
Is there any possible way to add additional variables to a tiles definition at runtime or to modify them? IE here is a definition: definition name=.menu.Software path=/tiles/menu.jsp putList name=menus add value=Home/ add value=SW1/ add value=SW2/ add value=SW3/ add value=SW4/ add value=SW5/ add value=SW6/ /putList /definition And then my menu jsp iterates through that list of menus adding them. The problem is I need a seperate tiles definition for every possible menu configuration, and then if I want an action that forwards to a definition that could show different menus.. etc etc it gets to be a pain. So would it be possible to change whats in that list or add to that list in my action before I forward to a tiles def? *Shrug just trying to get some ideas together here*. If that is not possible then my next question is in my baselayout.jsp I have the tiles:insert attribute=menu/ tag. In which scope does it search for a variable named menu? and if i changed that to tiles:insert attribute=$menu/ or something of that nature could it change at runtime based on something in my request/or session scope? Thanks in advance!
Re: html:checkbox, iterate and a value
Here's how I'm doing it: table border=3 bordercolor=#323299 trtd/tdtdPermission/tdtdDescription/td html-el:form action=/saveuser.do?user=${requestScope.userid} type=salesweb.EditUserForm logic:iterate name=edituserForm property=indexedBeans id=indexedBean trtdhtml:checkbox name=indexedBean property=available indexed=true//td tdhtml-el:text name=indexedBean property=id indexed=true readonly=true//td tdbean:write name=indexedBean property=description//td/tr /logic:iterate /table My form contains a getter for indexedBeans that returns an ArrayList, and it iterates through each item of that storing my custom bean in indexedBean. IndexedBean has getters and setters for available, id, description. My action that forwards to this jsp prepopulates all the items.. if oyu want the checkbox to be checked on viewing the property must be set to on yes or one other indicating yes, if you want it to be set to off just leave it blank. When the form is submitted if its not checked it submits no value at all. -David - Original Message - From: Gregory F. March [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, August 15, 2003 10:48 AM Subject: html:checkbox, iterate and a value What is the proper way to build html:checkbox's inside of an logic:iterate loop? It seems that the html:checkbox's value parameter can't reference a property from the bean of the iterate loop. I have something close to: logic:iterate id=myItem name=myData type=...MyData indexId=index ... html:checkbox indexed=true property=uniqueKey name=myItem/ ... html:link action=MyViewItemsAction paramId=myId paramName=myItem paramProperty=uniqueKey bean:write name=myItem property=uniqueKey/ /html:link ... The html:link works great. I just don't know how to achieve the same for the checkbox. What I get sent is: myItem[0].uniqueKey=on myItem[1].uniqueKey=on myItem[2].uniqueKey=on Not much of a help. I really need the value of that uniqueKey to be the value of the checkbox. Any help steering me in the right direction would be appreciated. Thanks! /greg -- Gregory F. March-=-http://www.gfm.net:81/~march-=- AIM:GfmNet - 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]
Stuts Tags Syntax Question
Hi I have a form bean named edituserForm which has a getter method getUser() which returns my custom User class bean, and I'm trying to render the value returned by my User Beans getId() method.. what syntax would I use? here's what ive tried with no luck.. html-el:hidden name=edituserForm.user property=id/ html-el:hidden name=edituserForm property=user.id/ Both return error [ServletException in:/admin/edituser.jsp] Cannot find bean userid in any scope' Thanks in advance! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Stuts Tags Syntax Question
Solved my own question.. the second one i listed below is the correct one.. had to dig through some api stuff and realized my error was caused by another problem on my page.. with a similar name, hate that =) - Original Message - From: David Erickson [EMAIL PROTECTED] To: Struts Mailing List [EMAIL PROTECTED] Sent: Friday, August 15, 2003 1:32 PM Subject: Stuts Tags Syntax Question Hi I have a form bean named edituserForm which has a getter method getUser() which returns my custom User class bean, and I'm trying to render the value returned by my User Beans getId() method.. what syntax would I use? here's what ive tried with no luck.. html-el:hidden name=edituserForm.user property=id/ html-el:hidden name=edituserForm property=user.id/ Both return error [ServletException in:/admin/edituser.jsp] Cannot find bean userid in any scope' Thanks in advance! - 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]
Designing a Form, help!
I need a form with a variable length list of items. Each item needs to contain 3 strings, 1) Permission name 2) Permission Description 3) If user has permission (on/off) The items will be used to populate a list of checkboxes with the descriptions of the name and description. So the big questions in my mind are what would i iterate through, and how would i design the getters and setters, and how to store that information. I'm sure someone has had to do something similar to this.. all help is extremely appreciated. Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Form Populating Error, help!!
Getting this error: exception javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) root cause java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:508) at java.util.ArrayList.get(ArrayList.java:320) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils. java:521) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils. java:428) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j ava:770) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80 1) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) When trying to submit to my bean. Here is my html code:table border=3 bordercolor=#3300CChtml-el:form action=/saveuser.do?user=${param.user} type=salesweb.EditUserFormlogic:iterate name=edituserForm property=indexedBeans id=indexedBeanstrtdhtml:checkbox name=indexedBeans property=available indexed=true//td tdhtml:textarea name=indexedBeans property=id indexed=true //td tdhtml:textarea name=indexedBeans property=description indexed=true //td/tr/logic:iterate/tablehtml:submit value=Submit Changes styleClass=submitButton//html-el:formAnd the relevant form code:public class EditUserForm extends ActionForm {private ArrayList myBeans = new ArrayList();public ArrayList getIndexedBeans() {return this.myBeans;}public void setIndexedBeans(ArrayList myBeans) {this.myBeans = myBeans;} // THIS METHOD IS REQUIRED IF YOUR FORM IS OF REQUEST SCOPE.public PermissionLine getIndexedBeans(int index) {while (this.myBeans.size() + 1 index) this.myBeans.add(new PermissionLine());return (PermissionLine) this.myBeans.get(index);}}The beans are stored in request scope.. any ideas?Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form Populating Error, help!!
I was thinking it had something to do with this function: public PermissionLine getIndexedBeans(int index) { System.out.println(Index Requested: + index + Size of Array: + this.myBeans.size()); while (index = this.myBeans.size()) this.myBeans.add(new PermissionLine()); return (PermissionLine) this.myBeans.get(index); } But i through that debugging code in there and it never gets output at all.. so it must be something to do with the populate function on copying getters and setters from the form to the bean, but its the exact same bean i used to populate it with, doesnt make any sense.. anyone got any ideas? - Original Message - From: Alawadhi, Mona [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, August 14, 2003 12:04 PM Subject: RE: Form Populating Error, help!! It looks like there is a method expecting a certain type of param, and it's getting something other than expected. -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 2:01 PM To: Struts Mailing List Subject: Form Populating Error, help!! Getting this error: exception javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) root cause java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:508) at java.util.ArrayList.get(ArrayList.java:320) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils. java:521) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils. java:428) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j ava:770) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80 1) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) When trying to submit to my bean. Here is my html code:table border=3 bordercolor=#3300CChtml-el:form action=/saveuser.do?user=${param.user} type=salesweb.EditUserFormlogic:iterate name=edituserForm property=indexedBeans id=indexedBeanstrtdhtml:checkbox name=indexedBeans property=available indexed=true//td tdhtml:textarea name=indexedBeans property=id indexed=true //td tdhtml:textarea name=indexedBeans property=description indexed=true //td/tr/logic:iterate/tablehtml:submit value=Submit Changes styleClass=submitButton//html-el:formAnd the relevant form code:public class EditUserForm extends ActionForm {private ArrayList myBeans = new ArrayList();public ArrayList getIndexedBeans() {return this.myBeans;}public void setIndexedBeans(ArrayList myBeans) {this.myBeans = myBeans;} // THIS METHOD IS REQUIRED IF YOUR FORM IS OF REQUEST SCOPE.public PermissionLine getIndexedBeans(int index) {while (this.myBeans.size() + 1 index) this.myBeans.add(new PermissionLine());return (PermissionLine) this.myBeans.get(index);}}The beans are stored in request scope.. any ideas?Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. * - 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]
Dynamic Form help
I'm developing some administrative functions for our web app, currently im working on a page where it will list all the permissions available with a checkbox by each, and the ones the current user has will be checked. I'm trying to decide the best way to go about it, becaues the permissions are pulled from a database and so they could change everytime the page is loaded, and obviously every user will have different permissions which need to be checked. It shouldnt be a problem to iterate through a list of permissions, but the question I have is when I go to submit a the form to modify the users permissions, the names of each checkbox (permission) will change, so how would I develop a form to handle that? And is there an easy way to populate all the checkboxes when the page loads? I'm using JSP's to handle it.. would love to use struts html:XXX tags if possible. Reccomendations welcome =) Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]