RE: An Action doesn't work as expected
You don't have the input attribute in your action mapping. ... ... HTH. Matt -Original Message- From: f f [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 10:51 AM To: [EMAIL PROTECTED] Subject: An Action doesn't work as expected Hi gurus, I'm just learning to develop web application with Struts. All Action works well, except SubmitCustomerAction. I've tried to find the problem but I can't find it so far. Here is some relevant information on jsp page : on struts-config.xml : tomcat gives this error : The server encountered an internal error (No input attribute for mapping path /submitCustomer) that prevented it from fulfilling this request. and from jboss server.log: 2004-02-03 22:01:52,180 DEBUG [org.apache.struts.util.RequestUtils] Looking for ActionForm bean instance in scope 'request' under attribute key 'CustomerRegistrationForm' 2004-02-03 22:01:52,180 DEBUG [org.apache.struts.util.RequestUtils] Creating new ActionForm instance of type 'proj.web.form.CustomerRegistrationForm' 2004-02-03 22:01:52,180 DEBUG [org.apache.struts.util.RequestUtils] --> [EMAIL PROTECTED] 2004-02-03 22:01:52,180 DEBUG [org.apache.struts.action.RequestProcessor] Storing ActionForm bean instance in scope 'request' under attribute key 'CustomerRegistrationForm' 2004-02-03 22:01:52,180 DEBUG [org.apache.struts.action.RequestProcessor] Populating bean properties from this request 2004-02-03 22:01:52,180 DEBUG [org.apache.struts.action.RequestProcessor] Validating input form properties 2004-02-03 22:01:52,390 DEBUG [org.apache.struts.util.PropertyMessageResources] getMessage(en,customer.email) 2004-02-03 22:01:52,390 DEBUG [org.apache.struts.util.PropertyMessageResources] loadLocale(en) 2004-02-03 22:01:52,431 DEBUG [org.apache.struts.action.RequestProcessor] Validation failed but no input form available I use Jboss 3.2.2,Apache-Tomcat 4.1.27-LE-jdk14,Jakarta-Struts 1.1 and JDK 1.4.0-b92. Something wrong ? Please help. Thanks for your help. Fredrich. __ 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Search/Results/Display Help (includes link to Example to help me with)
Hubert...thanks! Now, how do I then clear the fields out if the want to do a new search? Currently, the user types in http://localhost:/helpv1/search.do , the values that they filled in are still there. I only want those values to "persist" if there is an error of some sort...otherwise reset back to original. Another way to think of it is when the user links to the search page it should be "fresh", but on error it is "dirty". I tried changing the scope to session, but that didn't help. Is there a trick to the reset method in the form that I should use? Matt -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 2:52 PM To: Struts Users Mailing List Subject: Re: Struts Search/Results/Display Help (includes link to Example to help me with) Like in my two previous emails, it worked when I took out the "name" and "type" attributes in your html form: <%-- --%> hth, Hubert --- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote: > http:// www ! moosejaw ! org /java/help.zip > > Here is a zip file to demonstrate the problem I am having. I just hacked > this together, but it shows what I have been talking about. > > 1. Unzip this and put the helpv1.war in your webapps folder > 2. Start servlet container > 3. Goto http://localhost:/helpv1 > > This should take you to index.do which is fine. Click "Search" which takes > you top search.do. Type "1" for the Item Id and select "Lable 2" for the > Utem Type and click "Search". Do you see how the values are lost? How can > I mantain those values? Should I just have 1 Action class that handles both > the search form and the search results? If so, how do I set this up? > > Thanks for your help! > > Matt > > > > -Original Message- > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > Sent: Friday, January 23, 2004 11:31 AM > To: Struts Users Mailing List > Subject: Re: Strust Search/Results/Display HELP! > > > For your steps 2 to 4: > > in your struts-config: > > > ... > > > > type="com.my.action.PreparePageAction" > name="myForm" > input="/form.jsp"> > ... > > > > in your jsp: > > > > > > <%-- also use the struts tags to display error messages --%> > > > In your case, you may need to use input="/pageWithForm.do" since you need to > prep > the form, but there are other ways to do that, like placing your 's > options collection in session or app scope. However, I *have* used this > approach > before and it worked for me. > > hth, > Hubert > > --- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote: > > Ok. I guess I'm missing something - or it just won't sink in. This > really > > isn't that long. > > > > For simplicity, let's say I have a 4 page application. > > > > 1. Index > > 2. Search for an Item > > 3. Search Results List of Matching items > > 4. Details of an Item > > > > All of these "pages" needs to gather data from a database (not the > problem) > > and display to them to the end user. > > > > A typical scenario for a user would be: > > > > 1. User goes to http://localhost:/protoype they will land on the index > > page that really needs to be an Action because it looks up data from the > > database. > > 2. They click search which also gathers data from the database to display > a > > form. > > 3. They fill the form in and click Search. > > 4. They see the matching search results. > > 5. They pick the matching search result and the Item is displayed. > > > > Each page is essentially an action that forwards it's results to a jsp > page. > > > > However, here is the problem I am having. When an error occurs, I need to > > have that error displayed to the end user and have them on the previous > > page. > > > > For example, Step 2 to Step 3 from above - if the user does not type in a > > required field or there are no results, they need to be told this and > placed > > back on Step 2 with: > > 1. the form values filled out with what they submitted > > 2. this page needs to gather the data from the database again (in case > more > > data has been added). > > > > So I'm not sure of: > > > > 1. What do I need to put in the struts-config.xml file (specifically in > the > > Action Mappings section) > > > >> type="SearchAction"
Struts Search/Results/Display Help (includes link to Example to help me with)
http:// www ! moosejaw ! org /java/help.zip Here is a zip file to demonstrate the problem I am having. I just hacked this together, but it shows what I have been talking about. 1. Unzip this and put the helpv1.war in your webapps folder 2. Start servlet container 3. Goto http://localhost:/helpv1 This should take you to index.do which is fine. Click "Search" which takes you top search.do. Type "1" for the Item Id and select "Lable 2" for the Utem Type and click "Search". Do you see how the values are lost? How can I mantain those values? Should I just have 1 Action class that handles both the search form and the search results? If so, how do I set this up? Thanks for your help! Matt -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 11:31 AM To: Struts Users Mailing List Subject: Re: Strust Search/Results/Display HELP! For your steps 2 to 4: in your struts-config: ... ... in your jsp: <%-- also use the struts tags to display error messages --%> In your case, you may need to use input="/pageWithForm.do" since you need to prep the form, but there are other ways to do that, like placing your 's options collection in session or app scope. However, I *have* used this approach before and it worked for me. hth, Hubert --- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote: > Ok. I guess I'm missing something - or it just won't sink in. This really > isn't that long. > > For simplicity, let's say I have a 4 page application. > > 1. Index > 2. Search for an Item > 3. Search Results List of Matching items > 4. Details of an Item > > All of these "pages" needs to gather data from a database (not the problem) > and display to them to the end user. > > A typical scenario for a user would be: > > 1. User goes to http://localhost:/protoype they will land on the index > page that really needs to be an Action because it looks up data from the > database. > 2. They click search which also gathers data from the database to display a > form. > 3. They fill the form in and click Search. > 4. They see the matching search results. > 5. They pick the matching search result and the Item is displayed. > > Each page is essentially an action that forwards it's results to a jsp page. > > However, here is the problem I am having. When an error occurs, I need to > have that error displayed to the end user and have them on the previous > page. > > For example, Step 2 to Step 3 from above - if the user does not type in a > required field or there are no results, they need to be told this and placed > back on Step 2 with: > 1. the form values filled out with what they submitted > 2. this page needs to gather the data from the database again (in case more > data has been added). > > So I'm not sure of: > > 1. What do I need to put in the struts-config.xml file (specifically in the > Action Mappings section) > > type="SearchAction"> > > > > type = "SearchResultsAction" > name = "strainSearchForm" > validate = "true" <-- I know will call the validate > method > input = "/search.do"> <-- can this be an Action? > ><-- If this is > search.jsp, the data from the database is not regathered > > > > > 2. Should I have 1 action or is having multiple actions ok? If just 1 > action, how do I set this up? > > 3. What is the best approach for this type of scenario? I can solve this > fine with a straight Servlet and JSP approach, but what is the "Struts way"? > > Hubert and Wendy have answered my questions, but I am recovering from a cold > and nothing is getting into my brain. > > Thanks for the help. Be gentle and explain slowly. :) > > > - > 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Strust Search/Results/Display HELP!
Ok. I guess I'm missing something - or it just won't sink in. This really isn't that long. For simplicity, let's say I have a 4 page application. 1. Index 2. Search for an Item 3. Search Results List of Matching items 4. Details of an Item All of these "pages" needs to gather data from a database (not the problem) and display to them to the end user. A typical scenario for a user would be: 1. User goes to http://localhost:/protoype they will land on the index page that really needs to be an Action because it looks up data from the database. 2. They click search which also gathers data from the database to display a form. 3. They fill the form in and click Search. 4. They see the matching search results. 5. They pick the matching search result and the Item is displayed. Each page is essentially an action that forwards it's results to a jsp page. However, here is the problem I am having. When an error occurs, I need to have that error displayed to the end user and have them on the previous page. For example, Step 2 to Step 3 from above - if the user does not type in a required field or there are no results, they need to be told this and placed back on Step 2 with: 1. the form values filled out with what they submitted 2. this page needs to gather the data from the database again (in case more data has been added). So I'm not sure of: 1. What do I need to put in the struts-config.xml file (specifically in the Action Mappings section) <-- can this be an Action? <-- If this is search.jsp, the data from the database is not regathered 2. Should I have 1 action or is having multiple actions ok? If just 1 action, how do I set this up? 3. What is the best approach for this type of scenario? I can solve this fine with a straight Servlet and JSP approach, but what is the "Struts way"? Hubert and Wendy have answered my questions, but I am recovering from a cold and nothing is getting into my brain. Thanks for the help. Be gentle and explain slowly. :) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts, Search Page, Help!!!
Hubert, Here is the entire form... <%@ page language="java" contentType="text/html" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %> <%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %> http://www.informatics.jax.org/images/shared/help_large.jpg"; BORDER=0 WIDTH=32 HEIGHT=30> Strain Query Form Strain Id: Strain Name: contains begins with Sex: ANY female male Strain Type: JAX® MiceStock Number: equals not equals begins with contains ends with -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 2:15 PM To: Struts Users Mailing List Subject: RE: Struts, Search Page, Help!!! Can you send your entire html form? --- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote: > Yes. > > > > etc. > > > > > > -Original Message- > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 21, 2004 2:05 PM > To: Struts Users Mailing List > Subject: RE: Struts, Search Page, Help!!! > > > Are you using struts html tags to write the rest of your form? > > --- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote: > > I'm sorry I am so lost today! > > > > Now...here is the problem I am having. > > > > When a user goes to http://localhost:/search.do > > > > From my understanding this will call my SearchAction class as specified in > > my struts-config.xml file: > > > > > >> type="StrainSearchForm"/> > > > > > > > >> type="SearchAction" > > scope="session"> > > > > > > > > > >> type = "SearchResultsAction" > > name = "strainSearchForm" > > validate = "true" > > input = "/search.do"> > > > > > > > > > > > > > > and if all is well, forward to search.jsp to diplay my search screen (not > my > > search results). > > > > From the search screen, when the user clicks Search searchResults.do (not > > search.do) is invoked, strainSearchForm.validate() gets called and then my > > SearchResultsAction.execute() method. If the strainSearchForm.validate() > > returns an error, the error is displayed on the screen, but the values > that > > the user types are lost so they have to retype in everything. How do I > get > > the values to already be filled in? If I put them in session scope, will > I > > have to clear the values later (when they start a new search)? Also, I > > would like to do the same thing if no results are returned in my > > SearchResultsAction class - how do I do this as well? (On a side note, my > > strainSearchForm.reste() method is empty - should it be?) Is my config > file > > wrong? Am I not doing something correctly? > > > > Again, should I just have 1 action class or is having multiple action > > classes like this ok? What is the best practice or approach here? > > > > Matt > > > > > __ > Do you Yahoo!? > Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes > http://hotjobs.sweepstakes.yahoo.com/signingbonus > > - > 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! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts, Search Page, Help!!!
Sorry for the lag in response...I was out of the office yesterday. If I change search.do to search.jsp, when there is an error in my SearchResultsAction class, I receive the following error: javax.servlet.ServletException: Cannot find bean under name strainTypes I used the action (SearchAction) as an input so it could requery the database to display the form. Should I just consolidate into 1 action? Matt -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 2:15 PM To: Struts Users Mailing List Subject: RE: Struts, Search Page, Help!!! Matthew wrote: > input = "/search.do"> Shoudn't that be search.jsp instead? I don't believe I've ever seen an action used as input. I take back my advice to put name="formname" in the search.do mapping, based on your description. But it doesn't seem like SearchAction has much of a purpose in life, and that its code could be combined with SearchResultsAction. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts, Search Page, Help!!!
Yes. etc. -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 2:05 PM To: Struts Users Mailing List Subject: RE: Struts, Search Page, Help!!! Are you using struts html tags to write the rest of your form? --- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote: > I'm sorry I am so lost today! > > Now...here is the problem I am having. > > When a user goes to http://localhost:/search.do > > From my understanding this will call my SearchAction class as specified in > my struts-config.xml file: > > > type="StrainSearchForm"/> > > > > type="SearchAction" > scope="session"> > > > > > type = "SearchResultsAction" > name = "strainSearchForm" > validate = "true" > input = "/search.do"> > > > > > > > and if all is well, forward to search.jsp to diplay my search screen (not my > search results). > > From the search screen, when the user clicks Search searchResults.do (not > search.do) is invoked, strainSearchForm.validate() gets called and then my > SearchResultsAction.execute() method. If the strainSearchForm.validate() > returns an error, the error is displayed on the screen, but the values that > the user types are lost so they have to retype in everything. How do I get > the values to already be filled in? If I put them in session scope, will I > have to clear the values later (when they start a new search)? Also, I > would like to do the same thing if no results are returned in my > SearchResultsAction class - how do I do this as well? (On a side note, my > strainSearchForm.reste() method is empty - should it be?) Is my config file > wrong? Am I not doing something correctly? > > Again, should I just have 1 action class or is having multiple action > classes like this ok? What is the best practice or approach here? > > Matt > __ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts, Search Page, Help!!!
I'm sorry I am so lost today! Now...here is the problem I am having. When a user goes to http://localhost:/search.do >From my understanding this will call my SearchAction class as specified in my struts-config.xml file: and if all is well, forward to search.jsp to diplay my search screen (not my search results). >From the search screen, when the user clicks Search searchResults.do (not search.do) is invoked, strainSearchForm.validate() gets called and then my SearchResultsAction.execute() method. If the strainSearchForm.validate() returns an error, the error is displayed on the screen, but the values that the user types are lost so they have to retype in everything. How do I get the values to already be filled in? If I put them in session scope, will I have to clear the values later (when they start a new search)? Also, I would like to do the same thing if no results are returned in my SearchResultsAction class - how do I do this as well? (On a side note, my strainSearchForm.reste() method is empty - should it be?) Is my config file wrong? Am I not doing something correctly? Again, should I just have 1 action class or is having multiple action classes like this ok? What is the best practice or approach here? Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts, Search Page, Help!!!
Aha. That sheds some light. Real quick...here is my situation. My Search page is an Action because I have to lookup certain values in the database and display them in a select box. I then need this Search screen to submit to my actual search which is in SearchResulsAction (which needs to search the database for exactly what the user wants). Should I be using just one Action (perhaps SearchAction) and *somehow* display the appropriate page (the form or the results) based upon some criteria? Does that make sense? >From a user's point of view... 1. Click Search 2. Fill in Search Form 3. Click Search 4. View Result List 5. Click a link on the appropriate search results 6. View Detail of the record they want >From my point of view, I thought I would need: 1. (Click Search) An action for the search page called SearchAction, which queries the database and displays the results on search.jsp 2. (Fill in Search Form) this is just my search.jsp rendered 3. (Click Search) An action SearchResultsAction called SearchResultsAction, which queries the database and displays the result LIST on searchResults.jsp 4. (View Result List) this is just my searchResults.jsp rendered 5. (Click a link on the appropriate search results) An action to called SearchResultDetailAction, which queries the database and displays the results on searchResultDetail.jsp 6. (View Detail of the record they want) this is just my searchResultDetail.jsp rendered So should I be uing just 1 action class? What is the best approach? Matt -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 12:41 PM To: Struts Users Mailing List Subject: RE: Struts, Search Page, Help!!! > From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] > However, if I select a value, press submit, and there is an > error...the > selected value is not "saved" and pre-selected. Actually, none of the > values are saved. My SearchForm has the appropriate getters > and setters. > How do I accomplish this? HELP AGAIN! :) > Is my struts-config.xml file setup incorrectly? I was unsure of the > line below. > > > type="SearchAction" > scope="session"> > > > How is this even working with no 'name' attribute for the ? I think that's why you're not seeing the values... search.do does not have a form bean associated with it. > I think the purists will complain about "Action Chaining" but I have a couple places in my where I display a list of search results, and I have the same thing. It works, it's just something to avoid if you can. Actually in this case I'm not sure why you need two actions. If you just have a Search action, you should be able to detect whether you need to display the form, or display the results. Could be as simple as having a hidden field on the form, and if that's present, you know the form was submitted and you forward to searchResults.jsp. DispatchAction or LookupDispatchAction might be helpful. Instead of multiple Actions, you have multiple methods in one Action, and use a request parameter (with LDA) to decide which method to use. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts, Search Page, Help!!!
My SearchAction is pretty dumb. Here is my execute method. However, this forwards to my search.jsp which submits to SearchResultsAction...is this the right way to do it? Essentially I the result of an Action to Submit to another Action, etc. public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // default target to success String target = "success"; ArrayList strainTypes = getStrainTypes(request); // set the target to failure if we could not retrieve the strain types if (strainTypes == null) { target = "error"; } else { // put all the servers in the request request.setAttribute("strainTypes", strainTypes); } // forward to the appropriate View return (mapping.findForward(target)); } -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 12:36 PM To: Struts Users Mailing List Subject: RE: Struts, Search Page, Help!!! Your input points to search.do/SearchAction. It's possible that SearchAction is resetting the values of the form. Does it know when to leave the form values alone because it's only being called due to a redisplay of a poppulated input form? --- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote: > I tried, but it didn't work. Anyway, I used the Apache LabelValueBean to > store instead of a String and got it to work: > > > labelProperty="label"/> > > > However, if I select a value, press submit, and there is an error...the > selected value is not "saved" and pre-selected. Actually, none of the > values are saved. My SearchForm has the appropriate getters and setters. > How do I accomplish this? HELP AGAIN! :) > > Is my struts-config.xml file setup incorrectly? I was unsure of the > line below. > > > type="SearchAction" > scope="session"> > > > > > type = "SearchResultsAction" > name = "strainSearchForm" > validate = "true" > input = "/search.do"> > > > > > > > > Running to get COFFEE now! > > Matt > > > > -Original Message- > From: Wendy Smoak [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 21, 2004 10:55 AM > To: Struts Users Mailing List > Subject: RE: Struts, Search Page, Help!!! > > > > Thanks for the advice. Now I'm just having trouble thinking. :) > > if my collection is called strainTypes, but it is jjust an > > ArrayList of > > Strings, what do I use: > > > > > labelProperty=""/> > > > > http://jakarta.apache.org/struts/userGuide/struts-html.html#options > > It's not immediately clear, but try it with *just* 'collection' > specified. Leave off property & labelProperty, see what it does, and go > from there. > > -- > Wendy Smoak > Application Systems Analyst, Sr. > ASU IA Information Resources Management > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts, Search Page, Help!!!
I tried, but it didn't work. Anyway, I used the Apache LabelValueBean to store instead of a String and got it to work: However, if I select a value, press submit, and there is an error...the selected value is not "saved" and pre-selected. Actually, none of the values are saved. My SearchForm has the appropriate getters and setters. How do I accomplish this? HELP AGAIN! :) Is my struts-config.xml file setup incorrectly? I was unsure of the line below. Running to get COFFEE now! Matt -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 10:55 AM To: Struts Users Mailing List Subject: RE: Struts, Search Page, Help!!! > Thanks for the advice. Now I'm just having trouble thinking. :) > if my collection is called strainTypes, but it is jjust an > ArrayList of > Strings, what do I use: > > labelProperty=""/> > http://jakarta.apache.org/struts/userGuide/struts-html.html#options It's not immediately clear, but try it with *just* 'collection' specified. Leave off property & labelProperty, see what it does, and go from there. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts, Search Page, Help!!!
Thanks for the advice. Now I'm just having trouble thinking. :) if my collection is called strainTypes, but it is jjust an ArrayList of Strings, what do I use: Sorry. I need some coffee! Matt -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 9:50 AM To: Struts Users Mailing List Subject: RE: Struts, Search Page, Help!!! > From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] > I need some serious help with Struts. > I have a page that gets invoked by calling search.do, this in > turns calls my SearchAction which gets data from a database > to populate a select box in my JSP search.jsp. > > > ANY > varStatus="status"> > escapeXml="false"/> > > You don't have to do the iteration, and since you're familiar with JSTL, the Struts-EL tags are probably what you want. Here's an example that shows a select list of months, which are stored in a Map: Putting the form bean in session scope neatly solves the blank-form-on-validation-error. It looks like you've done that, but by not using the Struts tags, you're not giving the framework a chance to populate the form. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts, Search Page, Help!!!
I need some serious help with Struts. I have a page that gets invoked by calling search.do, this in turns calls my SearchAction which gets data from a database to populate a select box in my JSP search.jsp. ANY The problem I have is that when the user clicks submit, the correct url gets invoked (searchResults.do), but when there is an error (either when the form is not completely filled out or there are no "results" for the search), I want to put the user back on the search.do page with the values they filled out already populated and show an error message. I'm not sure if I have my struts-config.xml file correct or how to do this in general. How do I make sure that the option from the select box is what they previously chose? Should I not use JSTL for the select box? Also, what should my execute method in my StrainSearchResultsAction look like (i.e, do I need to put the values they submitted in scope again)? Is this making sense! Help! CODE BELOW = Here is the relative section from my struts-config.xml file: Here is the validate method of my StrainSearchForm: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if(((strainName == null) || (strainName.length() == 0)) || ((strainId == null) || (strainId.length() == 0))) { errors.add("strainName", new ActionError("errors.searchForms.strain.requiredField")); } return errors; } Thanks! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Page Flow with ActionForms (Repost)
Sorry all, I posted this ealier with a typo so here it is again. I have a url that gets invoked with the url http://localhost/prototype/search.do . I have a SearchAction class that uses EJBs to pull data from a database to populate a pick list in my search JSP page. I use some simple JSTL code to populate the select box: I use the following Struts tag to create the tag I have a SearchForm class that is a simple ActionForm. When I submit the form, I invoke my SearchResultsAction class, however this is where I need help. When an error occurs, how do I get back to my search.do page with my select box (1) populated and (2) have the chosen option from the select box selected? Should I be using the Struts tag for a select box? How do i re-retrieve the values in the select box? Am I making sense? In my stuts-config.xml file I have: Currently on an error, I am brought back to my search form with the errors displayed, but the select box is not populated. Help! Thanks! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Error Page Flow
Hello all, I have a url that gets invoked with the url http://localhost/prototype/search.do . I have a SearchAction class that uses EJBs to pull data from a database to populate a pick list in my search JSP page. I use some simple JSTL code to populate the select box: I use the following Struts tag to create the tag I have a SearchForm class that is a simple ActionForm. When I submit the form, I invoke my SearchResultsAction class, however this is where I need help. When an error occurs, how do I get back to my search.do page with my select box (1) populated and (2) have the chosen option from the select box selected? Should I be using the Struts tag for a select box? How do i re-retrieve the values in the select box? Am I making sense? In my stuts-config.xml file I have: Currently on an error, I am brought back to my search form with the errors displayed, but the select box is not populated. Help! Thanks! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Generic Error Handler
Would this be better handled in the web.xml Matt -Original Message- From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] Sent: Monday, January 12, 2004 11:08 AM To: Struts Users Mailing List Subject: Generic Error Handler I searched the archives and I must have missed it. I want to have a generic JSP or Servlet get invoked when an error occurs in my application. For example, when I try to clink on a link on one of my pages I get an error message: HTTP Status 500 - No action instance for path /detailSearch could be created Looking at the logs it is obvious why there is an error (because I didn't create the org.jax.mgi.mtb.wi.actions.DetailSearchAction class). What is the best approach to handle this type of error? I tried adding the following to my struts-config.xml, but it is not going to the appError.jsp page. What is the best way to handle this? What about other types of errors? Is there a rule of thumb that everyone follows? Sorry for the hopefully easy (probably already asked) question. Matt Here is an output of the logs: SEVERE: No action instance for path /detailSearch could be created java.lang.ClassNotFoundException: org.jax.mgi.mtb.wi.actions.DetailSearchAction at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1366) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1213) at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:207) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:23 1) at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcess or.java:326) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.j ava:284) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:204) at org.jax.mgi.mtb.wi.filters.TimerFilter.doFilter(TimerFilter.java:23) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.j ava:233) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:204) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext Valve.java:24 5) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:199) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:149) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :156) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11P rotocol.java:696) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:677) at java.lang.Thread.run(Thread.java:534) - 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]
Generic Error Handler
I searched the archives and I must have missed it. I want to have a generic JSP or Servlet get invoked when an error occurs in my application. For example, when I try to clink on a link on one of my pages I get an error message: HTTP Status 500 - No action instance for path /detailSearch could be created Looking at the logs it is obvious why there is an error (because I didn't create the org.jax.mgi.mtb.wi.actions.DetailSearchAction class). What is the best approach to handle this type of error? I tried adding the following to my struts-config.xml, but it is not going to the appError.jsp page. What is the best way to handle this? What about other types of errors? Is there a rule of thumb that everyone follows? Sorry for the hopefully easy (probably already asked) question. Matt Here is an output of the logs: SEVERE: No action instance for path /detailSearch could be created java.lang.ClassNotFoundException: org.jax.mgi.mtb.wi.actions.DetailSearchAction at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1366) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1213) at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:207) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:23 1) at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcess or.java:326) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.j ava:284) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:204) at org.jax.mgi.mtb.wi.filters.TimerFilter.doFilter(TimerFilter.java:23) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.j ava:233) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:204) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext Valve.java:24 5) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:199) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:149) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :156) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11P rotocol.java:696) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:677) at java.lang.Thread.run(Thread.java:534) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help Logic:Iterate
Last time I post this: Yesterday I posted a link containing source code on how to use the iterate tag. http://moosejaw.org/java/struts-iterate/ I hope it helps you. Matt -Original Message- From: Wagner Levi Brunca [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 3:20 PM To: struts list Subject: Fw: Help Logic:Iterate Friends, please i need of a example of Iterate!!! Thank!! Wagner - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logic Iterate in Struts
Deepak, Yesterday I posted a link containing source code on how to use the iterate tag. http://moosejaw.org/java/struts-iterate/ I hope it helps you. Matt -Original Message- From: Yinti, Deepak [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 2:25 PM To: Struts Users Mailing List Subject: RE: Logic Iterate in Struts I want to iterate thru by bean and retrieve all values in JSP thru this tag Deepak -Original Message- From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 2:20 PM To: 'Struts Users Mailing List' Subject: RE: Logic Iterate in Struts That's not overly general or anything ** Note the sarcasm ** What do you want to know? -Original Message- From: Yinti, Deepak [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 2:13 PM To: Struts Users Mailing List Subject: Logic Iterate in Struts Can some body some body tell me about logic iterate tag Thanks Deepak This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately. Thank you. Aetna - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems with logic:iterate (indexId has no effect) - doesn't anyone know the solution?
Bard, I'm not sure if you have figured this out or not, but to all who haven't - here is a link to a Struts tag example. http://moosejaw.org/java/struts-iterate/ Enjoy. Matt Thanks for your reply, Sandeep. From what I have understood from reading the java doc, a vector has an index on it like an array does. Is it really true that noone else has had any problems with this? If it is working for you, how do you implement it? Thanks a bunch! Bard - Original Message - From: Sandeep Takhar <[EMAIL PROTECTED]> Date: Mon, 7 Jul 2003 10:13:33 -0700 (PDT) To: Struts Users Mailing List <[EMAIL PROTECTED]> Subject: Re: Problems with logic:iterate (indexId has no effect) - doesn't anyone know the solution? > I wouldn't use a vector, but maybe you can? > > My understanding is that iterate works on anything > that returns an iterator. > > logic:iterate name="someName" > > should be used when the bean someName is in some scope > and is the collection that you want. > > logic:iterate name="someName" property="someProperty" > should not be used if the above case is true. > > sandeep > --- Bård Arve Evjen <[EMAIL PROTECTED]> wrote: > > I didn't think this was a big problem for you > > Struts-gurus, but maybe I'm wrong :-) > > > > I have a vector called variationmargins and in it I > > have a property called loadProfile that is either 1 > > or 2 for all postings. I have tried to use the > > logic:iterate tag to output the result using the > > loadProfile as an index, but it has not effect. It > > just outputs everything, no matter the indexId. > > > > Does anyone have a clue what I am doing wrong? > > > > > property="variationMargins" indexId="loadProfile"> > > > property="loadProfileName"/> > > > > > property="variationMargins" > > scope="session" width="100%" pagesize="100" > > requestURI="result.jsp" > > > decorator="org.apache.taglibs.display.test.ColumnsWrapper"> > > > > > property="deliveryPeriod" sort="true" width="10%"/> > > > align="right" sort="true" width="10%"/> > > > > > > > > I would really appreciate the help. > > > > Cheers, > > Bard A. Evjen > > > > > > > - > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > __ > Do you Yahoo!? > SBC Yahoo! DSL - Now only $29.95 per month! > http://sbc.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]