Changing Form Target in Action?
Hi all I have the following problem: I have a button on my form that uses javascript to change to form target before submitting because I'm exporting an RTF generated in my action to the new browser, as follows html:submit property=exportFlag onclick=set('export');setFormTarget('_export') disabled=falseCreate Graph (Popup)/html:submit function setFormTarget(newTarget){ document.forms[0].target=newTarget; } The thing is I want to be able to use the validate() method in my Form object and return to the ORIGINAL browser if an error is encountered... so is there anything I can do within the action to affect that? Thanks -- -Dave [EMAIL PROTECTED]
Re: Changing Form Target in Action?
Hmm. I suppose it would be easier to just do the validation in JavaScript... but I **really** dont want to. It just seems inconsistent. So there's no way to change what browser the validate() returns to once I've submitted the form and I'm in the validate() method? Some attribute on the request perhaps? I mean the request has to know where it's forwarding to, right? On 7/11/05, Joe Germuska [EMAIL PROTECTED] wrote: When I've had to do something like this in the past, I didn't actually change the target, but rather caused the response page to use the new target as part of its page loading. That is, the response page would have an onload handler which would load the necessary content in a new target. If your new target is a new window, pop-up blockers may foil this, and of course, you'll have to make sure to preserve any relevant state, since the onload handler will initiate a separate request. Can you make that work? Joe At 1:49 PM -0400 7/11/05, David Johnson wrote: Hi all I have the following problem: I have a button on my form that uses javascript to change to form target before submitting because I'm exporting an RTF generated in my action to the new browser, as follows html:submit property=exportFlag onclick=set('export');setFormTarget('_export') disabled=falseCreate Graph (Popup)/html:submit function setFormTarget(newTarget){ document.forms[0].target=newTarget; } The thing is I want to be able to use the validate() method in my Form object and return to the ORIGINAL browser if an error is encountered... so is there anything I can do within the action to affect that? Thanks -- -Dave [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: Changing Form Target in Action?
Joe Oh this one sounds good. I'm not sure how I'd actually DO that though.. can you provide more info? All my pages are tiles definitions right now. How would I cause the response page to use the new target (conditionally)? On 7/11/05, Joe Germuska [EMAIL PROTECTED] wrote: When I've had to do something like this in the past, I didn't actually change the target, but rather caused the response page to use the new target as part of its page loading. That is, the response page would have an onload handler which would load the necessary content in a new target. If your new target is a new window, pop-up blockers may foil this, and of course, you'll have to make sure to preserve any relevant state, since the onload handler will initiate a separate request. Can you make that work? Joe At 1:49 PM -0400 7/11/05, David Johnson wrote: Hi all I have the following problem: I have a button on my form that uses javascript to change to form target before submitting because I'm exporting an RTF generated in my action to the new browser, as follows html:submit property=exportFlag onclick=set('export');setFormTarget('_export') disabled=falseCreate Graph (Popup)/html:submit function setFormTarget(newTarget){ document.forms[0].target=newTarget; } The thing is I want to be able to use the validate() method in my Form object and return to the ORIGINAL browser if an error is encountered... so is there anything I can do within the action to affect that? Thanks -- -Dave [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Creating a standard page to handle Error 500
Hey all I recently added the following to my JSP pages to force them not to be cached: % response.setHeader(Pragma,no-cache);% % response.setHeader(Cache-Control,no-store);% % response.setDateHeader(Expires,-1);% the result is that if the user hits back then reload they get an error 500. How can I create a page that will handle any error 500 that comes up? Essentially, I just want to display a message that tells the user to re-login.. thoughts? -- -Dave [EMAIL PROTECTED]
Re: Creating a standard page to handle Error 500
I'd like to avoid modifying the struts code if I can On 5/26/05, Andrew Thorell [EMAIL PROTECTED] wrote: Where does one find this to modify the doGet method? I've yet to deal with actually modifiying the actual servlet... Andrew On 5/26/05, Martin Gainty [EMAIL PROTECTED] wrote: Inside the StrutsServlet's doGet method RequestDispatcher dispatcher = null; request.getRequestDispatcher(/err/SQL.jsp); try { // operation which causes 500 } catch (Exception se) { //forwards to a login.jsp dispatcher.forward(request, response); } check out http://java.sun.com/j2ee/1.4/docs/api/index.html Regards, Martin- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
error-page not catching errors...
Hi all I've added the following to my web.xml (thanks for the help) error-page error-code500/error-code location/error.jsp/location /error-page error-page error-code404/error-code location/error.jsp/location /error-page error-page error-codejava.lang.Exception/error-code location/error.jsp/location /error-page and I've added a global forward I invoke from error.jsp which points to my tiles def as follows forward name=error path=/page.error / the problem is when I cause an error (like stopping the database then trying to hit it or reloading a page that should cause an error 500), I'm not seeing my error page. am I forgetting something? -- -Dave [EMAIL PROTECTED]
Re: Redisplaying Information
I believe you can do this by setting the scope of the form bean associated with the form containing your field to session, which also means you need to reset() it when you're done. like this: action path=/SICAction name=sicForm scope=session input=page.portfolio type=com.company.struts.SICAction forward name=success path=/myPage.jsp redirect=true / /action On 5/26/05, Andrew Thorell [EMAIL PROTECTED] wrote: I know html:password has a redisplay option. Is there any way to put this functionality on html:text tags as well? html:password redisplay=false/ Any thoughts? Andrew - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: error-page not catching errors...
Wow It's insane to me that this cant be done with Tomcat 4.1.31 the Struts documents tell you to do exactly what I'm trying. http://jakarta.apache.org/tomcat/faq/misc.html#error BAH!!! On 5/26/05, Benedict, Paul C [EMAIL PROTECTED] wrote: Sorry. Just life then. Upgrade to 5 or use the exception block in web.xml instead to catch the java.lang.Exception. This is the workaround you'll have to do if you don't upgrade. -Original Message- *From:* David Johnson [mailto:[EMAIL PROTECTED] *Sent:* Thursday, May 26, 2005 2:39 PM *To:* Benedict, Paul C *Subject:* Re: error-page not catching errors... yeah. 4.1.28 actually. On 5/26/05, Benedict, Paul C [EMAIL PROTECTED] wrote: Are you using Tomcat 4? -Original Message- *From:* David Johnson [mailto: [EMAIL PROTECTED] *Sent:* Thursday, May 26, 2005 2:37 PM *To:* Benedict, Paul C *Subject:* Re: error-page not catching errors... I also caused a java.sql.SQLException which didnt get caught either :( On 5/26/05, Benedict, Paul C [EMAIL PROTECTED] wrote: David, I think Tomcat 4.x has a bug in which 500 errors are not captured. I ran into this before. Could be? Thanks, Paul -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, May 26, 2005 2:34 PM To: Struts Users Mailing List Subject: error-page not catching errors... Hi all I've added the following to my web.xml (thanks for the help) error-page error-code500/error-code location/error.jsp/location /error-page error-page error-code404/error-code location/error.jsp/location /error-page error-page error-codejava.lang.Exception /error-code location/error.jsp/location /error-page and I've added a global forward I invoke from error.jsp which points to my tiles def as follows forward name=error path=/page.error / the problem is when I cause an error (like stopping the database then trying to hit it or reloading a page that should cause an error 500), I'm not seeing my error page. am I forgetting something? -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- -Dave [EMAIL PROTECTED]
Fwd: error-page not catching errors...
I'm forwarding this to the Tomcat List as well, I'll forward any helpful responses for archival purposes. Thanks all! On 5/26/05, David Johnson [EMAIL PROTECTED] wrote: Wow It's insane to me that this cant be done with Tomcat 4.1.31 the Struts documents tell you to do exactly what I'm trying. http://jakarta.apache.org/tomcat/faq/misc.html#error BAH!!! On 5/26/05, Benedict, Paul C [EMAIL PROTECTED] wrote: Sorry. Just life then. Upgrade to 5 or use the exception block in web.xml instead to catch the java.lang.Exception. This is the workaround you'll have to do if you don't upgrade. -Original Message- *From:* David Johnson [mailto: [EMAIL PROTECTED] *Sent:* Thursday, May 26, 2005 2:39 PM *To:* Benedict, Paul C *Subject:* Re: error-page not catching errors... yeah. 4.1.28 actually. On 5/26/05, Benedict, Paul C [EMAIL PROTECTED] wrote: Are you using Tomcat 4? -Original Message- *From:* David Johnson [mailto: [EMAIL PROTECTED] *Sent:* Thursday, May 26, 2005 2:37 PM *To:* Benedict, Paul C *Subject:* Re: error-page not catching errors... I also caused a java.sql.SQLException which didnt get caught either :( On 5/26/05, Benedict, Paul C [EMAIL PROTECTED] wrote: David, I think Tomcat 4.x has a bug in which 500 errors are not captured. I ran into this before. Could be? Thanks, Paul -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, May 26, 2005 2:34 PM To: Struts Users Mailing List Subject: error-page not catching errors... Hi all I've added the following to my web.xml (thanks for the help) error-page error-code500/error-code location/error.jsp/location /error-page error-page error-code404/error-code location/error.jsp/location /error-page error-page error-codejava.lang.Exception /error-code location/error.jsp/location /error-page and I've added a global forward I invoke from error.jsp which points to my tiles def as follows forward name=error path=/page.error / the problem is when I cause an error (like stopping the database then trying to hit it or reloading a page that should cause an error 500), I'm not seeing my error page. am I forgetting something? -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please
Re: error-page not catching errors...
HHm interesting. I'm only using Tomcat. Can you check up at the top of the thread and see if there's anything I'm doing differently from you? On 5/26/05, Tait, Allen [EMAIL PROTECTED] wrote: For the record, we are using Tomcat 4.1 and it handles the 500 errors correctly. However, we have seen issues when request are passed through Apache. Be sure to test against Tomcat directly. -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, May 26, 2005 2:51 PM To: Struts Users Mailing List Subject: Fwd: error-page not catching errors... I'm forwarding this to the Tomcat List as well, I'll forward any helpful responses for archival purposes. Thanks all! On 5/26/05, David Johnson [EMAIL PROTECTED] wrote: Wow It's insane to me that this cant be done with Tomcat 4.1.31 the Struts documents tell you to do exactly what I'm trying. http://jakarta.apache.org/tomcat/faq/misc.html#error BAH!!! On 5/26/05, Benedict, Paul C [EMAIL PROTECTED] wrote: Sorry. Just life then. Upgrade to 5 or use the exception block in web.xml instead to catch the java.lang.Exception. This is the workaround you'll have to do if you don't upgrade. -Original Message- *From:* David Johnson [mailto: [EMAIL PROTECTED] *Sent:* Thursday, May 26, 2005 2:39 PM *To:* Benedict, Paul C *Subject:* Re: error-page not catching errors... yeah. 4.1.28 actually. On 5/26/05, Benedict, Paul C [EMAIL PROTECTED] wrote: Are you using Tomcat 4? -Original Message- *From:* David Johnson [mailto: [EMAIL PROTECTED] *Sent:* Thursday, May 26, 2005 2:37 PM *To:* Benedict, Paul C *Subject:* Re: error-page not catching errors... I also caused a java.sql.SQLException which didnt get caught either :( On 5/26/05, Benedict, Paul C [EMAIL PROTECTED] wrote: David, I think Tomcat 4.x has a bug in which 500 errors are not captured. I ran into this before. Could be? Thanks, Paul -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, May 26, 2005 2:34 PM To: Struts Users Mailing List Subject: error-page not catching errors... Hi all I've added the following to my web.xml (thanks for the help) error-page error-code500/error-code location/error.jsp/location /error-page error-page error-code404/error-code location/error.jsp/location /error-page error-page error-codejava.lang.Exception /error-code location/error.jsp/location /error-page and I've added a global forward I invoke from error.jsp which points to my tiles def as follows forward name=error path=/page.error / the problem is when I cause an error (like stopping the database then trying to hit it or reloading a page that should cause an error 500), I'm not seeing my error page. am I forgetting something? -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- -Dave [EMAIL PROTECTED
Re: Creating a standard page to handle Error 500
Alright, I think I'm thick. how would I do that? would I override doGet() and doPost()? help! On 5/26/05, Martin Gainty [EMAIL PROTECTED] wrote: Andrew- can intercept your ActionServlet's doGet or doPost method before process method is invoked If you want simple follow the instructions for supplying web.xml location attribute for login jsp page HTH, - Original Message - From: Andrew Thorell [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2005 11:41 AM Subject: Re: Creating a standard page to handle Error 500 Where does one find this to modify the doGet method? I've yet to deal with actually modifiying the actual servlet... Andrew On 5/26/05, Martin Gainty [EMAIL PROTECTED] wrote: Inside the StrutsServlet's doGet method RequestDispatcher dispatcher = null; request.getRequestDispatcher(/err/SQL.jsp); try { // operation which causes 500 } catch (Exception se) { //forwards to a login.jsp dispatcher.forward(request, response); } check out http://java.sun.com/j2ee/1.4/docs/api/index.html Regards, Martin- - 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] -- -Dave [EMAIL PROTECTED]
Re: Creating a standard page to handle Error 500
also... I have a BaseAction all my actions are inherited from might I do whatever you recommend I do... there? :D On 5/26/05, David Johnson [EMAIL PROTECTED] wrote: Alright, I think I'm thick. how would I do that? would I override doGet() and doPost()? help! On 5/26/05, Martin Gainty [EMAIL PROTECTED] wrote: Andrew- can intercept your ActionServlet's doGet or doPost method before process method is invoked If you want simple follow the instructions for supplying web.xmllocation attribute for login jsp page HTH, - Original Message - From: Andrew Thorell [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2005 11:41 AM Subject: Re: Creating a standard page to handle Error 500 Where does one find this to modify the doGet method? I've yet to deal with actually modifiying the actual servlet... Andrew On 5/26/05, Martin Gainty [EMAIL PROTECTED] wrote: Inside the StrutsServlet's doGet method RequestDispatcher dispatcher = null; request.getRequestDispatcher(/err/SQL.jsp); try { // operation which causes 500 } catch (Exception se) { //forwards to a login.jsp dispatcher.forward(request, response); } check out http://java.sun.com/j2ee/1.4/docs/api/index.html Regards, Martin- - 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] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: error-page not catching errors...
Doesnt work. I just get the standard IE error page. bah! It's my program (the shock is almost too much) On 5/26/05, Andrew Thorell [EMAIL PROTECTED] wrote: See if you can pitch a 404 error. If that works, then it's not your program's problem. Andrew - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: error-page not catching errors...
Oh, one more thing. what I'm really trying to avoid is the user using the back button, so I've added the following to my pages % response.setHeader(Pragma,no-cache);% % response.setHeader(Cache-Control,no-store);% % response.setDateHeader(Expires,-1);% Now, when I use the back button, I get the expided page... page. When I reload, I get the error 500 Should I take a step back here and simply be handling things like that in a different way? I want the user to use the back button I've provided since it cleans appropriate things up, etc... not the back browser button. thoughts? On 5/26/05, David Johnson [EMAIL PROTECTED] wrote: Thanks Wendy! I'll take a look at it... and likely still be confused :) On 5/26/05, Wendy Smoak [EMAIL PROTECTED] wrote: From: David Johnson [EMAIL PROTECTED] Can you tell me a little more about how you're setting this up then? Should I then just create an error.jsp page that is outside my tiles setup, and handle the error there? Can you keep it from getting as far as an error code 500? You can configure exception handlers in struts-config.xml using the exception tag. For me, the mapping in web.xml for error code 500 is a last ditch effort to avoid the user seeing a stack trace. It should only come into play if something REALLY bad happens. See if anything here is helpful... http://wiki.wendysmoak.com/cgi-bin/wiki.pl?TomcatErrorPage and the related page http://wiki.wendysmoak.com/cgi-bin/wiki.pl?StrutsException -- Wendy Smoak -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: error-page not catching errors...
Alright ONE more thing I see in your WIKI -- http://wiki.wendysmoak.com/cgi-bin/wiki.pl?TomcatErrorPage that I cant put a tiles-def in the location field, but what if I forward to a normal JSP that has the following (only) in it logic:forward name=error/ Then in my struts-config I have forward name=error path=/error.action / !-- and-- action path=/error type=com.foo.struts.ErrorAction forward name=success path=page.error / /action and page.error is of course defined in tiles-defs with the body part = errorBody.jsp Am I making sense? I really want to use a tiles def here somehow or my **only** page that is all hardcoded will be error.jsp. thoughts? On 5/26/05, David Johnson [EMAIL PROTECTED] wrote: Oh, one more thing. what I'm really trying to avoid is the user using the back button, so I've added the following to my pages % response.setHeader(Pragma,no-cache);% % response.setHeader(Cache-Control,no-store);% % response.setDateHeader(Expires,-1);% Now, when I use the back button, I get the expided page... page. When I reload, I get the error 500 Should I take a step back here and simply be handling things like that in a different way? I want the user to use the back button I've provided since it cleans appropriate things up, etc... not the back browser button. thoughts? On 5/26/05, David Johnson [EMAIL PROTECTED] wrote: Thanks Wendy! I'll take a look at it... and likely still be confused :) On 5/26/05, Wendy Smoak [EMAIL PROTECTED] wrote: From: David Johnson [EMAIL PROTECTED] Can you tell me a little more about how you're setting this up then? Should I then just create an error.jsp page that is outside my tiles setup, and handle the error there? Can you keep it from getting as far as an error code 500? You can configure exception handlers in struts-config.xml using the exception tag. For me, the mapping in web.xml for error code 500 is a last ditch effort to avoid the user seeing a stack trace. It should only come into play if something REALLY bad happens. See if anything here is helpful... http://wiki.wendysmoak.com/cgi-bin/wiki.pl?TomcatErrorPage and the related page http://wiki.wendysmoak.com/cgi-bin/wiki.pl?StrutsException -- Wendy Smoak -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: error-page not catching errors...
Wendy, Removing tiles from the equation has done the trick. I will emphasize that they should be using the supplied navigation scheme during training Thanks John On 5/26/05, Wendy Smoak [EMAIL PROTECTED] wrote: From: David Johnson [EMAIL PROTECTED] I really want to use a tiles def here somehow or my **only** page that is all hardcoded will be error.jsp. thoughts? What is the root cause of the error 500? Take the error-page out and look at the stack trace. Ignoring any ServletExceptions, what's the _real_ problem here? Configure THAT exception in struts-config.xml with an exception tag, and you will be able to use a tiles definition. Then create a simple html or jsp page that fits with your site design, put a generic error message on it, and use that for the location of your error code 500 in web.xml. IMO, you should never get as far as an error code 500 during normal operations. You know what kind of exceptions your code can throw, deal with those in struts-config.xml. It's the unchecked exceptions that are going to make it all the way out to the container, and the web.xml config is a last ditch effort to make sure the user does not see a stack trace. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
ActionError in Struts 1.2.7
Hi all I notice that ActionError is deprecated in this version.. is there some document describing what we should now be doing? [javac] C:\Builds\riskGrid\src\com\company\struts\form\QueryResultsForm.java:101: warning: org.apache.struts.action.ActionError in org.apache.struts.actionhas been deprecated [javac] errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( error.thing.duplicate.name http://error.thing.duplicate.name) ); -- -Dave [EMAIL PROTECTED]
Re: ActionError in Struts 1.2.7
tyvm : On 5/26/05, Niall Pemberton [EMAIL PROTECTED] wrote: It was deprecated in Struts 1.2.4 - theres info about this in the wiki: http://wiki.apache.org/struts/StrutsUpgradeNotes11to124 http://wiki.apache.org/struts/StrutsDeprecatedActionErrors Niall - Original Message - From: David Johnson [EMAIL PROTECTED] Sent: Friday, May 27, 2005 2:48 AM I notice that ActionError is deprecated in this version.. is there some document describing what we should now be doing? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: ActionError in Struts 1.2.7
Niall Related to this, I found your article http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html VERY helpful ant informative. I've refactored my application (yes it's midnight in NY) to REMOVE all ActionError references (leavinf the ActionErrors in the validate() as you recommend. I have a question though This opens up the possibility of having errors and messages both stored using saveerrors( request, ActionMessages) but what I'm wondering what method you'd recommend for separating them? I'm using this to display my errors in my jsp: html-el:messages id=msg message=false c:out value=${msg}/ /html-el:messages but it wouls seem to make more sense to have perhaps two areas in my JSP, one reserved for errors and one for messages, like this: html-el:messages id=msg message=false c:out value=${msg}/ /html-el:messages html-el:messages id=errors message=false c:out value=${errors}/ /html-el:messages it would seem that saveErrors() saves everything unser the msg key by default. Is there any way do override that behavior to store it under a key that makes more sense (i.e. I'm saving errors under the key=msg which seems sketchy) I understand that I can do this: ActionMessages am = new ActionMessages(); am.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage( msg.warning ) ); request.setAttribute(warnings, am); but it FEELS like a workaround thoughts? On 5/26/05, David Johnson [EMAIL PROTECTED] wrote: tyvm : On 5/26/05, Niall Pemberton [EMAIL PROTECTED] wrote: It was deprecated in Struts 1.2.4 - theres info about this in the wiki: http://wiki.apache.org/struts/StrutsUpgradeNotes11to124 http://wiki.apache.org/struts/StrutsDeprecatedActionErrors Niall - Original Message - From: David Johnson [EMAIL PROTECTED] Sent: Friday, May 27, 2005 2:48 AM I notice that ActionError is deprecated in this version.. is there some document describing what we should now be doing? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: Opening a Form in a New Window - Help!
hey there What meant was that I wanted to open a new browser that had these options set: window.height=400; window.width=300; window.status=yes; window.toolbar=no; window.menubar=no; window.location=no; so that it isnt just another same size browser with tiny help text in it. On 5/19/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Hello, In order to set those options you will have to use Javascript. The target attribute is a fairly dumb animal in that it just opens said target with the location you specify. Anything more requires scripting. I wasn't clear on what you meant by: Does anyone know how I might specify these options when opening up a new window, then submitting a struts form to said window? Specifically, the part about submitting a struts form to said window... can you explain that a different way because I'm not sure what your trying to accomplish from that. Frank David Johnson wrote: Hi there I'm trying to open up a new window from my struts application which will contain help information. The link opening the window looks like this so far html:link action=help.do http://help.do http://help.do target=_helpHelp/html:link What I'd like to do is specify the following options window.height=400; window.width=300; window.status=yes; window.toolbar=no; window.menubar=no; window.location=no; which I'd normally do using a javascript method... like this: script function openHelpWindow(){ var helpWindow = window.open(,_help, height=300,width=450,status=yes,toolbar=no,menubar=no,location=no); return helpWindow; } /script Does anyone know how I might specify these options when opening up a new window, then submitting a struts form to said window? -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: JSTL and Struts together
you can use the html-el:text value=${param.x}html-el:text control to accomplish just that I'm doing that in a bunch of places. On 5/20/05, Shey Rab Pawo [EMAIL PROTECTED] wrote: html-el:form etc. On 5/19/05, Suresh Khatri [EMAIL PROTECTED] wrote: %@ taglib uri=http://java.sun.com/jstl/core; prefix=c/ %@ taglib uri=/tags/struts-html prefix=html/ html:form action=dynaadd.do http://dynaadd.do html:text property=name value=c:out value=${param.x}// /html:form would display the whole thing. Is there a way of making it evaluate c:out first and then pass the evaluation to value of html:text this works but it is because input is not in the namespace html input type=text name=name value=c:out value=${param.x}// How can this be solved using Struts and JSTL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No one ever went blind looking at the bright side of life. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Template Library? What is it??
Hi there all Please forgive the stupid question, but I'm working with a client who is telling me that I am not using the template library in my struts application. The application uses struts and tiles, with all the page definitions stored in a tiles-defs.xml file I thought the Template Library was an alternative to Tiles, not something that worked with tiles. thoughts? Tiles is working super as is... but this question is making me wonder if I missed something... -- -Dave [EMAIL PROTECTED]
How to I check what version of struts I have?
Is there a file in the struts.jar I can check? -- -Dave [EMAIL PROTECTED]
Re: Template Library? What is it??
It helps a lot! Thanks Apparently I had the following in one of my JSPs %@ taglib uri=http://jakarta.apache.org/struts/tags-template; prefix=template % So.. I removed it :) I want using it anyway. On 5/20/05, James Mitchell [EMAIL PROTECTED] wrote: The template library, originally developed by David Geary, was sort of a launch pad for the Tiles Project. Cedric or others can verify if I've missed anything. Basically, the template library was not kept around or supported after 1.0 (Jeez, that seems like ages ago ;). Tiles is the preferred approach for what you are asking about. So, you can tell your client, yes, you are using templates. They are obviously basing their statements on old (and I mean REALLY old) information. Hope that helps. -- James Mitchell Software Engineer / Open Source Evangelist Consulting / Mentoring / Freelance EdgeTech, Inc. http://www.edgetechservices.net/ 678.910.8017 AIM: jmitchtx Yahoo: jmitchtx MSN: [EMAIL PROTECTED] - Original Message - From: David Johnson [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Friday, May 20, 2005 10:36 AM Subject: Template Library? What is it?? Hi there all Please forgive the stupid question, but I'm working with a client who is telling me that I am not using the template library in my struts application. The application uses struts and tiles, with all the page definitions stored in a tiles-defs.xml file I thought the Template Library was an alternative to Tiles, not something that worked with tiles. thoughts? Tiles is working super as is... but this question is making me wonder if I missed something... -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: How to I check what version of struts I have?
ty all :) On 5/20/05, Nitin Mandolkar [EMAIL PROTECTED] wrote: You can find it read me file. If you have only struts.jar file. Then unzip it with winzip and look for manifest file. This my manifest file reading. Look for your. Manifest-Version: 1.0 Implementation-Version: 1.0.2 Specification-Title: Struts Framework Specification-Version: 1.0 Implementation-Title: Struts Framework Extension-Name: Struts Framework Created-By: Ant 1.4.1 Implementation-Vendor-Id: org.apache Implementation-Vendor: Apache Software Foundation Specification-Vendor: Apache Software Foundation -ni3 -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: 20 May 2005 15:38 To: Struts Users Mailing List Subject: How to I check what version of struts I have? Is there a file in the struts.jar I can check? -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
[OT] Help with REgular Expressions in Validate()
Hi all I markled this OT because it's not a Struts question strictly speaking. what I'm trying to do is disallow names that contain spaces or special characters in the validate() method of my ActionForm Code: String pattern = \\W+; log.debug(Testing validity of name +name+ against +pattern); if (name!=null){ if (name.matches(pattern)) { log.info(Naming Convention Violated); e = new ActionError(error.create.portfolio.name.error); errors.add(,new ActionError(error.create.portfolio.name.error)); }else{ log.debug(Valid name chosen); } } What am I missing?!?!?! I always get valid name chosen Again, I want to allow MyNAme and disallow My Name or MyName! (due to spaces or special characters -- -Dave [EMAIL PROTECTED]
Opening a Form in a New Window - Help!
Hi there I'm trying to open up a new window from my struts application which will contain help information. The link opening the window looks like this so far html:link action=help.do http://help.do target=_helpHelp/html:link What I'd like to do is specify the following options window.height=400; window.width=300; window.status=yes; window.toolbar=no; window.menubar=no; window.location=no; which I'd normally do using a javascript method... like this: script function openHelpWindow(){ var helpWindow = window.open(,_help, height=300,width=450,status=yes,toolbar=no,menubar=no,location=no); return helpWindow; } /script Does anyone know how I might specify these options when opening up a new window, then submitting a struts form to said window? -- -Dave [EMAIL PROTECTED]
Opening a NEW browser for a 2nd content type from an action
Hey all is it possible to forme my struts app to open up a second browser window for the purpose of streaming a different content type (like a pdf file) into it while maintaining the page in the original browser? Essentially, I have a nicely rendered HTML report in browser a and when the user clicks export to PDF or export to excel I want a NEW browser to pop up into which I will send the response with the headerType set to the appropriate type. the generation of the XL and PDF is handled for me, but the app flow is where Im foggy. anyone done this? -- -Dave [EMAIL PROTECTED]
Re: Opening a NEW browser for a 2nd content type from an action
hmm I dont think I understand. so instead of redirecting to an action mapping, just add the HTML myself, like you would if you were writing a servlet (no jsp) application? interesting. you're right, I dont need a nice tiles definition page for my pdf/xls output.. all I really need is to pop up a browser, set the content type, and direct the response into the new browser. is there a way to target a browser like you can in a LINK but using an HTML:BUTTON? like a target=pdfOutput or something? that might work.. h On 5/12/05, Benedict, Paul C [EMAIL PROTECTED] wrote: David, You could have your response return HTML with rendered JavaScript; the script would then automatically pop open a new window with the destination link that generates your unstructured content. You could even provide a link in the response if the JavaScript doesn't run automatically. Thanks, Paul -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, May 12, 2005 10:31 AM To: Struts Users Mailing List; CCNY Subject: Opening a NEW browser for a 2nd content type from an action Hey all is it possible to forme my struts app to open up a second browser window for the purpose of streaming a different content type (like a pdf file) into it while maintaining the page in the original browser? Essentially, I have a nicely rendered HTML report in browser a and when the user clicks export to PDF or export to excel I want a NEW browser to pop up into which I will send the response with the headerType set to the appropriate type. the generation of the XL and PDF is handled for me, but the app flow is where Im foggy. anyone done this? -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- -Dave [EMAIL PROTECTED]
Re: Best practice for redirecting on session timeout?
I have a method in my BaseAction called boolean checkAuth(request). then in every Action I write I code this at the top // Check if session is active, if not redirect to login page if( !checkAuth( request )){ log.info(*** Session has timed out ***); errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( error.expired.session) ); saveErrors(request, errors); return (mapping.findForward(ApplicationConstants.APP_FORWARD_INVALID_SESSION)); } seems to work fine. On 5/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Although this approach might work, I don't like it so much. The reasons: 1) Maintainability: if you want to change the timeout to 30 minutes (and you have 50 jsp pages), then you have to make the change 50 times. 2) Business Logic: This approach will never prevent you Action from executing. Since you have to go through an action to reach the jsp page, when the *page* reloads, you are actually reloading the action first. Having said that, if your action does something that should only be executed if your session has not expired, your approach will not work. A combination of using a filter session-config (in web.xml) solves both problems above. How? 1) You only have to change the session timeout setting in one place. 2) Your filter is executed before anything else. Hence, you never have to worry about an action being executed unintentionally. Aladin That's easy, just drop this in all of your JSPs (preferrably via an include or let a filter do it for you). (assuming your session timeout is 20 minutes) meta http-equiv=refresh content=1200;/ You should be handling invalid/expired session state in your application and by using the above technique, it will work universally, whether you are managing sessions from your actions, CMS, or some other service outside of the conatiner, such as a product like SiteMinder by Netegrity. This will _force_ the browser to do a refresh of the page after 1200 seconds (20 minutes), which will allow your app to handle the request (from a now expired session) the same as it would if the user had initiated the request giving a hint of being on a rich client where such events are easily handled. -- James Mitchell Software Engineer / Open Source Evangelist Consulting / Mentoring / Freelance EdgeTech, Inc. http://www.edgetechservices.net/ 678.910.8017 AIM: jmitchtx Yahoo: jmitchtx MSN: [EMAIL PROTECTED] - Original Message - From: Adam Lipscombe [EMAIL PROTECTED] To: 'Struts Users Mailing List' user@struts.apache.org Sent: Thursday, May 12, 2005 6:19 AM Subject: Best practice for redirecting on session timeout? Folks, I there a standard way of handling session timeouts. If a user has been inactive for longer than N minutes I want to redirect them to the login page. It occurs to me that this could be done in a) the RequestProcessor or b) in an JSP include. Is there another way? What is best practice? TIA - Adam - 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] -- -Dave [EMAIL PROTECTED]
Re: Opening a NEW browser for a 2nd content type from an action
A, gotcha. it's an internal app thankfully, and they're fine with javascript. The report itself foesnt exist when the page is sitting there rendered. the action is going to render it.. a Call to SAS specifically, -- http://support.sas.com/rnd/appdev/V2/webAF/server/examples/streaming3-2.htm(so the answer is that I'm RECREATING the report with a new outputtype) so basically but PDF and XLS controls are HTML:BUTTON s that will cann an exportPDF() and exportXLS() javascript function, then do the exportWindow.location=PortfolioReportResults.action; What about form fields though? There are some hidden fields that I need to have passed along... will I have to resport to using the queryString? Like this exportWindow.location=PortfolioReportResults.action?dispatch=pdf; On 5/12/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: You said: Essentially, I have a nicely rendered HTML report in browser a and when the user clicks export to PDF or export to excel I want a NEW browser to pop up into which I will send the response with the headerType set to the appropriate type. Without an applet or ActiveX control or something similar to do it on the client, you will have to go back to the server to do the export... so, the first question is, does the report still exist on the server at that point or is it only in the browser a window at that point? Either way, what you probably want to do is open a new window via Javascript when the user clicks the Export button (let's say the Export To PDF button), holding the reference to it in exportWindow, then do the following: exportWindow.location=myExportPDFAction.do; The myExportPDFAction will have to be responsible for returning the report in PDF form. But, the question of whether the report exists on the server or not is important because your either going to be (a) doing a real export of an HTML file if it does exist or (b) re-running the report and generating the appropriate output type. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, May 12, 2005 10:47 am, David Johnson said: hmm I dont think I understand. so instead of redirecting to an action mapping, just add the HTML myself, like you would if you were writing a servlet (no jsp) application? interesting. you're right, I dont need a nice tiles definition page for my pdf/xls output.. all I really need is to pop up a browser, set the content type, and direct the response into the new browser. is there a way to target a browser like you can in a LINK but using an HTML:BUTTON? like a target=pdfOutput or something? that might work.. h On 5/12/05, Benedict, Paul C [EMAIL PROTECTED] wrote: David, You could have your response return HTML with rendered JavaScript; the script would then automatically pop open a new window with the destination link that generates your unstructured content. You could even provide a link in the response if the JavaScript doesn't run automatically. Thanks, Paul -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, May 12, 2005 10:31 AM To: Struts Users Mailing List; CCNY Subject: Opening a NEW browser for a 2nd content type from an action Hey all is it possible to forme my struts app to open up a second browser window for the purpose of streaming a different content type (like a pdf file) into it while maintaining the page in the original browser? Essentially, I have a nicely rendered HTML report in browser a and when the user clicks export to PDF or export to excel I want a NEW browser to pop up into which I will send the response with the headerType set to the appropriate type. the generation of the XL and PDF is handled for me, but the app flow is where Im foggy. anyone done this? -- -Dave [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: Opening a NEW browser for a 2nd content type from an action
whoa that's simple. I'm trying that first Thanks One things though, I'll have to set the target conditionally, only when the user clicks PDF or EXCEL since I dont **always** want it opening a new window... function setTarget(target) { document.forms[0].target=target; } On 5/12/05, Aladin Alaily [EMAIL PROTECTED] wrote: Hi Dave, This is pretty straightforward. In browser a, you have a button that says: Export to PDF The code would look like this: html:form action=/exportToPdf.do target=_NEW submit name=export value=Export to PDF /html When the user clicks on the button, the action exportToPdf.do opens an ServletOutputStream and writes whatever you want. The headers are also set to the content-type you want and the format you want (inline or attachment). Aladin Hey all is it possible to forme my struts app to open up a second browser window for the purpose of streaming a different content type (like a pdf file) into it while maintaining the page in the original browser? Essentially, I have a nicely rendered HTML report in browser a and when the user clicks export to PDF or export to excel I want a NEW browser to pop up into which I will send the response with the headerType set to the appropriate type. the generation of the XL and PDF is handled for me, but the app flow is where Im foggy. anyone done this? -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: Best practice for redirecting on session timeout?[Scanned]
So, how what would you all say about my method? does this seem to be a valid method for controlling this? On 5/12/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Good point Aladin... However, I would take this a step further... in pre-1.3 Struts, you might not want to implement your own RP for various reasons, so I would suggest doing this in a filter instead... Same benefit as modifying the RP, but doesn't touch Struts code and is also more portable... should you ever want to not use Struts for some reason, you don't have to worry about re-implementing your auth check. In 1.3, you could probably make a good argument for modifying the RP chain, certainly that's what your meant to be able to do!, but I think the same good reasons for using a filter would still apply there. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, May 12, 2005 10:57 am, [EMAIL PROTECTED] said: Hi, This approach would work as well. I just think that if you're going to do this in struts, it's better to do it in the RequestProcessor. Why? Assume that you are using the forward action defined in struts. If my session has timedout and I click on a link that uses the forward action, I will still see the page. This is because your BaseAction is never called. On the other hand, if you had checked the request in the RequestProcessor, I would have been blocked. This is because *ALL* actions pass through the RequestProcessor... even the struts-defined ones. That's the approach I would use (RequestProcessor approach) if my container didn't support filters. Aladin I have a method in my BaseAction called boolean checkAuth(request). then in every Action I write I code this at the top // Check if session is active, if not redirect to login page if( !checkAuth( request )){ log.info(*** Session has timed out ***); errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( error.expired.session) ); saveErrors(request, errors); return (mapping.findForward(ApplicationConstants.APP_FORWARD_INVALID_SESSION )); } seems to work fine. On 5/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Although this approach might work, I don't like it so much. The reasons: 1) Maintainability: if you want to change the timeout to 30 minutes (and you have 50 jsp pages), then you have to make the change 50 times. 2) Business Logic: This approach will never prevent you Action from executing. Since you have to go through an action to reach the jsp page, when the *page* reloads, you are actually reloading the action first. Having said that, if your action does something that should only be executed if your session has not expired, your approach will not work. A combination of using a filter session-config (in web.xml) solves both problems above. How? 1) You only have to change the session timeout setting in one place. 2) Your filter is executed before anything else. Hence, you never have to worry about an action being executed unintentionally. Aladin That's easy, just drop this in all of your JSPs (preferrably via an include or let a filter do it for you). (assuming your session timeout is 20 minutes) meta http-equiv=refresh content=1200;/ You should be handling invalid/expired session state in your application and by using the above technique, it will work universally, whether you are managing sessions from your actions, CMS, or some other service outside of the conatiner, such as a product like SiteMinder by Netegrity. This will _force_ the browser to do a refresh of the page after 1200 seconds (20 minutes), which will allow your app to handle the request (from a now expired session) the same as it would if the user had initiated the request giving a hint of being on a rich client where such events are easily handled. -- James Mitchell Software Engineer / Open Source Evangelist Consulting / Mentoring / Freelance EdgeTech, Inc. http://www.edgetechservices.net/ 678.910.8017 AIM: jmitchtx Yahoo: jmitchtx MSN: [EMAIL PROTECTED] - Original Message - From: Adam Lipscombe [EMAIL PROTECTED] To: 'Struts Users Mailing List' user@struts.apache.org Sent: Thursday, May 12, 2005 6:19 AM Subject: Best practice for redirecting on session timeout? Folks, I there a standard way of handling session timeouts. If a user has been inactive for longer than N minutes I want to redirect them to the login page. It occurs to me that this could be done in a) the RequestProcessor or b) in an JSP include. Is there another way? What is best practice? TIA - Adam - To unsubscribe, e-mail:
Re: how to validate when the form-property is of type=java.lang.String[]
What exactly is the problem you're having? Normally I'd say you'd loop through the array of values passed in thru the form bean On 5/12/05, m Komma [EMAIL PROTECTED] wrote: Hi, I have a problem using validatorplugin for multiselection box. my filed is of type form-property name=departments type=java.lang.String[] / I can't validate when the form-property is of type=java.lang.String[] I have the validation working correctly when form-property is of type=java.lang.String. I can't however validate when the form-property is of type=java.lang.String[]. any help is appreciated. Thanks, Mallik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: Opening a NEW browser for a 2nd content type from an action
Wow, excellent. Thanks! is tehre anything IU need to do to close my PrintWriter in the Action class? right now I have response.setContentType(application/pdf); response.setHeader(Content-disposition, inline ); PrintWriter out = response.getWriter(); socket.write(out); // I get my PDF through thtis socket do I need to close() it explicitly? On 5/12/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Return null. That's it (seriously!) Null effectively means do not forward to anything, the response is completely formed. Frank David Johnson wrote: Okay, I've got it opening the second browser (finally got back to it) using the target=_new in the form declaration, but here's the real problem I'm in the action class, and I can can work on the response using response.setContentType(application/pdf); response.setHeader(Content-disposition, inline ); BUT, when I get to the end of my action class, what do I return? I cant return to a JSP page because I've set the content type to be PDF (or excel) So, instead of mapping.findForward(success); what can I do? On 5/12/05, *Frank W. Zammetti* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Ugh, I always forget the simple target attribute! Absolutely agreed, that's probably the best approach. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, May 12, 2005 11:16 am, David Johnson said: whoa that's simple. I'm trying that first Thanks One things though, I'll have to set the target conditionally, only when the user clicks PDF or EXCEL since I dont **always** want it opening a new window... function setTarget(target) { document.forms[0].target=target; } On 5/12/05, Aladin Alaily [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Dave, This is pretty straightforward. In browser a, you have a button that says: Export to PDF The code would look like this: html:form action=/exportToPdf.do target=_NEW submit name=export value=Export to PDF /html When the user clicks on the button, the action exportToPdf.do opens an ServletOutputStream and writes whatever you want. The headers are also set to the content-type you want and the format you want (inline or attachment). Aladin Hey all is it possible to forme my struts app to open up a second browser window for the purpose of streaming a different content type (like a pdf file) into it while maintaining the page in the original browser? Essentially, I have a nicely rendered HTML report in browser a and when the user clicks export to PDF or export to excel I want a NEW browser to pop up into which I will send the response with the headerType set to the appropriate type. the generation of the XL and PDF is handled for me, but the app flow is where Im foggy. anyone done this? -- -Dave [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com -- -Dave [EMAIL PROTECTED]
html-el:img question
Hey all I've got the followiong directory structure for my web-app C:\Builds\riskGrid\WebRoot\jsp (all JSP's are here) C:\Builds\riskGrid\WebRoot\jsp\images (all images) This is the image code (in a JSP in the jsp directory) that results in the image not being found. What am I missing?? I cant have an absolute URL for obvious reasons. (note everything else is working, the link, the submit, etc.) html-el:img src=../jsp/images/portGraph.gif onclick=set('portfolioGraph');javascript:setPortName('${ refPortfolio.refPortfolioDesc}');document.forms[0].submit();/ -- -Dave [EMAIL PROTECTED]
Re: html-el:img question
Interesting twist, when I add in html:base/ it gets translated into this: base href=http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp; So, does that mean the base location is the layouts dir? Obviously I'm using Tiles in this app. Thoughts? On 5/11/05, David Johnson [EMAIL PROTECTED] wrote: Hey all I've got the followiong directory structure for my web-app C:\Builds\riskGrid\WebRoot\jsp (all JSP's are here) C:\Builds\riskGrid\WebRoot\jsp\images (all images) This is the image code (in a JSP in the jsp directory) that results in the image not being found. What am I missing?? I cant have an absolute URL for obvious reasons. (note everything else is working, the link, the submit, etc.) html-el:img src=../jsp/images/portGraph.gif onclick=set('portfolioGraph');javascript:setPortName('${ refPortfolio.refPortfolioDesc}');document.forms[0].submit();/ -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: html-el:img question
Any thoughts on this? I tried html-el:img src=../../jsp/images/portGraph.gif but that is an illegal argument :( On 5/11/05, David Johnson [EMAIL PROTECTED] wrote: Interesting twist, when I add in html:base/ it gets translated into this: base href=http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp;http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp%22 So, does that mean the base location is the layouts dir? Obviously I'm using Tiles in this app. Thoughts? On 5/11/05, David Johnson [EMAIL PROTECTED] wrote: Hey all I've got the followiong directory structure for my web-app C:\Builds\riskGrid\WebRoot\jsp (all JSP's are here) C:\Builds\riskGrid\WebRoot\jsp\images (all images) This is the image code (in a JSP in the jsp directory) that results in the image not being found. What am I missing?? I cant have an absolute URL for obvious reasons. (note everything else is working, the link, the submit, etc.) html-el:img src=../jsp/images/portGraph.gif onclick=set('portfolioGraph');javascript:setPortName('${ refPortfolio.refPortfolioDesc}');document.forms[0].submit();/ -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: html-el:img question
The full img tag includes some el tags which werent coming out properly with a normal img tag :( I tried that first :) the URL when this page is up is : http://localhost:8080/myApp/portfolio.action but the base href is: base href=http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp; html-el:img src=../jsp/images/portGraph .gif onclick=set('portfolioGraph');javascript:setPortName('${ refPortfolio.refPortfolioDesc}');document.forms[0].submit();/ how can I embed the above el stuff in a notmal img tag, and also within a JS call? On 5/11/05, Wendy Smoak [EMAIL PROTECTED] wrote: From: David Johnson [EMAIL PROTECTED] Any thoughts on this? I tried html-el:img src=../../jsp/images/portGraph.gif but that is an illegal argument :( What is the URL in the browser window when it's trying to load the image? Images are requested separately by the browser after the page is loaded. The URL for the image needs to be relative to the page the browser thinks it loaded, not the location of the JSP files. BTW, it looks like a plain old HTML img src=... tag would work fine here, why suffer the overhead of a taglib when there is no dynamic content? -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: Losing request attributes after validate()
Right. What I want is to pre-populate text fields if the user id editing or set it to if the user is creating a new thing. I think what I'll settle on is making the portfolioName request attribute a session attribute instead, then in the Save() methos, execute a myForm.reset() Is that fairly typical? Is there a better way to achive my goal of prepopulating fields that exist? I guess I assumed that they'd be populated but be linked to the form bean assigned to the form. Sigh. I feel like there's just a small bit of understanding I'l lacking here On 5/6/05, Michael Jouravlev [EMAIL PROTECTED] wrote: Umm... This one html:text property= userName / pulls data from userName property of a form bean. So if the form bean has session scope, the value will be retained.. This one html-el:text property= portfolioName value=${portfolioName}/ pulls value from portfolioName, you need to check where this object is stored, in what scope. You are right, if this object has request or page scope, then it will be wiped out after redirect. Michael. On 5/6/05, David Johnson [EMAIL PROTECTED] wrote: Hmm I'm now officially confused (and on a Friday no less). I've set the scope=session but when I get back from the validate() my values are STILL gone Also, a separate question, how is what we're talking about different from my login screen where if the user puts a userID in but no password, they get a validate() error , but the userID is populated with whatever they'd previously typed. the one difference I see is that I'm namually populating fields in the non working form. So, this does NOT work unpopulated after validate(): html-el:text property= portfolioName value=${portfolioName}/ this DOES work (populated after validate() html:text property= userName / am I stupidly OVERRIDING struts' behavior? I know there's a simple solution to this On 5/6/05, Michael Jouravlev [EMAIL PROTECTED] wrote: This is how Spring's RedirectView (or ViewRedirect? whatever) works. They have notion of model which is usually a Map. You stuff your data in it, and it is appended automatically as a payload to redirected request. Struts does not do this. If you had Struts appending all form data to the redirected request, your would be able to use the page only within a strict sequence of requests. If you jumped out from the page and browse somewhere else, you lose request data. If then you navigate to your page through browser navigation bar, you would see that you form is empty (at best. At worst, you get validation error). Spring transfers viewstate in the request, just like ASP.NEThttp://ASP.NET. I do not think this is a good idea. I think that it is much more flexible to pass ID of an object that you want to display, in the redirected request. Then your output action would load this object from the database (better from the RAM cache) and display it. Thus, the action would not care how it was called: directly, indirectly or through redirect. It just receives object ID in the request, loads object, fills out the form, and shows JSP. Pretty straightforward. Or, instead of fiddling with redirection request, just set scope=session in your action element in struts-config.xml. Then form bean will retain all values for you. On 5/6/05, David Johnson [EMAIL PROTECTED] wrote: here's a question. The way I thought it would work is that under the covers and before redirecting BACK to the page (assuming validate() fails) I thought it would take all the form attributes and put them back on the request to provide all the same data the original page was provided with but I'm seeing that's not the case. :( -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Losing request attributes after validate()
Hi all I apprear to be losing my request parameters after a form submit that fails in the Validate() of my Form. Has anyone seen this before? It works fine in all the other areas of the application, it's just this one page. the result is when I come back t the page all the data is blank as if I hasnt set the reequest parameters. thoughts? -- -Dave [EMAIL PROTECTED]
Re: Losing request attributes after validate()
I actually am for one of the properties. In the page I have : html-el:hidden property=queryName value=${queryName}/ and in the Action Class (right before the reditrct to this page) request.setAttribute(queryName,queryName); and it shows fine in view-- source. thn if I submit the form (wiuth an error) the hidden field is **not** populated On 5/6/05, Liu, Benson [EMAIL PROTECTED] wrote: You need to include hidden files for any static text properties. Typically I have bean:write name=form property=property /html:hidden name=form property=property / NOTE: this should not be done for input fields html:text name=form property=property / !-- do not include a hidden field for this property -- -Ben -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Friday, May 06, 2005 12:02 PM To: Struts Users Mailing List Subject: Losing request attributes after validate() Hi all I apprear to be losing my request parameters after a form submit that fails in the Validate() of my Form. Has anyone seen this before? It works fine in all the other areas of the application, it's just this one page. the result is when I come back t the page all the data is blank as if I hasnt set the reequest parameters. thoughts? -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: Losing request attributes after validate()
a I see. Soam I adding scrope=session to the Form Bean or the Action Mapping? On 5/6/05, Michael Jouravlev [EMAIL PROTECTED] wrote: I do have redirect=true set on the actionMapping that brings me to this page, and tthe browser should be caching field values. the weird thing is this works in other places If you want to keep redirect=true (I personally prefer redirects for better user experience), then you may want to set scope=session for your form. This should not work in other places. Maybe your other forms have session scope or somehow browser thinks that it can cache those pages? You need to include hidden files for any static text properties. Typically I have bean:write name=form property=property /html:hidden name=form property=property / NOTE: this should not be done for input fields html:text name=form property=property / !-- do not include a hidden field for this property -- I actually am for one of the properties. In the page I have : html-el:hidden property=queryName value=${queryName}/ and in the Action Class (right before the reditrct to this page) request.setAttribute(queryName,queryName); and it shows fine in view-- source. thn if I submit the form (wiuth an error) the hidden field is **not** populated It will not be populated. You redirect to the page, that is, you reload the page from the server using empty GET request with no query parameters. Struts cannot populate your form bean since there is no input data. So it just shows you JSP using current form field values. If your form has request scope, it is recreated for each request, so there are no values in it. Do not use hidden fields. You started well using redirection to the View ;-) Just change scope of your form to session, and it will retain values for you. But now you would have to clean unneeded values in the reset() method. It is a bit of a hassle, but it works better for an end user, and you do not need to pass viewstate in hidden HTML fields. Maybe you will find this useful: http://wiki.apache.org/struts/StrutsCatalogRedirectToInputPage http://wiki.apache.org/struts/StrutsMultipleActionForms Michael. -- -Dave [EMAIL PROTECTED]
Re: Losing request attributes after validate()
also.. you're RIGHT!!! It's not working in other places either!!! here's a question. The way I thought it would work is that under the covers and before redirecting BACK to the page (assuming validate() fails) I thought it would take all the form attributes and put them back on the request to provide all the same data the original page was provided with but I'm seeing that's not the case. :( On 5/6/05, David Johnson [EMAIL PROTECTED] wrote: a I see. Soam I adding scrope=session to the Form Bean or the Action Mapping? On 5/6/05, Michael Jouravlev [EMAIL PROTECTED] wrote: I do have redirect=true set on the actionMapping that brings me to this page, and tthe browser should be caching field values. the weird thing is this works in other places If you want to keep redirect=true (I personally prefer redirects for better user experience), then you may want to set scope=session for your form. This should not work in other places. Maybe your other forms have session scope or somehow browser thinks that it can cache those pages? You need to include hidden files for any static text properties. Typically I have bean:write name=form property=property /html:hidden name=form property=property / NOTE: this should not be done for input fields html:text name=form property=property / !-- do not include a hidden field for this property -- I actually am for one of the properties. In the page I have : html-el:hidden property=queryName value=${queryName}/ and in the Action Class (right before the reditrct to this page) request.setAttribute (queryName,queryName); and it shows fine in view-- source. thn if I submit the form (wiuth an error) the hidden field is **not** populated It will not be populated. You redirect to the page, that is, you reload the page from the server using empty GET request with no query parameters. Struts cannot populate your form bean since there is no input data. So it just shows you JSP using current form field values. If your form has request scope, it is recreated for each request, so there are no values in it. Do not use hidden fields. You started well using redirection to the View ;-) Just change scope of your form to session, and it will retain values for you. But now you would have to clean unneeded values in the reset() method. It is a bit of a hassle, but it works better for an end user, and you do not need to pass viewstate in hidden HTML fields. Maybe you will find this useful: http://wiki.apache.org/struts/StrutsCatalogRedirectToInputPage http://wiki.apache.org/struts/StrutsMultipleActionForms Michael. -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: Dispatch Action Strangeness
Any further insights on this? It seems I'm missing something simple here... I dont want ot have to manually call methods on my action... help? :) Is there something beyond the html:hidden property=dispatch value=error/ that I need (and the hidden field named dispatch) and of course to have my Action inherit from org.apache.struts.actions.DispatchAction (actually my BaseAction inherits from it... that wouldnt make a diffference though correct? On 4/15/05, David Johnson [EMAIL PROTECTED] wrote: in my HTML I have html:hidden property=dispatch value=error/ in my struts config (for the appropriate action) I have parameter=dispatch Is there something else I need? On 4/15/05, Rick Reumann [EMAIL PROTECTED] wrote: David Johnson wrote the following on 4/15/2005 3:21 PM: I saw that after I sent it. I have changed it to inherit from org.apache.struts.actions.DispatchAction (actually my BaseAction inherits from DispatchAction) but the methods still arent being called. You sure you have the parameter property in your action mapping in your struts config? set('graph'); I'm assuming is setting a hidden parameter (your dispatch parameter)... whatever that parameter is, is the one you need also defined in your action mapping. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dispatch Action Strangeness
yes, exactly. If changed the value of the hidden field to graph That part is working too. If I do a log.debug (dispatch=+theForm.getDispatch()); it puts out the right value (graph or whatever I clicked in the form) On 4/18/05, Hubert Rabago [EMAIL PROTECTED] wrote: IIRC you wanted the graph method to be called because you had set('graph') in an onclick handler. What does the set('graph') method do? Does it modify the dispatch form field? On 4/18/05, David Johnson [EMAIL PROTECTED] wrote: Any further insights on this? It seems I'm missing something simple here... I dont want ot have to manually call methods on my action... help? :) Is there something beyond the html:hidden property=dispatch value=error/ that I need (and the hidden field named dispatch) and of course to have my Action inherit from org.apache.struts.actions.DispatchAction (actually my BaseAction inherits from it... that wouldnt make a diffference though correct? On 4/15/05, David Johnson [EMAIL PROTECTED] wrote: in my HTML I have html:hidden property=dispatch value=error/ in my struts config (for the appropriate action) I have parameter=dispatch Is there something else I need? On 4/15/05, Rick Reumann [EMAIL PROTECTED] wrote: David Johnson wrote the following on 4/15/2005 3:21 PM: I saw that after I sent it. I have changed it to inherit from org.apache.struts.actions.DispatchAction (actually my BaseAction inherits from DispatchAction) but the methods still arent being called. You sure you have the parameter property in your action mapping in your struts config? set('graph'); I'm assuming is setting a hidden parameter (your dispatch parameter)... whatever that parameter is, is the one you need also defined in your action mapping. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dispatch Action Strangeness
yeah. this is my Action mapping action path=/PortfolioSummaryAction name=portfolioSummaryForm scope=request input=page.portfolioSummary type=com.foo.struts.PortfolioSummaryAction parameter=dispatch forward name=success path=page.portfolio.summary redirect=true/ forward name=invalidSession path=page.invalidSession redirect=true/ forward name=combineFailed path=page.portfolio.summary redirect=true/ forward name=noDispatch path=page.portfolio.summary redirect=true/!-- FIXME go to real error page-- /action On 4/18/05, Dave Newton [EMAIL PROTECTED] wrote: David Johnson wrote: yes, exactly. If changed the value of the hidden field to graph That part is working too. If I do a log.debug (dispatch=+theForm.getDispatch()); it puts out the right value (graph or whatever I clicked in the form) What does the code for your base action (that subclasses DispatchAction) look like? I've never had any issues with DispatchAction or its subclasses, so I'm a little confused as to why it wouldn't work. You probably already posted all of it, but the relevent snippets from struts-config, the JSP, the base action, and the action might be handy again :) Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
Re: Dispatch Action Strangeness
the BaseAction has import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; private Log log; and a constructor that initialized the log object so I can perform logging in all my actions. In addition it has a checkAuth() method that makes sure the user is logged in properly. On 4/18/05, Hubert Rabago [EMAIL PROTECTED] wrote: One part I missed was when you said your base action is extending DispatchAction. What is it that your base action is doing? It could be conflicting with the dispatch logic. Hubert On 4/18/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: You've confirm that you've changed the action-mapping so that it is now using your new dispatch action? If that's correct, then I'd say you need to break at DispatchAction.execute() and step through it to see what's going on. Dennis David Johnson [EMAIL PROTECTED] 04/18/2005 03:28 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org, Hubert Rabago [EMAIL PROTECTED] cc Subject Re: Dispatch Action Strangeness yes, exactly. If changed the value of the hidden field to graph That part is working too. If I do a log.debug (dispatch=+theForm.getDispatch()); it puts out the right value (graph or whatever I clicked in the form) On 4/18/05, Hubert Rabago [EMAIL PROTECTED] wrote: IIRC you wanted the graph method to be called because you had set('graph') in an onclick handler. What does the set('graph') method do? Does it modify the dispatch form field? On 4/18/05, David Johnson [EMAIL PROTECTED] wrote: Any further insights on this? It seems I'm missing something simple here... I dont want ot have to manually call methods on my action... help? :) Is there something beyond the html:hidden property=dispatch value=error/ that I need (and the hidden field named dispatch) and of course to have my Action inherit from org.apache.struts.actions.DispatchAction (actually my BaseAction inherits from it... that wouldnt make a diffference though correct? On 4/15/05, David Johnson [EMAIL PROTECTED] wrote: in my HTML I have html:hidden property=dispatch value=error/ in my struts config (for the appropriate action) I have parameter=dispatch Is there something else I need? On 4/15/05, Rick Reumann [EMAIL PROTECTED] wrote: David Johnson wrote the following on 4/15/2005 3:21 PM: I saw that after I sent it. I have changed it to inherit from org.apache.struts.actions.DispatchAction (actually my BaseAction inherits from DispatchAction) but the methods still arent being called. You sure you have the parameter property in your action mapping in your struts config? set('graph'); I'm assuming is setting a hidden parameter (your dispatch parameter)... whatever that parameter is, is the one you need also defined in your action mapping. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [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] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dispatch Action Strangeness
which part to you need to see? I'm s thankful for any help :) On 4/18/05, Dave Newton [EMAIL PROTECTED] wrote: Hubert Rabago wrote: Does it have an execute() method? If so, what does the execute method do? Yeah--what you gave isn't enough. In order to diagnose we must see the code, because on the surface everything appears to be fine. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED]
a Form with different actions actions
All I have a large page with a form on it that I need to submit to diffferent actions depending on that the user clicks. For example, I have on this page 0. a list of items the user can select 1--n of (using checkboxes) 1. a list of graph types, with a graph chosen now button (user chooses things from item #0 above) 2. a list of reports, with a report chosen now button (user chooses things from item #0 above) 3. a combine selected buttons (again user chooses things from item #0 above) 4. a create new button Essentially I may need to access some or ALL of the form fields seen on the page regardless of which path the user takes, so I assume that means one big form. the problem is I want to submit to graphAction for graphs or reportAction for reports or combineAction etc. how is this kind of thing normally handled? I have simple forms that have obvious attribures but this feels different somehow. thoughts? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: a Form with different actions actions
GREAT solution!!! Thank you both very much, and of course thanks to Ted H as well! -D On 4/15/05, Rafael Taboada [EMAIL PROTECTED] wrote: Hi. U can use DispatchAction class to have different methods for each function u have in ur form. For different buttons, there is a possibility to use LookupDispatchAction class. Don't forget to map the keys. On 4/15/05, David Johnson [EMAIL PROTECTED] wrote: All I have a large page with a form on it that I need to submit to diffferent actions depending on that the user clicks. For example, I have on this page 0. a list of items the user can select 1--n of (using checkboxes) 1. a list of graph types, with a graph chosen now button (user chooses things from item #0 above) 2. a list of reports, with a report chosen now button (user chooses things from item #0 above) 3. a combine selected buttons (again user chooses things from item #0 above) 4. a create new button Essentially I may need to access some or ALL of the form fields seen on the page regardless of which path the user takes, so I assume that means one big form. the problem is I want to submit to graphAction for graphs or reportAction for reports or combineAction etc. how is this kind of thing normally handled? I have simple forms that have obvious attribures but this feels different somehow. thoughts? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Rafael Taboada -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: a Form with different actions actions
question: Does this tip apply to the latest version of Struts? I'm using V1.2.4 and I notived this tip references the perform() method which as far as I know is deprecated. I implemented this as it recommends, setting parameter=dispatch in the ActionMapping, but the methods I've created (with the same signature as the execute() method arent being called, for example: my report submit button html is now html:submit property=runReportFlag onclick=set('report');Run Report/html:submit but the report method isnt being called what did I miss? Ted? On 4/15/05, David Johnson [EMAIL PROTECTED] wrote: GREAT solution!!! Thank you both very much, and of course thanks to Ted H as well! -D On 4/15/05, Rafael Taboada [EMAIL PROTECTED] wrote: Hi. U can use DispatchAction class to have different methods for each function u have in ur form. For different buttons, there is a possibility to use LookupDispatchAction class. Don't forget to map the keys. On 4/15/05, David Johnson [EMAIL PROTECTED] wrote: All I have a large page with a form on it that I need to submit to diffferent actions depending on that the user clicks. For example, I have on this page 0. a list of items the user can select 1--n of (using checkboxes) 1. a list of graph types, with a graph chosen now button (user chooses things from item #0 above) 2. a list of reports, with a report chosen now button (user chooses things from item #0 above) 3. a combine selected buttons (again user chooses things from item #0 above) 4. a create new button Essentially I may need to access some or ALL of the form fields seen on the page regardless of which path the user takes, so I assume that means one big form. the problem is I want to submit to graphAction for graphs or reportAction for reports or combineAction etc. how is this kind of thing normally handled? I have simple forms that have obvious attribures but this feels different somehow. thoughts? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Rafael Taboada -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:multibox nested within a c:forEach Help!
Hi all I have the following, with the goal being to allow the user to select multiple portfolios, which I can then access in the action class. JSP: c:forEach var=portfolio items=${userPortfolios} html:multibox value= c:out value='${portfolio.portfolioName}'/ property=userPortfolio / c:out value=${portfolio.portfolioName}/br /c:forEach this prints out a checkbox, then thename of the current portfolio from the userPortfolios collection. The problem is that in the rendered HTML the portfolioName is not being printed, only the following (from log.info in the Action Class) user selected portfolioID=c:out value='${portfolio.portfolioName}'/ the Question is: Should I be using the c:forEach here or would I have more luck using the Struts logic:iterate tag would they play more nicely together? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:multibox nested within a c:forEach Help!
Are there any resources you can point me to? On 4/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: David, Sounds like the same thing I was having fun with yesterday. I'm just back into the code... seems like the best would be Struts-EL tags. I have not looked into how to use them in the current environment (WebSphere Studio Application Developer). - Glenn David Johnson [EMAIL PROTECTED] 15/04/2005 12:42 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: (bcc: Glenn Deschenes/NAT/CMHC-SCHL/CA) Subject:html:multibox nested within a c:forEach Help! Classification: Hi all I have the following, with the goal being to allow the user to select multiple portfolios, which I can then access in the action class. JSP: c:forEach var=portfolio items=${userPortfolios} html:multibox value= c:out value='${portfolio.portfolioName}'/ property=userPortfolio / c:out value=${portfolio.portfolioName}/br /c:forEach this prints out a checkbox, then thename of the current portfolio from the userPortfolios collection. The problem is that in the rendered HTML the portfolioName is not being printed, only the following (from log.info in the Action Class) user selected portfolioID=c:out value='${portfolio.portfolioName}'/ the Question is: Should I be using the c:forEach here or would I have more luck using the Struts logic:iterate tag would they play more nicely together? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:multibox nested within a c:forEach Help!
This looks like exactly what I need. I cant seem to find the proper home page for the struts-el subproject however. I assume I need struts-bean-el.tld struts-html-el.tld struts-logic-el.tld struts-el.jar Anyone using this that can give me a starting point? On 4/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Here is what I know: http://struts.apache.org/faqs/struts-el.html http://struts.apache.org/userGuide/building_view.html section 3.4.6. HTH, Glenn David Johnson [EMAIL PROTECTED] 15/04/2005 12:52 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: (bcc: Glenn Deschenes/NAT/CMHC-SCHL/CA) Subject:Re: html:multibox nested within a c:forEach Help! Classification: Are there any resources you can point me to? On 4/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: David, Sounds like the same thing I was having fun with yesterday. I'm just back into the code... seems like the best would be Struts-EL tags. I have not looked into how to use them in the current environment (WebSphere Studio Application Developer). - Glenn David Johnson [EMAIL PROTECTED] 15/04/2005 12:42 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: (bcc: Glenn Deschenes/NAT/CMHC-SCHL/CA) Subject:html:multibox nested within a c:forEach Help! Classification: Hi all I have the following, with the goal being to allow the user to select multiple portfolios, which I can then access in the action class. JSP: c:forEach var=portfolio items=${userPortfolios} html:multibox value= c:out value='${portfolio.portfolioName}'/ property=userPortfolio / c:out value=${portfolio.portfolioName}/br /c:forEach this prints out a checkbox, then thename of the current portfolio from the userPortfolios collection. The problem is that in the rendered HTML the portfolioName is not being printed, only the following (from log.info in the Action Class) user selected portfolioID=c:out value='${portfolio.portfolioName}'/ the Question is: Should I be using the c:forEach here or would I have more luck using the Struts logic:iterate tag would they play more nicely together? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:multibox nested within a c:forEach Help!
Also if I'm using the Struts-EL version of the tags do I simply REMOVE the references to the old struts tags, or is it proper for them to coexist? I assume they ca coexist since not all of them have been ported. -D On 4/15/05, David Johnson [EMAIL PROTECTED] wrote: This looks like exactly what I need. I cant seem to find the proper home page for the struts-el subproject however. I assume I need struts-bean-el.tld struts-html-el.tld struts-logic-el.tld struts-el.jar Anyone using this that can give me a starting point? On 4/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Here is what I know: http://struts.apache.org/faqs/struts-el.html http://struts.apache.org/userGuide/building_view.html section 3.4.6. HTH, Glenn David Johnson [EMAIL PROTECTED] 15/04/2005 12:52 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: (bcc: Glenn Deschenes/NAT/CMHC-SCHL/CA) Subject:Re: html:multibox nested within a c:forEach Help! Classification: Are there any resources you can point me to? On 4/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: David, Sounds like the same thing I was having fun with yesterday. I'm just back into the code... seems like the best would be Struts-EL tags. I have not looked into how to use them in the current environment (WebSphere Studio Application Developer). - Glenn David Johnson [EMAIL PROTECTED] 15/04/2005 12:42 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: (bcc: Glenn Deschenes/NAT/CMHC-SCHL/CA) Subject:html:multibox nested within a c:forEach Help! Classification: Hi all I have the following, with the goal being to allow the user to select multiple portfolios, which I can then access in the action class. JSP: c:forEach var=portfolio items=${userPortfolios} html:multibox value= c:out value='${portfolio.portfolioName}'/ property=userPortfolio / c:out value=${portfolio.portfolioName}/br /c:forEach this prints out a checkbox, then thename of the current portfolio from the userPortfolios collection. The problem is that in the rendered HTML the portfolioName is not being printed, only the following (from log.info in the Action Class) user selected portfolioID=c:out value='${portfolio.portfolioName}'/ the Question is: Should I be using the c:forEach here or would I have more luck using the Struts logic:iterate tag would they play more nicely together? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:multibox nested within a c:forEach Help!
Where do you get all the struts-el stuff? dos it come bundles with Struts 1.2.4? On 4/15/05, Slattery, Tim - BLS [EMAIL PROTECTED] wrote: if I'm using the Struts-EL version of the tags do I simply REMOVE the references to the old struts tags, or is it proper for them to coexist? I assume they ca coexist since not all of them have been ported. They can co-exist, as long the prefix attribute in the taglib directive is different (so the container will know which to use). But why do that? It makes more sense to me to simply use the EL versions for everything. AFAIK, all the tags in the HTML, bean and logic taglibs have been ported. If you use tags from nested taglib or some other taglib that hasn't been ported, then of course you will need to reference the original version of that taglib. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:multibox nested within a c:forEach Help!
OH MY GOD IT WORKS For Future Reference: OLD: c:forEach var=refPortfolio items=${refPortfolios} html:multibox value= c:out value='${portfolio.portfolioName}'/ property=userPortfolio / /c:forEach NEW: c:forEach var=refPortfolio items=${refPortfolios} html:multibox value=${refPortfolio.industryFlag} property=referencePortfolios/br /c:forEach I have to admit... I'm actually stunned as hell that this worked ;) I am now mixing JSTL, Struts-EL and Struts (garden variety) tags. Does this eem strange or like S.O.P? /cheer On 4/15/05, Slattery, Tim - BLS [EMAIL PROTECTED] wrote: Where do you get all the struts-el stuff? dos it come bundles with Struts 1.2.4? It's in the Struts distribution ZIP file, in the contrib\struts-el subdirectory -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dispatch Action Strangeness
Hi there I thought I'd break this into its own thread. I'm trying to implement a DispatchAction as discussed by Ted Husted here -- http://husted.com/struts/tips/002.html I have done the following 1. changed the html:submit to the following (along with the necassary javascript) html:submit property=runGraphFlag onclick=set('graph');Run Graph/html:submit 2. Created a graph method on the Action class with the same signature at the execute() on the action however the graph method isn't getting called. My Action class still extends Action should it inherit DispatchAction instead? What am I missing? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dispatch Action Strangeness
I saw that after I sent it. I have changed it to inherit from org.apache.struts.actions.DispatchAction (actually my BaseAction inherits from DispatchAction) but the methods still arent being called. strange right? On 4/15/05, Dave Newton [EMAIL PROTECTED] wrote: David Johnson wrote: My Action class still extends Action should it inherit DispatchAction instead? What am I missing? If it doesn't extend DispatchAction how would it know to dispatch? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error Messages from the Database - Simple method?
Thank you. This is something I havent gotten to yet (trying to talk the client ouf ot if given the time contraints, of course) but thank you. I will no doubt make use of it!! On 4/14/05, David Johnson [EMAIL PROTECTED] wrote: -- Forwarded message -- From: Fogleson, Allen [EMAIL PROTECTED] Date: Apr 13, 2005 9:18 PM Subject: RE: Error Messages from the Database - Simple method? To: [EMAIL PROTECTED] David, I think I replied to this, but I released a more generalized version of the two reloadable message resources on sourceforge. (struts apps) The main improvements here are ease of development of new types of message resources. (I have not moved this over to commons-resources as the superclasses yet by the way so it is workable with struts 1.2x) Mainly now, to implement a reloadable message resource you subclass my BaseReloadableMessageResource and supply 2 methods 1) parseConfig(...) which will know what to do with the config passed from the factory. 2) getMessagesAsProperties() which returns a properties file containing all the messages for a particular locale. This would make it rather simple for you to partition messages between a DB and a properties file and you can enforce whatever ordering you desire. (i.e. all general messages come from the DB which can be changed by admins or whatever, and error messages come from a properties file so that the replacement arguments aren't mucked up) or vice versa or whatever. All of the caching/reloading, is determined by a timeout that can either be hardcoded and supplied to the superclass, or can be a part of the configuration. To load from different sources would be relatively simple, you devise some type of configuration that you can parse. And then load the messages from the appropriate resource type (file,db,etc) based on your scheme. You can grab the source or binary from the sourceforge site at: http://sourceforge.net/projects/struts/ The files are in reloadable message resources. Al -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 3:13 PM To: Fogleson, Allen Subject: Re: Error Messages from the Database - Simple method? ahh so inside your factory is where you're connecting to your database for the sole purpose of populating the messages hashmap? I suppose you looked at the default implementation to see that variable you're meant to be populating, huh? I also notice that this is an all or none thing... meaning errors AND messages in general now have to be in the DB (if I go this route) Thank you so much for the assistance. :) On Apr 7, 2005 4:06 PM, Fogleson, Allen [EMAIL PROTECTED] wrote: David, Correct, although I believe you can extend o.a.s.u.PropertyResources for an easier implementation. Once you have your stuff created you get struts to recognize it by changing the message-resources elements in your struts-config file. For instance I created a DBMessageResources class and factory (I can send them to you if you want a quick example of how to do these things. They don't merge two files but it might give you an idea on where to go) At any rate in mine I expect to get three things from the MR config 1) the JNDI Datasource name, 2) the sql to use to retrieve the value given a key, 3) a timeout for my cache. So my message-resources looks like this: message-resources factory=org.homedns.afogleson.messageresources.DBMessageResourcesFactor y parameter=java:comp/env/jdbc/myusersDS,SELECT value from Messages where locale=? and messagekey=?,30 null=false / As you can see there is no need to have your classes exist in o.a.s.util or any particular package in fact. Im sure you are aware, but the parameter is what gets passed as the config so it can pretty much be anything you want as long as it can be passed as a string. Let me know if you want my example and I will shoot it your way. Al -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 1:47 PM To: Fogleson, Allen; Struts Users Mailing List Subject: Re: Error Messages from the Database - Simple method? Oy. I'm assuming that you're talking about the loadLocale() method within... org.apache.struts.util.PropertyMessageResources I see that inheritance wise, 1. PropertyMessageResources extends MessageResources 2. PropertyMessageResourcesFactory extends MessageResourcesFactory Logical. So, I'll create 1. DatabaseMessageResources extends MessageResources 2. DatabaseMessageResourcesFactory extends MessageResourcesFactory Questions 1. should I create them in the org.apache.struts.util. package? mucking with struts seems risky 2. how do I tell the application to use MY DatabaseMessageResourcesFactory and DatabaseMessageResources instead
c:forEach for an object that extends ArrayList in Application **and** Session
This may be off topic.,.. but I'll float it out there ... I have an object in memory that I would like to iterate through on my JSP page as follows: The object is in the Session , and it is a PortfolioBeanCollection which extends ArrayList. It contains a bunch of PortfolioBean objects, which has a portfolioName attribute. My question is .. what is the simplest way to use the c:forEach tag to output the list of portfolioNames in the BortfolioBean objects within the PortfolioBeanCollection? Similarly, I have a separate set of cross user portfolios that are of the same approximate structure but ate stored in the Application context, and I need to list them as well what vital piece of understanding am I missing? am I explaining thie clealy? should I be using c:forEach or logic:iterate? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:forEach for an object that extends ArrayList in Application **and** Session
My First attempt was: c:forEach var=portfolio items=${userPortfolios} c:out value=${portfolioName}/br /c:forEach it outputs the proper number of br tags, but is not preperly displaying the correct PortfolioBeanCollection.PortfolioBean.portfolioName value.. h On 4/13/05, David Johnson [EMAIL PROTECTED] wrote: This may be off topic.,.. but I'll float it out there ... I have an object in memory that I would like to iterate through on my JSP page as follows: The object is in the Session , and it is a PortfolioBeanCollection which extends ArrayList. It contains a bunch of PortfolioBean objects, which has a portfolioName attribute. My question is .. what is the simplest way to use the c:forEach tag to output the list of portfolioNames in the BortfolioBean objects within the PortfolioBeanCollection? Similarly, I have a separate set of cross user portfolios that are of the same approximate structure but ate stored in the Application context, and I need to list them as well what vital piece of understanding am I missing? am I explaining thie clealy? should I be using c:forEach or logic:iterate? -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:forEach for an object that extends ArrayList in Application **and** Session
that makes sense, but the individual portfolios (the members of the PortfolioBeanCollection) dont really have a name, I just looped through my result set doing PortfolioBeanCollection PBC=new PortfolioBeanCollection (); while (result.hasnext){ pbc.add (new PortfolioBean(resultSet.getString(namefield))); } so I really just used the PortfolioBeanCollection as if it were a garden variety ArrayList does your comment still apply? On 4/13/05, Dave Newton [EMAIL PROTECTED] wrote: David Johnson wrote: c:forEach var=portfolio items=${userPortfolios} c:out value=${portfolioName}/br /c:forEach it outputs the proper number of br tags, but is not preperly displaying the correct PortfolioBeanCollection.PortfolioBean.portfolioName You're not specifying the bean from which to get the property. c:out value=${portfolion.portfolioName}/ Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:forEach for an object that extends ArrayList in Application **and** Session
Oh, and to answer the other question, I stored the PortfolioBeanCollection on the session under the key userPortfolios like this: PortfolioBeanCollection myPortfolios= loadUserPortfolios(userID); session.setAttribute(userPortfolios,myPortfolios); On 4/13/05, David Johnson [EMAIL PROTECTED] wrote: that makes sense, but the individual portfolios (the members of the PortfolioBeanCollection) dont really have a name, I just looped through my result set doing PortfolioBeanCollection PBC=new PortfolioBeanCollection (); while (result.hasnext){ pbc.add (new PortfolioBean(resultSet.getString(namefield))); } so I really just used the PortfolioBeanCollection as if it were a garden variety ArrayList does your comment still apply? On 4/13/05, Dave Newton [EMAIL PROTECTED] wrote: David Johnson wrote: c:forEach var=portfolio items=${userPortfolios} c:out value=${portfolioName}/br /c:forEach it outputs the proper number of br tags, but is not preperly displaying the correct PortfolioBeanCollection.PortfolioBean.portfolioName You're not specifying the bean from which to get the property. c:out value=${portfolion.portfolioName}/ Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT: JSTL] Re: c:forEach for an object that extends ArrayList in Application **and** Session
Hey That totally makes sense, and I definitely see hot to iterate through a collection of Strings or other straightforward things, but what I'm confused about is that my PortfolioBeanCollection (extends ArrayList) contains objects of type PortfolioBean which in turn contain the attribute I'm trying to display..so the PortfolioBean itself has no explicit name to which I can refer... so I really want to do something like PortfolioBeanCollection.PortfolioBean.portfolioName normally, I'd just loop through the PortfolioBeanCollection casting the resulting Object into a PortfolioBean then calling the getPortfolioName() method on the bean The examples I'be found deal more with simple Collections of Strings, ints, etc. where you might have a collection of teachers for example and want to print out the firstName attribute of each... whereas my example has another later. I might be babbling. Does that make sense? On 4/13/05, Dave Newton [EMAIL PROTECTED] wrote: David Johnson wrote: that makes sense, but the individual portfolios (the members of the PortfolioBeanCollection) dont really have a name, I just looped through my result set doing PortfolioBeanCollection PBC=new PortfolioBeanCollection (); while (result.hasnext){ pbc.add (new PortfolioBean(resultSet.getString(namefield))); } so I really just used the PortfolioBeanCollection as if it were a garden variety ArrayList does your comment still apply? Of course--you have to tell the c:out... tag a) what bean to get the property from and b) what property to display. When you say c:forEach items=${userPortfolios}... you are telling c:forEach what collection to use for the iteration. When you say c:forEach var=portfolio... you are creating a variable you can use in other JSTL tags--in essence naming each portfolio bean portfolio for the purposes of JSTL. But you still have to tell c:out... what bean and what property, otherwise how would it know what to print? When you just say c:out value=${portfolioName}/ it's looking for an application, session, request, or page scoped attribute named portfolioName. Without the prepended portfolio it doesn't know that the property portfolioName is associated with a bean created through the c:forEach iterator. I'd recommend checking out some very basic JSTL docs to get a feel for how JSTL works: http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html http://www.onjava.com/pub/a/onjava/2002/09/11/jstl2.html Dave (Wouldn't it have been quicker to just but the property name in your code and see if it worked?) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forEach for an object that extends ArrayList in Application **and** Session
bingo, that was it. Thank you! On 4/13/05, Abdullah Jibaly [EMAIL PROTECTED] wrote: try: c:forEach items=${sessionScope['userPortfolios']} var=p c:out value=${p.portfolioName} / /c:forEach -Abdullah -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 13, 2005 2:46 PM To: Struts Users Mailing List Subject: Re: forEach for an object that extends ArrayList in Application **and** Session Oh, and to answer the other question, I stored the PortfolioBeanCollection on the session under the key userPortfolios like this: PortfolioBeanCollection myPortfolios= loadUserPortfolios(userID); session.setAttribute(userPortfolios,myPortfolios); On 4/13/05, David Johnson [EMAIL PROTECTED] wrote: that makes sense, but the individual portfolios (the members of the PortfolioBeanCollection) dont really have a name, I just looped through my result set doing PortfolioBeanCollection PBC=new PortfolioBeanCollection (); while (result.hasnext){ pbc.add (new PortfolioBean(resultSet.getString(namefield))); } so I really just used the PortfolioBeanCollection as if it were a garden variety ArrayList does your comment still apply? On 4/13/05, Dave Newton [EMAIL PROTECTED] wrote: David Johnson wrote: c:forEach var=portfolio items=${userPortfolios} c:out value=${portfolioName}/br /c:forEach it outputs the proper number of br tags, but is not preperly displaying the correct PortfolioBeanCollection.PortfolioBean.portfolioName You're not specifying the bean from which to get the property. c:out value=${portfolion.portfolioName}/ Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [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] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT: JSTL] Re: c:forEach for an object that extends ArrayList in Application **and** Session
Bingo, that was it. The link you sent dealt with exatly what I was talking about. Thank you sir. :) On 4/13/05, David Johnson [EMAIL PROTECTED] wrote: Hey That totally makes sense, and I definitely see hot to iterate through a collection of Strings or other straightforward things, but what I'm confused about is that my PortfolioBeanCollection (extends ArrayList) contains objects of type PortfolioBean which in turn contain the attribute I'm trying to display..so the PortfolioBean itself has no explicit name to which I can refer... so I really want to do something like PortfolioBeanCollection.PortfolioBean.portfolioName normally, I'd just loop through the PortfolioBeanCollection casting the resulting Object into a PortfolioBean then calling the getPortfolioName() method on the bean The examples I'be found deal more with simple Collections of Strings, ints, etc. where you might have a collection of teachers for example and want to print out the firstName attribute of each... whereas my example has another later. I might be babbling. Does that make sense? On 4/13/05, Dave Newton [EMAIL PROTECTED] wrote: David Johnson wrote: that makes sense, but the individual portfolios (the members of the PortfolioBeanCollection) dont really have a name, I just looped through my result set doing PortfolioBeanCollection PBC=new PortfolioBeanCollection (); while (result.hasnext){ pbc.add (new PortfolioBean(resultSet.getString(namefield))); } so I really just used the PortfolioBeanCollection as if it were a garden variety ArrayList does your comment still apply? Of course--you have to tell the c:out... tag a) what bean to get the property from and b) what property to display. When you say c:forEach items=${userPortfolios}... you are telling c:forEach what collection to use for the iteration. When you say c:forEach var=portfolio... you are creating a variable you can use in other JSTL tags--in essence naming each portfolio bean portfolio for the purposes of JSTL. But you still have to tell c:out... what bean and what property, otherwise how would it know what to print? When you just say c:out value=${portfolioName}/ it's looking for an application, session, request, or page scoped attribute named portfolioName. Without the prepended portfolio it doesn't know that the property portfolioName is associated with a bean created through the c:forEach iterator. I'd recommend checking out some very basic JSTL docs to get a feel for how JSTL works: http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html http://www.onjava.com/pub/a/onjava/2002/09/11/jstl2.html Dave (Wouldn't it have been quicker to just but the property name in your code and see if it worked?) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT: JSTL] Re: c:forEach for an object that extends ArrayList in Application **and** Session
makes total sense. thanks a lot :) On 4/13/05, Dave Newton [EMAIL PROTECTED] wrote: David Johnson wrote: That totally makes sense, and I definitely see hot to iterate through a collection of Strings or other straightforward things, but what I'm confused about is that my PortfolioBeanCollection (extends ArrayList) contains objects of type PortfolioBean which in turn contain the attribute I'm trying to display..so the PortfolioBean itself has no explicit name to which I can refer... so I really want to do something like PortfolioBeanCollection.PortfolioBean.portfolioName normally, I'd just loop through the PortfolioBeanCollection casting the resulting Object into a PortfolioBean then calling the getPortfolioName() method on the bean You don't need to cast in JSTL; JSTL does the Right Thing. You give it a collection ('items' attribute, in your case a PortfolioBeanCollection, which is a collection, regardless of whatever additional functionality you've given it), a name to call each object in the iteration ('var' attribute, say you call it portfolio), and go. The c:out tag says Oh, you want the 'portfolio.portfolioName' to print out, tries to call getPortfolioName() on whatever object you've given it (hopefully a PortfolioBean, otherwise it will throw an exception), and displays the results. I don't think I can explain it any differently. Good luck! Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Error Messages from the Database - Simple method?
Hi all I have a similar need to a topic entitled Load Message Resources from DB??? but only for ERROR messages, and quite honestly, I want the simplest approach possible. since my Error Messages and my other test fields currently share ApplicationResources.properties I'm a little trapped though, and that's fine because I want it **totally*** transparent from the JSP tag My current vision is this: I will have a simple table as follows appliction_errors error_label - varchar(25) error_text - varchar(255) I will build a service within a plug-in to retrieve all of the error messages from the database and replace the proprtties bundle that struts loads. My questions are: 1. Where does stuts actually load up the message resources from the file into memory 2. What is the name and type of the variable (to make it transparent to the JSP tag 3. is it possible to just load up a new object and **replace** the one that struts creatd with mine? if not, what am I missing? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [resources] was: Re: RESEND: RE: Load message resources fromDB???
Hi This is sort of what I'm looking for as well. I sent a separate post about it, in fact. My goal is the simple substitution of whatever collection object type struts is using with one of the same type that I have loaded fomr a database table. I ***hate*** to tinker with the struts source code... so what might help me is knowing where the collection is, and what type it is, and whether or not I can simply replace it with another (of the same type) D On Apr 7, 2005 12:50 PM, Fogleson, Allen [EMAIL PROTECTED] wrote: Ahh that makes sense. Yes. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 11:45 AM To: Struts Users Mailing List Subject: Re: [resources] was: Re: RESEND: RE: Load message resources fromDB??? For localized configuration, I'm thinking Tiles and Validator config. -- James Mitchell Software Engineer / Open Source Evangelist Consulting / Mentoring / Freelance EdgeTech, Inc. 678.910.8017 AIM: jmitchtx Yahoo: jmitchtx MSN: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error Messages from the Database - Simple method?
Oy. I'm assuming that you're talking about the loadLocale() method within... org.apache.struts.util.PropertyMessageResources I see that inheritance wise, 1. PropertyMessageResources extends MessageResources 2. PropertyMessageResourcesFactory extends MessageResourcesFactory Logical. So, I'll create 1. DatabaseMessageResources extends MessageResources 2. DatabaseMessageResourcesFactory extends MessageResourcesFactory Questions 1. should I create them in the org.apache.struts.util. package? mucking with struts seems risky 2. how do I tell the application to use MY DatabaseMessageResourcesFactory and DatabaseMessageResources instead of PropertyMessageResourcesFactory and PropertyMessageResources What about my idea of just letting the whole thing run notmally then replacing the resulting collection with a NEW collection... The benefit there is I dont have to touch Struts at all, which, I'll be honest.. I REALLY dont want to. what I guess I'm looking at is somehow replacing that hashpamp of messages with my OWN messages. whaddya think? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [resources] was: Re: RESEND: RE: Load message resourcesfromDB???
James I have a separate thread going on this, I apologize for that, but I'll summarize, and please excuse my ignorance. Essentially, I understand your point , but if I may delve deeper, I see that inheritance wise, 1. PropertyMessageResources extends MessageResources 2. PropertyMessageResourcesFactory extends MessageResourcesFactory Logical. So, I'll create 1. DatabaseMessageResources extends MessageResources 2. DatabaseMessageResourcesFactory extends MessageResourcesFactory Questions 1. should I create them in the org.apache.struts.util. package? mucking with struts seems risky 2. how do I tell the application to use MY DatabaseMessageResourcesFactory and DatabaseMessageResources instead of PropertyMessageResourcesFactory and PropertyMessageResources then... I'd just create my own Struts.jar with all my nice custom code in it? uggghhhorammm also, that begs several questions... 1. where am I most logically making my DB connection? in my app now, it happens AFTER the message reources are loaded. oh the pain... On Apr 7, 2005 2:40 PM, James Mitchell [EMAIL PROTECTED] wrote: You should extend MessageResources and clear the protected Map formats with each call to your class. -- James Mitchell Software Engineer / Open Source Evangelist Consulting / Mentoring / Freelance EdgeTech, Inc. 678.910.8017 AIM: jmitchtx Yahoo: jmitchtx MSN: [EMAIL PROTECTED] - Original Message - From: Fogleson, Allen [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org; [EMAIL PROTECTED] Sent: Thursday, April 07, 2005 2:25 PM Subject: RE: [resources] was: Re: RESEND: RE: Load message resourcesfromDB??? The problem is that the collection is in a hashmap in the propertiesMessageResource class. And it is private in there, so the only real solution is your own custom MessageResource class. Al -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 1:21 PM To: Struts Users Mailing List Subject: Re: [resources] was: Re: RESEND: RE: Load message resourcesfromDB??? Hi This is sort of what I'm looking for as well. I sent a separate post about it, in fact. My goal is the simple substitution of whatever collection object type struts is using with one of the same type that I have loaded fomr a database table. I ***hate*** to tinker with the struts source code... so what might help me is knowing where the collection is, and what type it is, and whether or not I can simply replace it with another (of the same type) D On Apr 7, 2005 12:50 PM, Fogleson, Allen [EMAIL PROTECTED] wrote: Ahh that makes sense. Yes. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 11:45 AM To: Struts Users Mailing List Subject: Re: [resources] was: Re: RESEND: RE: Load message resources fromDB??? For localized configuration, I'm thinking Tiles and Validator config. -- James Mitchell Software Engineer / Open Source Evangelist Consulting / Mentoring / Freelance EdgeTech, Inc. 678.910.8017 AIM: jmitchtx Yahoo: jmitchtx MSN: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [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] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [resources] was: Re: RESEND: RE: Load message resourcesfromDB???
Okay, makes sense, whew. I'm still foggy on how to make the database connection. As it is now, I'm doing it inside a plugin. Will the DB cnxns be available before it loads my DatabaseMessageResourcesFactory class (which I identify in the struts config) ...or will I need to change the time at which I'm connecting to the database.. I suppose I can simply do some log.debugs so see whats getting called first.. thoughts? Other than that, I wanted to say THANK YOU so much for your help! On Apr 7, 2005 3:14 PM, James Mitchell [EMAIL PROTECTED] wrote: - Original Message - From: David Johnson [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, April 07, 2005 2:53 PM Subject: Re: [resources] was: Re: RESEND: RE: Load message resourcesfromDB??? James I have a separate thread going on this, I apologize for that, but I'll summarize, and please excuse my ignorance. Essentially, I understand your point , but if I may delve deeper, I see that inheritance wise, 1. PropertyMessageResources extends MessageResources 2. PropertyMessageResourcesFactory extends MessageResourcesFactory Logical. So, I'll create 1. DatabaseMessageResources extends MessageResources 2. DatabaseMessageResourcesFactory extends MessageResourcesFactory That's correct. Questions 1. should I create them in the org.apache.struts.util. package? mucking with struts seems risky No, do it seperatelycom.company.util 2. how do I tell the application to use MY DatabaseMessageResourcesFactory and DatabaseMessageResources instead of PropertyMessageResourcesFactory and PropertyMessageResources You configure Struts to use your factory by telling it in the Struts config: http://struts.apache.org/userGuide/configuration.html#resources_config then... I'd just create my own Struts.jar with all my nice custom code in it? uggghhhorammm No, make your own JAR. You don't want to have to deploy a custom Struts build with each project you use your new, and cool, Struts extension with. also, that begs several questions... 1. where am I most logically making my DB connection? in my app now, it happens AFTER the message reources are loaded. You make/manage the connection either: - as part the call to your factory class or - as part of the call to your getMessage(Locale locale, String key) method. or - (I suppose this is possible) - do it as a Struts Plugin oh the pain... Good luck with it! -- James Mitchell Software Engineer / Open Source Evangelist Consulting / Mentoring / Freelance EdgeTech, Inc. 678.910.8017 AIM: jmitchtx Yahoo: jmitchtx MSN: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why complicate? was: Eliminate Setup Actions
Frank can you send us a link when you have something? I for one am waiting with bated breath :) D On Tue, 8 Mar 2005 01:12:18 -0500, Frank W. Zammetti [EMAIL PROTECTED] wrote: In what way? -Original Message- From: Dakota Jack[EMAIL PROTECTED] Sent: 3/8/05 12:34:50 AM To: Struts Users Mailing Listuser@struts.apache.org, [EMAIL PROTECTED][EMAIL PROTECTED] Cc: Corey Probst[EMAIL PROTECTED] Subject: Re: why complicate? was: Eliminate Setup Actions Isn't this all a bit contrary to the rightfully hallowed principles of decoupling in OOP? On Mon, 07 Mar 2005 22:56:23 -0500, Frank W. Zammetti [EMAIL PROTECTED] wrote: Corey Probst wrote: Another thought, what about redirecting forwards? I'm glad you brought that up because I didn't think of it, and wouldn't have until after someone noticed it :) I don't think there is anything that can be done about that, at least not in the case where you redirect to a JSP. If you redirect to an Action Mapping (even if it's just an ActionForward), then sure, the setup could still work there. But redirect to a JSP I don't see a way to make it work. On your other point... I'm actually thinking about allowing the setup elements to be at the mapping level and/or the forward level. The idea being that there may be times you want to do some particular setup functions regadless of which forward is choosen, and other times where you want to do specific setups for specific forwards only. I'm thinking that each setup element you add to a forward can specify whether to process any mapping elements IN ADDITION to those of the forward, or don't use the mapping elements. For example: action path=myAction type=com.omnytex.actions.MyAction setupItem class=com.omnytex.setup.MyActionSetup method=setupMethod1 / forward name=defaultForward path=page1.jsp setupItem class=com.omnytex.setup.MyDefaultSetup method=defSetup1 / /forward /action In this case, when the defaultForward is selected, MyActionSetup.setupMethod1() would be called, followed by MyDefaultSetup.defSetup1(). But, in this case: action path=myAction type=com.omnytex.actions.MyAction setupItem class=com.omnytex.setup.MyActionSetup method=setupMethod1 / forward name=defaultForward path=page1.jsp setupItem class=com.omnytex.setup.MyDefaultSetup method=defSetup1 additive=false / /forward /action ...only MyDefaultSetup.defSetup1() would be executed when defaultForward is selected. Also, I think ideally I'd make the setupItems attached to the mapping executed BEFORE the Action's execute() is called, but clearly the forward-level items would have to execute AFTER execute() completes. I think that gives even a bit more flexibility to it. I'm making this up as I go, so feel free to comment :) -- Frank W. Zammetti Founder and Chief Software Architect [Message truncated. Tap Edit-Mark for Download to get remaining portion.] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Fwd: session.invaludate(); not working in LogoffAction
oops meant to send this to the list as well. -- Forwarded message -- From: David Johnson [EMAIL PROTECTED] Date: Tue, 8 Mar 2005 09:15:52 -0500 Subject: Re: session.invaludate(); not working in LogoffAction To: Max Cooper [EMAIL PROTECTED] Well, it's interesting actually. What I have is a simple login screen that validates login and password against a database. the FINAL version of this application will have to validate against my client's SSO (which I at this point know nothing about) So, I'm thinking that for now, I'll just use the DB validation, then put the UserID in the session scope, then check for it in in every action class. The logoutAction will null out the userID... am I over simplifying? On Mon, 07 Mar 2005 17:12:38 -0800, Max Cooper [EMAIL PROTECTED] wrote: Are you using HTTP BASIC authentication? If you get a login dialog box, as opposed to a login web page, you are probably using HTTP BASIC authentication. If so, the browser remembers the login and automatically sends it to the app with each request, which will log the user in again if they revisit a page after logging out. FORM-based authentication does not have this issue. So one resolution would be to switch to form-based authentication. To stay with BASIC, I think you could delete/expire the auth cookie as part of the logout action. I haven't tried this before, but it seems like it might work. Tell us more about your authentication system and we can help you find a solution to the problem. -Max On Mon, 2005-03-07 at 16:44 -0500, David Johnson wrote: hi all have a logoff action, and inside it I do the following. // Clean up the session if there is one HttpSession session = request.getSession(); session.invalidate(); When I watch what's happening in the manager application (I'm using Tomcat) the number of sessions does not decrease, and I can back up in the browser and call actions, all of which have code to check for a valid session.. This raises a question.. what's the best way in my web-app to make sure the user is valid? should I check in **every** action? -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Displaying a HashMap as a select
Hi all I have a HashMap in my application context called codes that contains a bunch of key,value pairs where the key is an Integer representing the codeID and the value is a string representing the codeName I simply want to create a select box containing all the items in my HashMap (displaying the codeName but passing the codeID) What's the easiest way to do this? Can I do this wil just a vanilla HashMap? The examples are slightly confusing. help! Also, keep in mind if the way I have the data stored (in a HashMap called codes on the application context) wont work, is there a better way to do it? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying a HashMap as a select
Thanks Wendy! My problem was the following. In order to get this select to display, I of course needed to set up all the crap asociated with doing such a thing... This is a list partially to get it into the archives so I can search on it later. So, I did the following 1. Loaded an ArrayList of CodeBean objects onto the application context at application startup (inder the name codes. (a CodeBean has a codeID and codeName attribure with getters and setters) I actualyl rethought the way I was saving data in the application context, and an ArrayList of code beans seemed nicer than a hashMap.. so I changed it. 2. create the HTML for it all to work html:form action=codeAction.do method=post html:select name=codeForm property=codeName html:options collection=codes property=codeID labelProperty=codeName/ /html:select /html:form WELL, in order for th above to work, you need a form-bean entry, and an action mapping, and for that to work, you need a Form Bean and an Action Class From Struts-Config.xml form-beans form-bean name=codeForm type=com.company.struts.form.CodeForm/ /form-beans ...and... action path=/CodeAction name=sicForm scope=request input=page.input type=com.company.struts.CodeAction forward name=success path=page.result redirect=true / /action My apologies, but I thought it might help reinforce it in my mind if I wrote it all down. Thanks for the help Wendy! On Mon, 07 Mar 2005 09:48:35 -0700, Wendy Smoak [EMAIL PROTECTED] wrote: From: David Johnson [EMAIL PROTECTED] I simply want to create a select box containing all the items in my HashMap (displaying the codeName but passing the codeID) What's the easiest way to do this? Can I do this wil just a vanilla HashMap? The examples are slightly confusing. I agree... I can never figure out what combination of tag attributes will do what I want just from reading the docs. Here's an example from a working webapp: html-el:select property=type html-el:options collection=contactTypes property=key labelProperty=value/ /html-el:select -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles Controllers Info?
Hi all I was reading the thread about eliminating setup actions and the tiles controllers look like a good option for me as I'm using tiles everywhere. Has anyone used these and if so ewhere did you do to learn how to? the API is nice and provides good theory as to how they're used, but does anyone have a practical example? the reference page : http://struts.apache.org/api/org/apache/struts/tiles/Controller.html -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Eliminate Setup Actions
I just found this link which gives FAR more detail on Tiles Controllers -- http://www.theserverside.com/articles/article.tss?l=Tiles101 On Sat, 5 Mar 2005 13:15:44 -0600, Corey Probst [EMAIL PROTECTED] wrote: If your app is using tiles, take a look at Tile controllers. http://struts.apache.org/api/org/apache/struts/tiles/Controller.html The controller will get called right before rendering the jsp, allowing you to put your info into the request. Corey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why complicate? was: Eliminate Setup Actions
I think a simple approach is using tiles Controllers. They're WAY simple. Having said that I might be over SIMPLIFIYING the problem http://www.theserverside.com/articles/article.tss?l=Tiles101 On Mon, 07 Mar 2005 14:23:07 -0500, Rick Reumann [EMAIL PROTECTED] wrote: Ben Taylor wrote the following on 3/5/2005 3:03 AM: Hi, Can anyone tell me if there is an easy way to put information (required to populate drop down boxes using data from a db) in to the request, without having to write a setup Action for each page as is done here: http://www.reumann.net/struts/lesson2/step9.do . I started reading a bunch of these threads in reply to the above and I do think that I'm seeing a trend of over-complification here (yea, made up word:). I do like the concept that JSF takes, but from some of the posts I've read, some are complaining about JSF being too page-centric. Personally I like the page-centric approach and find that it fits the mold of how typical web apps work. I'd say 99% of the time people use Struts in a page-centric manner. Sure you can create a ton of cool ways to handle the setup of Lists into scope, but I still find it very simple to have in my Dispatch Action a simple prep() method that handles this. (The above mentioned SetUp Action in the article was because I didn't want to introduce a dispatch action at that point, but look at the http://reumann.net/struts/articles/request_lists.jsp article for more specifics on how I'd do it using Struts 1.1 and a simple Dispatch Action). So to summarize typically I'd have //:SomeDispatchAction update(..) { //do stuff prep(request); //return forward } prep(Request request) { request.setAttribute(yourList, service.getYourList() ); } The only time the above is annoying is if you happen to use your update dispatch method from several different places and your resulting forward can go to many different pages (not all of which would need the list placed in request scope.) (Even if you end up going to different pages from reusing the above Dispatch update method, the worst case scenario is that you'd typically have a few extra things stuffed into the request. Yes, if logic is way different you could need to use different lists with the same name, etc.. but again how common is this? I still tend to think it's best to solve and code for the 90% rule.) And although many have proposed nice ideas one of the problems is as Leon mentioned: I find it hard enough to manage all the config files I have to manage right now (struts-config, resources, tiles-definitions, factories, and so on), I would be the last one to introduce one more. And the above point is the exact problem with some of the solutions. And yes Tak I have looked at OzStruts briefly and to me it overcomplicates things because it's just one more thing a developer needs to learn, when the standard practices solve 90% of the problems. To the initial poster (Ben), I'd opt for the simple prep() method unless it doesn't meet your needs. Another benefit is if someone has to look at the code, it's easy to find what is going on. Nothing to me is more frustrating than working on someone's application and trying to figure out what configuration file is injecting what where and how, or what pre and post operations are taking place that are setup somewhere else. Sometimes these solutions are needed, I just don't think for the vast majority of cases they are. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
session.invaludate(); not working in LogoffAction
hi all have a logoff action, and inside it I do the following. // Clean up the session if there is one HttpSession session = request.getSession(); session.invalidate(); When I watch what's happening in the manager application (I'm using Tomcat) the number of sessions does not decrease, and I can back up in the browser and call actions, all of which have code to check for a valid session.. This raises a question.. what's the best way in my web-app to make sure the user is valid? should I check in **every** action? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AppFuse - Impressions?
hi all I have been meaning to doeanload AppFuse after reading about it on this list (http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse) but I havent yet. Has anyone used it? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AppFuse - Impressions?
Related question. Isnt spring sort of an alternative to Struts? Can they work together? How? :) Do you feel like AppFuse is bloatware in any way? How is performance? On Wed, 2 Mar 2005 10:20:52 -0600, Steven Leija [EMAIL PROTECTED] wrote: Hey David, I've used this project for a while now and it's outstanding. You can literally get the foundation for a webproject setup and deployed to a tomcat server in a matter of a minutes. There is continuous work being done on it for additional functionality and improvements. It is consistently up-to-date with the newest opensource libraries that it utilizes. There is a wide breathe of opensource projects using in AppFuse so be prepared to learn alot of you are not already familar wtih the several of the popular opensource tools like Hibernate, Spring, Struts or JSF. Steven -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Wed 3/2/2005 10:03 AM To: Struts Users Mailing List Cc: Subject: AppFuse - Impressions? hi all I have been meaning to doeanload AppFuse after reading about it on this list (http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse) but I havent yet. Has anyone used it? -- -Dave [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] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CSS and Tiles
Hi all I have the following directory (partial shown) structure in my Struts/Tiles Web-app /webroot /webroot/jsp /webroot/layouts /webroot/styles the styles.css stylesheet is in styles and the layout is in ... not surprisingly, layouts What is the best way to get a reference for the CSS into my layout? Layout code follows - %@ page language=java% %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % %@ taglib uri=http://jakarta.apache.org/struts/tags-tiles; prefix=tiles % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN link rel=stylesheet href=styles/style.css type=text/css CONTENT=no-cache html:html locale=true head html:base / titletiles:getAsString name=title //title /head body table border=1 width=600 cellspacing=5 class=arial10 tbody tr tdtiles:insert attribute=header //td /tr tr td height=80tiles:insert attribute=nav //td /tr tr tdtiles:insert attribute=body //td /tr tr td height=80tiles:insert attribute=footer //td /tr /tbody /table /body /html:html -- -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CSS and Tiles
nope, that's PERFECT. Thanks. I was planning to use link rel=stylesheet ref=html:rewrite page='/jsp/styles/style.css'/ type=text/css CONTENT=no-cache but this is a better alternative. Thanks! On Mon, 28 Feb 2005 13:40:08 -0600, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Assuming I understood you correctly: I use webapplication absolute path with the JSTL core library's URL tag In my JSP: link rel=stylesheet type=text/css media=all href=c:url value=/styles/stylesheet.css// If you need to use a dynamic value for the stylesheets' name you could use the JSTL's expression language. -Henrik David Johnson [EMAIL PROTECTED] 02/28/2005 01:03 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: Subject:CSS and Tiles Hi all I have the following directory (partial shown) structure in my Struts/Tiles Web-app /webroot /webroot/jsp /webroot/layouts /webroot/styles the styles.css stylesheet is in styles and the layout is in ... not surprisingly, layouts What is the best way to get a reference for the CSS into my layout? Layout code follows - %@ page language=java% %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % %@ taglib uri=http://jakarta.apache.org/struts/tags-tiles; prefix=tiles % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN link rel=stylesheet href=styles/style.css type=text/css CONTENT=no-cache html:html locale=true head html:base / titletiles:getAsString name=title //title /head body table border=1 width=600 cellspacing=5 class=arial10 tbody tr tdtiles:insert attribute=header //td /tr tr td height=80tiles:insert attribute=nav //td /tr tr tdtiles:insert attribute=body //td /tr tr td height=80tiles:insert attribute=footer //td /tr /tbody /table /body /html:html -- -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CSS and Tiles
a follow up... what's the corresponding tablib element look like for the c.tld taglib? %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % On Mon, 28 Feb 2005 14:42:40 -0500, David Johnson [EMAIL PROTECTED] wrote: nope, that's PERFECT. Thanks. I was planning to use link rel=stylesheet ref=html:rewrite page='/jsp/styles/style.css'/ type=text/css CONTENT=no-cache but this is a better alternative. Thanks! On Mon, 28 Feb 2005 13:40:08 -0600, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Assuming I understood you correctly: I use webapplication absolute path with the JSTL core library's URL tag In my JSP: link rel=stylesheet type=text/css media=all href=c:url value=/styles/stylesheet.css// If you need to use a dynamic value for the stylesheets' name you could use the JSTL's expression language. -Henrik David Johnson [EMAIL PROTECTED] 02/28/2005 01:03 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: Subject:CSS and Tiles Hi all I have the following directory (partial shown) structure in my Struts/Tiles Web-app /webroot /webroot/jsp /webroot/layouts /webroot/styles the styles.css stylesheet is in styles and the layout is in ... not surprisingly, layouts What is the best way to get a reference for the CSS into my layout? Layout code follows - %@ page language=java% %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % %@ taglib uri=http://jakarta.apache.org/struts/tags-tiles; prefix=tiles % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN link rel=stylesheet href=styles/style.css type=text/css CONTENT=no-cache html:html locale=true head html:base / titletiles:getAsString name=title //title /head body table border=1 width=600 cellspacing=5 class=arial10 tbody tr tdtiles:insert attribute=header //td /tr tr td height=80tiles:insert attribute=nav //td /tr tr tdtiles:insert attribute=body //td /tr tr td height=80tiles:insert attribute=footer //td /tr /tbody /table /body /html:html -- -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JSTL c:if question
a little off topic but.. I have a variable (a string named mode) in request scope and I want to display something conditionally in the JSP. Right now, I have the following, which doesnt work. The error is 2: Illegal scope attribute without var in c:if tag. What am I doing wrong? c:if test=${mode}=='a' scope=request first thing /c:if c:if test=${mode}=='b' scope=request second thing /c:if -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CSS and Tiles
My final solution looks like this: link rel=stylesheet href='c:url value='/jsp/styles/style.css'/' type=text/css media=all/ Thanks all! On Mon, 28 Feb 2005 14:04:46 -0600, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Assuming you don't map it in web.xml, the default value is : http://java.sun.com/jstl/core It's defined in the c.tld taglib descriptor itself, see the uri sub element. -Henrik David Johnson [EMAIL PROTECTED] 02/28/2005 01:53 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: Subject:Re: CSS and Tiles a follow up... what's the corresponding tablib element look like for the c.tld taglib? %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % On Mon, 28 Feb 2005 14:42:40 -0500, David Johnson [EMAIL PROTECTED] wrote: nope, that's PERFECT. Thanks. I was planning to use link rel=stylesheet ref=html:rewrite page='/jsp/styles/style.css'/ type=text/css CONTENT=no-cache but this is a better alternative. Thanks! On Mon, 28 Feb 2005 13:40:08 -0600, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Assuming I understood you correctly: I use webapplication absolute path with the JSTL core library's URL tag In my JSP: link rel=stylesheet type=text/css media=all href=c:url value=/styles/stylesheet.css// If you need to use a dynamic value for the stylesheets' name you could use the JSTL's expression language. -Henrik David Johnson [EMAIL PROTECTED] 02/28/2005 01:03 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: Subject:CSS and Tiles Hi all I have the following directory (partial shown) structure in my Struts/Tiles Web-app /webroot /webroot/jsp /webroot/layouts /webroot/styles the styles.css stylesheet is in styles and the layout is in ... not surprisingly, layouts What is the best way to get a reference for the CSS into my layout? Layout code follows - %@ page language=java% %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % %@ taglib uri=http://jakarta.apache.org/struts/tags-tiles; prefix=tiles % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN link rel=stylesheet href=styles/style.css type=text/css CONTENT=no-cache html:html locale=true head html:base / titletiles:getAsString name=title //title /head body table border=1 width=600 cellspacing=5 class=arial10 tbody tr tdtiles:insert attribute=header //td /tr tr td height=80tiles:insert attribute=nav //td /tr tr tdtiles:insert attribute=body //td /tr tr td height=80tiles:insert attribute=footer //td /tr /tbody /table /body /html:html -- -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles - a reality check (contains many details) - Am I using this thing right?
Hi all I'm slowly figuring out the basics of Tiles, and I feel like its a good solution for my application. I want to make sure before I get to far that I'm thinking about things the right way. I have 1. a login page with a header, body and footer 2. Application itself which will contain a Header, Navigation, Body and Footer (same Header, and Footer as the login page). I have created the following directory structure ans JSP layout under my brand new shiny Struts 1.1 web application under the WebRoot Directory \WebRoot \WebRoot\WEB-INF \WebRoot\WEB-INF\tiles-defs.xml (listed below) \WebRoot\jsp \WebRoot\jsp\images \WebRoot\jsp\layouts \WebRoot\jsp\layouts\loginLayout.jsp \WebRoot\jsp\layouts\siteLayout.jsp \WebRoot\jsp\tiles \WebRoot\jsp\tiles\header.jsp (not full html page) \WebRoot\jsp\tiles\footer.jsp \WebRoot\jsp\tiles\navigation.jsp \WebRoot\jsp\loginBody.jsp \WebRoot\jsp\appPageBody.jsp Explanation: \layouts contains my JSP Layouts for the different parts of the app \tiles contains my reusable areas in the app (not complete html pages) \jsp contains the different body jsp files My question is : Is this a typical way to arrange a generic Tiles application? the problem come in when I try to use definition inheritance in the tiles-defs.xml file. See how in the tiles-defs.xml I have page.AppStart inheriting from base.definition, but it's using a DIFFERENT page as a template because the LOGIN page doesnt need navigation and th application page does... tiles-defs.xml tiles-definitions !-- Base Tiles Definition -- definition name=base.definition path=/jsp/layouts/loginLayout.jsp put name=header value=/jsp/tiles/header.jsp / put name=footer value=/jsp/tiles/footer.jsp / /definition !-- Tiles Definition of login page -- definition name=page.login extends=base.definition put name=title value=Login Page / put name=body value=/jsp/loginBody.jsp / /definition !-- Tiles definition of mail application page-- definition name=page.appStart extends=base.definition path=/jsp/layouts/siteLayout.jsp put name=title value=Application Title / put name=nav value=/jsp/navigation.jsp / put name=body value=/jsp/appStartBody.jsp / /definition /tiles-definitions -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles - a reality check (contains many details) - Am I using this thing right?
Hi again - a follow up question. When using tiles this way, does this mean that any forward I define in my struts-config.xml should be a valid Tiles Definition? Would that then imply that every page in my application is specified by a tiles Definition, and that's how I GET to any given page? Further, assuming all application pages use the Header/Nav/Body/Footer layout (called siteLayout) would there then just be one body page instead of what might be thought of as page in the application, that then gets included into a layout? example: I want to create a Profile Editing page, so I create profileEditBody.jsp and a NEW definition in the tiles-defs file specifying only the TITLE and BODY ..a la definition name=page.profile.edit extends=base.definition put name=title value=Edit Profile Page / put name=body value=/jsp/profileEditBody.jsp / /definition Bue heres the question... how do I call this thing from an Action Class?!?!?! Argh On Tue, 22 Feb 2005 15:50:34 -0500, David Johnson [EMAIL PROTECTED] wrote: Hi all I'm slowly figuring out the basics of Tiles, and I feel like its a good solution for my application. I want to make sure before I get to far that I'm thinking about things the right way. I have 1. a login page with a header, body and footer 2. Application itself which will contain a Header, Navigation, Body and Footer (same Header, and Footer as the login page). I have created the following directory structure ans JSP layout under my brand new shiny Struts 1.1 web application under the WebRoot Directory \WebRoot \WebRoot\WEB-INF \WebRoot\WEB-INF\tiles-defs.xml (listed below) \WebRoot\jsp \WebRoot\jsp\images \WebRoot\jsp\layouts \WebRoot\jsp\layouts\loginLayout.jsp \WebRoot\jsp\layouts\siteLayout.jsp \WebRoot\jsp\tiles \WebRoot\jsp\tiles\header.jsp (not full html page) \WebRoot\jsp\tiles\footer.jsp \WebRoot\jsp\tiles\navigation.jsp \WebRoot\jsp\loginBody.jsp \WebRoot\jsp\appPageBody.jsp Explanation: \layouts contains my JSP Layouts for the different parts of the app \tiles contains my reusable areas in the app (not complete html pages) \jsp contains the different body jsp files My question is : Is this a typical way to arrange a generic Tiles application? the problem come in when I try to use definition inheritance in the tiles-defs.xml file. See how in the tiles-defs.xml I have page.AppStart inheriting from base.definition, but it's using a DIFFERENT page as a template because the LOGIN page doesnt need navigation and th application page does... tiles-defs.xml tiles-definitions !-- Base Tiles Definition -- definition name=base.definition path=/jsp/layouts/loginLayout.jsp put name=header value=/jsp/tiles/header.jsp / put name=footer value=/jsp/tiles/footer.jsp / /definition !-- Tiles Definition of login page -- definition name=page.login extends=base.definition put name=title value=Login Page / put name=body value=/jsp/loginBody.jsp / /definition !-- Tiles definition of mail application page-- definition name=page.appStart extends=base.definition path=/jsp/layouts/siteLayout.jsp put name=title value=Application Title / put name=nav value=/jsp/navigation.jsp / put name=body value=/jsp/appStartBody.jsp / /definition /tiles-definitions -- -Dave [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles - a reality check (contains many details) - Am I using this thing right?
Yes. my template is : \WebRoot\jsp\layouts\siteLayout.jsp which contains a vanilla HTML table with tiles:insert in the proper places for nav, footer, header , and body. On Tue, 22 Feb 2005 13:57:56 -0700, Eric Lemle [EMAIL PROTECTED] wrote: Did you create a template.jsp that inserts the header, footer, nav, and main tile? Eric D. Lemle Senior Programmer / Analyst Intermountain Health Care 36 South State Street, Suite 1100 Salt Lake City, Utah 84111 United States of America (USA) (801) 442-3688 -- e-mail: [EMAIL PROTECTED] [EMAIL PROTECTED] 2/22/2005 1:50:34 PM Hi all I'm slowly figuring out the basics of Tiles, and I feel like its a good solution for my application. I want to make sure before I get to far that I'm thinking about things the right way. I have 1. a login page with a header, body and footer 2. Application itself which will contain a Header, Navigation, Body and Footer (same Header, and Footer as the login page). I have created the following directory structure ans JSP layout under my brand new shiny Struts 1.1 web application under the WebRoot Directory \WebRoot \WebRoot\WEB-INF \WebRoot\WEB-INF\tiles-defs.xml (listed below) \WebRoot\jsp \WebRoot\jsp\images \WebRoot\jsp\layouts \WebRoot\jsp\layouts\loginLayout.jsp \WebRoot\jsp\layouts\siteLayout.jsp \WebRoot\jsp\tiles \WebRoot\jsp\tiles\header.jsp (not full html page) \WebRoot\jsp\tiles\footer.jsp \WebRoot\jsp\tiles\navigation.jsp \WebRoot\jsp\loginBody.jsp \WebRoot\jsp\appPageBody.jsp Explanation: \layouts contains my JSP Layouts for the different parts of the app \tiles contains my reusable areas in the app (not complete html pages) \jsp contains the different body jsp files My question is : Is this a typical way to arrange a generic Tiles application? the problem come in when I try to use definition inheritance in the tiles-defs.xml file. See how in the tiles-defs.xml I have page.AppStart inheriting from base.definition, but it's using a DIFFERENT page as a template because the LOGIN page doesnt need navigation and th application page does... tiles-defs.xml tiles-definitions !-- Base Tiles Definition -- definition name=base.definition path=/jsp/layouts/loginLayout.jsp put name=header value=/jsp/tiles/header.jsp / put name=footer value=/jsp/tiles/footer.jsp / /definition !-- Tiles Definition of login page -- definition name=page.login extends=base.definition put name=title value=Login Page / put name=body value=/jsp/loginBody.jsp / /definition !-- Tiles definition of mail application page-- definition name=page.appStart extends=base.definition path=/jsp/layouts/siteLayout.jsp put name=title value=Application Title / put name=nav value=/jsp/navigation.jsp / put name=body value=/jsp/appStartBody.jsp / /definition /tiles-definitions -- -Dave [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] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where is page (now) to subscribe/unsubscribe to this list?
send an email to [EMAIL PROTECTED] that should do it. On Tue, 22 Feb 2005 16:02:39 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have looked everywhere, at at least it seems like it, on the apache site, but cannot find where I can subscribe to this list from another email address. Struts has been removed from the list of lists at http://jakarta.apache.org/site/mail2.html, but if I go to the Struts home page, as it tells me to do, I can't find any reference to this mail list. Ideas? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles Tabs Example - Has anyone used this?
Hi again Yes, I'm obsessed with Tiles. I admit it. Has anyone used the (really slick!) Tabs example you can see if you install the tiles exasmples locally by going to http://localhost:8080/tiles-documentation/examples/tabs.jsp By used I mean successfully extacted the associated code to run in your own applicaiton. If so, can you point mne in the right direction? I dont see an obvious way to do this cleanly.. Thanks -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
a *simple* tiles tutorial
All I'm searching for (as the title suggests) a simple Tiles tutorial. I have found the one by Cedric D, but I think it's assuming more knowledge than I have (http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf) Can anyone point me? -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Caching Appliction Level Data?
Hi again a related question. if I load up the data I need from within a plug in and store it in the application scope, is this an acceptable sepatation of view and Model as long as I am doing so from a service? Remember, this app architecture I'm using has a service factory (which was set up from within a plug in), and the way all the data access is done is from these services. Does that make sense? Essentially, I'll add a section to the init() after this service factory is set up that uses the service factory to instantiate a service whose purpose it is to pass back Application Level data (I use the example of state codes, common to all users) which I will then store in the application scope. Am I making sense? My goal is to keep this as simple as possible by introducing as little complexity as possible Dave J P.S. I mean no disrespect to people who have suggested other ways of doing this, I'm simply proposing what seems like a simple solution, and wondering is it seems drastically wrong, or if it's reasonable. thanks to everyone for the input! On Mon, 14 Feb 2005 14:34:23 -0500 (EST), Frank W. Zammetti [EMAIL PROTECTED] wrote: On Mon, February 14, 2005 2:26 pm, David Johnson said: Frank I see what you mean. I was assuming I'd just store the data in a hashtable or something in the Application Context That's what I think Wendy suggested, and it's probably a better idea than what I do frankly :) I have stupid question...where is your AppConfig actually getting stored? I'd think you'd need to do the above at some point and do a No question is stupid :) getServletContext().setAttribute( AppConfig, myAppInfo); oh boy what am I missing.. or was that implied.. OR did I miss your hwhole point? I really hope it's not the last one ;) Your forgetting some basic Java is all (and everyone does it from time to time, regardless of what anyone might claim :) A member of a class that is static is always present in the CLASS, independent of any instance of that class. For instance: public class myClass { public static int PI = 3.14159; } Now, if you have another class that wants to use PI, you just do: public class test { public void showPI() { System.out.println(myClass.PI); } } No instance of myClass is created, yet you can access the PI member of it through the instance of the CLASS... That's sometimes confusing to people... The way I learned to think of it is that the JVM (the class loader specifically) in a sense does automatically creates an instance of the myClass class, but an instance that ONLY contains the static members. That's not actually what happens AFAIK, but IN EFFECT it is. As long as the two classes are loader by the same class loader, your good to go. For this app it's safe to assume we'll always be using struts (btw) Then a plugin is safe. But, as others have said, it's just about as easy to do it other ways, so you may as well have one less Struts tie-in. And as Vic I think said, DAOs are the best-practice (one I haven't had cause to use yet myself, but I in *no way* disagree with his point). -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Mon, 14 Feb 2005 14:15:28 -0500 (EST), Frank W. Zammetti [EMAIL PROTECTED] wrote: Using a plugin only tells you WHERE your going to read the information in, not where your going to STORE it. I think that's the question you really want to ask. Plugins are pretty standard practice when dealing with Struts, but if you have a concern that you might not be using Struts at some point, you might want to do something else. In any case, where you put the data is the question. I'd still put my vote down for a static storage class. I do that, read the data in a plugin, stick it in the storage class, and I'm done. The storage class is pretty much nothing more than this: import java.util.HashMap; public class AppConfig { private static HasMap config = new HashMap(); public static void setConfig(HashMap config) { this.config = config; } public static HashMap getConfig() { return config; } } I start my plugin by doing: HashMap config = AppConfig.getConfig(); ...then read in whatever data I need, shove it in config, and final do: AppConfig.setConfig(config); Again, so long as this data isn't going to change, and it's not a huge amount of data, that's all there is to it. I don't know if this would be considered best practice', but it's certainly common practive AFAIK :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Mon, February 14, 2005 2:08 pm, David Johnson said: Ah! After reading up on the Struts Plugins, I have the following question Are struts plugins a perfectly acceptable way to handle Application level caching? How about
Caching Appliction Level Data?
Hi All I have a need in an app I'm working on to cache data that is valid and shared across users, like standard country codes, region codes, industry codes... stuff like that. What's the best way to do that with my struts 1.2 application? Is there something built in that I'm not aware of that I can leverage or any best practices you guys can point me toward? Betst to ask the experts first... Thanks! D -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Caching Appliction Level Data?
Ahhh a little more information on using a Struts plugin? I'm such a noobie I've never done this.. anywhere you can point me for examples? UGH! Sorry for the simpleton question On Mon, 14 Feb 2005 13:26:12 -0500, Erik Weber [EMAIL PROTECTED] wrote: I use the same strategy often. Another option (besides a ServletContextListener) for loading your application scope attributes is a Struts PlugIn. Erik Wendy Smoak wrote: From: David Johnson [EMAIL PROTECTED] I have a need in an app I'm working on to cache data that is valid and shared across users, like standard country codes, region codes, industry codes... stuff like that. What's the best way to do that with my struts 1.2 application? Is there something built in that I'm not aware of that I can leverage or any best practices you guys can point me toward? I use a ServletContextListener that puts a bunch of Maps and other resources in application scope. (Then I use a HttpSessionListener to set up user-specific things.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Caching Appliction Level Data?
Ah! After reading up on the Struts Plugins, I have the following question Are struts plugins a perfectly acceptable way to handle Application level caching? How about best practices-wise? Thoughts? D On Mon, 14 Feb 2005 11:03:24 -0800 (PST), Martin Wegner [EMAIL PROTECTED] wrote: A PlugIn works nicely as well. I am not sure which is the recommended Struts practice. --- Wendy Smoak [EMAIL PROTECTED] wrote: From: David Johnson [EMAIL PROTECTED] I have a need in an app I'm working on to cache data that is valid and shared across users, like standard country codes, region codes, industry codes... stuff like that. What's the best way to do that with my struts 1.2 application? Is there something built in that I'm not aware of that I can leverage or any best practices you guys can point me toward? I use a ServletContextListener that puts a bunch of Maps and other resources in application scope. (Then I use a HttpSessionListener to set up user-specific things.) -- Wendy Smoak - 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] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Caching Appliction Level Data?
I see your points. We arent sure yet what version of Weblogic we'll be deploying to, but I'm developing in Tomcat. Sounds like an open question to me. Where would you point me to learn how to do this the ContextListener way? On Mon, 14 Feb 2005 11:10:19 -0800, Craig McClanahan [EMAIL PROTECTED] wrote: On Mon, 14 Feb 2005 11:03:24 -0800 (PST), Martin Wegner [EMAIL PROTECTED] wrote: A PlugIn works nicely as well. I am not sure which is the recommended Struts practice. If you're on a Servlet 2.3 or later container (which is when ServletContextListener was introduced), you should use it instead of plugins: * There are also other listeners that you should explore which are available in this version -- did you know, for example, that you can be notified whenever anyone else in your app adds, removes, or replaces an application or session scope attribute? (In Servlet 2.4 you can do this for request scope too.) * The way a Struts plugin is implemented is to have the init() and destroy() methods called from the corresponding methods on ActionServlet. Technically, an app server is allowed to destroy servlet instances any time it wants to, so you're not guaranteed that destroy() *really* means the application is shutting down. * Context listeners work in non-Struts apps too; one less concept to learn. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Dave [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]