RE: JBoss v.s. tomcat?
Yes I just did some research and realized that JBoss is simply a EJB app server to add J2EE Beans to the applications. My bad.. Regards, Sloan JBoss actually uses tomcat (or jetty, (etc...)) to provide its servlet container functionality. -Original Message- From: Sloan Bowman [mailto:[EMAIL PROTECTED] Sent: Monday, 23 June 2003 11:00 To: Struts-user MailingList Subject: JBoss v.s. tomcat? I have been using Tomcat for over a year now and I am very happy with the way it performs. Recently though I have been looking at JBoss, does any one here use JBoss or have any comments on the differents besides J2EE compliance. Thanks for your help. Thanks, Sloan - 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] -- Sloan Bowman www.nashlinux.com www.q3networks.com www.aboutgoodlettsville.com www.spudibby.com --- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JBoss v.s. tomcat?
I have been using Tomcat for over a year now and I am very happy with the way it performs. Recently though I have been looking at JBoss, does any one here use JBoss or have any comments on the differents besides J2EE compliance. Thanks for your help. Thanks, Sloan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action without a form
You should also build your Action using a package so struts/Web Container knows exactly where to look. Do some debugging to see if the Action is actually called at all. Example struts-config.xml ActionMapping with package --Sloan In a JSP page, I have a link that calls an Action. Usually, this is done with a submit button within a form, but I need it to be a link. Apparently, this introduces a problem, since I'm not using a form. Basically, I want to click a link, execute an Action which puts some object in request scope, then forward to some results page. Here's the link: [ jsp snippet ] ... List Users In my struts-cfg.xml, I have In the GetUsersAction class, I put an object in request scope with request.setAttribute( "label", myObj ), and then call return (mapping.findForward("ViewUsers")); I believe that this Action class is not being called since no log messages are displayed in the console and myObj is not availabe in the ViewUsers JSP. However the request is forwarded to the ViewUsers.jsp file. (This part doesn't make sense.) Is it possible for me to call an action from a link without a form, or do I need to use a dummy form? Or do I need to change my stuts-cfg.xml somehow? Thanks in advance. Morgan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sloan Bowman www.nashlinux.com www.q3networks.com www.aboutgoodlettsville.com www.spudibby.com --- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and database
I will do my best to explain this but I will also point you in the right direction. First off you need to read the Java Blueprints on using DAO with J2ee. This will teach you the best methods of using Databases by using the DAO to encapsulate the DataSource . Here is the link to the Java Blueprints http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html read this complete document and it will help you out alot with how you should use your databases in your applications. Lets use an example say for a User requesting a item from the online store for our example. First you build the ActionForm which stores the data sent by the form. The ActionForm is passed through the FrontController which in turn dispatches you to the correct Action. In our case the Action will be using methods from a class which contains all of your Buisness logic. Form example, we have a ItemDAO which has a method getItem(int itemNum). This method returns a ItemBean which stores all of the information about that item. This Bean you are using to store all of the information is called a State Bean (if I remember right, corrections are welcome). When you get the ItemBean returned from the method getItem(int itemNum) you can then add it to your session/request etc.. for example you could do request.setAttribute("itemBean", itemBean). Now once you return the ActionForward in the Action (Example: mapping.findForward("success")) the itemBean will be part of the request and you acn access these properties in the View using jsp, velocity etc.. I hope this helps you out. --Sloan p.s. Sorry for the type o's I didn't proof read Hi! Would anyone give me some examples of database programming, which lead from retrieving data to rendering view. (I mean real database, not from XML files), e.g. any web site with source, or even better, some simple example? I am very confused on how to use beans from the model. If there any book that focus on database programming? I have been searching on the web, but unable to find. Andy Cheng [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bean in the view or in the model?
Andy, You never want to have a bean return html tags because this would cause the bean to only be used in as a http bean. Instead you should create a Data Access Bean pull the data from the database and return a State bean to the view you are wanted to use. In the view you can use the state bean to get the parameters. For example: Your query the database using the DAO and return a UserBean Object. In the Action set this bean into the session with session.setAttribute("userBean", userBean). Then have the Action return a ActionForward to the correct view. Use the view to get the information from the Bean to display or in your case create the html tags you wanted. Hope this helps -Sloan hi! I am currently learning struts, and I have a bean that I can set some parameters, and then it query the database, render and return the result as a HTML table. I am just wondering if I should place this bean in the View (the jsp page), or the Model then return the string (HTML table) to the JSP page using request for displaying? Would there be a better way? Please point me to a source for this area of information, thanks. Andy Cheng [EMAIL PROTECTED] -- Sloan Bowman www.nashlinux.com www.q3networks.com www.aboutgoodlettsville.com www.spudibby.com --- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best Book on Struts
I read Struts in Action and found it to be pretty good but didn't go into as much detail as would like on some subjects but all around its pretty good. I would recommend having a strong background in JSP/Servlet/Taglibs before reading this book though. Hope this helps. Also if you read the Java Blueprints on Web Teir patterns you will learn a lot. Link: java.sun.com/j2ee/blueprints/ Hope this helps, Sloan Hi all, I am a struts newbie and am happy with the struts-documentaion.war Can anyone suggest a good book on struts. I feel that all the books mentioned in the documentation - resources would definately be good, but out of all those 6 shown, which one would be the best buy ! PS : I have to buy the book from my own expenses and my company is not gonna buy it for me. Thankyou in advance, Vijay Pawar - 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: -Newbie- my own Servlet
Your ActionMapping should look as follows to do forwarding If you want to define an Action class to use do the following scope="request" input="page used to input the data"/> Hope this helps. -Sloan At 07:37 AM 6/17/2003, you wrote: Hi Im very new with this struts thing, I've got an action path /login now I want it to use my own Controller Servlet... this is what I've got "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";> now my login jsp form looks as follows This does not work this happnes when the JSP compiels (Cannot retrieve mapping for action /login) what is wrong? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best method for Databae Access in Struts/Tomcat combo?
I appreciate your help very much. You were extremely helpful. --Sloan David, That clears up quite a bit for me. So if I have a Resource setup in my container (Tomcat 4.1.24) I can use that resource in any class using JNDI and don't have to worry about specifying it inside my struts-configuration.xml file. Am I understanding you correct. That's exactly right. You probably want to look it up from JNDI once and cache it somewhere because JNDI calls are potentially expensive. David Thanks, Sloan Struts stores DataSources defined in struts-config.xml in the ServletContext so any class can access them. A more common approach is to define your DataSource in JNDI and have your business objects look it up from there. Both ways allow for MVC and the Struts configuration is provided as a convenience. David I have been reading all over the place and can't seem to find a simple answer to my question. In struts using MVC development what is the best method to connect to a database. In struts 1.1rc1 you can specify DataSources but to my understanding you can only access this datasource from within the subclasses of the Action class. Using MVC I don't see how this could be helpful because you couldn't use the Struts datasource in the Data Access Object Beans. I would love to hear all of the ideas everybody has about this and examples if possible. I greatly appreciate it. Regards, Sloan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sloan Bowman www.nashlinux.com www.q3networks.com www.aboutgoodlettsville.com www.spudibby.com --- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sloan Bowman www.nashlinux.com www.q3networks.com www.aboutgoodlettsville.com www.spudibby.com --- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best method for Databae Access in Struts/Tomcat combo?
David, That clears up quite a bit for me. So if I have a Resource setup in my container (Tomcat 4.1.24) I can use that resource in any class using JNDI and don't have to worry about specifying it inside my struts-configuration.xml file. Am I understanding you correct. Thanks, Sloan Struts stores DataSources defined in struts-config.xml in the ServletContext so any class can access them. A more common approach is to define your DataSource in JNDI and have your business objects look it up from there. Both ways allow for MVC and the Struts configuration is provided as a convenience. David I have been reading all over the place and can't seem to find a simple answer to my question. In struts using MVC development what is the best method to connect to a database. In struts 1.1rc1 you can specify DataSources but to my understanding you can only access this datasource from within the subclasses of the Action class. Using MVC I don't see how this could be helpful because you couldn't use the Struts datasource in the Data Access Object Beans. I would love to hear all of the ideas everybody has about this and examples if possible. I greatly appreciate it. Regards, Sloan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sloan Bowman www.nashlinux.com www.q3networks.com www.aboutgoodlettsville.com www.spudibby.com --- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Best method for Databae Access in Struts/Tomcat combo?
I have been reading all over the place and can't seem to find a simple answer to my question. In struts using MVC development what is the best method to connect to a database. In struts 1.1rc1 you can specify DataSources but to my understanding you can only access this datasource from within the subclasses of the Action class. Using MVC I don't see how this could be helpful because you couldn't use the Struts datasource in the Data Access Object Beans. I would love to hear all of the ideas everybody has about this and examples if possible. I greatly appreciate it. Regards, Sloan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:
I have been able to get one app working then when I tore it down and trying to start from stratch again to see if could finally figure it out I am getting the same error message. I am pasting the code below to see if you see anything I am doing wrong. Thanks for the help. I really appreciate it. === Logon Page Form === <%@ taglib uri="/tags/struts-html" prefix="html" %> <%@ taglib uri="/tags/struts-logic" prefix="logic" %> <%@ taglib uri="/tags/struts-bean" prefix="bean" %> Logon Username: Password: === LogonForm Bean === package app; import org.apache.struts.action.*; public class LogonForm extends ActionForm { private String username; private String password; private String passwordMatch; public void setUsername(String aUsername) { this.username = aUsername; } // end setUsername() public String getUsername() { return(this.username); } // end getUsername() public void setPassword(String aPassword) { this.password = aPassword; } // end setPassword() public String getPassword() { return(this.password); } // end getPassword() public void setPasswordMatch(String aPassword) { this.passwordMatch = aPassword; } // end setPasswordMatch() public String getPasswordMatch() { return(this.passwordMatch); } // end getPasswordMatch } // end class LogonForm === Struts config === http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";> Thanks again for the help.. Regards, Sloan Bowman Take a look at the struts-example. For subscriptions and registration tasks, there are 2 parts to the flow. 1. Setup 2. Save In a general sense "Setup" is usually an "edit" or a "new" when using the application. The only difference being that edit uses some values from persistence to allow the user to edit them. "new" just presents the user with a blank form so that they can fill it out from scratch. In both cases, the "setup" is handled by one action and uses a request parameter to determine if this is a a "new" subscription or "editing" an existing one. That parameter is called (coincidentally) "action". Here's the struts-config entry to handle that: type="org.apache.struts.webapp.example.EditSubscriptionAction" attribute="subscriptionForm" scope="request" validate="false"> ..notice that this action uses attribute="subscriptionForm" instead of name="subscriptionForm" as is done when saving the subsciption... type="org.apache.struts.webapp.example.SaveSubscriptionAction" name="subscriptionForm" scope="request" input="subscription"> What this essentially saying is..."let me setup the form on the way into the page, and let me tell struts which form I used when it gets submitted. I hope this clears it up for you. -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org - Original Message - From: "Sloan Bowman" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 9:54 AM Subject: Re: Do you mean specify the form bean in the struts-config.xml or the --Sloan At 11:25 AM 6/11/2003, you wrote: >You need to specify that your particular action uses a form-bean (for >example "UserFormBean"). You may be wanting to display a blank form to the >user, but as the jsp is rendering that form, it needs to check the fields of >UserFormBean to display it's content (which could be null or empty in your >case). You would specify the action to submit to in the html:form tag. >Struts will then use the form-bean that you specified (which happens to be >the same..."UserFormBean"). > >Does this help? > > >-- >James Mitchell >Software Developer/Struts Evangelist >http://www.struts-atlanta.org > > >- Original Message - >From: "Sloan Bowman" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Wednesday, June 11, 2003 11:25 AM >Subject: > > > When I am creating a form text field with property="username"/> > > I get the following error message. I wasn't aware I was supo
Re:
Do you mean specify the form bean in the struts-config.xml or the --Sloan At 11:25 AM 6/11/2003, you wrote: You need to specify that your particular action uses a form-bean (for example "UserFormBean"). You may be wanting to display a blank form to the user, but as the jsp is rendering that form, it needs to check the fields of UserFormBean to display it's content (which could be null or empty in your case). You would specify the action to submit to in the html:form tag. Struts will then use the form-bean that you specified (which happens to be the same..."UserFormBean"). Does this help? -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org - Original Message - From: "Sloan Bowman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 11:25 AM Subject: > When I am creating a form text field with > I get the following error message. I wasn't aware I was supossed to be > using a bean yet. I thought you put the bean in the submitted Action. > > > Cannot find bean org.apache.struts.taglib.html.BEAN in any scope > > I am developing on Tomcat 4.1.18 and Struts 1.1.rc1. Thanks for your help. > > > --Sloan > > > - > 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]
struts-user@jakarta.apache.org
When I am creating a form text field with I get the following error message. I wasn't aware I was supossed to be using a bean yet. I thought you put the bean in the submitted Action. Cannot find bean org.apache.struts.taglib.html.BEAN in any scope I am developing on Tomcat 4.1.18 and Struts 1.1.rc1. Thanks for your help. --Sloan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts doesn't execute my ActionForm.
With most Container's you always want to lock down the WEB-INF directory from any external access. If you use the container with lets say apache you would use the Override all deny etc.. to keep users out of this directory. Again though this is coming from the jsp/Servlet standpoint. With Struts framework you are using RequestDispatchers to access the files which will not reveal the location of the file and you should be able to access it because its not going through tcp/ip. So yes it will work but not recommend by several books I have read. > I am new to Struts and learning myself but from what I have read the input attribute is for validation if the form/Action fails it will send it back to the view. My book states: "input - Used to define where the user should be redirected, if a validation error occurs. Usually, the user is redirected back to the JSP page where the data was submitted." And this is exactly what I'm doing. I want to send the user back to the PostTest.jsp form to let him correct his entry and I want to tell him which part is wrong showing error messages. And know that you should never has .jsp pages located in your WEB-INF directory. Just an idea. I'm new to Struts too. But this is what I got from the Professional Struts Applications from WROX. They've placed the the jsp directory containing all jsps unter WEB-INF. BTW I wouldn't know what's the trouble with that would be? Thanks Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * 141 FETCH (FLAGS (\Seen)) -- Sloan Bowman www.nashlinux.com www.q3networks.com www.aboutgoodlettsville.com www.spudibby.com --- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts doesn't execute my ActionForm.
I am new to Struts and learning myself but from what I have read the input attribute is for validation if the form/Action fails it will send it back to the view. And know that you should never has .jsp pages located in your WEB-INF directory. Just an idea. --Sloan Marco, > input="/WEB-INF/jsp/postTest.jsp" > name="postTestForm" > scope="request" > validate="true" > type="com.mycompany.PostTestForm"> > > the input elemement should not contain the /WEB-INF specification (but I could be wrong). I tried it already. You mean input="/postTest", right? I doesn't work too. I'm being send to the application entrypage anyway. Can you explain what the %20name= thing in the URL is? I have no idea where does it come from... It seems to me also that as type you specified a class representing your Form more than the action to execute. The class specified as type is the ActionForm for the HTML form. Here how it looks like: package com.mycompany; import org.apache.struts.action.Action; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.lang.String; public class PostTestForm extends ActionForm { private String field1 = ""; private String field2 = ""; private String field3 = ""; private void checkForEmpty(String fieldName, String fieldKey, String value, ActionErrors errors) { if (value.trim().length() == 0) { System.out.println("***checkForEmpty***"); ActionError error = new ActionError("error.posttest.field.null", fieldName); errors.add(fieldKey, error); } } private void checkForLength(String fieldName, String fieldKey, String value, int maxLength, ActionErrors errors) { if (value.length() > maxLength) { ActionError error = new ActionError("error.posttest.field.length", fieldName); errors.add(fieldKey, error); } } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); checkForEmpty("field1", "error.field1.empty", getField1(), errors); checkForEmpty("field2", "error.field2.empty", getField2(), errors); checkForEmpty("field3", "error.field3.empty", getField3(), errors); System.out.println("***checkForEmpty zu Ende***"); checkForLength("field1", "error.field1.lenght", getField1(), 5, errors); checkForLength("field2", "error.field2.lenght", getField2(), 5, errors); checkForLength("field3", "error.field3.lenght", getField3(), 5, errors); return errors; } public void reset(ActionMapping mapping, HttpServletRequest request) { field1 = ""; field2 = ""; field3 = ""; } public String getField1() { return field1; } public void setField1(String feld1) { this.field1 = field1; } public String getField2() { return field2; } public void setField2(String field2) { this.field2 = field2; } public String getField3() { return field3; } public void setField3(String field3) { this.field3 = field3; } } I'm sitting on it since couple of hours already, but I'm no step further. I using the Professional Struts Applicatons book. I wonder if there are some many error in there or what else is going on? Thanks Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * 141 FETCH (FLAGS (\Seen)) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]