Tomcat performance - Was Clever trick required
Hi First of all: Please direct these types of questions to the proper maillisting for Tomcat. Tomcat is as I stated, first and foremost a Servlet engine (Reference implementation), and is as such tuned for that. My guess is that if you are having performance problems, that these are due to hardware insuficies. Most likely to little avavailable memory, or that your application is badly written. By badly written I mean for instance that there is a lot of garbage collection occurring. Hermod -Opprinnelig melding- Fra: Martin Gainty [mailto:[EMAIL PROTECTED] Sendt: 18. oktober 2005 15:14 Til: Struts Users Mailing List Emne: Re: Clever trick required Hermod- Currently I am currently running tomcat 5.5.7 and not using any HTTP server for front end If I have no legacy CGI / Perl scripts or static content to server up would I need to front end Tomcat with an HTTP Server? What are the performance considerations for Tomcat standalone vs FrontEnded with an HTTP Server? Takk Martin- - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Tuesday, October 18, 2005 4:20 AM Subject: SV: Clever trick required Hi Your running Tomcat as an HTTP Server? Why? Tomcat is a Servlet engine and is not optimized for serving static content. You should put Apache Http server in front of it, serving static content. I have Tomcat running on servers, and have seen more that 1200 concurrent sessions on it without any problem at all. Hermod -Opprinnelig melding- Fra: Neil Meyer [mailto:[EMAIL PROTECTED] Sendt: 18. oktober 2005 10:12 Til: Struts Users Mailing List Emne: RE: Clever trick required Hi, I know this is probably of topic but I have huge problems with my webserver. We are running struts on this server under Tomcat 5.1. It seems like the tomcat server can't handle load. Any comment or recommendations will really be appreciated. I'm looking at Sun web server now. Regards Neil Meyer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DnB NOR Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the virus programs used in the DnB NOR Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - 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]
form.submit() issue with
I seem to have a issue using 's onclick. My value of onclick is a javascript performing form.submit(), but I found out this is not working. However if I chang my button to then the javascript is working. Why this is the case? Thanks. - Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
Re: What's wrong with DTOs?
George Could you explain on how MVC patterns are fractal? Thanks, Martin- - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Tuesday, October 18, 2005 4:49 PM Subject: RE: What's wrong with DTOs? From: Leon Rosenberg P.S. Have you ever considered, that the View itself can be an MVC as well? Yes, patterns are fractal. - 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: I am getting frustrated with LookupDispatchAction
On 10/18/05, Adam Hardy <[EMAIL PROTECTED]> wrote: > Michael, > > I like your code alot but a couple of things prevent me from purloining > it for my own purposes: > > firstly, I like to allocate my base class to sort out user, locale, > msgKeys, and messages objects for use in the subclass. It doesn't seem > to be possible to sandwich a subclass in-between SelectAction and the > child class to do this, isn't that so? I guess I have to make an utility class out of it, so it could be called from any Action.execute(). I will do that. > Secondly, getKeyMethodMap() looks really clunky - is there no way this > can be pushed into the struts-config.xml? It can be done, but if this to be defined inside existing structures like , then I would have to change Struts code. Another way is to define it somewhere else like instead of or just , in this case you would need to include custom ruleset object into web.xml. The latter would be easier because Struts code would not be changed. I will think about moving map to config file, but frankly I do not consider it a priority. Why you don't like it in the class file? What benefit do you expect from moving it to config file? YOu want to be able to remap handlers? BTW, you can purloin ;) from another link that I posted, that version does not use map at all and is _very_ compact. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I am getting frustrated with LookupDispatchAction
Michael, I like your code alot but a couple of things prevent me from purloining it for my own purposes: firstly, I like to allocate my base class to sort out user, locale, msgKeys, and messages objects for use in the subclass. It doesn't seem to be possible to sandwich a subclass in-between SelectAction and the child class to do this, isn't that so? Secondly, getKeyMethodMap() looks really clunky - is there no way this can be pushed into the struts-config.xml? Adam Michael Jouravlev on 18/10/05 23:30, wrote: This action class is inspired by LookupDispatchAction, but it does not use property file and does not tie button caption to property name. Actually, it supports "parameter" to be compatible with original DispatchAction. On the other hand, if you think that hashmap brings an unnecessary overhead, then sticking method name directly into request key is simpler. No hashmaps, and clickable images are elegantly supported, but one can spot handler method name right from the browser, and rearrange the names names. If you don't care for visible method names, you can check out my version based on idea of parsing "dotted" request key: http://issues.apache.org/bugzilla/attachment.cgi?id=15762 I first saw this parsing style on McGrady's website and borowed it from there. I am not pretending that this particuar idea is mine. The class from the link above has some comments here and there, and tries not to duplicate DispatchAction code. I think that this solution is compact and clean and could be a very good alternative/replacement to current DispatchAction, but I don't want to argue anymore on who stole from whom and why others can or cannot use it or why it cannot be included into Struts core. I needed a good dispatch action for my event-based library, I guess what I have now is good enough and allows to write well-structured code. Also, I get a level of indirection which hides actual method names from a user, so I will stick to what I have. Michael. On 10/18/05, Martin Gainty <[EMAIL PROTECTED]> wrote: Michael Without a doubt this is the most intuitive page I have ever seen I take it the lack of support for orphaned 'parameter' action attribute is overcome with inserting map events to method handlers via HashMap such as this example protected Map getKeyMethodMap() { Map map = new HashMap(); map.put(getInitKey()+"-ADD", "add"); map.put(getInitKey()+"-DELETE", "delete"); map.put(getInitKey()+"-CREATE", "create"); map.put(getInitKey()+"-LOGIN", "login"); return map; } //where methods are coded as // Handler of Add button public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println("--> add"); return mapping.findForward("addpage"); } Very insightful.. Martin- - Original Message - From: "Michael Jouravlev" <[EMAIL PROTECTED]> On 10/17/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi. I am using struts 1.2.7. My struts-config-xml file has the following: my jsp has the following: But I get the following error in tomcat: javax.servlet.ServletException: Request[/mywizard1] does not contain handler parameter named 'method'. Can someone save me from insanity? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Default values for Multiple Select
Natalie, Your question isn't clear If you're dealing with multiple checkboxes, the property backing them should be a String[] so you can capture all the values selected. If you're dealing with multiple options of a radio group, only one option will ever be selected. Paul __ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I am getting frustrated with LookupDispatchAction
This action class is inspired by LookupDispatchAction, but it does not use property file and does not tie button caption to property name. Actually, it supports "parameter" to be compatible with original DispatchAction. On the other hand, if you think that hashmap brings an unnecessary overhead, then sticking method name directly into request key is simpler. No hashmaps, and clickable images are elegantly supported, but one can spot handler method name right from the browser, and rearrange the names names. If you don't care for visible method names, you can check out my version based on idea of parsing "dotted" request key: http://issues.apache.org/bugzilla/attachment.cgi?id=15762 I first saw this parsing style on McGrady's website and borowed it from there. I am not pretending that this particuar idea is mine. The class from the link above has some comments here and there, and tries not to duplicate DispatchAction code. I think that this solution is compact and clean and could be a very good alternative/replacement to current DispatchAction, but I don't want to argue anymore on who stole from whom and why others can or cannot use it or why it cannot be included into Struts core. I needed a good dispatch action for my event-based library, I guess what I have now is good enough and allows to write well-structured code. Also, I get a level of indirection which hides actual method names from a user, so I will stick to what I have. Michael. On 10/18/05, Martin Gainty <[EMAIL PROTECTED]> wrote: > Michael > Without a doubt this is the most intuitive page I have ever seen > I take it the lack of support for orphaned 'parameter' action attribute is > overcome with inserting map events to method handlers via HashMap such as > this example > protected Map getKeyMethodMap() { > Map map = new HashMap(); > map.put(getInitKey()+"-ADD", "add"); > map.put(getInitKey()+"-DELETE", "delete"); > map.put(getInitKey()+"-CREATE", "create"); > map.put(getInitKey()+"-LOGIN", "login"); > return map; > } > //where methods are coded as > // Handler of Add button > public ActionForward add(ActionMapping mapping, >ActionForm form, >HttpServletRequest request, >HttpServletResponse response) > throws IOException, ServletException { > System.out.println("--> add"); > return mapping.findForward("addpage"); > } > Very insightful.. > Martin- > > - Original Message - > From: "Michael Jouravlev" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" > Sent: Tuesday, October 18, 2005 12:09 PM > Subject: Re: I am getting frustrated with LookupDispatchAction > > > On 10/17/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi. I am using struts 1.2.7. My struts-config-xml file has the following: > > > > > name="wizardForm" > > scope="session" > > type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction" > > input="/step1.jsp" > > validate="false" > > parameter="method"> > > > > > > > > my jsp has the following: > > > key="button.next"/> > > > > But I get the following error in tomcat: > > javax.servlet.ServletException: Request[/mywizard1] does not contain > > handler parameter named 'method'. > > > > Can someone save me from insanity? > > Try this instead: > http://struts.sourceforge.net/strutsdialogs/selectaction.html > You do not have to use Struts tags with it, just HTML. Works with > buttons, links and images. Consider it an improved > LookupDispatchAction. > > The library also allows you to build a robust wizard component. > > -- > Struts Dialogs > http://struts.sourceforge.net/strutsdialogs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: What's wrong with DTOs?
> From: Leon Rosenberg > > P.S. Have you ever considered, that the View itself can be an > MVC as well? Yes, patterns are fractal. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: What's wrong with DTOs?
Only fair to mark this thread OT by now, hope no one minds... Talking about the view that considers what goes on in Struts Actions to be part of the view, here's why I don't agree with that perception... In that view, if I have a webapp and later want to make it a Swing-based app, I would be throwing away not only the JSPs but also the Actions. In fact, all I'd be keeping is the "Model" components, the real business logic guts of the app. This is the typical approach taken. However, in my view, If I have that webapp, I would only throw away the JSPs, which is what I consider the View, and only the JSPs. The way I write apps, the calls to the server made from a browser are either viewed as events or service requests. In fact, the whole paradigm is simply termed Service-Oriented Architecture. If you view a webapp as a sequence of pages, then you tend to have trouble doing what I'm saying because the underlying architecture is a contrary one. Instead of coding into the Swing app what should happen when a user clicks a button for instance, what window should be shown perhaps, this decision is pushed back onto the server. A normal HTTP request is made that determines the next window to show. Now, the difference is that the new view is not rendered on the server as with JSPs. Instead, a code is returned that the Swing code interprets and displays the appropriate "response". In this regard, the Swing app is strictly the View. The Control layer, still implemented in Struts, remains the same, and has no knowledge that its now dealing with a Swing app instead of JSPs... the only difference is that I use the JSPs that an Action forwards to in order to render the code that the Swing app recognizes. The JSPs are something like this: <%="showCustomerEditWindow"%> Literally, that's it! Wouldn't even be a scriplet in reality, but I showed it that way to illustrate what's going on. This code tells the Swing code to display a particular window, but it doesn't tell it anything about what the presentation looks like, that's all up to the Swing code. Usually I would have the JSP also send back a serialized version of the ActionForm so I can have my data too. Now, it's easy to remove the JSPs if I want to and do this all from the Actions, it's arguably a superfluous step to go to a JSP. But, the nice thing about it is that all I do is change the JSPs in struts-config to not point to the JSPs that render a browser-based page, but instead points to the pages that renders the codes the Swing app can make sense of. In this way, switching from a web-based app to a Swing-based app, as far as the code on the server goes, is nothing but changing a config file. NO code needs to be touched. The point I'm trying to make is that if I viewed the Actions, and indeed all of Struts, as part of the View and not the Control, I'd be throwing a lot more away than I need to. I mean, the flow of the application still exists in Struts, the Swing app is just another way to represent things to the user. This is why when we talk about the "webapp" being not only the JSPs but the Actions and ActionForms, etc., I believe that view leads not to less work to change, but MORE work, and as such does not represent "proper" separation or description of MVC (as we know it today at least). I admit I've never done this in a production environment, but as a proof-of-concept about 3 years ago I took an existing webapp, a relatively complex one too, and did exactly what I'm talking about... I threw together a Swing-based front-end and used it instead of a browser. It worked perfectly. Now, the obvious drawback is performance. You *do* pay a penalty doing this vs. a "typical" Swing app where there are no server calls involved. Not to mention the question of what's the point?? So, the whole premise probably doesn't make a whole lot of sense to begin with (switching a webapp to a Swing app in this fashion I mean). But it can be done, and by thinking of what lives in Struts as truly the Control layer, and keeping that separate from the View and the Model (the model being everything else, the real "guts" of the app), you have the flexibility to change presentations without doing more than you really have to, i.e., recoding the flow of the application. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Tue, October 18, 2005 3:37 pm, Christian Bollmeyer said: > [EMAIL PROTECTED] schrieb: > > +1. The first thing I always preach new developers > on my team is that they should think the entire web > tier away and replace it (mentally) with a Swing or > whatever client, without changing anything in the > subsequent layers, and the application still has to > work as usual. From an architectural view, the > entire OO thing is about loose coupling, separation > of concerns and minimizing dependencies. Now > MVC - a pattern emerging from
Re: What's wrong with DTOs?
+1. .V Christian Bollmeyer wrote: [EMAIL PROTECTED] schrieb: +1. The first thing I always preach new developers on my team is that they should think the entire web tier away and replace it (mentally) with a Swing or whatever client, without changing anything in the subsequent layers, and the application still has to work - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's wrong with DTOs?
On 10/18/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I can't answer for Ted, but I consider *all* of MVC to be > > part of the > > > view tier. The Model is just the presentation layer's view of the > > > business system. It should be abstract and opaque and > > contain all of > > > the business logic. > > > > So the model is the enterprise system which the presentation > > layer lies upon, or in other words the business components > > interfaces and protocols (objects)? > > > > Right? > > Yes, and the Model can be DTOs and Business Delegates (a procedural > interface that separates data and code) or can be OO Business objects > exposed through interfaces (and which may, in turn, proxy via DTOs and > Business Delegates to a remote implementation). Ok... but I think that we've had this discussion about 20 times last year on this list, so, whats the point? :-) regards Leon P.S. Have you ever considered, that the View itself can be an MVC as well? Like the servlet/action is the controller, the bean is the model, and the jsp the view? More, the business logic can be the view on the persistence logic or vice versa, depends on how you define the interfaces. Like in a layered architecture business logic is the view on the persistence, since it's using the persistence's interfaces and objects, and in a business-logic-centric architecture persistence is another view on the business logic, since it's using business logic objects in its interfaces (pretty similar, but the difference is where the protocol (the data objects) are defined. I don't know whether you was watching an OT discussion some months ago, as Ted has brought up the "Olympic Ring" Metaphor, which can be interpreted (my personal interpretation) by each layer being the view of the underlying layer, therefore the architecture being a row of circular MVCs. Search the list for the topic "[OT] DTOs are evil" for messages in the beginning of august. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's wrong with DTOs?
[EMAIL PROTECTED] schrieb: +1. The first thing I always preach new developers on my team is that they should think the entire web tier away and replace it (mentally) with a Swing or whatever client, without changing anything in the subsequent layers, and the application still has to work as usual. From an architectural view, the entire OO thing is about loose coupling, separation of concerns and minimizing dependencies. Now MVC - a pattern emerging from its first Xerox in- carnation some 25 years ago, originally invented for SmallTalk-based rich clients and targeted at helping to coordinate keyboard input, 'business logic' (as understood back then, mysteriously named 'Model') and monitor output in a responsibility-oriented way, has since been adapted to different technologies including the web. Still, it's strictly about getting input and showing things from the Model. Now, unlike in the old days, applications are usually architecturally somewhat more complex now- adays and split into different layers (naming varies). Usually, there's at least one layer for the 'business logic' (a.k.a the application) and a subsequent one for resource access. Both of them are relative long- lived compared to the client (web) tier which can change every few years, from Struts to JSF or whatever, whereas the business logic itself tends to stay relatively static (usually the database itself is the part with the longest lifespan, database models easily reaching the age of 30 or more). There- fore, IMHO it's a good idea to keep heed of a strict separation of architectural layers throughout the entire application, providing interfaces like BusinessDelegate or Facade to be used by different client implementa- tions in a consistent way even in case of a complete technology change in the client tier. This may possibly require more work to keep thing as abstract as possible, but I'm quite confident it'll pay some day. And that's where DTOs (or ValueObjects, which originally were designed to address granu- larity issues when dealing with EJB and the like) or domain classes come in. I, for once, don't want to see *any* web-related stuff in my backing layers; no document/view con- siderations here. Better leave that ground to the few remaining MFC adepts who still think C++ is the one true solution to every- thing. MVC, then, was born as a 'client' pattern and stays one. YMMV, as always :-) -- Chris. -Original Message- From: Dave Newton I'm still not clear on how the entirety of MVC is the V It's not. MVC is a View Tier pattern, though. Within the pattern it separates the Model, an abstraction of the business logic, the View, which displays a representation of the Model, and the Controller, which translates user input into requests to the Model. The point is to bring clarity to the Presentation Layer. See http://idiacomputing.com/moin/LayeredArchitecture#head-386ccace28b9d5122 1f9ed6fe4dc1c59581ef0b5 Many people learning MVC for the first time mistake this presentation layer pattern for an architecture of an entire application. - George - 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: I am getting frustrated with LookupDispatchAction
Michael Without a doubt this is the most intuitive page I have ever seen I take it the lack of support for orphaned 'parameter' action attribute is overcome with inserting map events to method handlers via HashMap such as this example protected Map getKeyMethodMap() { Map map = new HashMap(); map.put(getInitKey()+"-ADD", "add"); map.put(getInitKey()+"-DELETE", "delete"); map.put(getInitKey()+"-CREATE", "create"); map.put(getInitKey()+"-LOGIN", "login"); return map; } //where methods are coded as // Handler of Add button public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println("--> add"); return mapping.findForward("addpage"); } Very insightful.. Martin- - Original Message - From: "Michael Jouravlev" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Tuesday, October 18, 2005 12:09 PM Subject: Re: I am getting frustrated with LookupDispatchAction On 10/17/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi. I am using struts 1.2.7. My struts-config-xml file has the following: my jsp has the following: key="button.next"/> But I get the following error in tomcat: javax.servlet.ServletException: Request[/mywizard1] does not contain handler parameter named 'method'. Can someone save me from insanity? Try this instead: http://struts.sourceforge.net/strutsdialogs/selectaction.html You do not have to use Struts tags with it, just HTML. Works with buttons, links and images. Consider it an improved LookupDispatchAction. The library also allows you to build a robust wizard component. -- Struts Dialogs http://struts.sourceforge.net/strutsdialogs - 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: What's wrong with DTOs?
> -Original Message- > From: Dave Newton > I'm still not clear on how the entirety of MVC is the V It's not. MVC is a View Tier pattern, though. Within the pattern it separates the Model, an abstraction of the business logic, the View, which displays a representation of the Model, and the Controller, which translates user input into requests to the Model. The point is to bring clarity to the Presentation Layer. See http://idiacomputing.com/moin/LayeredArchitecture#head-386ccace28b9d5122 1f9ed6fe4dc1c59581ef0b5 Many people learning MVC for the first time mistake this presentation layer pattern for an architecture of an entire application. - George - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: trouble with dispatching on a paramter
Thank you so much, as soon as I removed the execute method it worked perfectly Wendy Smoak wrote: From: "Troy Bull" <[EMAIL PROTECTED]> public ActionForward execute( ... ) { SearchForm s = (SearchForm) form; String dispatchString = s.getDispatch(); System.out.println("Main Dispatch String : " + dispatchString); // manually dispatching works but is ugly //if ("run_main_search".equals(dispatchString)) { return runMainSearch(mapping, form, request, response);} //if ("save_defaults".equals(dispatchString)) { return setAsDefaults(mapping, form, request, response);} return mapping.findForward("error"); } public ActionForward runMainSearch(... ) { ... } I still think you're overriding 'execute' and never calling super.execute(...) to give DispatchAction a chance to do its job. Does it work if you remove the 'execute' method entirely from your DoSearchAction (and fix the 'dispatch' param value so it matches the method name)? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's wrong with DTOs?
[EMAIL PROTECTED] wrote: On 10/18/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I can't answer for Ted, but I consider *all* of MVC to be part of the view tier. The Model is just the presentation layer's view of the business system. It should be abstract and opaque and contain all of the business logic. So the model is the enterprise system which the presentation layer lies upon, or in other words the business components interfaces and protocols (objects)? Yes, and the Model can be DTOs and Business Delegates (a procedural interface that separates data and code) or can be OO Business objects exposed through interfaces (and which may, in turn, proxy via DTOs and Business Delegates to a remote implementation). I'm still not clear on how the entirety of MVC is the V, since that seems to contradict itself and doesn't appear to jibe with how I'm writing my apps, which have _very_ distinct MVC components. Even bits of my C are cross-purposed. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: What's wrong with DTOs?
> From: Leon Rosenberg > On 10/18/05, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > > -Original Message- > > > From: Frank W. Zammetti > > [snip] > > > > > > Ted, this seems to be saying that you consider the Actions to be > > > part of the view... is that what you intended? > > > > I can't answer for Ted, but I consider *all* of MVC to be > part of the > > view tier. The Model is just the presentation layer's view of the > > business system. It should be abstract and opaque and > contain all of > > the business logic. > > So the model is the enterprise system which the presentation > layer lies upon, or in other words the business components > interfaces and protocols (objects)? > > Right? Yes, and the Model can be DTOs and Business Delegates (a procedural interface that separates data and code) or can be OO Business objects exposed through interfaces (and which may, in turn, proxy via DTOs and Business Delegates to a remote implementation). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Shale] Help - wonky prerender() call! - SOLVED :)
Since I always seem to be asking questions and receiving help, I thought I would let you know how I finally solved this problem. What was wrong was in the naming of my jsps (the view-ids). I changed my faces-config.xml from: loggedOff /failure.jsp to loggedOff /logon.jsp The rules for "registration" of the backing bean to a jsp/view-id are given in detail in the javadocs for ViewController: http://people.apache.org/~craigmcc/shale-core-javadocs/. Also, there are examples in DefaultControllerMapper.java in the source. For example, I have a managed bean called logon and hence setting the view-id as /logon.jsp marries them together.. (I hope I've got that right!). Clearly, unless the naming rules are strictly followed (see gory details again in DefaultViewControllerMapper.java), Shale cannot be expected to satisfy its contract. So, I guess as always, the rule is: read the documentation. And if that doesn't help, read the code..:) Regards, Geeta
Re: What's wrong with DTOs?
On 10/18/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: Frank W. Zammetti > [snip] > > > > Ted, this seems to be saying that you consider the Actions to > > be part of the view... is that what you intended? > > I can't answer for Ted, but I consider *all* of MVC to be part of the > view tier. The Model is just the presentation layer's view of the > business system. It should be abstract and opaque and contain all of > the business logic. So the model is the enterprise system which the presentation layer lies upon, or in other words the business components interfaces and protocols (objects)? Right? Leon :-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator - requiredif validation query
May be you could use "validWhen". I'm not sure if this works, may be you could give it a try test ((*this*==null) or ((*this*!=null) and (sub1.x!=null ))) On 10/18/05, Ashutosh Satyam <[EMAIL PROTECTED]> wrote: > > Hi, > > Is there a way to perform 'requiredif' validation on nested objects ? > > I would like to check for the value of an object only if the object > containing > > it is not null. > > > > In the following example scenario: > > > > Class A{ > > String x; > > String y; > > } > > > > Class Obj{ > > A sub1; > > String sub2; > > } > > > > I need to validate an object of class Obj based on the rule that 'If > sub1 is not null > > then sub1.x should be not null, and if sub1 is null, then do not check > for sub1.x' > > > The validator.xml is: > > > > > . > > > > > > field[0] > > sub1 > > > > > > fieldTest[0] > > NOTNULL > > > > > > > > ... > > > > > > However, this does not seem to work, and fails when sub1 is null. It > throws an > > exception when trying to retrieve sub1.x value. > > > > Is there any way to perform such a validation ? > > > > > > > > Thanks and Regards, > Ashutosh > > >
Re: I am getting frustrated with LookupDispatchAction
On 10/17/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi. I am using struts 1.2.7. My struts-config-xml file has the following: > > name="wizardForm" > scope="session" > type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction" > input="/step1.jsp" > validate="false" > parameter="method"> > > > > my jsp has the following: > > > But I get the following error in tomcat: > javax.servlet.ServletException: Request[/mywizard1] does not contain handler > parameter named 'method'. > > Can someone save me from insanity? Try this instead: http://struts.sourceforge.net/strutsdialogs/selectaction.html You do not have to use Struts tags with it, just HTML. Works with buttons, links and images. Consider it an improved LookupDispatchAction. The library also allows you to build a robust wizard component. -- Struts Dialogs http://struts.sourceforge.net/strutsdialogs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: What's wrong with DTOs?
> -Original Message- > From: Frank W. Zammetti [snip] > > Ted, this seems to be saying that you consider the Actions to > be part of the view... is that what you intended? I can't answer for Ted, but I consider *all* of MVC to be part of the view tier. The Model is just the presentation layer's view of the business system. It should be abstract and opaque and contain all of the business logic. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Associating validation errors with input fields
Ramesh; That was it... I had overlooked the property attribute of the errors tag... thanks for your help! Regards, Chris >>> [EMAIL PROTECTED] 10/18/2005 9:24:23 AM >>> Hi there, Say u hv a with the property name "custName". U can use right below the . So, when an action error occurs, it will be displayed right below the corresponding to the property. Regards, Ramesh M. --- Christopher Becker <[EMAIL PROTECTED]> wrote: > > I have a form in a Struts app (v1.2.7) that I am > attempting to use in > conjunction with the validator framework. I wish to > associate the error > messages directly with the input field that caused > them (e.g. additional > row in a table, etc.) I am using the errors/> tag and can see > that the errors are being generated correctly, but > they are in a list > and are not directly associated to the input fields. > Is there a way to > do this? I see an implied reference to the errors in > the errorKey > attribute of the tag, but not sure how > this works. Any > suggestions or guidance would be appreciated > > Regards, > > > > Chris Becker > Senior Programmer/Analyst > Enterprise IT > (516) 803-3921 > [EMAIL PROTECTED] > > BEGIN:VCARD > VERSION:2.1 > X-GWTYPE:USER > FN:Becker, Christopher > TEL;WORK:(516)803-3921 > ORG:;Corporate Information Systems > TEL;PREF;FAX:(516)803-6115 > EMAIL;WORK;PREF:[EMAIL PROTECTED] > N:Becker;Christopher > TITLE:Sr., Programmer/Analyst > ADR;DOM;WORK;PARCEL;POSTAL:New York > LABEL;DOM;WORK;PARCEL;POSTAL;ENCODING=QUOTED-PRINTABLE:Becker, > Christopher=0A= > New York > END:VCARD > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] __ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's wrong with DTOs?
On Tue, October 18, 2005 11:05 am, Ted Husted said: > The question is whether we want to stop transfering the data when we > get to the servlet (or filter or Action), or continue to transfer the > data on to the model. If we stop at the Action layer, and start > making model calls there, we eliminate a transfer, but we embed > business logic into the presentation layer. If we continue on, we need > to hand-off to yet-another DTO, but we can cleanly separate view from > model. There are benefits and side effects either way. Your Mileage > May Vary. Ted, this seems to be saying that you consider the Actions to be part of the view... is that what you intended? Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's wrong with DTOs?
On 10/18/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > You may ask now what's the place for HttpServletRequest and its company. I > think its natural place is inside the document itself, hidden inside its > code, so that the interface is independent from the use of servlet > technology. In fact HttpServletRequest is a relevant part of the status > (current requests, session objects, etc.) but the status must be > "extracted" from the request. I would tend to agree. An easy mistake to make is to start porgramming ~with~ a framework instead of *into* a framework.This is not only true of web frameworks but GUI grameworks, like VB. In fact, McConnel tells a story in Code Conplete of how he used to add a "commit" method to all his VB forms to help separate th model from the view. In my own work, we've been bundling up the input we need from the presentation layer into a context and shipping it up to the model. The bundle includes items like a "user profile", which in turn includes the locale and roles, so we can localize and authorize outside the view. When the context returns, the business transaction, or transactions, have succeeded or not, and we can disburse any messages or alter the page flow based on the outcome. Something like this. IViewHelper h = executeRead ("SaveB"); if (h.isNominal()) ... Although it not apparent in this snippet, we are using the equivalent of a DynaBean as a data transfer object. We send all the input needed by the transaction up to the model at once. Let the model do its job, and then flow according to the outcome (isNominal). IMHO, most presentation frameworks are trying to way too much of the work. I'm reminded of Boxer from George Orwell's Animal Farm. Every time the Pigs wanted something, Boxer would say "I will work harder." Until one day, loyal Boxer collasped. Much of what we want to do with Struts (or WebWork, or Spring MVC, or JSF) could be done outside of the presentation layer, or at least a specific presentation layer. If you see the presentation layer as a place where we do markup and just the markup, then DTOs become very useful. The HTTP request sent by the browser agent is a DTO. The question is whether we want to stop transfering the data when we get to the servlet (or filter or Action), or continue to transfer the data on to the model. If we stop at the Action layer, and start making model calls there, we eliminate a transfer, but we embed business logic into the presentation layer. If we continue on, we need to hand-off to yet-another DTO, but we can cleanly separate view from model. There are benefits and side effects either way. Your Mileage May Vary. -- HTH, Ted. http://www.husted.com/poe/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: trouble with dispatching on a paramter
From: "Troy Bull" <[EMAIL PROTECTED]> public ActionForward execute( ... ) { SearchForm s = (SearchForm) form; String dispatchString = s.getDispatch(); System.out.println("Main Dispatch String : " + dispatchString); // manually dispatching works but is ugly //if ("run_main_search".equals(dispatchString)) { return runMainSearch(mapping, form, request, response);} //if ("save_defaults".equals(dispatchString)) { return setAsDefaults(mapping, form, request, response);} return mapping.findForward("error"); } public ActionForward runMainSearch(... ) { ... } I still think you're overriding 'execute' and never calling super.execute(...) to give DispatchAction a chance to do its job. Does it work if you remove the 'execute' method entirely from your DoSearchAction (and fix the 'dispatch' param value so it matches the method name)? -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: trouble with dispatching on a paramter
Troy Bull wrote: Hello I am trying to get my form to dispatch to different functions inside my action handler class. I followed this tip exactly : http://www.husted.com/struts/tips/002.html (except i fixed a couple type o's). The problem is my dispatch parameter is not being recognized. I have the following code in my ActionForward execute method: SearchForm s = (SearchForm) form; String dispatchString = (String) request.getAttribute("dispatch"); Are you searching for request parameter - the subject of your email is "rouble with dispatching on a paramter"? why do you use request.getAttribute("dispatch") in this case? try request.getParameter("dispatch"); (for sure it's there is its populated also in the form, since the form is populated from request parameters) Borislav - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
R: trouble with dispatching on a paramter
-Messaggio originale- Da: Troy Bull [mailto:[EMAIL PROTECTED] Inviato: martedì 18 ottobre 2005 14.35 A: user@struts.apache.org Oggetto: trouble with dispatching on a paramter Hello I am trying to get my form to dispatch to different functions inside my action handler class. I followed this tip exactly : http://www.husted.com/struts/tips/002.html (except i fixed a couple type o's). The problem is my dispatch parameter is not being recognized. I have the following code in my ActionForward execute method: SearchForm s = (SearchForm) form; String dispatchString = (String) request.getAttribute("dispatch"); System.out.println("this is execute"); System.out.println(dispatchString); System.out.println(s.getDispatch()); and it prints out the following 05/10/18 07:30:28 this is execute 05/10/18 07:30:28 null 05/10/18 07:30:28 run_main_search what I want is the method run_main_search to execute instead. My strut-config contains the following action mapping: Any ideas? Thanks in advance troy unknown protected boolean unknown Indicates Action be configured as the default one for this module, when true - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Clever trick required
Hi, I'm not serving any static content; everything is dynamic out of a database. Neil -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: 18 October 2005 03:14 PM To: Struts Users Mailing List Subject: Re: Clever trick required Hermod- Currently I am currently running tomcat 5.5.7 and not using any HTTP server for front end If I have no legacy CGI / Perl scripts or static content to server up would I need to front end Tomcat with an HTTP Server? What are the performance considerations for Tomcat standalone vs FrontEnded with an HTTP Server? Takk Martin- - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Tuesday, October 18, 2005 4:20 AM Subject: SV: Clever trick required Hi Your running Tomcat as an HTTP Server? Why? Tomcat is a Servlet engine and is not optimized for serving static content. You should put Apache Http server in front of it, serving static content. I have Tomcat running on servers, and have seen more that 1200 concurrent sessions on it without any problem at all. Hermod -Opprinnelig melding- Fra: Neil Meyer [mailto:[EMAIL PROTECTED] Sendt: 18. oktober 2005 10:12 Til: Struts Users Mailing List Emne: RE: Clever trick required Hi, I know this is probably of topic but I have huge problems with my webserver. We are running struts on this server under Tomcat 5.1. It seems like the tomcat server can't handle load. Any comment or recommendations will really be appreciated. I'm looking at Sun web server now. Regards Neil Meyer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DnB NOR Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the virus programs used in the DnB NOR Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - 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: trouble with dispatching on a paramter
Here is the class declaration : public class DoSearchAction extends DispatchAction { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { SearchForm s = (SearchForm) form; String dispatchString = s.getDispatch(); System.out.println("Main Dispatch String : " + dispatchString); // manually dispatching works but is ugly //if ("run_main_search".equals(dispatchString)) { return runMainSearch(mapping, form, request, response);} //if ("save_defaults".equals(dispatchString)) { return setAsDefaults(mapping, form, request, response);} return mapping.findForward("error"); } public ActionForward runMainSearch(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { SearchForm s = (SearchForm) form; System.out.println(s.getDispatch()); return mapping.findForward("gms"); } public ActionForward setAsDefaults(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println("Hello from save defaults"); return mapping.findForward("confirm_save_defaults"); } } Any ideas? Wendy Smoak wrote: From: "Troy Bull" <[EMAIL PROTECTED]> The problem is my dispatch parameter is not being recognized. I have the following code in my ActionForward execute method: SearchForm s = (SearchForm) form; String dispatchString = (String) request.getAttribute("dispatch"); Try request.getParameter("dispatch"); instead if you want to see what was submitted with the form. (Request parameters are not the same as request attributes.) But it looks okay, because the form bean property was populated. what I want is the method run_main_search to execute instead. Java naming conventions would point to runMainSearch, but okay. :) Does your DoSearchAction extend DispatchAction? (You mention your "ActionForward" execute method-- typo?) If you've overridden the 'execute' method to print debugging statements, are you calling super.execute(...)? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Default values for Multiple Select
Hi Natalie, Are you using String[] for the options in the ActionFormBean? HTH, Dharmendra ps: have a nice day! -Original Message- From: Rassmann, Natalie D [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 18, 2005 8:27 AM To: struts-user@jakarta.apache.org Subject: Default values for Multiple Select Hi - I am trying to get the default values for a multiple select to work when more than one option is selected. It seems as though I only can get one of the options marked as selected when several are actually selected.Has anyone run into this before? Can anyone help me? Natalie Rassmann Collaborative Environments & Support Systems (CE&SS) Lockheed Martin Maritime Systems & Sensors (MS2) 199 Borton Landing Road Moorestown, NJ 08057-0927 Mail Stop 6000-7 Phone: (856)608-3177 Cell: (609)865-3613 FAX: (856)608-3198 Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Associating validation errors with input fields
Hi there, Say u hv a with the property name "custName". U can use right below the . So, when an action error occurs, it will be displayed right below the corresponding to the property. Regards, Ramesh M. --- Christopher Becker <[EMAIL PROTECTED]> wrote: > > I have a form in a Struts app (v1.2.7) that I am > attempting to use in > conjunction with the validator framework. I wish to > associate the error > messages directly with the input field that caused > them (e.g. additional > row in a table, etc.) I am using the errors/> tag and can see > that the errors are being generated correctly, but > they are in a list > and are not directly associated to the input fields. > Is there a way to > do this? I see an implied reference to the errors in > the errorKey > attribute of the tag, but not sure how > this works. Any > suggestions or guidance would be appreciated > > Regards, > > > > Chris Becker > Senior Programmer/Analyst > Enterprise IT > (516) 803-3921 > [EMAIL PROTECTED] > > BEGIN:VCARD > VERSION:2.1 > X-GWTYPE:USER > FN:Becker, Christopher > TEL;WORK:(516)803-3921 > ORG:;Corporate Information Systems > TEL;PREF;FAX:(516)803-6115 > EMAIL;WORK;PREF:[EMAIL PROTECTED] > N:Becker;Christopher > TITLE:Sr., Programmer/Analyst > ADR;DOM;WORK;PARCEL;POSTAL:New York > LABEL;DOM;WORK;PARCEL;POSTAL;ENCODING=QUOTED-PRINTABLE:Becker, > Christopher=0A= > New York > END:VCARD > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] __ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Associating validation errors with input fields
I have a form in a Struts app (v1.2.7) that I am attempting to use in conjunction with the validator framework. I wish to associate the error messages directly with the input field that caused them (e.g. additional row in a table, etc.) I am using the tag and can see that the errors are being generated correctly, but they are in a list and are not directly associated to the input fields. Is there a way to do this? I see an implied reference to the errors in the errorKey attribute of the tag, but not sure how this works. Any suggestions or guidance would be appreciated Regards, Chris BeckerSenior Programmer/AnalystEnterprise IT(516) 803-3921[EMAIL PROTECTED]BEGIN:VCARD VERSION:2.1 X-GWTYPE:USER FN:Becker, Christopher TEL;WORK:(516)803-3921 ORG:;Corporate Information Systems TEL;PREF;FAX:(516)803-6115 EMAIL;WORK;PREF:[EMAIL PROTECTED] N:Becker;Christopher TITLE:Sr., Programmer/Analyst ADR;DOM;WORK;PARCEL;POSTAL:New York LABEL;DOM;WORK;PARCEL;POSTAL;ENCODING=QUOTED-PRINTABLE:Becker, Christopher=0A= New York END:VCARD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Clever trick required
Hermod- Currently I am currently running tomcat 5.5.7 and not using any HTTP server for front end If I have no legacy CGI / Perl scripts or static content to server up would I need to front end Tomcat with an HTTP Server? What are the performance considerations for Tomcat standalone vs FrontEnded with an HTTP Server? Takk Martin- - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Tuesday, October 18, 2005 4:20 AM Subject: SV: Clever trick required Hi Your running Tomcat as an HTTP Server? Why? Tomcat is a Servlet engine and is not optimized for serving static content. You should put Apache Http server in front of it, serving static content. I have Tomcat running on servers, and have seen more that 1200 concurrent sessions on it without any problem at all. Hermod -Opprinnelig melding- Fra: Neil Meyer [mailto:[EMAIL PROTECTED] Sendt: 18. oktober 2005 10:12 Til: Struts Users Mailing List Emne: RE: Clever trick required Hi, I know this is probably of topic but I have huge problems with my webserver. We are running struts on this server under Tomcat 5.1. It seems like the tomcat server can't handle load. Any comment or recommendations will really be appreciated. I'm looking at Sun web server now. Regards Neil Meyer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DnB NOR Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the virus programs used in the DnB NOR Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - 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: trouble with dispatching on a paramter
From: "Troy Bull" <[EMAIL PROTECTED]> The problem is my dispatch parameter is not being recognized. I have the following code in my ActionForward execute method: SearchForm s = (SearchForm) form; String dispatchString = (String) request.getAttribute("dispatch"); Try request.getParameter("dispatch"); instead if you want to see what was submitted with the form. (Request parameters are not the same as request attributes.) But it looks okay, because the form bean property was populated. what I want is the method run_main_search to execute instead. Java naming conventions would point to runMainSearch, but okay. :) Does your DoSearchAction extend DispatchAction? (You mention your "ActionForward" execute method-- typo?) If you've overridden the 'execute' method to print debugging statements, are you calling super.execute(...)? -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: So boring issues about character encoding in action ......
At 1:44 PM +0800 10/18/05, Tony Lu wrote: I need to create an internationalized Web application by struts,mysql and hibernate. Each component Character Encoding is utf8. It runs well when I run a pure servlet to save 'Chinese Character' to database and load it from database. But when I implement it with struts action, the application can not save Chinese correctly. I really don't know why struts action can not work well. I am sure there is no difference between them. By the time that your action class is executing, Struts has already read from the request input stream (to populate the ActionForm). In any web application, if you want to set the request character encoding, you must arrange to do it before any code will read from the request input stream. The best way to do this in a Servlet 2.3 or later web environment is to use a ServletFilter. In fact, most of the worked examples of writing ServletFilters on the web are to solve this problem. You could also do it by extending RequestProcessor (or TilesRequestProcessor, if you use Tiles) and overriding the processPreprocess method. However, in Struts 1.3 the processPreprocess method is no longer used. Using a ServletFilter will apply to any application you write in any Struts version, or with a non-Struts approach. Joe Is there anywhere to set character encoding for action? Please help! --Pure Servlet ( It runs well) - public class UtfTest extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String description = request.getParameter("description"); description = (description == null?"":description.trim()); try{ ItemDAO itemDao = ItemDAO.getInstance(); Item item = new Item(); item.setDescription(description); itemDao.save(item); }catch(Exception e){ e.printStackTrace(); } response.sendRedirect("test.jsp"); } } --Action for struts public class TestAction extends Action{ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception { req.setCharacterEncoding("UTF-8"); String description = req.getParameter("description"); description = (description == null?"":description.trim()); try{ ItemDAO itemDao = ItemDAO.getInstance(); Item item = new Item(); item.setDescription(description); itemDao.save(item); // Determine which action forward should be returned return mapping.findForward("success"); }catch(Exception e){ } } } -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
trouble with dispatching on a paramter
Hello I am trying to get my form to dispatch to different functions inside my action handler class. I followed this tip exactly : http://www.husted.com/struts/tips/002.html (except i fixed a couple type o's). The problem is my dispatch parameter is not being recognized. I have the following code in my ActionForward execute method: SearchForm s = (SearchForm) form; String dispatchString = (String) request.getAttribute("dispatch"); System.out.println("this is execute"); System.out.println(dispatchString); System.out.println(s.getDispatch()); and it prints out the following 05/10/18 07:30:28 this is execute 05/10/18 07:30:28 null 05/10/18 07:30:28 run_main_search what I want is the method run_main_search to execute instead. My strut-config contains the following action mapping: type="bum.model.DoSearchAction" unknown="false" parameter="dispatch"> Any ideas? Thanks in advance troy
Default values for Multiple Select
Hi - I am trying to get the default values for a multiple select to work when more than one option is selected. It seems as though I only can get one of the options marked as selected when several are actually selected.Has anyone run into this before? Can anyone help me? Natalie Rassmann Collaborative Environments & Support Systems (CE&SS) Lockheed Martin Maritime Systems & Sensors (MS2) 199 Borton Landing Road Moorestown, NJ 08057-0927 Mail Stop 6000-7 Phone: (856)608-3177 Cell: (609)865-3613 FAX: (856)608-3198
Validator - requiredif validation query
Hi, > Is there a way to perform 'requiredif' validation on nested objects ? > I would like to check for the value of an object only if the object > containing > it is not null. > > In the following example scenario: > > Class A{ > String x; > String y; > } > > Class Obj{ > A sub1; > String sub2; > } > > I need to validate an object of class Obj based on the rule that 'If sub1 is > not null > then sub1.x should be not null, and if sub1 is null, then do not check for > sub1.x' > The validator.xml is: > > . > > > field[0] > sub1 > > > fieldTest[0] > NOTNULL > > > > ... > > > However, this does not seem to work, and fails when sub1 is null. It throws > an > exception when trying to retrieve sub1.x value. > > Is there any way to perform such a validation ? > > > > Thanks and Regards, Ashutosh
Load datasource config without action classes
Hi i'm thinking about loading struts-config datasources configuration directly to my business classes, but i appears to be necesary to use action clases (by calling getDataSource method). is it possible to use a load-on-startup servlet to get struts configured datasources (or something similar, instead action clases)?? I really like the form how struts configure databases but i preffer to link those databases directly to my business tier. I'm opened to other options instead :) Any idea? thanks all! -- M4RC0 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to update the Resource Bundle values in STRUTS
Hi All! I am Shailesh.This is my first Post on this group.I working on an B2B Web application which uses Struts,Hibernate .My task is to allow an administrator to change the messages list(Containing various Error Messages) on a JSP page which is enabled by a particular action.I have to access these messages from resourse bundle.However, when the administrator has to change this message he will click on the message.How it can be updated in the Resource Bundle?Kindly guide... Regards, shailesh Barde
Re: logic:present and html:text tags problem
Emmanuel.Leguy a écrit : Yes name is specified. I think it needs more explanations. My action sequence is: jsp0 ---> Action1> jsp1 -> Action2 > jsp2 | | Formbean1 Formbean2 I would like to pre-populate Formbean2 in Action1 to put default values in jsp1. Formbean2 specifies a name property. Unfortunately, when i code this DynaActionForm dForm = (DynaActionForm) form; dForm.set( "name", person.getName() ); in Action1 dForm refers to Formbean1 (not Formbean2). Formbean1 is used to get informations entered in jsp0. Since Formbean1 does not specify a name property (it does not need any), i get an error. My question is then: How to populate Formbean2 in Action1? Fixed! I red the struts doc again and i solved my problem. I did not understand that i need 2 actions: an action to populate the form (before the jsp is displayed) and one to process the user infos. So my flow is now: jsp0 ---> Action1>prepareAction -> jsp1 -> Action2 > jsp2 | || Formbean1 Formbean2(pre-populated) Formbean2 and it works!!! Thanx for all, Manu. -- Emmanuel Leguy LIFL - UMR8022 CNRS - Bat M3 Tel: +33 3 28 77 85 32 USTL - Universite de Lille 1 Fax: +33 3 28 77 85 37 59655 VILLENEUVE D'ASCQ CEDEX - FRANCE mailto:[EMAIL PROTECTED] http://www.lifl.fr/ANNUAIRE/employee.php?login=leguye Ce mail est signe par un certificat X509 fourni par le CNRS La verification de ce certificat peut etre faite a l'adresse suivante: http://igc.services.cnrs.fr/CNRS-Standard/recherche.html smime.p7s Description: S/MIME Cryptographic Signature
SV: Clever trick required
Hi Your running Tomcat as an HTTP Server? Why? Tomcat is a Servlet engine and is not optimized for serving static content. You should put Apache Http server in front of it, serving static content. I have Tomcat running on servers, and have seen more that 1200 concurrent sessions on it without any problem at all. Hermod -Opprinnelig melding- Fra: Neil Meyer [mailto:[EMAIL PROTECTED] Sendt: 18. oktober 2005 10:12 Til: Struts Users Mailing List Emne: RE: Clever trick required Hi, I know this is probably of topic but I have huge problems with my webserver. We are running struts on this server under Tomcat 5.1. It seems like the tomcat server can't handle load. Any comment or recommendations will really be appreciated. I'm looking at Sun web server now. Regards Neil Meyer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DnB NOR Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the virus programs used in the DnB NOR Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Clever trick required
1) Don't high-jack threads. Start a new one if you really want an answer. 2) This is hardly a topic for the struts-user list. mail to [EMAIL PROTECTED] 3) What is tomcat 5.1??? leon On 10/18/05, Neil Meyer <[EMAIL PROTECTED]> wrote: > Hi, > > I know this is probably of topic but I have huge problems with my webserver. > We are running struts on this server under Tomcat 5.1. It seems like the > tomcat server can't handle load. > > Any comment or recommendations will really be appreciated. I'm looking at Sun > web server now. > > Regards > Neil Meyer > > - > 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: Clever trick required
Hi, I know this is probably of topic but I have huge problems with my webserver. We are running struts on this server under Tomcat 5.1. It seems like the tomcat server can't handle load. Any comment or recommendations will really be appreciated. I'm looking at Sun web server now. Regards Neil Meyer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:present and html:text tags problem
Laurie Harper a écrit : Sure. DynaActionForm dForm = (DynaActionForm) form; dForm.set( "name", person.getName() ); You can also use BeanUtils to copy properties from the Person to the Form bean: BeanUtils.copyProperties( dForm, person ); Il get this error: javax.servlet.ServletException: Invalid property name 'name' org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* java.lang.IllegalArgumentException: Invalid property name 'name' org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:600) org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:413) fr.lifl.existant.struts.action.ChoisirHomonyme.execute(ChoisirHomonyme.java:67) 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.doGet(ActionServlet.java:397) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) ? Thanx, Manu. Did you specify a 'name' property in your form bean declaration in struts-config.xml? 'Dyna' forms only have the properties you specify. I've never used them, but I think the 'lazy' versions allow you to use arbitrary properties without having to declare them. Yes name is specified. I think it needs more explanations. My action sequence is: jsp0 ---> Action1> jsp1 -> Action2 > jsp2 | | Formbean1 Formbean2 I would like to pre-populate Formbean2 in Action1 to put default values in jsp1. Formbean2 specifies a name property. Unfortunately, when i code this DynaActionForm dForm = (DynaActionForm) form; dForm.set( "name", person.getName() ); in Action1 dForm refers to Formbean1 (not Formbean2). Formbean1 is used to get informations entered in jsp0. Since Formbean1 does not specify a name property (it does not need any), i get an error. My question is then: How to populate Formbean2 in Action1? Thanx, Manu. -- Emmanuel Leguy LIFL - UMR8022 CNRS - Bat M3 Tel: +33 3 28 77 85 32 USTL - Universite de Lille 1 Fax: +33 3 28 77 85 37 59655 VILLENEUVE D'ASCQ CEDEX - FRANCE mailto:[EMAIL PROTECTED] http://www.lifl.fr/ANNUAIRE/employee.php?login=leguye Ce mail est signe par un certificat X509 fourni par le CNRS La verification de ce certificat peut etre faite a l'adresse suivante: http://igc.services.cnrs.fr/CNRS-Standard/recherche.html smime.p7s Description: S/MIME Cryptographic Signature
Re: What's wrong with DTOs?
I wish to tell you a story, to show because I changed my mind about DTOs. Once upon a time I used to write GUIs (i.e. Swing GUIs). I have to tell that I used to mix controller code with model. But when I think about that "era" I noticed that it was pretty easy to write code. Why now is it so difficult? The answer is simple: the technology switch changed not only the purely-technical aspects of programming, but also the way we code. We all now have the burden of using servlets (directly or indirectly), servlets mean HTTP requests, sessions, scopes, contexts, things that in GUIs we never imagined. I think that we once code the OOP way, now we returned to some sort of procedural programming, i.e. it is like emulating BASIC in Java :-P For example, take the Business Delegate pattern (that once I loved a lot and now this love finished). It is a collection of business methods, not a real object! Its methods act on different objects, not itself or related objects! Is it OOP? About DAOs, they are a way of storing objects, not part of the object itself. I mean, the DAO calls must be inside the implementation of the objects, not in their interface! For example, suppose that you want to connect an object of class B to an object of class A. public class A { public void addB(B b); public List getBs(); } I think the DAO call must be present in "addB" implementation or you have to code a sort of "committer" that takes all the requests from domain objects and then, when a "commit" method is invoked, it commits using DAOs. And maybe a very-big object that represents the whole model for the current "status" (notice that I used "status" and not "user", "session", etc.) that gives away objects to everyone needs them. Hello! It is a "document", as in "Document/View" architecture! You may ask now what's the place for HttpServletRequest and its company. I think its natural place is inside the document itself, hidden inside its code, so that the interface is independent from the use of servlet technology. In fact HttpServletRequest is a relevant part of the status (current requests, session objects, etc.) but the status must be "extracted" from the request. Maybe the MVC pattern should be renamed "DVC" (D obviously stands for "Document"), so maybe we'll return to real OOP. Ciao Antonio Petrelli P.S.: All the things I told are to be intended as "IMHO". They are neither patterns nor real code. P.P.S.: I think DVC is a trademark, so maybe it can't be used :-P [EMAIL PROTECTED] wrote: >Hi, Gurus, > >Background: I just started a Struts project with Hibernate. I have chosen to use the Data Access Object with (Abstract Factory) design pattern because my client uses Oracle and I use Postgresql database. I am working with other teams remotely and they decided to use DTO. > >Problem: A few months ago, I recall a message thread on this list with a subject header of: 'DTOs are evil'. Since I am new to this, I am having problems understanding why. I thought that DTO are for data storage and data transfer between Business and Value Objects. > >Questions: I have the following questions: > >1. Why I shouldn't choose it? > >2. Should I be using the Apache Commons BeanUtils in my action? It has a method like BeanUtils.copyProperties(...). > >3. If not BeanUtils, then what do you recommend? > > >Thanks, > >Bob > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]