RE: Need to pass data to JSP in ActionForm
I like the adapter idea. Does the adapter contain all data that is required by the jsp page? so fomr a modelling perspective, do you have adapter that match the pages? Thanks, Pat Young --- Andrew Hill <[EMAIL PROTECTED]> wrote: > If the list doesnt change during the course of a > users session then the best > thing to do is to create it on first demand and > store it in the session. > This saves you from looking it up from the db > repeatedly when unnecessary > and is thus more efficient. If the list is the same > for all users and doesnt > change at all then you could store it in the servlet > (application) context. > > If it does change (for example when new records are > added) then you will > still need to look it up each time. In this case > your best bet might be to > extend Rick's suggestion about having a seperate > helper class that assembles > the list (always a good idea). This > helper/manager/thing is part of your > business process layer. Above that you could have an > aditional (very simple) > adaptor class that is passed a request, calls this > helper to obtain the > list, and stores said list under the appropriate > request attribute. > > Your validate method could thus call this adapter to > setup the list when it > is validating the entered data. Your setup action, > likewise would call the > adaptor class rather than directly calling the > business layer and storing > the result. > > One thing to beware of when you do such non-trivial > things in the > actionform, is that if memory serves me correctly > (someone please correct me > if Im wrong on this!), exceptions thrown here wont > be handled by the > exception handler you configured in struts config as > the try/catch that > invokes that handler is merely around the invocation > of the actual action > execute and not the form reset / validate stuff. > > These are some of the reasons I personally prefer to > do my validation in the > action itself and dont make use of the forms > validate method. (Of course if > your using struts validator that becomes problematic > too) > > hth > Andrew > > > -Original Message----- > From: Rick Reumann [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 4 February 2004 12:26 > To: Struts Users Mailing List > Subject: Re: Need to pass data to JSP in ActionForm > > > Pat Young wrote: > > > 6. The problem I am having is that if the > ActionForm > > failes validation, then the sales.jsp page gets an > > error becaue it can not find the bean in the > Request > > for the products list. Should I build this bean > in my > > validate and place it in the request at the > beginning > > of validate? If validate fails, there is no other > > opportunity to build the products list and get it > into > > the Request. > > Personally I often opt for the easy solution and put > the List in Session > scope, but there are other alternatives that have > been discussed on this > list before. > > > 7. I typically uses Actions to retrieves and > build > > beans and then add them to the request for the jsp > to > > access. Is this an acceptable practice also? > > Depends what you mean by "build beans." Nothing > wrong wtih setting stuff > into Request scope from your Actions, but make sure > you are calling some > business process that does the actual "building." > For example... > > //in your Action: > List someList = someBusinessClass.getMyList(); > request.setAttribute("listWhatever", someList); > > -- > Rick > > - > 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] > __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need to pass data to JSP in ActionForm
I am working in a multi-server, multi-application environment, so placing objects in the session isn't a simple option. I have to worry about the user getting the same session and also that I don't use too much memory. When I said "build", I did mean that I am calling a business object to get the list. I guess my issue with doing this in the validate method, is the validate method is meant for validation logic and not for processing. I guess it depends on how you look at it. Could you breifly mention some of the other alternatives? Thanks, Pat Young --- Rick Reumann <[EMAIL PROTECTED]> wrote: > Pat Young wrote: > > > 6. The problem I am having is that if the > ActionForm > > failes validation, then the sales.jsp page gets an > > error becaue it can not find the bean in the > Request > > for the products list. Should I build this bean > in my > > validate and place it in the request at the > beginning > > of validate? If validate fails, there is no other > > opportunity to build the products list and get it > into > > the Request. > > Personally I often opt for the easy solution and put > the List in Session > scope, but there are other alternatives that have > been discussed on this > list before. > > > 7. I typically uses Actions to retrieves and > build > > beans and then add them to the request for the jsp > to > > access. Is this an acceptable practice also? > > Depends what you mean by "build beans." Nothing > wrong wtih setting stuff > into Request scope from your Actions, but make sure > you are calling some > business process that does the actual "building." > For example... > > //in your Action: > List someList = someBusinessClass.getMyList(); > request.setAttribute("listWhatever", someList); > > -- > Rick > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Need to pass data to JSP in ActionForm
I have the follow scenerio that I am trying to code for. 1. I have a JSP with a form. This page ios called "sales.jsp". 2. The form has a select box in it that displays a list of products. The page grabs the products list Bean from the Request. There are also additional fields in the form. 3. The list of products is retrieved with a call to our service layer in the Action for the JSP page. This Action is called "sales.do". 4. The submit button for the form submits the data on the form to "salesAdjust.do". 5. The salesAdjust.do Action has an ActionForm associated to it called "salesForm". This form has a validate method for validating the input. If the validate fails, controls is forwarded back to the sales.jsp page. Therefore, sales.jsp is the "input" property for the salesAdjust.do Action. 6. The problem I am having is that if the ActionForm failes validation, then the sales.jsp page gets an error becaue it can not find the bean in the Request for the products list. Should I build this bean in my validate and place it in the request at the beginning of validate? If validate fails, there is no other opportunity to build the products list and get it into the Request. 7. I typically uses Actions to retrieves and build beans and then add them to the request for the jsp to access. Is this an acceptable practice also? Any help would be greatly appreciated. Pat Young __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Cannot find BEAN in any scope
I get this error when trying to use a bean write tag... Cannot find bean org.apache.struts.taglib.html.BEAN in any scope org.apache.jasper.JasperException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) . . . Does this mean I have something set up incorrectly? I'm not sure what to make of this error. Any help is greatly appreciated. - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Accessing query string parameter
I need to be able to access a parameter from a query string. My url looks like... http://localhost:8080/myApp/reports/summaryReport.jsp?reportType=print I need to be able to access the reportType parameter from this URL. What is the best way to do this? Pat Young __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Passing values into action
What is the best way to pass values into an action? I want to do this in order to be able to make my actions dynamic. However, I don't want to have to include these values in the URL. Is there a way to pass them in using the action xml element and then use logic in my JSP to process these? Pat Young __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: struts-config.xml
Thanks Joseph! This is exactly the solution we are looking for. We can break our struts-config.xml file into multiple files and do not have the added complexity of using application modules. Pat Young --- Joseph Fifield <[EMAIL PROTECTED]> wrote: > If you are using 1.1, you can simply split the file > into multiple files, > and list each comma-delimited in web.xml. IIRC, this > was new in 1.1b3. > We have one for every major part of our application, > and it required no > additional code changes. > > Joe > > > -Original Message- > > From: Pat Young [mailto:[EMAIL PROTECTED] > > Sent: Thursday, March 20, 2003 4:23 PM > > To: Struts Users Mailing List > > Subject: RE: struts-config.xml > > > > > > Yes, I have looked at sub-applications and we are > > considering it. Using sub-applications does have > some > > technical considerations that have to be accounted > > for.I realize that we could use a merge > feature of > > a versioning tool also. I was curious if anyone > had > > any other creative ideas around this problem or if > > there was a feature in Struts that I had missed. > > > > Pat Young > > > > > > > > --- Mike Jasnowski <[EMAIL PROTECTED]> wrote: > > > Well, version control considerations aside (for > > > issues around merges when > > > new struts-config.xml are checked in), Have you > also > > > looked at Struts > > > sub-applications? Each can have it's own > > > struts-config.xml. > > > > > > -Original Message- > > > From: Pat Young [mailto:[EMAIL PROTECTED] > > > Sent: Thursday, March 20, 2003 4:14 PM > > > To: [EMAIL PROTECTED] > > > Subject: struts-config.xml > > > > > > > > > I am curious as to how others are working with > the > > struts-config.xml > > > file. I am working on a large project with a > team of 8 other > > > developers. So far we > > > have over 200 actions. The struts-config.xml is > > > becoming a bottle neck, because each developer > needs > > > to update the file at the same with entries into > > > this > > > file. Does anyone have any ideas as to how to > make > > > working with this file any easier? Thanks in > > > advance. > > > > > > Pay Young > > > > > > > __ > > > Do you Yahoo!? > > > Yahoo! Platinum - Watch CBS' NCAA March Madness, > > > live on your desktop! > > > http://platinum.yahoo.com > > > > > > > > > - > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > - > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > __ > > Do you Yahoo!? > > Yahoo! Platinum - Watch CBS' NCAA March Madness, > live on your > > desktop! http://platinum.yahoo.com > > > > > - > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: struts-config.xml
Yes, I have looked at sub-applications and we are considering it. Using sub-applications does have some technical considerations that have to be accounted for.I realize that we could use a merge feature of a versioning tool also. I was curious if anyone had any other creative ideas around this problem or if there was a feature in Struts that I had missed. Pat Young --- Mike Jasnowski <[EMAIL PROTECTED]> wrote: > Well, version control considerations aside (for > issues around merges when > new struts-config.xml are checked in), Have you also > looked at Struts > sub-applications? Each can have it's own > struts-config.xml. > > -----Original Message- > From: Pat Young [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 20, 2003 4:14 PM > To: [EMAIL PROTECTED] > Subject: struts-config.xml > > > I am curious as to how others are working with the > struts-config.xml file. I am working on a large > project with a team of 8 other developers. So far > we > have over 200 actions. The struts-config.xml is > becoming a bottle neck, because each developer needs > to update the file at the same with entries into > this > file. Does anyone have any ideas as to how to make > working with this file any easier? Thanks in > advance. > > Pay Young > > __ > Do you Yahoo!? > Yahoo! Platinum - Watch CBS' NCAA March Madness, > live on your desktop! > http://platinum.yahoo.com > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts-config.xml
I am curious as to how others are working with the struts-config.xml file. I am working on a large project with a team of 8 other developers. So far we have over 200 actions. The struts-config.xml is becoming a bottle neck, because each developer needs to update the file at the same with entries into this file. Does anyone have any ideas as to how to make working with this file any easier? Thanks in advance. Pay Young __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]