Re: Having ttruble with actions and buttons
On 6/13/05, Paul Goepfert <[EMAIL PROTECTED]> wrote: > ok here is what I am talking about. I have a form that takes in first > name, last name, street address, city, state and zipcode. When I press > on the button to enter that information into a database. I want the > page to reload with clear input fields. > > -Paul So you want to be able to click "Save", and you app would: * pick up values you entered * store them in database * respond with the same page, but with cleaned up fields So, you need web interface for inserting data record by record, with no stupid messages and intermediate screens. Something like bookkeeping or banking app. Right? Have you thought on the following: * What happens if data is incorrect? (usually redisplay the same page with error message) * What happens if a user clicks Refresh browser button? * What happens if a user clicks Back browser button? * What if the same data is entered twice? On the same note, where do you create/assign unique ID to your records? Can you detect that same data is entered twice, or you want web framework to check this for you? * Do you care if a user saw nagging "Do you want to resend POSTDATA?" message? * Do you think regular users understand what this message mean? ;) * Do you want to create new record by duplicating existing one? If you just started web development, the whole "double submit" thing is a huge issue and you will need to address it in some way. (Option 1) Basically, if you do not care much for Refresh, Back and Forward buttons, and you are OK that a user would see POSTDATA message when he refreshes a page, then you can go with tokens. Struts has built-in support for tokens. You will need to do this to ensure that same data is not posted twice. You can use tokens with any data. You can also ensure that your data is not posted twice by using object ID. Before server shows a form with empty fields to fill in, it generates object ID (or database PK) and uses it as hidden field in the HTML FORM. If a user tries to resubmit the same data, database would reject it, because it cannot insert data with the same key. But still, you would see POSTDATA message, if you try to refresh a page. Well, how many people refresh a dialog page? Apparently, not many. So you might get away with this simple design. So, to do this: * read about tokens. * use action form with request scope. * Use some flavor of DispatchAction to better structure your code, using methods as event handlers. When you receive the request, validate it. If it is not valid, generate error messages. If you defined "input" property with the same JSP name as your input form, Struts will show it for you. If data is ok, your action class will be called. Store it in the database, then manually clean fields in the form bean, and forward to your JSP. That's it. (Option 2) If you want something that look more easy on user, and behaves more robust and professional, but with a little more involvement, you might use two-phase I/O processing: process data input via POST request, then redirect, then load result page with GET request. This way a user would be able to click as many reload buttons as he likes. And data will be there. In this case you might want to look at my DialogAction, which I wrote specifically for cases like this: http://struts.sourceforge.net/strutsdialogs/dialogaction.html See live demo, check the source code, it is simple. You might like it. You would have only one page, so you will need to define one view mapping in your config file, nothing to code in action class. Then see login() method. It redisplays the same page on error, and moves to different page on success. Your case is even simpler, you need to display the same page anyway. You just need to validate input data. If it is valid, store it, clean form fields, and forward to DialogConstants.DIALOG_RELOAD_KEY, which will reload same action. If data is wrong, stick error message to session, and forward to the same DialogConstants.DIALOG_RELOAD_KEY, it will show the page with errors. Cannot be simpler. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Having ttruble with actions and buttons
ok here is what I am talking about. I have a form that takes in first name, last name, street address, city, state and zipcode. When I press on the button to enter that information into a database. I want the page to reload with clear input fields. -Paul Michael Jouravlev wrote: What do you mean "clear out" and what do you mean by "reload"? If you need a stateful component to obtain user data, and to be able to to redisplay the page with error messages, and to store intermediate data, and to correctly process Refresh and Back buttons, you might want to take a look at the class that I put together last week: http://struts.sourceforge.net/strutsdialogs If you totally against storing data in the session, this class is not for you, though ;-) Michael. P.S. Damn, that download counter did reset, when I updated the zip :-( P.P.S. The live samples are not available right at this moment, the server is down. It should be up soon. On 6/13/05, Paul Goepfert <[EMAIL PROTECTED]> wrote: I figured it out. It was a stupid mistake, the mappings didn't match between my struts-config and my Action Class. By the way, the Dispacher looks like a better way to handle actions. I don't suppose anyone would know where I would call the reset method to clear out the form onn a reload? -Paul Dave Newton wrote: Paul Goepfert wrote: [...] try { session = request.getSession(); action = request.getParameter("action"); if(action.equals("enterInfo")) { return (mapping.findForward("enter")); } else if(action.equals("default")) { sorted = data.createSortedArray("ascending", "first"); data.removeInsert(sorted); data.createContext(sorted); return (mapping.findForward("default")); } else { return (mapping.findForward("sort")); } } [...] This code reeks of code smell, regardless of any other issues, especially if you have to do something similar in any other action. This is, more or less, what DispatchAction (?) was created for. Here you've duplicated controller logic inside an action, which is really supposed to be a target of the controller. So here you are expecting forwards named "enter", "default", and "sort". menu onchange="menu.action.value='enterInfo'" $text.get("menuEnter") enterInfo onchange="menu.action.value='default'">$text.get("menuDefault") default onchange="menu.action.value='sort'">$text.get("menuSort") sort Okay, so that looks good. Have you done a sanity check with a plain 'ol action with a forward to a JSP like Frank suggested? Have you put in logging statements to make sure that the action parameter is what you expect it to be when you hit your action? Have you been able to get _any_ Velocity file to render, i.e., hit one without going through Struts? An the related Have you checked on the Velocity list to make sure you have the VelocityViewServlet set up properly? Have you checked the log files for error messages? Dave - 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: Having ttruble with actions and buttons
What do you mean "clear out" and what do you mean by "reload"? If you need a stateful component to obtain user data, and to be able to to redisplay the page with error messages, and to store intermediate data, and to correctly process Refresh and Back buttons, you might want to take a look at the class that I put together last week: http://struts.sourceforge.net/strutsdialogs If you totally against storing data in the session, this class is not for you, though ;-) Michael. P.S. Damn, that download counter did reset, when I updated the zip :-( P.P.S. The live samples are not available right at this moment, the server is down. It should be up soon. On 6/13/05, Paul Goepfert <[EMAIL PROTECTED]> wrote: > I figured it out. It was a stupid mistake, the mappings didn't match > between my struts-config and my Action Class. By the way, the Dispacher > looks like a better way to handle actions. I don't suppose anyone > would know where I would call the reset method to clear out the form onn > a reload? > > -Paul > > Dave Newton wrote: > > > Paul Goepfert wrote: > > > >> [...] try > >>{ > >>session = request.getSession(); > >>action = request.getParameter("action"); > >>if(action.equals("enterInfo")) > >>{ > >>return (mapping.findForward("enter")); > >>} > >>else if(action.equals("default")) > >>{ > >>sorted = data.createSortedArray("ascending", "first"); > >>data.removeInsert(sorted); > >>data.createContext(sorted); > >>return (mapping.findForward("default")); > >>} > >>else > >>{ > >>return (mapping.findForward("sort")); > >>} > >>} [...] > > > > > > This code reeks of code smell, regardless of any other issues, > > especially if you have to do something similar in any other action. > > This is, more or less, what DispatchAction (?) was created for. Here > > you've duplicated controller logic inside an action, which is really > > supposed to be a target of the controller. > > > > So here you are expecting forwards named "enter", "default", and "sort". > > > >> > >> > > > > > > menu > > > >> onchange="menu.action.value='enterInfo'" > >> >$text.get("menuEnter") > > > > > > enterInfo > > > >> onchange="menu.action.value='default'">$text.get("menuDefault") > > > > > > default > > > >> onchange="menu.action.value='sort'">$text.get("menuSort") > > > > > > sort > > > type="actions.MenuAction" > name="menuForm" > scope="request"> > path="/info.vm" /> > path="/results.vm" /> > path="/sort.vm" /> > > >>> > >>> > > Okay, so that looks good. > > > > Have you done a sanity check with a plain 'ol action with a forward to > > a JSP like Frank suggested? > > > > Have you put in logging statements to make sure that the action > > parameter is what you expect it to be when you hit your action? > > > > Have you been able to get _any_ Velocity file to render, i.e., hit one > > without going through Struts? An the related Have you checked on the > > Velocity list to make sure you have the VelocityViewServlet set up > > properly? > > > > Have you checked the log files for error messages? > > > > Dave > > > > > > > > - > > 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: Having ttruble with actions and buttons
I figured it out. It was a stupid mistake, the mappings didn't match between my struts-config and my Action Class. By the way, the Dispacher looks like a better way to handle actions. I don't suppose anyone would know where I would call the reset method to clear out the form onn a reload? -Paul Dave Newton wrote: Paul Goepfert wrote: [...] try { session = request.getSession(); action = request.getParameter("action"); if(action.equals("enterInfo")) { return (mapping.findForward("enter")); } else if(action.equals("default")) { sorted = data.createSortedArray("ascending", "first"); data.removeInsert(sorted); data.createContext(sorted); return (mapping.findForward("default")); } else { return (mapping.findForward("sort")); } } [...] This code reeks of code smell, regardless of any other issues, especially if you have to do something similar in any other action. This is, more or less, what DispatchAction (?) was created for. Here you've duplicated controller logic inside an action, which is really supposed to be a target of the controller. So here you are expecting forwards named "enter", "default", and "sort". menu onchange="menu.action.value='enterInfo'" >$text.get("menuEnter") enterInfo onchange="menu.action.value='default'">$text.get("menuDefault") default onchange="menu.action.value='sort'">$text.get("menuSort") sort Okay, so that looks good. Have you done a sanity check with a plain 'ol action with a forward to a JSP like Frank suggested? Have you put in logging statements to make sure that the action parameter is what you expect it to be when you hit your action? Have you been able to get _any_ Velocity file to render, i.e., hit one without going through Struts? An the related Have you checked on the Velocity list to make sure you have the VelocityViewServlet set up properly? Have you checked the log files for error messages? Dave - 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: Having ttruble with actions and buttons
On Mon, June 13, 2005 2:41 pm, Dave Newton said: > Have you put in logging statements to make sure that the action > parameter is what you expect it to be when you hit your action? Dave is right... throw some println's in that Action and make sure your getting there in the first place. The code looks like it should work, putting aside the code smell observation :) , and as near as I can tell it should work, at least going to a plain JSP. Any chance the action you are passing in isn't the same case? I always use EqualsIgnoreCase() unless I know I require case sensitivity... saves a lot of headache that way. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Having ttruble with actions and buttons
You don't need to have forwards named "success" or "failure"; I'm not sure how this part of the thread got started. If they don't make sense for your app obviously you can call them whatever you want. Although I'd shy away from 'Fred' ;) Dave Martin Gainty wrote: This is straight from BEA doc "An object of this type is returned from an action methods in a PageFlowController to determine the next URI to be displayed. It is constructed on the name of a forward defined by the @jpf:forward tag, and resolves to the URI specified in that forward" The name of the variable forward's name (sucesss,failure,fred) paths you to the URI identitied to the path of the associated forward via the supplied name attribute 'success' and 'failure' are used as they are relatively easy forward names to remember You may even code these programmatically thru setForward Take a look at ActionForward doc for your implementation http://struts.apache.org/api/org/apache/struts/config/ActionConfig.html#getForward() HTH, Martin - Original Message - From: "Paul Goepfert" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Sunday, June 12, 2005 11:10 PM Subject: Re: Having ttruble with actions and buttons I am still new too struts so I don't understand why I would need to incluide forwards with names of success and failure in my struts-config. Those forward names just look like their just general forward names that have no real effect on where the page goes. Am I wrong in my thinking? -Paul Martin Gainty wrote: Paul- you need forwards defined for both success and failure name identified such as what you see in the struts doc http://struts.apache.org/userGuide/building_controller.html e.g. struts-config.xml HTH, Martin- - Original Message - From: "Paul Goepfert" <[EMAIL PROTECTED]> To: Sent: Sunday, June 12, 2005 9:37 PM Subject: Having ttruble with actions and buttons Ok, here is the problem. When I load up my web app the page loads fine. When I try to advance to another web page in my web app all I get is a blank screen. For every page I have a form.java and an action.java file so I can move through the web app. Here is part of my struts-config file that handles the actions. In the form.java files I have getters and setters for the information I pass through the address bar. In the action.java files I have method calls to my logic for the program as well as forwards for the next page I wannt to go to. If anyone can help me out that would be great. If more information is needed let me know. -Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Having ttruble with actions and buttons
Paul Goepfert wrote: [...] try { session = request.getSession(); action = request.getParameter("action"); if(action.equals("enterInfo")) { return (mapping.findForward("enter")); } else if(action.equals("default")) { sorted = data.createSortedArray("ascending", "first"); data.removeInsert(sorted); data.createContext(sorted); return (mapping.findForward("default")); } else { return (mapping.findForward("sort")); } } [...] This code reeks of code smell, regardless of any other issues, especially if you have to do something similar in any other action. This is, more or less, what DispatchAction (?) was created for. Here you've duplicated controller logic inside an action, which is really supposed to be a target of the controller. So here you are expecting forwards named "enter", "default", and "sort". menu onchange="menu.action.value='enterInfo'" >$text.get("menuEnter") enterInfo onchange="menu.action.value='default'">$text.get("menuDefault") default onchange="menu.action.value='sort'">$text.get("menuSort") sort Okay, so that looks good. Have you done a sanity check with a plain 'ol action with a forward to a JSP like Frank suggested? Have you put in logging statements to make sure that the action parameter is what you expect it to be when you hit your action? Have you been able to get _any_ Velocity file to render, i.e., hit one without going through Struts? An the related Have you checked on the Velocity list to make sure you have the VelocityViewServlet set up properly? Have you checked the log files for error messages? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Having ttruble with actions and buttons
This is straight from BEA doc "An object of this type is returned from an action methods in a PageFlowController to determine the next URI to be displayed. It is constructed on the name of a forward defined by the @jpf:forward tag, and resolves to the URI specified in that forward" The name of the variable forward's name (sucesss,failure,fred) paths you to the URI identitied to the path of the associated forward via the supplied name attribute 'success' and 'failure' are used as they are relatively easy forward names to remember You may even code these programmatically thru setForward Take a look at ActionForward doc for your implementation http://struts.apache.org/api/org/apache/struts/config/ActionConfig.html#getForward() HTH, Martin - Original Message - From: "Paul Goepfert" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Sunday, June 12, 2005 11:10 PM Subject: Re: Having ttruble with actions and buttons I am still new too struts so I don't understand why I would need to incluide forwards with names of success and failure in my struts-config. Those forward names just look like their just general forward names that have no real effect on where the page goes. Am I wrong in my thinking? -Paul Martin Gainty wrote: Paul- you need forwards defined for both success and failure name identified such as what you see in the struts doc http://struts.apache.org/userGuide/building_controller.html e.g. struts-config.xml HTH, Martin- - Original Message - From: "Paul Goepfert" <[EMAIL PROTECTED]> To: Sent: Sunday, June 12, 2005 9:37 PM Subject: Having ttruble with actions and buttons Ok, here is the problem. When I load up my web app the page loads fine. When I try to advance to another web page in my web app all I get is a blank screen. For every page I have a form.java and an action.java file so I can move through the web app. Here is part of my struts-config file that handles the actions. In the form.java files I have getters and setters for the information I pass through the address bar. In the action.java files I have method calls to my logic for the program as well as forwards for the next page I wannt to go to. If anyone can help me out that would be great. If more information is needed let me know. -Paul - 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: Having ttruble with actions and buttons
Here is my MenuAction.java package actions; import org.apache.struts.action.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.Arrays.*; import java.io.*; import forms.*; import beans.InfoBean; import logic.DB; public class MenuAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String action; HttpSession session; DB data = new DB(); InfoBean sorted [] = new InfoBean [data.getInformation().size()]; try { session = request.getSession(); action = request.getParameter("action"); if(action.equals("enterInfo")) { return (mapping.findForward("enter")); } else if(action.equals("default")) { sorted = data.createSortedArray("ascending", "first"); data.removeInsert(sorted); data.createContext(sorted); return (mapping.findForward("default")); } else { return (mapping.findForward("sort")); } } catch (Exception e) { e.printStackTrace(); } return (mapping.findForward("menu")); } } I am also including part of the webpage source file incase the problem is in there and its a html error. $text.get("menuEnter") $text.get("menuDefault") $text.get("menuSort") The $text variable is a varable that is defined in the velocity tools package. The variables are defined in a properties file I defined. When displayed on the web the $text variable is exchanged with the mapping in the properties file. -Paul Frank W. Zammetti wrote: On Mon, June 13, 2005 12:54 am, Paul Goepfert said: Well I just created a test jsp file to see if I got to the page. I didn't. I just want to be sure about one thing. I am soppose to have multiple actions in my struts config? One for each page? Right? How your app is configured is completely up to you... there are no rules per se (there's some commonly-accepted pattersn though). You might have 10 Actions for a single page (reasonable in some cases), or one Action for 10 pages (probably not a good idea generally), or one per page (most common I'd say), or something else I haven't thought of. I'm guessing, based on the config you posted, that you are submitting a form to /Menu when any of a number of menu items are clicked? Then in the Action you are determine which was clicked and forwarding to the appropriate Velocity template? If so, that's a reasonable approach... some would say you should probably use a DispatchAction, but it's more a matter of what you prefer than what is right or wrong. Now... why you aren't seeing the JSP... I think you want to solve that before anything else... The first thing to do is be sure what forward is being returned... As a matter of fact, how about posting your Action's code? I assume it isn't too big... There might be something obvious that I or someone else can point out right away... You either have something configured wrong, or the Action's code is wrong... Are you sure the Action is being reached at all? If so then most of your configuration it obviously correct, the only remaining point could be the forward declarations. Nothing stands out as wrong to me though, so seeing the code might help. Frank -Paul Frank W. Zammetti wrote: Ok... I probably can't be of too much help then... I've never used Velocity. One thing to try though... change your forwards to go to a test JSP... if you get to it, then the problem is in the Velocity side of things (or the forward to the Velocity templates). At least you'll narrow down your focus a bit. Frank Paul Goepfert wrote: I am forwarding to a web page. The .vm file extension is mapped to org.apache.velocity.tools.view.servlet.VelocityViewServlet. I am using Apache Velocity for my Web page design. Should I be forwarding to Actions? My intention is to go to a Velocity page rather then an html or JSP. -Paul Frank W. Zammetti wrote: What are you forwarding to in this mapping Paul? Is .vm the extension your application uses to map to ActionServlet, in which case you are forwarding to Actions? Or is it something else? Most commonly, the forwards go to JSPs (although not necessarily). You are correct in your thinking with regard to what M
Re: Having ttruble with actions and buttons
On Mon, June 13, 2005 12:54 am, Paul Goepfert said: > Well I just created a test jsp file to see if I got to the page. I > didn't. I just want to be sure about one thing. I am soppose to have > multiple actions in my struts config? One for each page? Right? How your app is configured is completely up to you... there are no rules per se (there's some commonly-accepted pattersn though). You might have 10 Actions for a single page (reasonable in some cases), or one Action for 10 pages (probably not a good idea generally), or one per page (most common I'd say), or something else I haven't thought of. I'm guessing, based on the config you posted, that you are submitting a form to /Menu when any of a number of menu items are clicked? Then in the Action you are determine which was clicked and forwarding to the appropriate Velocity template? If so, that's a reasonable approach... some would say you should probably use a DispatchAction, but it's more a matter of what you prefer than what is right or wrong. Now... why you aren't seeing the JSP... I think you want to solve that before anything else... The first thing to do is be sure what forward is being returned... As a matter of fact, how about posting your Action's code? I assume it isn't too big... There might be something obvious that I or someone else can point out right away... You either have something configured wrong, or the Action's code is wrong... Are you sure the Action is being reached at all? If so then most of your configuration it obviously correct, the only remaining point could be the forward declarations. Nothing stands out as wrong to me though, so seeing the code might help. Frank > -Paul > > Frank W. Zammetti wrote: > >> Ok... I probably can't be of too much help then... I've never used >> Velocity. >> >> One thing to try though... change your forwards to go to a test JSP... >> if you get to it, then the problem is in the Velocity side of things >> (or the forward to the Velocity templates). At least you'll narrow >> down your focus a bit. >> >> Frank >> >> Paul Goepfert wrote: >> >>> I am forwarding to a web page. The .vm file extension is mapped to >>> org.apache.velocity.tools.view.servlet.VelocityViewServlet. I am >>> using Apache Velocity for my Web page design. Should I be forwarding >>> to Actions? >>> >>> My intention is to go to a Velocity page rather then an html or JSP. >>> >>> -Paul >>> Frank W. Zammetti wrote: >>> What are you forwarding to in this mapping Paul? Is .vm the extension your application uses to map to ActionServlet, in which case you are forwarding to Actions? Or is it something else? Most commonly, the forwards go to JSPs (although not necessarily). You are correct in your thinking with regard to what Martin said... there are no special meaning forward names that I am aware of, you can name your forwards whatever you wish. Success and Failure are two very common names however. Is your intention to go to a JSP when you return a given forward from your Action? If so, I suspect that is what is wrong... change the paths on the forwards... if your intention is something else, please explain so we can try and help :) >>> >>> >>> Frank Paul Goepfert wrote: > Ok, here is the problem. When I load up my web app the page loads > fine. When I try to advance to another web page in my web app all > I get is a blank screen. For every page I have a form.java and an > action.java file so I can move through the web app. Here is part > of my struts-config file that handles the actions. > > type="actions.MenuAction" > name="menuForm" > scope="request"> > path="/info.vm" /> > path="/results.vm" /> > path="/sort.vm" /> > > > In the form.java files I have getters and setters for the > information I pass through the address bar. In the action.java > files I have method calls to my logic for the program as well as > forwards for the next page I wannt to go to. > > If anyone can help me out that would be great. If more information > is needed let me know. > > -Paul > > - > 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: Having ttruble with actions and buttons
> Ok, here is the problem. When I load up my web app the page loads fine. Which app, what page? Not enough detail, and the question is too generic. > When I try to advance to another web page in my web app all I get is a blank screen. You do not "advance to pages" in Struts. You have to get used to think on lower level, on HTTP level. You send request to an action which is a controller. Action processes your input if needed, and returns with mapping name. Then Struts uses this mapping to navigate to another location, usually to make a server-side forward to JSP page. What do you mean "to advance"? Do you use a link? What link? If anyone can help me out that would be great. > If more information is needed let me know. Read a good book, say Chuck Cavaness's or Ted Huste's. > I am soppose to have multiple actions in my struts config? One for each > page? Right? Usually, but not always... It depends. Pages are generated by action, so if you are processing same data and generate different pages, you can do it from the same action. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Having ttruble with actions and buttons
Well I just created a test jsp file to see if I got to the page. I didn't. I just want to be sure about one thing. I am soppose to have multiple actions in my struts config? One for each page? Right? -Paul Frank W. Zammetti wrote: Ok... I probably can't be of too much help then... I've never used Velocity. One thing to try though... change your forwards to go to a test JSP... if you get to it, then the problem is in the Velocity side of things (or the forward to the Velocity templates). At least you'll narrow down your focus a bit. Frank Paul Goepfert wrote: I am forwarding to a web page. The .vm file extension is mapped to org.apache.velocity.tools.view.servlet.VelocityViewServlet. I am using Apache Velocity for my Web page design. Should I be forwarding to Actions? My intention is to go to a Velocity page rather then an html or JSP. -Paul Frank W. Zammetti wrote: What are you forwarding to in this mapping Paul? Is .vm the extension your application uses to map to ActionServlet, in which case you are forwarding to Actions? Or is it something else? Most commonly, the forwards go to JSPs (although not necessarily). You are correct in your thinking with regard to what Martin said... there are no special meaning forward names that I am aware of, you can name your forwards whatever you wish. Success and Failure are two very common names however. Is your intention to go to a JSP when you return a given forward from your Action? If so, I suspect that is what is wrong... change the paths on the forwards... if your intention is something else, please explain so we can try and help :) Frank Paul Goepfert wrote: Ok, here is the problem. When I load up my web app the page loads fine. When I try to advance to another web page in my web app all I get is a blank screen. For every page I have a form.java and an action.java file so I can move through the web app. Here is part of my struts-config file that handles the actions. In the form.java files I have getters and setters for the information I pass through the address bar. In the action.java files I have method calls to my logic for the program as well as forwards for the next page I wannt to go to. If anyone can help me out that would be great. If more information is needed let me know. -Paul - 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: Having ttruble with actions and buttons
Ok... I probably can't be of too much help then... I've never used Velocity. One thing to try though... change your forwards to go to a test JSP... if you get to it, then the problem is in the Velocity side of things (or the forward to the Velocity templates). At least you'll narrow down your focus a bit. Frank Paul Goepfert wrote: I am forwarding to a web page. The .vm file extension is mapped to org.apache.velocity.tools.view.servlet.VelocityViewServlet. I am using Apache Velocity for my Web page design. Should I be forwarding to Actions? My intention is to go to a Velocity page rather then an html or JSP. -Paul Frank W. Zammetti wrote: What are you forwarding to in this mapping Paul? Is .vm the extension your application uses to map to ActionServlet, in which case you are forwarding to Actions? Or is it something else? Most commonly, the forwards go to JSPs (although not necessarily). You are correct in your thinking with regard to what Martin said... there are no special meaning forward names that I am aware of, you can name your forwards whatever you wish. Success and Failure are two very common names however. Is your intention to go to a JSP when you return a given forward from your Action? If so, I suspect that is what is wrong... change the paths on the forwards... if your intention is something else, please explain so we can try and help :) Frank Paul Goepfert wrote: Ok, here is the problem. When I load up my web app the page loads fine. When I try to advance to another web page in my web app all I get is a blank screen. For every page I have a form.java and an action.java file so I can move through the web app. Here is part of my struts-config file that handles the actions. In the form.java files I have getters and setters for the information I pass through the address bar. In the action.java files I have method calls to my logic for the program as well as forwards for the next page I wannt to go to. If anyone can help me out that would be great. If more information is needed let me know. -Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Having ttruble with actions and buttons
I am forwarding to a web page. The .vm file extension is mapped to org.apache.velocity.tools.view.servlet.VelocityViewServlet. I am using Apache Velocity for my Web page design. Should I be forwarding to Actions? My intention is to go to a Velocity page rather then an html or JSP. -Paul Frank W. Zammetti wrote: What are you forwarding to in this mapping Paul? Is .vm the extension your application uses to map to ActionServlet, in which case you are forwarding to Actions? Or is it something else? Most commonly, the forwards go to JSPs (although not necessarily). You are correct in your thinking with regard to what Martin said... there are no special meaning forward names that I am aware of, you can name your forwards whatever you wish. Success and Failure are two very common names however. Is your intention to go to a JSP when you return a given forward from your Action? If so, I suspect that is what is wrong... change the paths on the forwards... if your intention is something else, please explain so we can try and help :) Frank Paul Goepfert wrote: Ok, here is the problem. When I load up my web app the page loads fine. When I try to advance to another web page in my web app all I get is a blank screen. For every page I have a form.java and an action.java file so I can move through the web app. Here is part of my struts-config file that handles the actions. In the form.java files I have getters and setters for the information I pass through the address bar. In the action.java files I have method calls to my logic for the program as well as forwards for the next page I wannt to go to. If anyone can help me out that would be great. If more information is needed let me know. -Paul - 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: Having ttruble with actions and buttons
What are you forwarding to in this mapping Paul? Is .vm the extension your application uses to map to ActionServlet, in which case you are forwarding to Actions? Or is it something else? Most commonly, the forwards go to JSPs (although not necessarily). You are correct in your thinking with regard to what Martin said... there are no special meaning forward names that I am aware of, you can name your forwards whatever you wish. Success and Failure are two very common names however. Is your intention to go to a JSP when you return a given forward from your Action? If so, I suspect that is what is wrong... change the paths on the forwards... if your intention is something else, please explain so we can try and help :) Frank Paul Goepfert wrote: Ok, here is the problem. When I load up my web app the page loads fine. When I try to advance to another web page in my web app all I get is a blank screen. For every page I have a form.java and an action.java file so I can move through the web app. Here is part of my struts-config file that handles the actions. In the form.java files I have getters and setters for the information I pass through the address bar. In the action.java files I have method calls to my logic for the program as well as forwards for the next page I wannt to go to. If anyone can help me out that would be great. If more information is needed let me know. -Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Having ttruble with actions and buttons
I am still new too struts so I don't understand why I would need to incluide forwards with names of success and failure in my struts-config. Those forward names just look like their just general forward names that have no real effect on where the page goes. Am I wrong in my thinking? -Paul Martin Gainty wrote: Paul- you need forwards defined for both success and failure name identified such as what you see in the struts doc http://struts.apache.org/userGuide/building_controller.html e.g. struts-config.xml HTH, Martin- - Original Message - From: "Paul Goepfert" <[EMAIL PROTECTED]> To: Sent: Sunday, June 12, 2005 9:37 PM Subject: Having ttruble with actions and buttons Ok, here is the problem. When I load up my web app the page loads fine. When I try to advance to another web page in my web app all I get is a blank screen. For every page I have a form.java and an action.java file so I can move through the web app. Here is part of my struts-config file that handles the actions. In the form.java files I have getters and setters for the information I pass through the address bar. In the action.java files I have method calls to my logic for the program as well as forwards for the next page I wannt to go to. If anyone can help me out that would be great. If more information is needed let me know. -Paul - 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: Having ttruble with actions and buttons
Paul- you need forwards defined for both success and failure name identified such as what you see in the struts doc http://struts.apache.org/userGuide/building_controller.html e.g. struts-config.xml HTH, Martin- - Original Message - From: "Paul Goepfert" <[EMAIL PROTECTED]> To: Sent: Sunday, June 12, 2005 9:37 PM Subject: Having ttruble with actions and buttons Ok, here is the problem. When I load up my web app the page loads fine. When I try to advance to another web page in my web app all I get is a blank screen. For every page I have a form.java and an action.java file so I can move through the web app. Here is part of my struts-config file that handles the actions. In the form.java files I have getters and setters for the information I pass through the address bar. In the action.java files I have method calls to my logic for the program as well as forwards for the next page I wannt to go to. If anyone can help me out that would be great. If more information is needed let me know. -Paul - 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]