Should Action or ActionForm be accessing business delegates?
The reading I've done suggested that one of the Action class's primary responsibilities was to access the business layer. Then today I was looking at the core j2ee patterns and it showed the View Helper accessing the business layer. I associated (maybe mistakenly) the View Helper pattern with the ActionForm and was then wondering if I should design our ActionForm's to have direct access to the business layer. Thoughts? Thanks, Brian Barnett
RE: OT - java.sun.com is not accecsible
I can access it. -Original Message- From: Ramachandiran, Karuna [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 02, 2004 2:03 PM To: Struts Users Mailing List Subject: OT - java.sun.com is not accecsible Hello guys-, Does anybody noticed and know why java.sun.com is not accessible today? Thanks Karuna - 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: Validator and DispatchAction
Set validate=false in your action mapping in struts-config. This tells the struts framework not to call validate. Then in your action class you can call validate where appropriate, i.e., the *save* method. -Original Message- From: Renato Romano [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 18, 2004 6:43 AM To: 'Struts Users Mailing List' Subject: Validator and DispatchAction I'm quite new to the validator framework, and was trying to figure out how to use it. My situation is: 1) I want to perform server side validation, and so I made my form extend ValidatorForm; 2) the action that processes my form is a DispatchAction, so I have methods like edit, save list, all associated with the same form; 3) I call http://blabla/myapp/myAction.do?methodName=edit to have the app present me with an empty form; 4) When processing this action, struts allocates the form and calls the validate method, which of course causes validation errors to be produced, and the request to be forwarded to the input element of my action, which, as usual, is the same jsp which contains the form; 5) since the page finds some errors (the form is empty!!) they are shown by the html:errors/ tag. The only think I can imagine is to have a separate action in struts-config, which takes no form and simply redirects control to the jsp page which shows the (html) form. This should avoid Struts from calling the validate method, and hence html:errors/ should show nothing. Of course this would change a bit the logic we already placed in the application actions: for example action.do?methodName=edit in our architecture should present an empty form, while action.do?m=editid=88 should fill the form with the properties of the object with id 88, and then forward to the same jsp page, which then shows that object ready to be modified. If my above consideration is correct I should define two separate actions in struts-config, and let the links be something like newObject.do (for the presentation of an empty form) and unchanged for the loading of an object. Is all this correct ?Are there alternative approaches? Should I quit server side validation and only use client-side (which does not suffer from this problem)? Any help is very appreciated. Renato Renato Romano Sistemi e Telematica S.p.A. Calata Grazie - Vial Al Molo Giano 16127 - GENOVA e-mail: [EMAIL PROTECTED] Tel.: 010 2712603 _ - 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: Role based access?
Another option I believe is to let the j2ee container handle security. I'm not up on all the jargon, but I'm using roles and form-based security. Here are some code snippets from some relevant files: web.xml snippet: security-constraint web-resource-collection web-resource-nameGeneralAgent/web-resource-name url-pattern/do/generalAgent/*/url-pattern url-pattern/do/company/*/url-pattern url-pattern/do/reportOptions/*/url-pattern /web-resource-collection auth-constraint role-namega/role-name /auth-constraint user-data-constraint transport-guaranteeNONE/transport-guarantee /user-data-constraint /security-constraint security-constraint web-resource-collection web-resource-nameAgent/web-resource-name url-pattern/do/login/* /url-pattern url-pattern/do/agent/* /url-pattern url-pattern/do/policy/* /url-pattern url-pattern/do/commissionStatement/* /url-pattern url-pattern/do/commissionStatementPrint/* /url-pattern /web-resource-collection auth-constraint role-namega/role-name role-namea/role-name /auth-constraint user-data-constraint transport-guaranteeNONE/transport-guarantee /user-data-constraint /security-constraint login-config auth-methodFORM/auth-method form-login-config form-login-page/WEB-INF/jsp/Login.jsp/form-login-page form-error-page/WEB-INF/jsp/LoginBad.jsp/form-error-page /form-login-config /login-config security-role role-namea/role-name /security-role security-role role-namega/role-name /security-role Then in Tomcat's server.xml file (other containers should support something similar). Basically you can tell the container where to get a user's role from a database when they login. Realm className=org.apache.catalina.realm.JDBCRealm debug=99 driverName=com.microsoft.jdbc.sqlserver.SQLServerDriver connectionURL=jdbc:microsoft:sqlserver://BB-SERVER:1433;DatabaseName=commis sion;SelectMethod=cursor connectionName=dbLogin connectionPassword=dbPassword userTable=agent userNameCol=login userCredCol=password userRoleTable=agent roleNameCol=role / You also have to create the Login.jsp and LoginBad.jsp files. This link talks a little more about it. http://www.jguru.com/faq/view.jsp?EID=115231 -Original Message- From: Nadeem Bitar [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 18, 2004 12:30 PM To: Struts Users Mailing List Subject: Re: Role based access? You have to use JAAS. If you are not using JAAS and still want to use the roles attribute in your action mapping you have to override the processRoles method . On Wed, 2004-02-18 at 20:49 +0530, [EMAIL PROTECTED] wrote: Hi Guys, Struts-config.xml action attribute=Form roles=userRole How do i use this 'roles' attribute to implement role-based access. Thanks and Regards Subramaniam Olaganthan Tata Consultancy Services Mailto: [EMAIL PROTECTED] Website: http://www.tcs.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]
Could not find resource error
Can't figure out why this code is giving me an error: import java.io.Reader; import com.ibatis.common.resources.Resources; Reader reader = Resources.getResourceAsReader(properties/sql-map-config.xml); The error I'm getting is: java.io.IOException: Could not find resource properties/sql-map-config.xml at com.ibatis.common.resources.Resources.getResourceAsStream(Ljava.lang. String;)Ljava.io.InputStream;(Unknown Source) I verified the file is there, but my app can't find it. Is there a setting somewhere I have messed up somehow? Any suggestions on things I can check? Thanks, Brian Barnett
RE: Could not find resource error
Good point! :) The only reason it is struts related is because it's happening my struts app. (A pretty weak link I must admit.) I suspect it's more of a general java development environment issue. Got any good java development environment issue mailing lists? -Original Message- From: Paul McCulloch [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 17, 2004 10:26 AM To: 'Struts Users Mailing List' Subject: RE: Could not find resource error And this is struts related how? -Original Message- From: Barnett, Brian W. [mailto:[EMAIL PROTECTED] Sent: 17 February 2004 17:22 To: 'Struts Users Mailing List' Subject: Could not find resource error Can't figure out why this code is giving me an error: import java.io.Reader; import com.ibatis.common.resources.Resources; Reader reader = Resources.getResourceAsReader(properties/sql-map-config.xml); The error I'm getting is: java.io.IOException: Could not find resource properties/sql-map-config.xml at com.ibatis.common.resources.Resources.getResourceAsStream(Ljava.lang. String;)Ljava.io.InputStream;(Unknown Source) I verified the file is there, but my app can't find it. Is there a setting somewhere I have messed up somehow? Any suggestions on things I can check? Thanks, Brian Barnett ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. - 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: [OT] - Request against Session
When a browser first requests a page from a web server, the session is created, so as Wendy said, it's always there. The creation of the session has nothing to do with whether the user is authenticated/logged in or not. This is the way I understand it. If you are set on using hidden variables here is a bit of info: Using a hidden variable on a jsp page in Struts is pretty straightforward. First, you add a variable to the formbean being used on the page with corresponding setter/getter methods. Then in your jsp page, put something like this in your form: html:hidden name=myFormBean property=myHiddenRegistrationValue/ When the form is submitted, Struts finds a myFormBean object in the appropriate scope (or instantiates a new one) and stuffs the value of the hidden variable into myFormBean (using setter method). In other words, it treats it like all the other form variables by calling the setter methods of the formbean. Then in your action class, you can reference the variable using the getter method of your formbean. For multiple pages, you'd have to follow the above guidelines on each page and most likely programmatically call the setter method in your action classes between page calls. Don't use getParameter() to try to get hidden form variables. getParameter() looks for parameters appended to the request URL -- http://www.myhost.com/do/myAction?param1=1param2=2. getParameter() will give you access to param1 and param2. You can also very easily access the session variables in your action class like this: request.getSession().getAttribute(sessionVarName) Brian Barnett -Original Message- From: Pani R [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 2:02 PM To: Struts Users Mailing List Subject: RE: [OT] - Request against Session Thanks for the advice Wendy. I may end up storing all the values in the Session. But, on the other side, how would I store it in the hidden form variable. I think if I store it in my hidden variable, then its available to me in the action class via getParameter() which will return me a String object against my User Defined Object. Is there any other way to do that? Pani -- - Original Message - DATE: Wed, 11 Feb 2004 13:27:11 From: Wendy Smoak [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: From: Pani R [mailto:[EMAIL PROTECTED] Now, when the un-logged user tries to register, where am I suppose to store the Registration Values, Session or Request? Which one will be the better approach and why? I'm not entirely sure when the session officially gets created, I just expect it to be there, and it always is. If you're going to need something across requests, you can either jump through hoops and put it in hidden form elements, etc., or just stuff it in the session. I tend to treate memory and disk space as infinite resources, which may not scale, but works for my purposes. My vote is to put your values in the session and don't look back. Others may disagree... -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Find what you are looking for with the Lycos Yellow Pages http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp ?SRC=lycos10 - 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: Validation And JavaScript Problem
Make sure the form names match in your jsp and the validation.xml file. validation.xml ... form name=myFormBean ... your.jsp ... html:javascript formName = myFormBean/ ... Brian Barnett -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 3:07 PM To: Struts User Mailing List Subject: Validation And JavaScript Problem Hey I am using struts validations with my application. The problem I'm having is that when I open a page with client side JavaScript validation the JavaScript is coming out at the bottom of my JSP. Anybody encountered this problem before? Thanks CH - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation And JavaScript Problem
--typo on last post (removed space)-- html:javascript formName = myFormBean/ -Original Message- From: Barnett, Brian W. [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 4:10 PM To: 'Struts Users Mailing List' Subject: RE: Validation And JavaScript Problem Make sure the form names match in your jsp and the validation.xml file. validation.xml ... form name=myFormBean ... your.jsp ... html:javascript formName = myFormBean/ ... Brian Barnett -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 3:07 PM To: Struts User Mailing List Subject: Validation And JavaScript Problem Hey I am using struts validations with my application. The problem I'm having is that when I open a page with client side JavaScript validation the JavaScript is coming out at the bottom of my JSP. Anybody encountered this problem before? Thanks CH - 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: Validation problem
The Struts Validator provides a mechanism to deal with Cancel buttons. A flag is set in the onclick method for the cancel button in the jsp page. The validate methods check this flag and if it is set, they skip validation and just return true. html:cancel onclick=bCancel=true; If you're not using the Struts Validator, maybe you could try mimicking this behavior in your validate method ?? Brian Barnett -Original Message- From: Nathan Pitts [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 4:16 PM To: Struts List Subject: Validation problem I am wondering how to solve the following problem with a minimal amount of recoding, and hope someone can give some input. I have a form the has three html:submit buttons -- Update, Cancel and Delete. I am using a LookupDispatchAction and an ActionForm with the validation in the validate() method. Under normal conditions everything works fine..But when a user clicks Update with invalid data on the form, the validate method catches the bad data and returns the proper error message. If the user then decides to click Cancel (without changing the invalid data), the validate() method is still called and the user is returned the same error. One thing that I might be able to do is to somehow find out what button was clicked in the validate() method...?? How would I do that, I wonder... thanks in advance, -nathan - 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: Action mappings
What is the error when it errors out? -Original Message- From: struts fox [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 12:45 PM To: [EMAIL PROTECTED] Subject: Action mappings I t seems Struts lets you use action mappings that it figures out and forwards for you, but I have had no luck testing this. action-mappings action path=/setUpEmployeeForm type=net.strutstest.SetUpEmployeeAction name=employeeForm scope=request validate=false forward name=continue path=/steve/ /action action path=/steve type=net.strutstest.SteveAction name=employeeForm scope=request validate=false forward name=continue path=/employeeForm.jsp/ /action So basically SetUpEmployeeAction should be called when the user submits. Then SetUpEmployeeAction forward to SteveAction and then that forwards to employeeForm.jsp. It errors out trying to load the resource SteveAction, but I see nothing else I need to declare in any properties file or resource file. Struts should be able to do this from what I've read. - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: form validation question
Your orderForm does extend ValidatorForm instead of ActionForm right? The struts validator plug-in relies on your forms extending ValidatorForm in order to do server-side validations. Out of curiosity, you may want to see if client-side validation works first. html:form action=SubmitOrder.do onsubmit=return validateOrderForm(this) ... /html:form validator:javascript formName=orderForm/ When the submit button is pressed, if the required field is empty, you should get a message window indicating the field is required. Brian Barnett -Original Message- From: Andy Kriger [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 1:16 PM To: 'Struts Users Mailing List' Subject: RE: form validation question I see an empty page - no HTML, no nothing. It's as if the handoff to the input path never happens, even though the logging informs me that validation failed and the input path is being returned to. When you say 'a question of display not working right', what do you have in mind? -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 3:05 PM To: Struts Users Mailing List Subject: Re: form validation question Andy: What do you see in the source of the html page..? Maybe it is just a question of display not working right..? Geeta Andy Kriger wrote: I am having a curious problem with form validation. I submit a form, see in the logs that the form fails to validate, however, the webapp does not return to the input page (I get a blank page with no HTML in it), so I do not see the form with error messages as expected. If I put text in the field, the form does submit correctly and I see the JSP specified in the resulting action chain. The log files have no error messages indicating something is amiss. When validation fails, the subsequent action is definitely not running (I do not see the logging in the execute method). Does anyone have any ideas what could be happening here? Or how I can track down the problem? Below is the relevant info... === STRUTS CONFIG === action path=/OrderForm forward=/web/forms/orderForm.jsp / action path=/SubmitOrder type=MyClass name=orderForm validate=true input=/OrderForm.do scope=request forward name=success path=/OrderThanks.do/ /action action path=/OrderThanks parameter=/web/orderThanks.jsp type=org.apache.struts.actions.ForwardAction/ === orderForm.jsp === logic:messagesPresent html:messages id=err %=err%br/ /html:messages /logic:messagesPresent html:form action=SubmitOrder.do html:text property=firstName styleId=firstName size=20/ html:submit value=Press Me/ /html:form === VALIDATION CONFIG === form name=orderForm field property=firstName depends=required arg0 key=orderForm.firstName.label name=required / /field /form === LOG MESSAGES === [org.apache.struts.action.RequestProcessor][RequestProcessor] Validating input form properties [org.apache.struts.action.RequestProcessor][RequestProcessor] Validation failed, returning to '/OrderForm.do' Andy Kriger | Software Mechanic | Greater Than One, Inc. 28 West 27th Street | 7th Floor | New York, NY 10001 P: 212.252.7197 | F: 212.252.7364 | E: [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 Redirecting To Input Page After Vaildation Fails
Personally, I would try to use the same page for add, update and delete, which would solve this problem. If this is not an option for you, you may have to deal with it in ClientAction. Remove the input attribute from your action mapping, add validate=false, and add a couple of forward elements. action path=/clientaction type=ie.sentenial.application.actions.ClientAction name=clientForm scope=request validate=false attribute=clientForm forward name=AddValidationError path=/pages/addClient.jsp/ forward name=UpdateValidationError path=/pages/updateClient.jsp/ /action Then inside ClientAction, programmatically call the validate() method, since the framework won't be calling it for us (validate=false). If validation fails, return the appropriate ActionForward, based on whether you are adding or updating. Brian Barnett -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 11:57 AM To: Struts User Mailing List Subject: Problems Redirecting To Input Page After Vaildation Fails Hello can anybody help me with this problem I'm having please? I am using the same action to perform two functions action path=/clientaction type=ie.sentenial.application.actions.ClientAction name=clientForm scope=request input=/pages/addClient.jsp attribute=clientForm /action This is called as follows from 2 different forms: html:form action=/clientaction?action=update focus=clientName onsubmit=return validateClientForm(this) and html:form action=/clientaction?action=add focus=clientName onsubmit=return validateClientForm(this) The problem is that because I have input=/pages/addClient.jsp ...that when a validation fails while doing an update it is directed back to the addClient.jsp rather than the updateClient.jsp As far as I know the input field will not take dynamic values. I am not sure how to resolve this problem. I need to be directed back to the correct page when validations fail Thanks Ciaran - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] jPowered chart example in Struts
ChartFx looks nice. Unfortunately, it's 10x the price of jPowered charts. ($500 vs $5000) -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Saturday, January 24, 2004 2:26 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: [OT] jPowered chart example in Struts Brian I can see what you mean. When I click on jPowered's Charting and Graphing Server I get sent to oblivion I would recommend trying http://www.chartfx.com/SFXJavaProducts/CfxforJava/ (It works) Best Regards, Martin Gainty 617-852-7822 - Original Message - From: Barnett, Brian W. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, January 24, 2004 3:10 PM Subject: [OT] jPowered chart example in Struts If anyone has implemented jPowered charts in their Struts web app, would you mind sharing some snippets of code from the various affected files on how you got it setup and implemented? Thanks! Brian Barnett - 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]
[OT] jPowered chart example in Struts
If anyone has implemented jPowered charts in their Struts web app, would you mind sharing some snippets of code from the various affected files on how you got it setup and implemented? Thanks! Brian Barnett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Chart generation Framework
I recently did a little research on charting tools. I went through the cewolf tutorial, http://cewolf.sourceforge.net/, and in the end, got stuck on a type library problem. This is probably due to my lack of experience with Struts/JSP. I can't remember the exact error message I kept getting. Other options I am considering are EasyCharts by ObjectPlanet and Advanced Graph Chart Collection by jPowered. You can get into either of these for $300 - $400 USD I think. Brian -Original Message- From: Vinicius Carvalho [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 5:28 AM To: [EMAIL PROTECTED] Subject: Chart generation Framework Hi there! Does anyone here uses a chart Framework? I've heard about Cewolf, seems to be nice, any suggestions on this? Thanks Vinicius - 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]
Tag library versioning
I'm a little confused on how tab library versioning works. When I run my Struts web app, the resin console fills up with SAXCompileExceptions, complaining about jsp-version is an unexpected element and short-name is expected, etc., etc. My app seems to run fine, but I'd like to resolve this issue. Not sure what to. Can someone give me some guidance here? Thanks.