Re: Sending dynamic parameters to a forward
Here's something I'm using to accomplish this: http://www.systemmobile.com/wp/?p=114 It's pretty simple, but can be refit to be fairly complex. On 6/14/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > Sorry, my bad... it's not setURL, it's setPath. It's actually a method > of ForwardConfig, which ActionForward extends. Look in the third table > down in the link you sent, the section labeled "Methods inherited from > class org.apache.struts.config.ForwardConfig". > > That's what I get for going from memory ;) > > Frank > > Zarar Siddiqi wrote: > > Where do you see the af.setURL(String) method in the ActionForward class? > > http://struts.apache.org/api/org/apache/struts/action/ActionForward.html > > > > I had a similar problem where dynamic values needed to be passed in via > > an ActionForward but I wasn't able to find something as simple as you > > suggest. I had to store the values in session scope (because the > > ActionForward had redirect=true) and then clean up the session in my > > receiving code. > > > > So you store the values that you are passing in session scope for a > > quick millisecond while you forward and then clean up once you're in the > > called method. > > > > Zarar > > > > > > - Original Message - From: "Frank W. Zammetti" > > <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" > > Cc: "Struts Users Mailing List" > > Sent: Tuesday, June 14, 2005 9:27 AM > > Subject: Re: Sending dynamic parameters to a forward > > > > > >> You can, IIRC, append a query string to the URL returned by your > >> forward... off the top of my head, it would look something like > >> this... in > >> Action 1: > >> > >> String param1Val = "someValue1"; > >> String param2Val = "someValue2"; > >> String queryString = "?param1=" + param1Val + "¶m2 = " + param2Val; > >> ActionForward af = new > >> ActionForward(mapping.findForward("ForwardToAction2")); > >> af.setURL(af.getURL() + queryString); > >> return af; > >> > >> You'll probably want to encode the parameter values, I'd suggest Commons > >> Codec for that. > >> > >> -- > >> Frank W. Zammetti > >> Founder and Chief Software Architect > >> Omnytex Technologies > >> http://www.omnytex.com > >> > >> On Tue, June 14, 2005 7:52 am, tarek.nabil said: > >> > >>> Hi Everyone, > >>> > >>> I have an action (Action1) which when completed successfully, forwards > >>> to another action (Action2). I need to be able to send dyanamic > >>> parameters to Action2. I thought about putting the parameters as request > >>> attributes, but the problem here is that Action2 can be called directly > >>> using a link from some pages and this case, the parameters will be send > >>> as request parameters rather than attributes. > >>> > >>> I can write code to look in the request attributes and if not found, it > >>> can check the request parameters, but I was hoping there's another way > >>> to do it. I thought about setting the redirect attribute to true on this > >>> forward but I still wouldn't know how to append parameters with dynamic > >>> values to the forward while forwarding to it from Action1. > >>> > >>> Any ideas? > >>> > >>> - > >>> 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] > > > > > > > > > > > > -- > 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] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: carriage returns
The problem was that the receiving system would choke when the XML responses were too long, so gzip wouldn't have helped it. I'm not sure what system/app they were using as it was with an external service provider, but it sounds pretty broken regardless. Probably some kind of fixed buffer overrun, yuck! -ed On 6/14/05, Dave Newton <[EMAIL PROTECTED]> wrote: > Ed Griebel wrote: > > >We had a problem with XML having too many carriage returns and > >whitespace for a downstream system. > > > Heck, XML has too much NON-whitespace, too ;) > > >To solve the problem I wrote a > >simple javax.servlet.Filter instance that would get the response and > >strip out extraneous stuff using String.replaceAll() on the output > >from a HttpServletResponseWrapper instance. Not the most efficient, > >but it was expedient and the XML output was relatively small, > >especially when compared with the app's HTML output. > > > > > Was the difference between the performance of the .replaceAll so much > better than a gzip filter? > > Dave > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Themes
In looking into providing a Themes type functionality I've run across the idea of setting up a new DefinitionsFactory class. According to the section '8.4 Writing your own Definition Factory' of the document http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf this looks like a neat way in which one might implement a themes subsystem. I think that this could allow me to basically re-write the value of a tile definition in such a way that for example: /layout/menu.jsp Is changed to something like /themes/example/layout/menu.jsp Depending on say a session scoped variable. Some code would be needed to check to make sure that this new jsp actually exists (giving me the fall-back to original functionality previously mentioned in this thread). Apparently I'll need to extend DefinitionsFactory. Unfortunately the document is now a little out of date and I'm wondering if anyone out there has successfully messed with this class? If you can share any experiences you may have had I'd really appreciate it. Regards Marty
Re: Sending dynamic parameters to a forward
Sorry, my bad... it's not setURL, it's setPath. It's actually a method of ForwardConfig, which ActionForward extends. Look in the third table down in the link you sent, the section labeled "Methods inherited from class org.apache.struts.config.ForwardConfig". That's what I get for going from memory ;) Frank Zarar Siddiqi wrote: Where do you see the af.setURL(String) method in the ActionForward class? http://struts.apache.org/api/org/apache/struts/action/ActionForward.html I had a similar problem where dynamic values needed to be passed in via an ActionForward but I wasn't able to find something as simple as you suggest. I had to store the values in session scope (because the ActionForward had redirect=true) and then clean up the session in my receiving code. So you store the values that you are passing in session scope for a quick millisecond while you forward and then clean up once you're in the called method. Zarar - Original Message - From: "Frank W. Zammetti" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Cc: "Struts Users Mailing List" Sent: Tuesday, June 14, 2005 9:27 AM Subject: Re: Sending dynamic parameters to a forward You can, IIRC, append a query string to the URL returned by your forward... off the top of my head, it would look something like this... in Action 1: String param1Val = "someValue1"; String param2Val = "someValue2"; String queryString = "?param1=" + param1Val + "¶m2 = " + param2Val; ActionForward af = new ActionForward(mapping.findForward("ForwardToAction2")); af.setURL(af.getURL() + queryString); return af; You'll probably want to encode the parameter values, I'd suggest Commons Codec for that. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Tue, June 14, 2005 7:52 am, tarek.nabil said: Hi Everyone, I have an action (Action1) which when completed successfully, forwards to another action (Action2). I need to be able to send dyanamic parameters to Action2. I thought about putting the parameters as request attributes, but the problem here is that Action2 can be called directly using a link from some pages and this case, the parameters will be send as request parameters rather than attributes. I can write code to look in the request attributes and if not found, it can check the request parameters, but I was hoping there's another way to do it. I thought about setting the redirect attribute to true on this forward but I still wouldn't know how to append parameters with dynamic values to the forward while forwarding to it from Action1. Any ideas? - 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] -- 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]
Re: Sending dynamic parameters to a forward
On 6/14/05, Zarar Siddiqi <[EMAIL PROTECTED]> wrote: > Where do you see the af.setURL(String) method in the ActionForward class? > http://struts.apache.org/api/org/apache/struts/action/ActionForward.html > > I had a similar problem where dynamic values needed to be passed in via an > ActionForward but I wasn't able to find something as simple as you suggest. > I had to store the values in session scope (because the ActionForward had > redirect=true) and then clean up the session in my receiving code. > > So you store the values that you are passing in session scope for a quick > millisecond while you forward and then clean up once you're in the called > method. > > Zarar This is the one that I use. To make it proper, it should be urlencoded too. /** * Creates ActionForward object with URL parameters. * * @param actionMapping action mapping object * @param forwardNamemapping name * @param urlParams array of "key=value" strings which * should be added to actionForward path * as HTTP GET parameters * * @return ActionForward object with GET parameters */ public static ActionForward goForward(ActionMapping actionMapping, String forwardName, String[] urlParams) { /* * Find ActionForward object, defined in struts-config.xml */ ActionForward actionForward = actionMapping.findForward(forwardName); if (actionForward == null) return null; /* * Build URL parameters */ String actionPath = actionForward.getPath(); if (actionPath != null) { for (int i = 0; i < urlParams.length; i++) { actionPath += i==0 ? "?" : "&"; actionPath += urlParams[i]; } } /* * Create new ActionForward object. Stuts does not * allow to modify ActionForward objects, statically * defined in struts-config.xml */ ActionForward patchedForward = new ActionForward(actionForward.getName(), actionPath, actionForward.getRedirect() ); return patchedForward; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sending dynamic parameters to a forward
Where do you see the af.setURL(String) method in the ActionForward class? http://struts.apache.org/api/org/apache/struts/action/ActionForward.html I had a similar problem where dynamic values needed to be passed in via an ActionForward but I wasn't able to find something as simple as you suggest. I had to store the values in session scope (because the ActionForward had redirect=true) and then clean up the session in my receiving code. So you store the values that you are passing in session scope for a quick millisecond while you forward and then clean up once you're in the called method. Zarar - Original Message - From: "Frank W. Zammetti" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Cc: "Struts Users Mailing List" Sent: Tuesday, June 14, 2005 9:27 AM Subject: Re: Sending dynamic parameters to a forward You can, IIRC, append a query string to the URL returned by your forward... off the top of my head, it would look something like this... in Action 1: String param1Val = "someValue1"; String param2Val = "someValue2"; String queryString = "?param1=" + param1Val + "¶m2 = " + param2Val; ActionForward af = new ActionForward(mapping.findForward("ForwardToAction2")); af.setURL(af.getURL() + queryString); return af; You'll probably want to encode the parameter values, I'd suggest Commons Codec for that. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Tue, June 14, 2005 7:52 am, tarek.nabil said: Hi Everyone, I have an action (Action1) which when completed successfully, forwards to another action (Action2). I need to be able to send dyanamic parameters to Action2. I thought about putting the parameters as request attributes, but the problem here is that Action2 can be called directly using a link from some pages and this case, the parameters will be send as request parameters rather than attributes. I can write code to look in the request attributes and if not found, it can check the request parameters, but I was hoping there's another way to do it. I thought about setting the redirect attribute to true on this forward but I still wouldn't know how to append parameters with dynamic values to the forward while forwarding to it from Action1. Any ideas? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: carriage returns
Thanks Jason, that is more like what I was looking for. From: Jason Lea <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" To: Struts Users Mailing List Subject: Re: carriage returns Date: Wed, 15 Jun 2005 10:17:12 +1200 You can get Tomcat-5's JSP compiler to remove some whitespace in conf/web.xml you can set trimSpaces to true. It will remove whitespace between tags. eg Would be reduced to but abc def would be abc def draegoon Z wrote: Hey guys, I'm finally sick of all the unwanted carriage returns created by tiles and struts tags. I searched the archives and found this trick: but it doesn't fix everything, especially comments. Has anyone else gotten sick of this and came up with a quick and clean solution? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: carriage returns
Thanks Jason, that is more like what I was looking for. From: Jason Lea <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" To: Struts Users Mailing List Subject: Re: carriage returns Date: Wed, 15 Jun 2005 10:17:12 +1200 You can get Tomcat-5's JSP compiler to remove some whitespace in conf/web.xml you can set trimSpaces to true. It will remove whitespace between tags. eg Would be reduced to but abc def would be abc def draegoon Z wrote: Hey guys, I'm finally sick of all the unwanted carriage returns created by tiles and struts tags. I searched the archives and found this trick: but it doesn't fix everything, especially comments. Has anyone else gotten sick of this and came up with a quick and clean solution? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: carriage returns
> I'm finally sick of all the unwanted carriage returns created by > tiles and struts tags. > I searched the archives and found this trick: > > > > > > but it doesn't fix everything, especially comments. > > Has anyone else gotten sick of this and came up with a quick > and clean solution? We use a filter that removes white-space from html, css, and javascript output. It's pretty straight forward, but there are a few caveats. For instance, it probably shouldn't remove extra white-space inside of a . This is a clean solution, configuration-wise. - Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: carriage returns
You can get Tomcat-5's JSP compiler to remove some whitespace in conf/web.xml you can set trimSpaces to true. It will remove whitespace between tags. eg Would be reduced to but abc def would be abc def draegoon Z wrote: Hey guys, I'm finally sick of all the unwanted carriage returns created by tiles and struts tags. I searched the archives and found this trick: but it doesn't fix everything, especially comments. Has anyone else gotten sick of this and came up with a quick and clean solution? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea
Re: carriage returns
Ed Griebel wrote: We had a problem with XML having too many carriage returns and whitespace for a downstream system. Heck, XML has too much NON-whitespace, too ;) To solve the problem I wrote a simple javax.servlet.Filter instance that would get the response and strip out extraneous stuff using String.replaceAll() on the output from a HttpServletResponseWrapper instance. Not the most efficient, but it was expedient and the XML output was relatively small, especially when compared with the app's HTML output. Was the difference between the performance of the .replaceAll so much better than a gzip filter? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: carriage returns
We had a problem with XML having too many carriage returns and whitespace for a downstream system. To solve the problem I wrote a simple javax.servlet.Filter instance that would get the response and strip out extraneous stuff using String.replaceAll() on the output from a HttpServletResponseWrapper instance. Not the most efficient, but it was expedient and the XML output was relatively small, especially when compared with the app's HTML output. -ed On 6/14/05, draegoon Z <[EMAIL PROTECTED]> wrote: > Hey guys, > > I'm finally sick of all the unwanted carriage returns created by tiles and > struts tags. > I searched the archives and found this trick: > > > > > > but it doesn't fix everything, especially comments. > > Has anyone else gotten sick of this and came up with a quick and clean > solution? > > Thanks. > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using ActioForm in ActionForm practice
Depends. This topic is discussed heavily from time to time. The last tide was about a month ago :) Search archives. Basically, if you need only to output your A, B, C entities, you do not need action forms. Just stick your object in the proper scope. If you need to input data into A, B, C or your A, B, C are interactive (that is you need to output them, to modify them, to validate and to redisplay them on error, and finally to store them back to hibernate) then I know two obvious choices. You must recall, that: * Struts automatically stores request values into action form when request hits the server. * Also, action form is a bean, accessible from JSP. Thus, action form can be used as a buffer for interactive I/O. * Struts uses setters and getters to access properties. * Struts does not try to set property, if request does not have corresponding value. * Simple redirect does not keep request values. * Another thing to know, is that action form can handle aggregated (aka nested) objects. The choices I know of: (1) Use action form as I/O buffer, business objects would contain only valid and persisted data. Copy data from action form to BO when you store data. (2) Use a separate instance(s) of business object(s) or DTO(s) as I/O buffer, and store all interactive data there, even invalid data. Valid data can be persisted to database or wherever. For (1) you would need to write a lot of setters/getters, but on the plus side is that you do not need to call your business layer unless all values are valid. You can check validity in validate() method. On the other hand, if you already have validation functionality on business layer, this does not look good. For (2) You can aggregate your BOs in the action form. In this case action form should have session scope. Struts would populate your BOs as nested properties of action form. Less bloat in action form, but your BOs need to accept strings, to validate input, and to store whatever was set, even invalid data. Are you going to handle Refresh button and double submits? After I typed that huge email, I think I am entitled to a small plug :) Take a look at DialogAction at http://struts.sourceforge.net/strutsdialogs/dialogaction.html , maybe you could use some its ideas. Michael. On 6/14/05, Ovidiu EFTIMIE <[EMAIL PROTECTED]> wrote: > Hi, > I've recently started working on a project that uses Struts 1.2 and > Hibernate - and I'm in the dev team. Nothing unusual here. > The project architecture is made in such way that ActionForms are an > almost 1-1 mirror with the the Hibernate mapped entities. > For example : if I have an entity A that contains an entity B and a > list of etities C, in the corresponding forms I'll have Aform > containing Bform and a List of CForm objects. > > What I would like to know if anyone used the ActionForms in such a way > , or if this is considered to be a best practice. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: carriage returns
Aehm, this is not quite true. If you look in the generated jsp you will see a bunch of lines like this: _jsp_string14 = "\r\n ".toCharArray(); (this is for resin users, in tomcat jsps it will be somewhere in the code with write()) The jsp compiler usually handles all whitespaces before and after a tag as html code. This means, that if your IDE fills out idents with spaces, you have about 10% additional garbage in a tag heavy page. I've seen pages with 10K garbage, even with zip-on it's still waste of cpu and bandwith. Regards Leon > -Ursprüngliche Nachricht- > Von: Jason Sheldon [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 14. Juni 2005 23:17 > An: Struts Users Mailing List > Cc: struts-user@jakarta.apache.org > Betreff: Re: carriage returns > > What are your concerns with unwanted carriage returns? > > Do you think they are adding to the weight of the page? If > you a using a server that support the 1.1 http spec(with > compression), then the carriage returns apply a negible > amount of weight to the page. > > Jason > > On 6/14/05, draegoon Z <[EMAIL PROTECTED]> wrote: > > Hey guys, > > > > I'm finally sick of all the unwanted carriage returns > created by tiles > > and struts tags. > > I searched the archives and found this trick: > > > > > > > > > > > > but it doesn't fix everything, especially comments. > > > > Has anyone else gotten sick of this and came up with a > quick and clean > > solution? > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: carriage returns
Aehm, this is not quite true. If you look in the generated jsp you will see a bunch of lines like this: _jsp_string14 = "\r\n ".toCharArray(); (this is for resin users, in tomcat jsps it will be somewhere in the code with write()) The jsp compiler usually handles all whitespaces before and after a tag as html code. This means, that if your IDE fills out idents with spaces, you have about 10% additional garbage in a tag heavy page. I've seen pages with 10K garbage, even with zip-on it's still waste of cpu and bandwith. Regards Leon > -Ursprüngliche Nachricht- > Von: Jason Sheldon [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 14. Juni 2005 23:17 > An: Struts Users Mailing List > Cc: struts-user@jakarta.apache.org > Betreff: Re: carriage returns > > What are your concerns with unwanted carriage returns? > > Do you think they are adding to the weight of the page? If > you a using a server that support the 1.1 http spec(with > compression), then the carriage returns apply a negible > amount of weight to the page. > > Jason > > On 6/14/05, draegoon Z <[EMAIL PROTECTED]> wrote: > > Hey guys, > > > > I'm finally sick of all the unwanted carriage returns > created by tiles > > and struts tags. > > I searched the archives and found this trick: > > > > > > > > > > > > but it doesn't fix everything, especially comments. > > > > Has anyone else gotten sick of this and came up with a > quick and clean > > solution? > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using ActioForm in ActionForm practice
: I hated the 1-1 mirroring of action forms and business objects, so I wrote FormDef: https://formdef.dev.java.net/ . You may want to take a look at it, it'll save you time keeping the two in sync, and can also handle deep copying between the two, especially the current dev version ( https://formdef.dev.java.net/servlets/ReadMsg?list=users&msgNo=112 ). Hubert On 6/14/05, Ovidiu EFTIMIE <[EMAIL PROTECTED]> wrote: > Hi, > I've recently started working on a project that uses Struts 1.2 and > Hibernate - and I'm in the dev team. Nothing unusual here. > The project architecture is made in such way that ActionForms are an > almost 1-1 mirror with the the Hibernate mapped entities. > For example : if I have an entity A that contains an entity B and a > list of etities C, in the corresponding forms I'll have Aform > containing Bform and a List of CForm objects. > > What I would like to know if anyone used the ActionForms in such a way > , or if this is considered to be a best practice. > > Thanx, > Ovidiu > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: carriage returns
On 6/14/05, draegoon Z <[EMAIL PROTECTED]> wrote: > > I'm finally sick of all the unwanted carriage returns created by tiles and > struts tags. > I searched the archives and found this trick: > Just to clarify: If the trick you used worked on the CRs you see around the tags, that means the "unwanted carriage returns" aren't being "created by tiles and struts tags", it means you're putting them in there yourself. That's why when you eliminated the CRs in your JSP template text, they disappeared in the JSP output. ;) Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using ActioForm in ActionForm practice
Hi, I've recently started working on a project that uses Struts 1.2 and Hibernate - and I'm in the dev team. Nothing unusual here. The project architecture is made in such way that ActionForms are an almost 1-1 mirror with the the Hibernate mapped entities. For example : if I have an entity A that contains an entity B and a list of etities C, in the corresponding forms I'll have Aform containing Bform and a List of CForm objects. What I would like to know if anyone used the ActionForms in such a way , or if this is considered to be a best practice. Thanx, Ovidiu - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: carriage returns
What are your concerns with unwanted carriage returns? Do you think they are adding to the weight of the page? If you a using a server that support the 1.1 http spec(with compression), then the carriage returns apply a negible amount of weight to the page. Jason On 6/14/05, draegoon Z <[EMAIL PROTECTED]> wrote: > Hey guys, > > I'm finally sick of all the unwanted carriage returns created by tiles and > struts tags. > I searched the archives and found this trick: > > > > > > but it doesn't fix everything, especially comments. > > Has anyone else gotten sick of this and came up with a quick and clean > solution? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wildcard action paths
On 6/14/05, Laurie Harper <[EMAIL PROTECTED]> wrote: > The problem with that approach is duplication of information: you have > to know the URL structure in the action / tag / whatever that does the > URL parsing, as well as in struts-config.xml. And I don't need a single > pattern, there would be a number of them, so the URL parsing would > quickly get messy. > > L. You are starting to lose me here. To quote your original example: with URLs like this: /Sections/Section1/Subsections/Subsection1 An action mapping like this will match that URL: The problem is, there's then no way to get what the wildcards matched in the view (JSP). For reasons discussed elsewhere I don't want to put a different action in front of each view, so I need a more general solution. Okay. So maybe this isn't the only wildcard mapping you will have. Still, you could have one SectionAction class for this particular wildcard mapping. That would be a vast improvement over status quo. How many different wildcard mappings do you have in this application? You could pass one request parameter that indicated which wildcard pattern was involved. If you don't want to have branching logic, you could even make this additional request parameter be a property name and store in your application properties file the regular expression to use against the incoming request URL to pull out the matching wildcard values. That should scale generally to any number of different wildcard mappings using a single Action class that was driven by these regular expressions coming from your application properties file. -Van -- - Mike "Van" Riper [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wildcard action paths
On 6/13/05, Laurie Harper <[EMAIL PROTECTED]> wrote: > I didn't get any response to this last time so I'm asking again... :-) > > I'd like to replace URLs like this: > >/Sections/Subsections/?section=Section1&subsection=SubSection1 > > with URLs like this: > >/Sections/Section1/Subsections/Subsection1 You don't want to solve this with mod_rewrite, do you? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wildcard action paths
Van wrote: The problem is, there's then no way to get what the wildcards matched in the view (JSP). For reasons discussed elsewhere I don't want to put a different action in front of each view, so I need a more general solution. This seems so obvious to me that I'm probably missing something about your requirements. Why can't you access the HttpServleRequest.getRequestURI() method and then process the returned URI string in your subclass of the Struts ForwardAction? The execute method for an Action class gets the incoming request object as one of the parameters. Your subclass can process the URI for the section and subsection values and set them as request attributes. For that matter, the request object is available to your JSP pages as well: http://tinyurl.com/9jn4d Of course, you would have to write scriptlet logic or define a JSP custom tag to encapsulate the logic to parse for the section/subsection values in order to handle it directly in the JSPs. All easily doable though. I'm just not seeing what the problem is here. The problem with that approach is duplication of information: you have to know the URL structure in the action / tag / whatever that does the URL parsing, as well as in struts-config.xml. And I don't need a single pattern, there would be a number of them, so the URL parsing would quickly get messy. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: carriage returns
No clean solutions... Probably you need a better jsp compiler... What you can try is to use jsp comments: <%-- --%><%-- --%> If you have a good ide, you will at least be able to read the code... Another solutions is to put everything in a pack tag (which you have to write) and which would remove all empty lines (actually you can remove all CRs from your html, except javascript parts). Regards Leon > -Ursprüngliche Nachricht- > Von: draegoon Z [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 14. Juni 2005 22:22 > An: struts-user@jakarta.apache.org > Betreff: carriage returns > > Hey guys, > > I'm finally sick of all the unwanted carriage returns created > by tiles and struts tags. > I searched the archives and found this trick: > > > > > > but it doesn't fix everything, especially comments. > > Has anyone else gotten sick of this and came up with a quick > and clean solution? > > Thanks. > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: carriage returns
No clean solutions... Probably you need a better jsp compiler... What you can try is to use jsp comments: <%-- --%><%-- --%> If you have a good ide, you will at least be able to read the code... Another solutions is to put everything in a pack tag (which you have to write) and which would remove all empty lines (actually you can remove all CRs from your html, except javascript parts). Regards Leon > -Ursprüngliche Nachricht- > Von: draegoon Z [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 14. Juni 2005 22:22 > An: struts-user@jakarta.apache.org > Betreff: carriage returns > > Hey guys, > > I'm finally sick of all the unwanted carriage returns created > by tiles and struts tags. > I searched the archives and found this trick: > > > > > > but it doesn't fix everything, especially comments. > > Has anyone else gotten sick of this and came up with a quick > and clean solution? > > Thanks. > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ensuring valid forwards
FYI, just added Bugzilla ticket # 35361 regarding this. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Tue, June 14, 2005 7:53 am, David Whipple said: > I would really like to see this as well. > > > > > > "Frank W. > Zammetti" > <[EMAIL PROTECTED] To > com> Struts Users Mailing List > > 06/13/2005 05:59 cc > PM >Subject >Re: ensuring valid forwards > Please respond to >"Struts Users >Mailing List" > <[EMAIL PROTECTED] > he.org> > > > > > > > Yeah, that seemed a little too easy :) > > I would think it should throw an exception... Any Struts devs out there > have an opinion? I know someone (I forget who, sorry!) just mentioned > they added a warning that didn't make it into 1.2.7... A warning is > good, but I would personally think an exception would be better because > it's a pretty severe situation that deserves immediate attention (also a > situation that theoretically would never happen outside development... > at least, QA procedures better make that true! :) ). > > Frank > > Dan Tenenbaum wrote: >> On 6/13/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: >> >>>But again, I'm not certain this type of problem will be caught because > I'm >>>not even sure an exception is thrown in such a case. If it isn't that >>>strikes me as a bug. Anyone else know for sure? >>> >> >> >> I don't think it does throw an exception. I tried putting just the >> findForward() line in a try/catch block and nothing was thrown. Also, >> no stack traces appear in my tomcat log except a broken pipe error >> when trying to render the error page (there is nothing weird in the >> error page itself that would cause this). >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > > -- > 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] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sending dynamic parameters to a forward
You can, IIRC, append a query string to the URL returned by your forward... off the top of my head, it would look something like this... in Action 1: String param1Val = "someValue1"; String param2Val = "someValue2"; String queryString = "?param1=" + param1Val + "¶m2 = " + param2Val; ActionForward af = new ActionForward(mapping.findForward("ForwardToAction2")); af.setURL(af.getURL() + queryString); return af; You'll probably want to encode the parameter values, I'd suggest Commons Codec for that. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Tue, June 14, 2005 7:52 am, tarek.nabil said: > Hi Everyone, > > I have an action (Action1) which when completed successfully, forwards > to another action (Action2). I need to be able to send dyanamic > parameters to Action2. I thought about putting the parameters as request > attributes, but the problem here is that Action2 can be called directly > using a link from some pages and this case, the parameters will be send > as request parameters rather than attributes. > > I can write code to look in the request attributes and if not found, it > can check the request parameters, but I was hoping there's another way > to do it. I thought about setting the redirect attribute to true on this > forward but I still wouldn't know how to append parameters with dynamic > values to the forward while forwarding to it from Action1. > > Any ideas? > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
When you have you get a whatever.x and whatever.y returned as request parameters with x and y intergers showing the coordinates of the button press on the client. The simplest code you can have solving the problem is the ones at www.michaelmcgrady.com and mentioned by Jouravlev recently. I have got a kick out of him having the solution, supposedly on his own, without understanding the problem at all. This is another interesting and humorous instance of that amazing phenomenon. LOL If you provide a know value for whatever, such as "create" or "delete" in a CRUD applications, then you can run the request parameters through a loop and get the value of the image clicked without paying any attention to the value of the parameter. Note that the value attribute does not give you the value of the parameter attribute but can be used for other purposes. Good luck On 6/14/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > > You need to specify method name in "value" attribute. Since it is an > > image, it won't be shown: > > > > > value="myProcName" src="myimage.gif" /> > > > > The above should produce request like this: > > method.x=51&method.y=16&method=myProcName > > Hmm... Seems like MSIE do not add "method=myProcName" for > value="myProcName" for image tag. Strange. Maybe I need another HTTP > sniffer... > > Michael. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
Actually the images I use *do* scale automagically. It all depends upon how sophisticated you are in this sort of thing. On 6/14/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > On 6/14/05, Wendy Smoak <[EMAIL PROTECTED]> wrote: > > If you just want images on the buttons, you can do it with CSS and keep the > > (which you already have working): > > http://www.ampsoft.net/webdesign-l/image-button.html > > Neat! But images do not scale automatically, I prefer not to use them. > With images scaled form looks weird. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
carriage returns
Hey guys, I'm finally sick of all the unwanted carriage returns created by tiles and struts tags. I searched the archives and found this trick: but it doesn't fix everything, especially comments. Has anyone else gotten sick of this and came up with a quick and clean solution? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Themes
While Tiles is better for page composition I think you'll find SiteMesh better suited for overall site layout, especially for things like custom CSS/JavaScript/... based on request or session level parameters. -- Abdullah -Original Message- From: Wiebe de Jong [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 11:48 AM To: 'Struts Users Mailing List' Subject: RE: Themes Use CSS. Use one JSP/tile to get your content together, then based on the company setting, choose a CSS style sheet to go with it. The style sheet would contain your graphics, fonts, layouts, etc. Take a look at http://www.csszengarden.com/ to see the possibilities of this approach. Wiebe -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 5:22 PM To: Struts User Mailing List Subject: Themes I have a requirement to build a 'Themes' (think 'skins') capability into the UI of my Struts app and would just like to poll the list for ideas on the best way to approach such a mechanism. Multiple customers use the same app but they need to be presented with a view that meets their specific requirements. For example graphics, fonts and even layout would be specific to the user's login (actually their company/organization which is stored in the database). Now, for ease of use I guess something relying on CSS would be a way to go. Since I already use stylesheets for most HTML elements specifying a particular theme's stylesheet would not be hard. The tricky part is that I'd also like to be able to specify different jsp pages (mainly for Tiles layouts) in case I need to modify the layout beyond what is easy to do with CSS. Ultimately I may well have functionality in the app itself that is specific to a given customer so this concept should deal with handling customisation to that level well. Ideally I'd like to have a concept of an 'alternate source' directory that is used by the app to load it's jsp. i.e. the app first looks under the appropriate alternate directory for a jsp and uses the page it finds there if it exists but falls back to the standard jsp dir if there is no alternate. This would mean that I could create a theme with only those pages that need to be modified rather than copying and modifying the entire jsp source tree. If anyone has had to implement something along these lines I'd love to hear from you. What sort of mechanisms have you found work well within the structure of a Struts app? My architecture is Struts, Tiles, Spring and Hibernate if you are interested but I'm thinking that it's the Struts area that I'll be looking at mostly for this job. Are there any Struts sub-projects that touch on this sort of thing? Regards Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Themes
Use CSS. Use one JSP/tile to get your content together, then based on the company setting, choose a CSS style sheet to go with it. The style sheet would contain your graphics, fonts, layouts, etc. Take a look at http://www.csszengarden.com/ to see the possibilities of this approach. Wiebe -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 5:22 PM To: Struts User Mailing List Subject: Themes I have a requirement to build a 'Themes' (think 'skins') capability into the UI of my Struts app and would just like to poll the list for ideas on the best way to approach such a mechanism. Multiple customers use the same app but they need to be presented with a view that meets their specific requirements. For example graphics, fonts and even layout would be specific to the user's login (actually their company/organization which is stored in the database). Now, for ease of use I guess something relying on CSS would be a way to go. Since I already use stylesheets for most HTML elements specifying a particular theme's stylesheet would not be hard. The tricky part is that I'd also like to be able to specify different jsp pages (mainly for Tiles layouts) in case I need to modify the layout beyond what is easy to do with CSS. Ultimately I may well have functionality in the app itself that is specific to a given customer so this concept should deal with handling customisation to that level well. Ideally I'd like to have a concept of an 'alternate source' directory that is used by the app to load it's jsp. i.e. the app first looks under the appropriate alternate directory for a jsp and uses the page it finds there if it exists but falls back to the standard jsp dir if there is no alternate. This would mean that I could create a theme with only those pages that need to be modified rather than copying and modifying the entire jsp source tree. If anyone has had to implement something along these lines I'd love to hear from you. What sort of mechanisms have you found work well within the structure of a Struts app? My architecture is Struts, Tiles, Spring and Hibernate if you are interested but I'm thinking that it's the Struts area that I'll be looking at mostly for this job. Are there any Struts sub-projects that touch on this sort of thing? Regards Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [To sum it up] Re: Confused
Le 14 juin 2005 à 04:59, Stéphane Zuckerman a écrit : Hello Stéphane, ... Anyway, this little presentation is far from complete, and I suggest you read some doc about J2EE applications before going further with struts (java.sun.com is a good start). -- Stéphane Zuckerman The difficulty here is that there is lot of pieces that go together. There is a lot of choices and it is not clear for the new developers which path to fellow. I decided to buy the book 'Struts The Complete Reference' and I am only at the beginning. I'll continue to dig on the subject. I'm happy to see that there is community here for helping me. I fell already a lot more comfortable. Thank you. A+ -- Pierre
Re: Confused
Ok, I'll use Hibernate. Le 14 juin 2005 à 04:31, delbd a écrit : I could add, use EJBs only if you really can't do without them :D Things like Hibernate are more flexible an easy to use than EJB 2.0 and i heard the EJB 3.0 specs will be very similar to what current ORMapping like Hibernate does! A+ -- Pierre
Re: LookupDispatchAction
From: "Rafael Taboada" <[EMAIL PROTECTED]> > I tried to use css like Wendy said but alt option is missing. Missing from what? There is an 'alt' attribute for the tag. Are you trying to get 'hover text' on your submit button? I think that's the 'title' attribute. If you already have working, I would stick with that... as you've noted, clickable images as submit buttons are a bit of a pain. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
Yep, MSIE is a sucky one. For the following image button: Firefox generates the following: method.x=48&method.y=20&method=add while MSIE generates just the following: method.x=48&method.y=20 Hmm, how to obtain method name on MSIE? I don't know yet. But obviously I need to update my DialogAction to remove stinking ".x" and ".y". See, Jack, I did not know about this image thing. But I know know ;-) Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ensuring valid forwards
David Whipple wrote: I would really like to see this as well. +1 I had a very convoluted "solution" involving pre-processing my java/jsp/xml files (mostly for the automagic creation of web app documentation along with the bulk of CRUD actions/form pre-population/etc.) but an exception might be handy. Should it be configurable? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
> You need to specify method name in "value" attribute. Since it is an > image, it won't be shown: > > value="myProcName" src="myimage.gif" /> > > The above should produce request like this: > method.x=51&method.y=16&method=myProcName Hmm... Seems like MSIE do not add "method=myProcName" for value="myProcName" for image tag. Strange. Maybe I need another HTTP sniffer... Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ensuring valid forwards
The best way that I have found to counter this is to stick rigidly to a limited set of forward names, such as 'display', 'failed', 'insert', 'delete'. Hard-code them in a utility class as string finals, or as an enum if you use jdk 1.5. Make it part of your coding convention only to refer to map forwards from the utility class, so you are using only these strings as forward names. To avoid the problem with the blank page, set up global forwards with those names as well, and send them to an error page with an obvious error msg. The global forwards will be used by default when there is no local map-forward in your action mapping. I know there are often situations where a page has many possible consequent actions so you might not want to define your map-forward name set so rigidly. However such pages are big and cumbersome with lots of command buttons and I prefer to break them down into smaller pages. Regards Adam On 13/06/05 21:15 Hubert Rabago wrote: I recently checked in a change that would log a warning if mapping.findForward was called with a forward name that wasn't recognized. This change didn't make it to the 1.2.7 release, but is available from nightly builds. Apart from that, it wouldn't be too hard to customize/extend your Struts installation to handle it the way you'd wish. You can use a custom request processor that'd log or redirect or even use a custom ActionMapping class that can intercept findForward() calls. Hubert On 6/13/05, Dan Tenenbaum <[EMAIL PROTECTED]> wrote: My codebase has a lot of lines like this in struts actions: return mapping.findForward("foo"); If I make a typo and it turns out that "foo" is not a valid forward according to the struts config file, when I hit the action in the browser, I get a blank page. Not my designated error page. Is there some sort of struts-centric way to ensure that an exception is thrown and my error page appears? I just want to know if there is an existing mechanism to do this. I could easily write a method to do it (to be called instead of mapping.findForward()) but it seems that this is something Struts should handle. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
Rafael, first of all, as web developer you should always know what input your application receives. If you use Firefox, go to their plugin site and get LiveHTTPHeaders plugin, an invaluable thing. After you install it, you will be able to trace requests and responses. To save you time, I can tell you that when you click your image, browser sends to server something like this: method.x=51&method.y=16 DispatchAction and LookupDispatchAction expects a "method" parameter, not a "method.x" or "method.y". Also, you need somehow to signal which method do you want to call. You need to specify method name in "value" attribute. Since it is an image, it won't be shown: The above should produce request like this: method.x=51&method.y=16&method=myProcName I hope it works with DispatchAction, but I have not tested it. I think that you do not need LookupDispatchAction for this. Also check Dakota Jack's page: www.michaelmcgrady.com/button Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
From: "Rafael Taboada" <[EMAIL PROTECTED]> > altKey="ComprasNuevo.imagen.agregararticulo" > border="0" property="method" src="../images/Nuevo.png" /> > > javax.servlet.ServletException: Request[/ComprasNuevo] does not contain > handler parameter named 'method'. Did you look at the request parameters that ARE there? I bet you'll find two parameters: 'method.x' and 'method.y'. The browser is trying to tell you _where_ on the image the user clicked. Check the list archives for ways to deal with this, some people have posted alternate DispatchAction implementations that can handle images. Or maybe one of them has made it into Struts by now... I'm not sure. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
I think there are problems with property.x and property.y Do u know about it? How to solve it? -- Rafael Taboada Software Engineer Cell : +511-97753290 "No creo en el destino pues no me gusta tener la idea de controlar mi vida"
Re: LookupDispatchAction
Please. Any suggestions? Do u know about "ImageButtonDispatchAction.java in the archives of 'struts-user '"??? Where can I find it??? -- Rafael Taboada Software Engineer Cell : +511-97753290 "No creo en el destino pues no me gusta tener la idea de controlar mi vida"
Re: problem with indexed property and logic:iterate
Just passing you a solution I had got from the user list earlier Nitesh - Original Message - From: "John Fitzpatrick" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Friday, June 03, 2005 6:06 PM Subject: Re: Problem using indexed properties and validator framework In the struts-config.xml: In EditUsersAction.java execute method // get collection of users from the database Collection users = getUserBeans (); // put collection into form as an array for editing form.set ( "users", users.toArray ( new UserBean[0] ) ); In editUsers.jsp In the produced HTML: If you need to client side validation, you'll probably need to write your own JSP to deal with the element above. As for using validate.xml to validate on the server side. I've never tried it with arrays, I just iterate over them in the validate (...) method of the form, like so: UserBean users[] = (UserBean[]) form.get ( "users" ); for ( int i = 0; i < users.length; i++ ) { // check on the attributes of UserBean users[i] } Hope that example clears it up for you. John On 20050603 5:05 AM, "Nitesh" <[EMAIL PROTECTED]> wrote: Thanks for the answer John... Could you give me an example as to how we pre populate the array? Regards, Nitesh - Original Message - From: "John Fitzpatrick" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Thursday, June 02, 2005 6:00 PM Subject: Re: Problem using indexed properties and validator framework For an Array in a DynaForm property, you can either set the size in the form-property descriptor or, in the case of a session form, pre-populate the Array in your action with the number of elements you desire. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
Well my code is like this. In my jsp: In my Action class I extend LookupDispatchAction. Methods: protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("ComprasNuevo.boton.preagregarArticulo", "preagregarArticulo"); map.put("ComprasNuevo.boton.registrar", "agregarArticulo"); return map; } So, when I click on the button. The preagregarArticulo method will be called. As I said, all work fine. But I want to use html:image instead html:submit. Like this: But there is an error: javax.servlet.ServletException: Request[/ComprasNuevo] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text. org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java :224) org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java :258) org.apache.struts.actions.LookupDispatchAction.execute( LookupDispatchAction.java:162) org.apache.struts.action.RequestProcessor.processActionPerform( RequestProcessor.java:421) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter( MonitorFilter.java:362) My ActionMapping: How can I use html:image like html:button?? Maybe property="method" in html:image is called incorrectly??? I tried to use css like Wendy said but alt option is missing. -- Rafael Taboada Software Engineer Cell : +511-97753290 "No creo en el destino pues no me gusta tener la idea de controlar mi vida"
Re: LookupDispatchAction
On 6/14/05, Wendy Smoak <[EMAIL PROTECTED]> wrote: > If you just want images on the buttons, you can do it with CSS and keep the > (which you already have working): > http://www.ampsoft.net/webdesign-l/image-button.html Neat! But images do not scale automatically, I prefer not to use them. With images scaled form looks weird. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
Hi, create a hidden value that has name of the property of your LookupDispatchAction which is defined in your struts-config.xml . Then set the necessary value to the property when image is clicked. All you need is to send a parameter(property in your struts-config.xml ) with necessary value. hope I could explain well.. On Tue, 2005-06-14 at 09:09 -0500, Rafael Taboada wrote: > Hi folks. I'm using LookupDispatchAction in order to manage several > buttons > in a form. > All work fine, but I want to use html:image instead of html:submit > Please, do u know how to use that? I don't understand its attributes > very > well. > Thanks in advance >
Initial parameters
If I used traditional servlet, I can set initial parameters for every servlet in web.xml. How can I set parameters for Struts? Thanks, __ Discover Yahoo! Use Yahoo! to plan a weekend, have fun online and more. Check it out! http://discover.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sending dynamic parameters to a forward
http://marc.theaimsgroup.com/?l=struts-user&m=111841184227894&w=2 > I have an action (Action1) which when completed successfully, forwards > to another action (Action2). I need to be able to send dyanamic > parameters to Action2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
Cool... Thanks so much =) -- Rafael Taboada Software Engineer Cell : +511-97753290 "No creo en el destino pues no me gusta tener la idea de controlar mi vida"
Re: LookupDispatchAction
From: "Rafael Taboada" <[EMAIL PROTECTED]> > Hi folks. I'm using LookupDispatchAction in order to manage > several buttons in a form. > All work fine, but I want to use html:image instead of html:submit > Please, do u know how to use that? I don't understand its attributes very > well. If you just want images on the buttons, you can do it with CSS and keep the (which you already have working): http://www.ampsoft.net/webdesign-l/image-button.html Here is the list of attributes for : http://struts.apache.org/userGuide/struts-html.html#image What do you need help with? Are you possibly running into the issue where the browser sends buttonName.x and buttonName.y parameters instead of a single parameter? -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can struts-1.1 support multiple configurations and multiple resources
Manfred, THanks again for giving clarification. Here I got some solution. I used bundle parametre in so that I can find the Resources where It was tied to the key "sub" which is as I already mentioned given in struts-sub.xml like below But again I got some problem with validation files. Can struts-1.1 support multiple validation files? Thank you Manfred --Venkat -Original Message- From: Manfred Wolff [mailto:[EMAIL PROTECTED] Sent: Tue 6/14/2005 1:12 AM To: Struts Users Mailing List Cc: Subject:Re: Can struts-1.1 support multiple configurations and multiple resources --Venkat Thats the trick. If you set null to false, than *if* a error message is not found, the struts framework prints the language and the key, that is not found. So it says: You have an error here. So you have an other mistake. It is good practice to set null to false in all ressurce bundles, so you can see if anything is wrong. -Manfred Venkat Reddy Valluri wrote: >Hi Manfred, > I have given null="false" for my main module struts config file and still > the error message is not displayed > > instead it is just dipaying like below > en.us.error.user.user_name.required. (It is just displaying > property but not value) > >Thank you very much > >--Venkat > > > > > >-Original Message- >From: Manfred Wolff [mailto:[EMAIL PROTECTED] >Sent: Mon 6/13/2005 1:47 PM >To:Struts Users Mailing List >Cc: >Subject: Re: Can struts-1.1 support multiple configurations and multiple >resources >Venkat > >I think you don't have to deal with suffixes (like sub) because struts >itsselfs concatinate the module in the key, stored into the session. I >have a little example written for my struts book (only in german) that >deals with multiple struts config files. You may download it under > >http://struts-ge-packt.de/download/code.zip > >Because it is no maven project it comes with a lot of libraries. > >1st Struts config: (struts-config.xml) > > >2nd Struts config with Module (struts-modul-confix.xml) > > >It is a struts 1.2 application but the module support is fine in 1.1 > >-Manfred > >Venkat Reddy Valluri wrote: > > > >>Hi Manfred, >>Thank you very much for responding immediately. I ended up multiple >> struts config files successfully. But the thing is when I tried to use >> separate resources for each struts config file using bundle parametre, It >> seems not to be working. >> >>Here is my struts configurations >> >> In my main module struts config file >>I included below one >>struts-main.xml---> >>> parameter="com.main.examp.ApplicationResources"/> >> >> >>In my sub module struts config file >> >>I included below one >>struts-sub.xml---> >> > parameter="com.sub.examp.SubResources" key="sub"> >> >> >>SubResources.properties> >>error.user.user_name.required=UserName is required >> >>Here in my sub module >> >>SubEditActionForm.java---> >> >>In validate method I have given like this >> >>public ActionErrors validate(ActionMapping mapping, >>HttpServletRequest request) { >> ActionErrors errors = new ActionErrors(); >> >> if (user_name == null || user_name.length() == 0) { >> errors.add("user_name", new >> ActionError("error.user.user_name.required")); >> } >> return errors; >>} >> >>But here the error messgae "UserName is required" is not able to be displyed >>on screen when I submit the page with out entering user_name >> >> So I thought of passing buddle attribute "sub" which is used >> struts-sub.xml to ActionError class >>( >>> parameter="com.sub.examp.SubResources" key="sub"> >>) >> >> But there is no option to pass that attribute in ActionError or >> ActionMessage class >> >> SO here where I struck >> >>Can you please throw some light on this >> >>Thanks in advace >> >>--Venkat >> >> >> >> >> >> >> >> >> >> >>-Original Message- >>From: Manfred Wolff [mailto:[EMAIL PROTECTED] >>Sent: Mon 6/13/2005 10:00 AM >>To: Struts Users Mailing List >>Cc: >>Subject: Re: Can struts-1.1 support multiple configurations and multiple >>resources >> >>Yes it can with multiple module support. >> >>http://struts.apache.org/userGuide/configuration.html#dd_config_modules >> >>Manfred >> >>Venkat Reddy Valluri wrote: >> >> >> >> >> >>>Hi >>> >>> Can struts-1.1 support multiple configurations and multiple resources. Can >>> some body please throw some light on this. I need it very urgent >>> >>>Thanks in advance >>> >>>--Venkat >>> >>> >>> >>> >>> >>>- >>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >>> >> >> >> >> > > > > >-
Re: LookupDispatchAction
Dakota Jack worked with image buttons: www.michaelmcgrady.com/button Maybe you find this useful. On 6/14/05, Rafael Taboada <[EMAIL PROTECTED]> wrote: > Hi folks. I'm using LookupDispatchAction in order to manage several buttons > in a form. > All work fine, but I want to use html:image instead of html:submit > Please, do u know how to use that? I don't understand its attributes very > well. > Thanks in advance > > -- > Rafael Taboada > Software Engineer > > Cell : +511-97753290 > > "No creo en el destino pues no me gusta tener la idea de controlar mi vida" > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: reponse commited
Quickly glancing at your code I believe you need to return null such as ostr.close(); return null; HTH, Glenn Karthika L V somayajula <[EMAIL PROTECTED]> 14/06/2005 10:35 AM Please respond to "Struts Users Mailing List" To user@struts.apache.org cc Subject reponse commited I hope am into the right group I have a problem with downloading files using struts. I am using J2SDK 1.4.2_06 Struts 1.2.4 Jboss 4.0.1RC2 My download Action is : public ActionForward executeAction( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws BusinessDelegateException,IOException { ReportGenerateForm rform = (ReportGenerateForm) form ; ActionForward forward = mapping.findForward(Constant.DOWNLOAD_REPORT); ReportGenerateDelegate reportGenerateDelegate = new ReportGenerateDelegate(); int empId = getIntranetUser( request ).getEmployeeID(); String reportId = request.getParameter("rid"); String companyId = String.valueOf(getIntranetUser(request).getCompanyId()); String companyName = getIntranetUser(request).getCompanyName(); String projectId = Constant.STRING_ZERO; String projectName = Constant.BLANK; String fn = reportGenerateDelegate.getFileName(reportId); //prepend employee Id to file Name StringBuffer file = new StringBuffer(String.valueOf(empId)); file.append(Constant.FILENAME_SEPERATOR_LITERAL).append(fn); String fileName = new String(file); // scrub the company name ArrayList arr = new ArrayList(); arr.add(companyName); arr = (ArrayList)rform.validateData( arr ) ; String scrubbedCompanyName = (String)arr.get(0); IntranetLogger.logInfo("Scrubbed Comapny Name is "+scrubbedCompanyName); arr = null; if( fileName != null ) { File fname = new File(fileName); FileUpload fileUpload = new FileUpload(); String default_folder = Constant.REPORTS_FOLDER; String relativePath = FileUpload.getPathName (companyId,scrubbedCompanyName,projectId,projectName,default_folder); // append relative path to the Document Root defined in FileUpload.properties file String downloadPath = FileUpload.getPath(Constant.BLANK) + relativePath; IntranetLogger.logInfo("In DownloadReportAction FULL PATH of the file." + downloadPath); FileInputStream istr = null ; OutputStream ostr = null; try { IntranetLogger.logInfo("TOTAL DOWNLOAD PATH IS: " +(downloadPath + fname)); istr = new FileInputStream( downloadPath + fname); IntranetLogger.logInfo("File available? " + istr.available()); IntranetLogger.logInfo("File name "+fileName); if ( istr.available() == 0 ) { IntranetLogger.logInfo("File Not available" + fileName); addErrors("error.document.empty", fileName,request); } else { // set content type of the response object to Application/octet-stream. By setting this // we can download any type of file like txt, pdf, doc, xls etc response.setContentType("APPLICATION/OCTET-STREAM"); response.setHeader("Content-Disposition", "attachment;filename=\"" + fname.getName() +"\";"); IntranetLogger.logInfo("Reponse content type set"); // the following line is required to send a pop-up open-save-cancel file dialog box ostr = response.getOutputStream(); int bytesRead = 0; byte[] buffer = new byte[8192]; while( (bytesRead = istr.read(buffer, 0, 8192)) != -1) { ostr.write(buffer, 0, bytesRead); } //ostr.flush(); istr.close(); ostr.close(); addMessages("download.success", fileName, request); } }//try catch(Exception ex) { IntranetLogger.logInfo("Error in flushing out the Streams: "+ex.toString()); // if file already exists, then gives the proper messeage. addErrors("error.document.empty", fileName,request); //forward = mapping.findForward( Constant.GENERATE_REPORT) ; forward = mapping.findForward(Constant.DOWNLOAD_REPORT); } finally { try { istr.close(); ostr.close(); } catch(Exception ex) { IntranetLogger.logInfo("Major Error Releasing Streams: "+ex.toString()); addErrors("error.document.empty", fileName,request); } } try { response.flushBuffer(); } catch(Exception ex) { IntranetLogger.logInfo("Error flushing the Response: "+ex.toString()); addErrors("error.document.empty", fileName, request); } } return forward; } My jsp includes I get the list of file name with links in my JSP, one of which I click i should get a open, save file dialog box Now, when i click on the the filename on link I get the exception StandardWrapperValve[action]: cannot forward,reponse already commited Please reply if you find mistakes or errors in my action Thank you advance Karthika - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CanBaseTagHandler class be extended?
Can the BaseTagHandler class be extended ?? I would like to use "disabled" property from action form using setter methods. Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
reponse commited
I hope am into the right group I have a problem with downloading files using struts. I am using J2SDK 1.4.2_06 Struts 1.2.4 Jboss 4.0.1RC2 My download Action is : public ActionForward executeAction( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws BusinessDelegateException,IOException { ReportGenerateForm rform = (ReportGenerateForm) form ; ActionForward forward = mapping.findForward(Constant.DOWNLOAD_REPORT); ReportGenerateDelegate reportGenerateDelegate = new ReportGenerateDelegate(); int empId = getIntranetUser( request ).getEmployeeID(); String reportId = request.getParameter("rid"); String companyId = String.valueOf(getIntranetUser(request).getCompanyId()); String companyName = getIntranetUser(request).getCompanyName(); String projectId = Constant.STRING_ZERO; String projectName = Constant.BLANK; String fn = reportGenerateDelegate.getFileName(reportId); //prepend employee Id to file Name StringBuffer file = new StringBuffer(String.valueOf(empId)); file.append(Constant.FILENAME_SEPERATOR_LITERAL).append(fn); String fileName = new String(file); // scrub the company name ArrayList arr = new ArrayList(); arr.add(companyName); arr = (ArrayList)rform.validateData( arr ) ; String scrubbedCompanyName = (String)arr.get(0); IntranetLogger.logInfo("Scrubbed Comapny Name is "+scrubbedCompanyName); arr = null; if( fileName != null ) { File fname = new File(fileName); FileUpload fileUpload = new FileUpload(); String default_folder = Constant.REPORTS_FOLDER; String relativePath = FileUpload.getPathName (companyId,scrubbedCompanyName,projectId,projectName,default_folder); // append relative path to the Document Root defined in FileUpload.properties file String downloadPath = FileUpload.getPath(Constant.BLANK) + relativePath; IntranetLogger.logInfo("In DownloadReportAction FULL PATH of the file." + downloadPath); FileInputStream istr = null ; OutputStream ostr = null; try { IntranetLogger.logInfo("TOTAL DOWNLOAD PATH IS: " +(downloadPath + fname)); istr = new FileInputStream( downloadPath + fname); IntranetLogger.logInfo("File available? " + istr.available()); IntranetLogger.logInfo("File name "+fileName); if ( istr.available() == 0 ) { IntranetLogger.logInfo("File Not available" + fileName); addErrors("error.document.empty", fileName,request); } else { // set content type of the response object to Application/octet-stream. By setting this // we can download any type of file like txt, pdf, doc, xls etc response.setContentType("APPLICATION/OCTET-STREAM"); response.setHeader("Content-Disposition", "attachment;filename=\"" + fname.getName() +"\";"); IntranetLogger.logInfo("Reponse content type set"); // the following line is required to send a pop-up open-save-cancel file dialog box ostr = response.getOutputStream(); int bytesRead = 0; byte[] buffer = new byte[8192]; while( (bytesRead = istr.read(buffer, 0, 8192)) != -1) { ostr.write(buffer, 0, bytesRead); } //ostr.flush(); istr.close(); ostr.close(); addMessages("download.success", fileName, request); } }//try catch(Exception ex) { IntranetLogger.logInfo("Error in flushing out the Streams: "+ex.toString()); // if file already exists, then gives the proper messeage. addErrors("error.document.empty", fileName,request); //forward = mapping.findForward( Constant.GENERATE_REPORT) ; forward = mapping.findForward(Constant.DOWNLOAD_REPORT); } finally { try { istr.close(); ostr.close(); } catch(Exception ex) { IntranetLogger.logInfo("Major Error Releasing Streams: "+ex.toString()); addErrors("error.document.empty", fileName,request); } } try { response.flushBuffer(); } catch(Exception ex) { IntranetLogger.logInfo("Error flushing the Response: "+ex.toString()); addErrors("error.document.empty", fileName, request); } } return forward; } My jsp includes I get the list of file name with links in my JSP, one of which I click i should get a open, save file dialog box Now, when i click on the the filename on link I get the exception StandardWrapperValve[action]: cannot forward,reponse already commited Please reply if you find mistakes or errors in my action Thank you advance Karthika - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
LookupDispatchAction
Hi folks. I'm using LookupDispatchAction in order to manage several buttons in a form. All work fine, but I want to use html:image instead of html:submit Please, do u know how to use that? I don't understand its attributes very well. Thanks in advance -- Rafael Taboada Software Engineer Cell : +511-97753290 "No creo en el destino pues no me gusta tener la idea de controlar mi vida"
User Registration
Hi I have a link in my application for user registration form . It has combo box in the form that need to be populated from database. Say : Form action path is register.do and form name is register_form What should be the link and how we have to do mapping in struts-config.xml Regards Vijay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Themes
Well, as promised here is some feedback. I recommend the article : http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf Especially the section 7.4.3 Dynamic L & F. Regards Marty
Re: ensuring valid forwards
I would really like to see this as well. "Frank W. Zammetti" <[EMAIL PROTECTED] To com> Struts Users Mailing List 06/13/2005 05:59 cc PM Subject Re: ensuring valid forwards Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED] he.org> Yeah, that seemed a little too easy :) I would think it should throw an exception... Any Struts devs out there have an opinion? I know someone (I forget who, sorry!) just mentioned they added a warning that didn't make it into 1.2.7... A warning is good, but I would personally think an exception would be better because it's a pretty severe situation that deserves immediate attention (also a situation that theoretically would never happen outside development... at least, QA procedures better make that true! :) ). Frank Dan Tenenbaum wrote: > On 6/13/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > >>But again, I'm not certain this type of problem will be caught because I'm >>not even sure an exception is thrown in such a case. If it isn't that >>strikes me as a bug. Anyone else know for sure? >> > > > I don't think it does throw an exception. I tried putting just the > findForward() line in a try/catch block and nothing was thrown. Also, > no stack traces appear in my tomcat log except a broken pipe error > when trying to render the error page (there is nothing weird in the > error page itself that would cause this). > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > -- 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Themes
I seem to keep coming back to the 'put' definitions in my tiles defs. Is there a way that I can insert a variable into the value at runtime? Something like: This still doesn't answer the fall-back to 'original' jsp tree idea but it would be a start. Worst case I could keep a register of the pages that have alternates for a particular theme and sub in the dir when necessary otherwise leaving it blank to grab the base 'original' version. Obviously I don't want to setup a put for every theme page. This would get out of hand awful fast. Regards Marty -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Tuesday, 14 June 2005 4:36 PM To: Struts Users Mailing List Subject: RE: Themes Martin, If you're using tiles already, be sure to check out a tiles controller. It can insert pieces (putList) into your tile however you wish it, i.e. if the path is /members, if you set a (session?) cookie, etc. A tutorial on the capabilities of Tiles Controllers by Cedric Dumoulin which I wrote about earlier this week. The link is under the userGuide section for Tiles (at the bottom of the page). The site is in France but the tutorial is in English, if I recall correctly. I read it a year ago but it should still be relevant and current. Regards, David -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 2:09 AM To: 'Struts Users Mailing List' Subject: RE: Themes Thanks for the links David. The app is already using Tiles extensively and as a result I need something that integrates well with this framework. I've had a quick read of the SiteMesh and Xkins sites and plan to download and compare the two later today. Will post back any findings. Regards Marty -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Tuesday, 14 June 2005 2:58 PM To: Struts Users Mailing List Subject: RE: Themes Martin, Have you looked at any of these? a) Tiles http://struts.apache.org b) SiteMesh: http://www.opensymphony.com/sitemesh c) XKins: http://xkins.sourceforge.net/ Regards, David -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 8:22 PM To: Struts User Mailing List Subject: Themes I have a requirement to build a 'Themes' (think 'skins') capability into the UI of my Struts app and would just like to poll the list for ideas on the best way to approach such a mechanism. Multiple customers use the same app but they need to be presented with a view that meets their specific requirements. For example graphics, fonts and even layout would be specific to the user's login (actually their company/organization which is stored in the database). Now, for ease of use I guess something relying on CSS would be a way to go. Since I already use stylesheets for most HTML elements specifying a particular theme's stylesheet would not be hard. The tricky part is that I'd also like to be able to specify different jsp pages (mainly for Tiles layouts) in case I need to modify the layout beyond what is easy to do with CSS. Ultimately I may well have functionality in the app itself that is specific to a given customer so this concept should deal with handling customisation to that level well. Ideally I'd like to have a concept of an 'alternate source' directory that is used by the app to load it's jsp. i.e. the app first looks under the appropriate alternate directory for a jsp and uses the page it finds there if it exists but falls back to the standard jsp dir if there is no alternate. This would mean that I could create a theme with only those pages that need to be modified rather than copying and modifying the entire jsp source tree. If anyone has had to implement something along these lines I'd love to hear from you. What sort of mechanisms have you found work well within the structure of a Struts app? My architecture is Struts, Tiles, Spring and Hibernate if you are interested but I'm thinking that it's the Struts area that I'll be looking at mostly for this job. Are there any Struts sub-projects that touch on this sort of thing? Regards Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E
problem with indexed property and logic:iterate
Hello all, I have a DynaActionForm with two properties of type String[], one named priorities and the other named owner I am having problem in displaying their value in my jsp using logic:iterate My JSP is as follows 1 2 3 4 5 somehow I cannot set the value of both owners and priorities for each line.. anyone could help? Unfortunately I cannot use JSTL so if someone could point out what I am doing wrong... thanx in advance and regards marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Sending dynamic parameters to a forward
Hi Everyone, I have an action (Action1) which when completed successfully, forwards to another action (Action2). I need to be able to send dyanamic parameters to Action2. I thought about putting the parameters as request attributes, but the problem here is that Action2 can be called directly using a link from some pages and this case, the parameters will be send as request parameters rather than attributes. I can write code to look in the request attributes and if not found, it can check the request parameters, but I was hoping there's another way to do it. I thought about setting the redirect attribute to true on this forward but I still wouldn't know how to append parameters with dynamic values to the forward while forwarding to it from Action1. Any ideas? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:option
Hello Amitava, [EMAIL PROTECTED] a écrit : I want xxx Is there a way out to select a default value at design time? (I hate javascript!!... lol. ) You could always prepopulate your form before forwarding to the JSP : public ActionForward execute(...) { form.setMySelect("my value"); ... return mapping.findForward("/toMyJsp"); } -- Stéphane Zuckerman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[To sum it up] Re: Confused
Hello Pierre, Struts is "just" too big a project to stay among its siblings under the Jakarta general project, which is why it is "on its own". I have just installed Tomcat 5 for Java WSDP. Do I need this version to make Struts development or can I use the regular 5.5 version too? I have installed both. If you use JBoss, there is an embedded version of Tomcat 5 with it. You don't need anything else. Also, I would like to know how can I have access to J2EE? I am on Mac OS 10.4 and as I know I need JBoss to have access to J2EE. If you use JBoss to do your work, that's fine : it works great. Just don't forget to put your webapp in the $JBOSS_DIR/server/{default,minimal,all}/deploy directory (either as a WAR archive, or as a yourapp.war directory). For instance, I use the "default" server, that leads to a path like : C:\jboss\jboss-4.0.1\server\default\deploy\my_webapp.war (I am currently using MS-Windows for my devs) I have installed JBoss on my machine too. But I don't understand how can I use Tomcat, JBoss and Struts altogether. Can you help me? Struts is a collection of Java packages that you must embed with your web application. You must understand how a J2EE application is built (which is a bit beyond the scope of this mailing list, I think). Basically, this means your application will have the following structure : +---WEB-INF | +-classes | +-lib | | +---META-INF WEB-INF contains configuration files (such as web.xml, and struts-config.xml), definition files (for instance the taglib definition files), etc. ; its subdirectories contain the various compiled classes (the "classes" directory ;-) ), and the various packages you hava to embed with your application (for instance, struts.jar ;-) ). Anyway, this little presentation is far from complete, and I suggest you read some doc about J2EE applications before going further with struts (java.sun.com is a good start). -- Stéphane Zuckerman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:option
use tag along with the or print XXX using Thanks and Regards, Nitish Kumar Tavant Technologies Ltd Bangalore -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 11:53 AM To: user@struts.apache.org Subject: html:option I want xxx Is there a way out to select a default value at design time? (I hate javascript!!... lol. ) Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Confused
I could add, use EJBs only if you really can't do without them :D Things like Hibernate are more flexible an easy to use than EJB 2.0 and i heard the EJB 3.0 specs will be very similar to what current ORMapping like Hibernate does! Le Mardi 14 Juin 2005 10:08, Daniel Perry a écrit : > No, > J2EE is a NOT EJBS! > J2EE is a collection of technologies, including servlets, jsp, EJBs, etc. > > Tomcat hosts various parts of J2EE - servlets, jsps, etc, but it is not a > full J2EE container - it doesnt host EJBs. But you can use servlets, JSP > and taglibs without using EJBs. I do. I've never used an EJB. > > Daniel. > > > -Original Message- > > From: Pierre Thibault [mailto:[EMAIL PROTECTED] > > Sent: 14 June 2005 04:51 > > To: Struts Users Mailing List > > Subject: Re: Confused > > > > > > Yes, I want to use Beans. > > > > Do you mean that I can use servlets, JSP and taglibs without J2EE? > > > > Le 13 juin 2005 à 16:42, Dave Newton a écrit : > > > Pierre Thibault wrote: > > >> There are talking about Tomcat but not about JBoss. I'll continue > > >> with JBoss because I want to access J2EE. > > > > > > I think you might be confused about what "J2EE" is. If you need > > > EJBs, then yeah, JBoss would be one way to go. If you don't, > > > there's a lot of other parts of J2EE, like servlets, JSP, taglibs, > > > etc.. > > > > > > Dave > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- David Delbecq Royal Meteorological Institute of Belgium - Is there life after /sbin/halt -p? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Presenting one application in another
Hi, I am planning to build an web application that will manage a number of servers on a network using RMI. Each of these servers today has a local web interface that uses Struts, the RMI functionality is already in place and functional. What i would like to do is move the web interfaces to the central position and show the correct interface for each server depending on the users choice. The problem is that i need to be able to add new types and versions of the interfaces without having to redeploy since the application will be distibuted to a number of customers. I am hoping to be able to use a separate web app for each type/version and presenting it in a tile in the central application. Simply having the different interfaces as modules or something similar. Is it possible to show one web app in a tile of another or am i heading down a dead end using this aproach? And in that case, any other suggestions? thank you in advance, /Björn Höglund _ Nyhet! MSN Messenger i Mobiltelefonen! http://mobile.msn.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Confused
No, J2EE is a NOT EJBS! J2EE is a collection of technologies, including servlets, jsp, EJBs, etc. Tomcat hosts various parts of J2EE - servlets, jsps, etc, but it is not a full J2EE container - it doesnt host EJBs. But you can use servlets, JSP and taglibs without using EJBs. I do. I've never used an EJB. Daniel. > -Original Message- > From: Pierre Thibault [mailto:[EMAIL PROTECTED] > Sent: 14 June 2005 04:51 > To: Struts Users Mailing List > Subject: Re: Confused > > > Yes, I want to use Beans. > > Do you mean that I can use servlets, JSP and taglibs without J2EE? > > Le 13 juin 2005 à 16:42, Dave Newton a écrit : > > > Pierre Thibault wrote: > > > > > >> There are talking about Tomcat but not about JBoss. I'll continue > >> with JBoss because I want to access J2EE. > >> > > > > I think you might be confused about what "J2EE" is. If you need > > EJBs, then yeah, JBoss would be one way to go. If you don't, > > there's a lot of other parts of J2EE, like servlets, JSP, taglibs, > > etc.. > > > > Dave > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Themes
I'm googling now for the article you mentioned since it isn't clear to me exactly where you meant. If you have a URL I'd appreciate it. This Tiles Controller looks like it is worth a good look. Regards Marty -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Tuesday, 14 June 2005 4:36 PM To: Struts Users Mailing List Subject: RE: Themes Martin, If you're using tiles already, be sure to check out a tiles controller. It can insert pieces (putList) into your tile however you wish it, i.e. if the path is /members, if you set a (session?) cookie, etc. A tutorial on the capabilities of Tiles Controllers by Cedric Dumoulin which I wrote about earlier this week. The link is under the userGuide section for Tiles (at the bottom of the page). The site is in France but the tutorial is in English, if I recall correctly. I read it a year ago but it should still be relevant and current. Regards, David -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 2:09 AM To: 'Struts Users Mailing List' Subject: RE: Themes Thanks for the links David. The app is already using Tiles extensively and as a result I need something that integrates well with this framework. I've had a quick read of the SiteMesh and Xkins sites and plan to download and compare the two later today. Will post back any findings. Regards Marty -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Tuesday, 14 June 2005 2:58 PM To: Struts Users Mailing List Subject: RE: Themes Martin, Have you looked at any of these? a) Tiles http://struts.apache.org b) SiteMesh: http://www.opensymphony.com/sitemesh c) XKins: http://xkins.sourceforge.net/ Regards, David -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 8:22 PM To: Struts User Mailing List Subject: Themes I have a requirement to build a 'Themes' (think 'skins') capability into the UI of my Struts app and would just like to poll the list for ideas on the best way to approach such a mechanism. Multiple customers use the same app but they need to be presented with a view that meets their specific requirements. For example graphics, fonts and even layout would be specific to the user's login (actually their company/organization which is stored in the database). Now, for ease of use I guess something relying on CSS would be a way to go. Since I already use stylesheets for most HTML elements specifying a particular theme's stylesheet would not be hard. The tricky part is that I'd also like to be able to specify different jsp pages (mainly for Tiles layouts) in case I need to modify the layout beyond what is easy to do with CSS. Ultimately I may well have functionality in the app itself that is specific to a given customer so this concept should deal with handling customisation to that level well. Ideally I'd like to have a concept of an 'alternate source' directory that is used by the app to load it's jsp. i.e. the app first looks under the appropriate alternate directory for a jsp and uses the page it finds there if it exists but falls back to the standard jsp dir if there is no alternate. This would mean that I could create a theme with only those pages that need to be modified rather than copying and modifying the entire jsp source tree. If anyone has had to implement something along these lines I'd love to hear from you. What sort of mechanisms have you found work well within the structure of a Struts app? My architecture is Struts, Tiles, Spring and Hibernate if you are interested but I'm thinking that it's the Struts area that I'll be looking at mostly for this job. Are there any Struts sub-projects that touch on this sort of thing? Regards Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]