Re: [OT] Need Free database
On Tuesday 25 November 2003 14:38, Ramachandiran, Karuna wrote: Hi, Can any buddy suggest me Database which is free and has JDBC driver. If possible get me the URL. www.firebirdsql.org Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem in deploying struts app in production environment. Pls help
Samanth Athrey wrote: Hello, Am using struts1.1, tomcat 4.1.27. During development there was no problem. But when the same was deployed on th production server, not a single page was displayed correctly. Struts code is displayed as it is. When I click on a link, the .do page it says cannot be displayed. All the jar files are in place and the production environment is a replica of my development envi. Is there something that am missing here? Pls help. Regards, Samanth Athrey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Recheck all of the steps described here: http://jakarta.apache.org/struts/userGuide/installation.html especially setting up the struts controller servlet in web.xml: Modify the WEB-INF/web.xml file for your web application to include a servlet element to define the controller servlet, and a servlet-mapping element to establish which request URIs are mapped to this servlet. Use the WEB-INF/web.xml file from the Struts example application for a detailed example of the required syntax. Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts 1.1 validation problem / question
Hi Andreas, i think the best way is to write your own validate() method in your action form. There you can easily check the value of the userAction attribute and depending on that the other attributes. example: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (getName().length() 1) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(form.error.name.required)); } return errors; } HTH Phil - Original Message - From: Andreas Wuest [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 15, 2003 2:36 PM Subject: struts 1.1 validation problem / question Hi, i have a small problem / question concerning the struts 1.1 validation. i have a jsp form that has the following input fields : id name password userAction Depending on the userAction value (can be 'show' or 'save') i need to validate only the id (when userAction is 'show') or the name, password and id (when the userAction is 'save'). i have one form that contains the 4 properties (with getters and setters) and an action class that handles the show and the save action. the problem that i have is the validation. as far as i understand the docuemtneation it is not possible to validate a property only when another property has a certain value. in other words it is not possible to tell the validator to skip validation of a property when another property has a certain value. or am i mistaken ? how can i solve this problem ? do i need 2 forms and action to handle the different userActions or is there another way ?? Thanks in advance, Andreas - 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, action not working
Hi, the methode signature is wrong. You have to override the methode public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { There is no method public ActionForward perform(ActionServlet servlet, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { in the Action class. Since Struts 1.1 the perform method is deprecated, so you better use the execute method. public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) throws Exception { HTH, Phil - Original Message - From: Ajay Kalidindi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 13, 2003 12:23 PM Subject: action-mappings, action not working Hi I am using : Redhat 9 Apache 2.0.48 Tomcat 4.1.29 Struts 1.1 For some reason I am not getting any errors and control is not getting forwarded to respective success forward from DummyAction. Any help is appreciated. Regards Ajay Kalidindi config and source follows: struts-config.xml entry: action-mappings action path=/Menutype=com.kalidindis.home.DummyAction forward name=success path=/common/menu.jsp/ /action /action-mappings DummyAction.java : package com.kalidindis.home; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.*; import org.apache.struts.action.*; import org.apache.struts.util.*; /** * Implementation of strongAction/strong that lists contacts of Ajay Kalidindi. */ public final class DummyAction extends Action { public ActionForward perform(ActionServlet servlet, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return (mapping.findForward(success)); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request scope for FormBeans does not work??
Hi, i think you have to set the attribute redirect=false, than a simple forward is done. The difference between a redirect and a simple forward is that if you use redirect a new request is create when you call another resource (jsp or action). The default value of the attribute redirect is false, so you dont have to specify it. HTH, Phil - Original Message - From: Voinea, Marina [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, November 13, 2003 8:42 PM Subject: Request scope for FormBeans does not work?? Hi, Heeelp: I have been struggling for the last 2 days with an issue regarding the / request / session scope of the form beans defined in action mappings. (Request scope does not work for me, I have to use session scope...). Can you please help : I have the following steps within the code; - display login form (works OK) - on submit, execute LoginAction (works OK) - LoginAction returns Admin forward, and , as expected from the configuration (attached below), the prep_mtg_day action is executed. -PrepMtgDayAction action extracts the data from backend and stores the result (a collection of beans) in the form as following: public class PrepMtgDayAction extends Action { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { (MtgDayForm)form.setMeetings(mtgBeanList); // try to store in form, the form scoped at request or: request.setAttribute(meetings, mtgBeanList); // try to store a bean in the request sscope } After the action returns success and the page associated in the mapping of the action is executed, the JSP tries to use meetings object (Collection) from the form or request. Only if the form scope is session or I set the attribute on the session,(with session.setAttribute(meetings, mtgBeanList), can I use it in the forwarded jsp... So, when does a Request start or end? It seems like during the forward there is a new Request created?, so , whatever I stored within request gets lost? Any indications on when can I use Request scope? Thanks!!! Struts exception: == Nov 13, 2003 1:48:10 PM EST Error HTTP BEA-101017 [ServletContext(id=20 393935,name=CfgMgrWeb,context-path=/CfgMgrWeb)] Root cause of ServletException. javax.servlet.jsp.JspException: Cannot find bean meetings in any scope at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:938) at org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java: 277) =struts config action mappings= action path=/login type=com.genesys.cfgmgr.web.action.LoginAction scope=request name=loginForm validate=true input=/Login.jsp forward name=Admin path=/action/prep_mtg_day redirect=true/ This is what I use forward name=Unknown path=/Login.jsp redirect=true/ /action action path=/prep_mtg_day type=com.genesys.cfgmgr.web.action.PrepMtgDayAction scope=request name=mtgDayForm forward name=success path=/MeetingDay.jsp redirect=true/ forward name=error path=/error.jsp redirect=true/ /action - 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]
Forward attribute vs. ForwardAction
Hi, i write my thesis about the struts framework and i have a question about the ForwardAction class. I think the forward attribute in an action-mapping has the same effect as the use of the ForwardAction, so why is there a special class to perform a forward? I think you get the same result if you use: action path=/login type=org.apache.struts.actions.ForwardAction parameter=/login.jsp / or: action path=/login forward=/login.jsp / So what is the benefit of the ForwardAction class? Thanks, Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forward attribute vs. ForwardAction
Hi Ashish, thanks for your answer. But i think you missunderstood me. In the Struts Framework, there is a prebuild Action class called ForwardAction. The ForwardAction and the forward attribute of an action-mapping (see my example) serve the same purpose which is to forward from one JSP to another. So you dont have to write your own Action class to achieve a simple forward between two pages. So, i am confused why there is a extra prebuild class, if you get the same effect by using the forward attribute. regards, Phil - Original Message - From: Ashish Sinha [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 7:49 PM Subject: Re: Forward attribute vs. ForwardAction Hi Phil, If I understood you write, you have confusions over forward and ForwardAction due to the name you have chosen for the Action subclass. ForwardAction as you have defined in your type attribute could be named anything. A forward attribute in your struts configuration file tells the framework where to redirect/forward the control. There could be multiple entries for forward each pointing to different destinations and the one that is chosen depends on to what you forward from within Action subclass in your case ForwardAction. They serve different purpose. Regards, Ashish. [Provedu do Bezkonechnostiu] - Original Message - From: Phil [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 11:51 AM Subject: Forward attribute vs. ForwardAction Hi, i write my thesis about the struts framework and i have a question about the ForwardAction class. I think the forward attribute in an action-mapping has the same effect as the use of the ForwardAction, so why is there a special class to perform a forward? I think you get the same result if you use: action path=/login type=org.apache.struts.actions.ForwardAction parameter=/login.jsp / or: action path=/login forward=/login.jsp / So what is the benefit of the ForwardAction class? Thanks, Phil - 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: Forward attribute vs. ForwardAction
Hi Hubert, thanks for your answer. I thought of this too. But then i examined the source code of the RequestProcessor. There, the forward element is processed just before the operations which are related to the actions (like creating Action instances and calling the execute() method) are processed. After this there are no more features called. So i think using the forward attribute has no impact to any features of struts. All operations they need to work right are done before the forward attribute is processed. But maybe i didnt examine the source code right. If you know a case in which a feature does not work with the forward attribute this would be very helpful to me. Phil - Original Message - From: Hubert Rabago [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 5:39 PM Subject: Re: Forward attribute vs. ForwardAction Phil, ForwardAction allows a response to still go through struts processing. Not all of the Struts features will kick in or perform as expected when you use forward=/login.jsp. I don't have a full list of which ones will still work and which ones won't, and it may depend on the complexity of your app, so it may or may not affect you. Think of ForwardAction as add'l future-proofing for your app/action. Hubert --- Phil [EMAIL PROTECTED] wrote: Hi, i write my thesis about the struts framework and i have a question about the ForwardAction class. I think the forward attribute in an action-mapping has the same effect as the use of the ForwardAction, so why is there a special class to perform a forward? I think you get the same result if you use: action path=/login type=org.apache.struts.actions.ForwardAction parameter=/login.jsp / or: action path=/login forward=/login.jsp / So what is the benefit of the ForwardAction class? Thanks, Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - 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: Forward attribute vs. ForwardAction
Hi Rick, thanks for your answer. But if you defined the forward attribute no instance of the ForwardAction is created. I checked the source code of the RequestProcessor. Phil - Original Message - From: Rick Reumann [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 5:56 PM Subject: Re: Forward attribute vs. ForwardAction Phil wrote: action path=/login type=org.apache.struts.actions.ForwardAction parameter=/login.jsp / or: action path=/login forward=/login.jsp / So what is the benefit of the ForwardAction class? I'm not positive but I'm pretty sure both are using the ForwardAction class, the second approach above is just a shortcut version so you don't have to type out the FowardAction type = stuff. I could be wrong, though, so someone correct me if I am. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trouble redirecting
Hi Marcella, in the struts api there is an entry about the path attribute: The URL to which this entry points, which must start with a slash (/) character. Phil - Original Message - From: Marcella Turner [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 8:43 PM Subject: Re: Trouble redirecting Hubert, Thanks for this suggestion, I would like to try it. So, in my action I have: response.sendRedirect(http://www.yahoo.com;); How/where am I returning a NULL? Thanks, Marcella From: Hubert Rabago [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Trouble redirecting Date: Wed, 5 Nov 2003 10:56:31 -0800 (PST) It looks like you're not the first to have redirect=true backfire on you when trying to redirect to an absolute path. I wonder why that is. You can try response.sendRedirect() within your action class and just return null. --- Marcella Turner [EMAIL PROTECTED] wrote: Hi Rick and Hubert, Thanks for giving my problem some thought. My action mapping is below: action path=/verifyXYZ name=obtainXYZFormBean scope=request type=my.package.actions.VerifyXYZAction input=/SelectXYZ.jsp validate=true forward name=success path=/SelectTerms.jsp /forward forward name=back path=/ViewPrices.jsp /forward forward name=failure path=/SelectSPR.jsp /forward forward name=goSpt path=http://www.yahoo.com; redirect=true/ /action I believe that I will need to construct an absolute path in order to redirect to the other app, however since I can't get the redirect to work to http://www.yahoo.com yet I'm waiting to construct the real absolute path just yet. From: Rick Reumann [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Trouble redirecting Date: Wed, 05 Nov 2003 12:33:56 -0500 Marcella Turner wrote: The contextPath may prove to be a real problem for me since I would like to transfer control to a servlet in a different contextPath than the one my app is in. Why don't you post the syntax of the exact page you are trying to redirect to. As far as I know you will need the full http:// path to redirect to an application in a totally different context from a forward mapping. Are you putting in the full path to this other servlet you want to redirect to? -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Is your computer infected with a virus? Find out with a FREE computer virus scan from McAfee. Take the FreeScan now! http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Crave some Miles Davis or Grateful Dead? Your old favorites are always playing on MSN Radio Plus. Trial month free! http://join.msn.com/?page=offers/premiumradio - 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]
Validator : date
Hi, I am having problems with client side date validation in 1.1. If I set the depends value to include 'date', there seems to be a problem in the javascript generated. I get the following error.. Error: Length is null or not an object. The Error seems to be in the validation-rules.xml for the date valadation, line 12 (datePattern.length 0)) { Any ideas? Phil -- 12:56pm up 92 days, 1:49, 1 user, load average: 0.34, 0.13, 0.05 ICQ: 760757 AIM: pjshrimpton Y!: pjshrimpton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator : date
On Thursday 17 July 2003 13:15, Michael Nascimento Santos wrote: Hi, You must define a datePattern var in your validation.xml config, such as: field property=aDate depends=date var var-namedatePattern/var-name var-valueMM-dd-/var-value /var /field Same error, but if I change it to... var-namedatePatternStrict/var-name ..it works. Also, according to the docs I have, you don't need to supply the datePattern, as it will default to the locales short date format Phil -- 2:02pm up 92 days, 2:55, 1 user, load average: 0.02, 0.04, 0.01 ICQ: 760757 AIM: pjshrimpton Y!: pjshrimpton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to build dropdown lists?
On Tuesday 15 July 2003 12:52, [EMAIL PROTECTED] wrote: Hi, Another thing that I noticed when playing with the JavaScript pop ups was that all the validator JavaScript, whether used or not is included in the JSP code. I ende up with hundreds of lines of JavaScript, including date, email and phone number validation, for a login for that had two elements? Is this the way it should work? Look at the... html:javascript staticJavascript=false ..tag. Phil -- 1:11pm up 90 days, 2:03, 1 user, load average: 0.41, 0.14, 0.04 ICQ: 760757 AIM: pjshrimpton Y!: pjshrimpton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Web Page acess to struts-user archive?
Leander Jedamus wrote: Hi! Try http://marc.theaimsgroup.com/?l=apache-httpd-usersr=1w=2 I think you meant http://marc.theaimsgroup.com/?l=struts-userr=1w=2 This archive seems to get updated very quickly. Am Montag, 2. Juni 2003 16:47 schrieb José Fortunato H. Tomás: Hi! Is there any Web Page to query and access to the history or archive for this mailling list? Tnx! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LDAP client API?
Adolfo Miguelez wrote: Hi All, quick question. Is there any LDAP client project in the Jakarta/Apache set of projects. Otherwise, is there any open source outside? TIA, Adolfo Adolfo, I agree with Jose, you should first look at JNDI. If you really need an LDAP client SDK, I would suggest the Netscape LDAP Java SDK which is freely available (with source) at http://www.mozilla.org/directory/ Novell has also contributed an SDK to OpenLDAP, which you can find at http://www.openldap.org/ hth, Phil _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - 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: Does a degree matter?
Craig R. McClanahan wrote: On Sat, 29 Mar 2003, Arron Bates wrote: Date: Sat, 29 Mar 2003 20:36:21 -0600 From: Arron Bates [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Does a degree matter? Brandon, If you can do the deed (which it sounds like you can), I would hazard offering my opinion in thinking that it wouldn't be the best use of your time. By education I'm a graphic designer, not a computer scientist. First job was web design, programmer ever since. Results... I've only had two places not take me on because it's not a computer degree. Two interviews of hundreds. My personal experience (both for myself and for folks I have hired over the years) mirrors this -- indeed, my personal opinion is that a Comp Sci degree is worth less (to me as an employer) than a degree in some field that is more closely associated with the general needs of potential employers. Why? A couple of reasons: * Many folks who go for Comp Sci degrees obsess over learning the particular technologies being taught in their classes, at the expense of courses to improve your general thinking skills. Any specific technology you learn in your first year is going to be totally obsolete by the time you graduate from the program anyway, so why bother? The important skill to employers (at least from my viewpoint) is that you've learned how to quickly adapt your existing skills to new technologies as they become available. Also, the fundamentals of good architecture and design practices tend to change much more slowly than the favorite language de jour -- so if you decide to go for Comp Sci, focus on fundamentals like O-O, design patterns, and so on. * Many folks who go for Comp Sci degrees are so focused on the technical things, and don't accumulate any domain knowledge along the way that would make you *more* valuable to potential employers than another Comp Sci graduate with similar skills. If you're building e-commerce systems, do you know anything about the fundamental accounting principles involved in tracking purchases? If you're building systems to introduce novices to the world of online information, have you ever studied any human factors engineering? If you're building trading systems for a Wall Street broker, do you have the slightest idea how stock and commodity exchanges work? It may surprise some of you to find out that I don't have a Comp Sci degree at all -- instead, I got a BA in Business with a focus on Accounting. This was ***tremendously*** helpful in setting me apart from everyone else who was learning programming and systems analysis in those days -- I could immediately communicate with the end users responsible for the systems we were building, using their vocabulary, without having to be trained -- in addition to the fact that I was a fair-to-middlin' programmer :-). If you are looking at going to college today (either because it's that time in your life, or because the job market sucks right now), I would suggest thinking about a primary major other than Comp Sci (with a Comp Sci minor to keep your hand in on all the technical stuff). The name of the game is making yourself more valuable, relative to everyone else out there -- and, quite frankly, there are more interesting things in the world than just computers and web apps :-). Craig As someone who has hired and been hired many times over the years, I have to agree with the main point above in terms of market value for a CS degree per se -- not a big differentiator. The most important question to ask, in my mind, is are you *interested* in computer science and will the programs that you are considering add value to you personally. If you really have an interest in CS, it can be an excellent field of study for developing the cognitive skills and discipline that really can make a difference in solving hard technical problems and learning new technologies quickly. So can math, engineering, business or virtually any academic discipline with an exacting technical component. In my experience, people who have mastered a technical discipline of some sort tend to be better at technical learning. Given the pace of technology change, technical learning ability is the most important quality in a technologist of any kind today, IMHO. This is what I look for when I hire people. So...bottom line is that I would recommend pursuing a CS degree if a) you have a genuine interest in CS and b) you find a program that focuses on the foundations/fundamentals to avoid the pitfalls that Craig mentions above. -Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use messages from ApplicationResource.properties for an e-mail
Raible, Matt wrote: I have a requirement to send a notification e-mail when an item in my app is deleted. I was hoping to use a string (post-substitution) from ApplicationResource.properties to do this, but alas, it does not work like I hoped. Is this possible without loading it as a ResourceBundle and calling getString()? The struts MessageResources class encapsulates the ResourceBundle and will perform the substitution. Use: MessageResources messages = MessageResources.getMessageResources(ApplicationResources); String msgText = messages.getMessage(cr.deleted.msg, deletedBy, appURL); // deletedBy and appURL are set previously as String variables new ActionMessage(cr.deleted.msg, deletedBy, appURL).toString() results in... [EMAIL PROTECTED] Thanks, Matt - 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: Use messages from ApplicationResource.properties for an e-mail
[EMAIL PROTECTED] wrote: Is there a way to force the Locale? I have a requirement, for user, say in en_US locale, to send an email that will have standard notes to a user that is in, say Germany (de or de_CH). So I need to se the locale only when I try to get the message, not change it fr the user. See http://jakarta.apache.org/struts/api/org/apache/struts/util/MessageResources.html getMessage can take a locale as its first argument, if this is what you mean. _ Thank You Mick Knutson Sr. Designer - Project Trust aUBS AG, Financial - Zürich Office: +41 (0)1/234.42.75 Internal: 48194 Mobile: 079.726.14.26 _ -Original Message- From: Phil Steitz [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 6:05 AM To: Struts Users Mailing List Subject: Re: Use messages from ApplicationResource.properties for an e-mail Raible, Matt wrote: I have a requirement to send a notification e-mail when an item in my app is deleted. I was hoping to use a string (post-substitution) from ApplicationResource.properties to do this, but alas, it does not work like I hoped. Is this possible without loading it as a ResourceBundle and calling getString()? The struts MessageResources class encapsulates the ResourceBundle and will perform the substitution. Use: MessageResources messages = MessageResources.getMessageResources(ApplicationResources); String msgText = messages.getMessage(cr.deleted.msg, deletedBy, appURL); // deletedBy and appURL are set previously as String variables new ActionMessage(cr.deleted.msg, deletedBy, appURL).toString() results in... [EMAIL PROTECTED] Thanks, Matt - 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] Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - 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: case study with security
Dan Allen wrote: There have been several discussions on this list about how security should be loosely coupled with the ActionServlet itself (a filter on top of the application), but I am curious to know the best practicing for handling the following type of case. Assume I have an action with a path of /EditAccount. Naturally if a user is not logged in, this path should be protected via filtering. However, /EditAccount has two purposes, one for the regular user to edit his/her own account, but also for the administrator to edit any user account via the query string ?user=username. In this case, I have to check in the action class if the user is allowed to take on the role of another user in which case the form is populated with that user's data or, if not, the form should populate with the user's own data. Is this something that is reasonable to do in the action, or should I create another action path /EditUserAccount?user=username and filter that to only admins and then forward to the /EditAccount once the proper credientials have been established, hence relieving the action behind /EditAccount from looking at any roles? Assuming that you are using container-managed security and roles, you can do it with one action by having the action ignore the user parameter unless the user is an administrator. You can check if the user is an administrator using if (request.isUserInRole(whatever-you-named-the-admin-role)). If the user is not an administrator, you can use request.getRemoteUser() to get the user id and then populate the form based on the user's own data. Here is a similar example: if ((frm.getDeskPhone() != null) (request.isUserInRole(Constants.ADMINISTRATOR))) { rd.setDeskPhone(frm.getDeskPhone()); rd.retrieveByPhone(); } else { rd.setUid(request.getRemoteUser()); rd.retrieveByUid(); } ...use rd to populate current profile data onto frm... In this example, the deskPhone parameter is what the admin uses to loookup a user. The rd object is an entity-like bean that represents a user. If you decide to use separate Actions for admins and users -- eliminating the need for the conditional logic above -- you should make sure NOT to leave the user parameter in the queryString for the non-administrators or to add a check in the non-admin action to make sure that the user is editing his/her own profile. In this case, you should also encapsulate the common elements that both editAccount actions will share. Which approach is best depends on the complexity of the application and how you expect it to evolve over time. The second approach -- different actions for admins -- is more flexible but a little more work to implement. hth, Phil Dan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: case study with security
Dan Allen wrote: After reading the suggestions, I am going to go with two different actions for setting up the form. In order to use container managed security most effectively, I am going to prefix paths with admin restrictions with admin/ for ease of filter matching. So /EditAccount /admin/EditAccount?user=username Then I will make a common abstract Action class for editing an account which both actions will extend to make use of the common routines. The /EditAccount will not listen to any query params but rather use the current session data as the data to populate the form with, whereas the /admin/EditAccount will use the user parameter to lookup the user using the DeskPhone as suggested. This way, all the security is controlled by the container, but the logic is left in the action for simply setting it up as instructed (with no checks for security). Thanks for the input and append anywhere I have deviated from the suggestion. Dan Looks like a good solution to me. I agree that it is best to keep all of the security policies declaratively defined. I also like to keep the link between the logged in user and his/her account automatic (i.e., determined by the system and looked up as close as possible to the model updates) whenever possible. Your solution does both of these things. Note, btw, that I did not mean to recommend desk phone as a generic identifier. Obviously, a) the lookup key best for your admins to use depends on your application and b) whatever you use, it has to be unique. The app that I took the example from enforces this. Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [XEN] Simple question: forward and redirect
Fabio Mancinelli wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 13 Mar 2003, Ian Hunter wrote: Are you redirecting or forwarding to your JSP from that Action? What is the exact difference between forwarding and redirecting? What are their implications? I searched the Servlet and JSP specs but I haven't found nothing about that. Forward = RequestDispatcher.forward() (http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/RequestDispatcher.html) Redirect = HttpServletResponse.sendRedirect() (http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html) Big difference is that redirect sends an HTTP Response back the browser with a redirect header, generating a new request from the browser. This makes it in general slower and less efficient. Also, the Request object (and anything that you have shoved into it) is not preserved. On the other hand, redirect gives you control over the destination URL. Search the archives for full discussion. hth, Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Data driven struts application
I apologize if this has already been beaten to death, but I am still struggling with the implications of dyna-stuff on traditional OOD in struts applications. See interspersed. Craig R. McClanahan wrote: This is pretty much what RowSetDynaClass does for you, without the need to create classes for your value objects. Yes, but then you no longer have encapsulation at the business object level. If you short-circuit the persistence = business objects = view path, then either the view or the persistence layer is going to have to absorb both data abstraction and business logic. Unless what you mean is to use the RowSetDynaClass to populate your BOs...? Or...maybe there is a class of applications where persistence really can effectively absorb both data abstraction and business logic? * For read only data access i used an optimised SQL statement (plse see below) which returns only enough data to render the current screen to the client. This is almost always a really smart strategy -- not only should you limit which columns are retrieved to only those that meet the requirements, you should (more importantly) limit the number of rows that is retrieved, as Pat points out below. Two possible concerns are that you'll be tying the persistence tier and the view tier together, because (for example) the page author has to know about the column names in the database, and the business logic has to be tweaked every time the page author needs a new column added. To mitigate these problems, I suggest using two strategies: * Store the actual SQL query sources into properties files, so that it can be modified easily without touching the business logic classes. (This can also be a lifesaver if you have to support more than one database, where the SQL query syntax has to change slightly.) * Use the column aliasing capability of SQL (the as modifier) to convert the database column names into simple names that the page author can expect, and document (for him or her) only those names. For example, a query might say something like: select customer-account-number as account, external-display-name as name from customers where ...; and the page author will see properties named account and name, no matter what the database actually uses. But isn't this effectively still binding the view tier to the persistence tier? How do you handle derived fields? Using SQL to encapsulate business logic can lead to a maintenance nightmare. First come views, then stored procedures, then more database dependency than you ever wanted I can see how simple CRUD apps can be assembled VERY quickly using dyna-stuff tied directly to a SQL data model, with the model really just being the data model (with techniques like the above used to loosen the coupling a bit); but this brings back some *BAD* memories for me -- instant 2-tier applications using advanced data binding technologies having to be rewritten entirely when they needed to scale (either in terms of load or complexity). Am I just once bitten, twice shy here? Am I missing the point? Craig McClanahan - 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: [Q] Use of DispatchAction with security concerns
Rick Reumann wrote: Someone e-mailed me privately the following question about security and the use of DispatchAction and a hidden variable. I'd appreciate any comments pertinent question When using the dispatch action, you make use of a hidden variable to determine which method with be called. What happens if this hidden variable is changed to a method which does not exist? Is an error thrown (the user can change hidden variables to be malicious). According to the docs for DispatchAction, this should result in either dispatch to the overridden unspecified method, or an HTTP Bad Request response sent if this has not been overridden. Also, if the user changes the hidden variable from update to insert, will it duplicate the entry of the employee or would you check that the employee already existed. I know for the sake of the tutorial you probably left this out, but this is a common assumption that people make which leads to security holes. Using hidden fields for control information can open security holes. Here are a couple of ways to deal with this exposure: 1. Authorize all actions that can affect the model: i.e., use some form of Action Protection either what struts + Container-Managed Security provides or application-based security to verify that the user is authorized to perform the requested action *with the posted data* (i.e., at the account or row level). 2. If the hidden fields contain sensitive data or you want to be *extra* paranoid about manipulation, you can encrypt the hidden fields. /end pertinent question Would the following help? Keep JSP's under WEB-INF Use LookupDispatchAction instead of DispatchAction Make sure to use token to avoid duplicate inserts Thanks for any Struts user comments on the issue. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Data driven struts application
Thanks, Craig. I understand a lot better now, but I am still struggling a bit. What you seem to be saying is that for read-only access we can safely skip the value/business object encapsulation; but for updates, we should use real BOs. This asymmetry troubles me; though I see the appeal in terms of developer productivity. I still see the risk of becoming persistence-implementation dependent, however, even with externalized SQL and field name normalization using AS. I see how the Dynamic model easily accomodates adding new fields to views, etc; but what happens when you decide to re-engineer the data model or to bring in a new datasource altogether? Or when you need to add derived fields? Consider the following example. Suppose that I am developing an online banking site, enabling customers to do both inquiries and updates on their accounts. The account info is stored in an RDBMS and I use Dyna-stuff to hit the store directly (using a model-free BO) with SQL queries, quickly generating a flexible infrastructure for account data retrieval. For updates (only?) I develop a traditional middle tier, with BOs and VOs modelling the domain and encapsulating the business logic. All is well and good until my company acquires another bank that has a legacy back end. If my update BOs and VOs are cleanly defined, I will not have much of a problem engineering connectors to the new system so that the new accounts can look no different from the others; but I will be SOL for account retrieval (unless, once again, I am missing something). This example may seem contrived; but this kind of thing does happen. One more point on the adding fields topic. I understand and agree with the basic point that if you use VOs, you need to keep them in synch with the model and you also need to keep the view in synch with them and that takes time. It also forces some analysis to be done, adds compile-time type checking, enhances readability of code and makes it easier to keep track of what data elements are being used in what way by what functions (so that implications of changes to the underlying data can be understood and fully tested). Call me a geezer; but somehow I prefer UML to SQL for design documentation. If the only artifacts expressing the design of the read-only view are SQL properties files, how do you keep these consistent with the model expressed in the BOs/VOs for updates? I guess the best strategy depends on the expected lifetime and required extensibility of the application. Thanks again for the explanation. -Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [THURSDAY] struts questions
Bueno Carlos M wrote: Hi, all -- I'm new to struts and I have a few questions. Since you are the experts I'm sure you will be able to help me. My boss wants to know how many people are using struts and how long it will take to build our application using struts as opposed to our current development process. We currently have a thousand monkeys sitting at a thousand emacs editors. The application isn't completely designed yet, and of course I can't release confidential information about our application but if you could give me an estimate of monkey-hours saved, that would be great. Time saving will depend on the nature of the application and its expected lifetime. Obvioulsly, it also depends on what your current development process is. I was able to download the struts-blank.war file but I am having trouble setting it up. The first stumbling block was that it is misnamed. It should be called 'struts-blank.zip' because it is in zip format. I had to open the file in hexedit to figure that one out. Hopefully the next version will have the right name??? It is a war file, which is a compressed archive used to package J2EE web applications for deployment. To understand better how to use war files (and to answer your feline questions below) and more generally how to deploy J2EE web applications, see http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/index.html. If you have not already done so, you should also read the Servlet spec: http://java.sun.com/products/servlet/download.html The other problem I have is that I can't get my application to behave properly. If the user types in their email address I want to be able to check that it is a correct one and show the field red while they are typing if it is not. I have a javascript that checks for the '@' sign but many people are typing in '[EMAIL PROTECTED]'. Since I don't think so many people would have the same email address we are losing valuable data. How can struts help me with this? Will it take many monkey-hours to implement? The Struts Validator can help here: http://jakarta.apache.org/struts/userGuide/dev_validator.html Once I unzipped the file I could not find any README or INSTALL file. I tried the usual 'make; make install' but that did not work. I went out on the net to find some install instructions and I read one place that said I just had to stick the zip file inside my tom cat. I do have a cat, but she's female. Will that make a difference, or does struts only run on male cats? Does it matter if they are neutered? Does each client need to have a male cat or just the server? See above comment. If you use a standard web container (e.g Tomcat) and conform to the directory structure described in the links above, you can just put the .war file in the /webapps directory and the container will automatically expand it when it (the container) starts. You should also read http://jakarta.apache.org/struts/faqs/kickstart.html http://jakarta.apache.org/struts/userGuide/index.html http://jakarta.apache.org/struts/installation.html#Containers Thank you for your time, Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANN] Struttin' With Struts beta (newbies esp. welcome)
Mark Zeltser wrote: Rick, Good job, somehow I can't unzip war files, I am getting corrupt zip file exception. Mark. Use jar -xf war file name War files are jar files, not zips. Your JDK should include the jar utility in its /bin directory. Rick Reumann wrote: I created a web site that walks new Struts users step by step through the development of three VERY simple web applications in three lessons. Each lesson adds a few more features so that they build upon each other yet each stands alone such that if you follow the steps in any lesson you'll have built a very basic application regardless of which lesson you start with. I created these because there seemed to be lacking some more recent walk through Struts tutorials geared toward the very new Struts developer. I think real newbies will find them especially useful, but then again I could be way wrong:) I'm considering the site a beta because I'm sure there will be some mistakes. If anyone sees something I'm doing in a lesson that is way off (or a very bad practice) please let me know. Some of the stuff I know could be done in a more best practice way, but for the sake of trying to also keep the lessons small and simple some ideas weren't included (ie- I didn't use a constants interface for my forward definitions). If anyone wants to contribute, reword, or add anything please let me know. The site is there to help others. I got really lazy in a lot of places and didn't say much about certain things that I would have liked to. Hopefully over time the site will improve. Struttin' with Struts: http://www.reumann.net/do/struts/main -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - 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: Session Management
Puneet Agarwal wrote: Session Management is required to achieve persistence. there are two manner in which persistence can be achieved. 1. storing the information in HTTP session (possibly in session scope) 2. Storing the information using stateful session beans. You can also use hidden fields (basically client-side state management), or application-managed durable storage (e.g RDBMS). You have to take the decision based on your application's performance expectations. The cleaner approach is to define the scope of form as session and storing everything in formbeans, nowhere else. some readonly information can be stored in application context also. Well you may choose to store some information in stateful session beans and some in formbeans (HTTP session) but I would not suggest to keep the scope of formbeans as request unless the screen is totally stateless. Or unless the application has to scale to very large volumes, in which case you want to be very careful about creating too many session-scoped objects. Regards Puneet - Original Message - From: JONATHAN PHILIP HOLLOWAY [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, January 10, 2003 4:10 PM Subject: Session Management Hi everyone, I'm wondering about the ways of managing sessions in Struts and wanted to know out of these two ways which was the better way of doing things: 1. Storing things within the standard servlet session 2. Using a UserWrapper object and storing that within the session. Is the second way more preformance intensive or not and which is best practice? Many thanks, Jon Holloway. *-* Jonathan Holloway, Dept. Of Computer Science, Aberystwyth University, Ceredigion, West Wales, SY23 3DV. 07968 902140 http://users.aber.ac.uk/jph8 *-* -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Struts application infrastructure choices
David Graham wrote: It should be fairly easy to implement this and do some performance testing. Your DAOs will be the only piece that changes to use RMI. You might try just using straight sockets because RMI is another layer on top of sockets which may slow you down. David I would be surprised if RMI per se really turned out to be a significant performance bottleneck -- especially compared to a custom sockets implementation (which essentially amounts to rewriting application server functionality). The real issue is do you want to introduce EJBs, if the application does not already use them. If you don't want to use EJBs and you do want a physically three-tier setup, then you have a basic deployment/integration problem which some of us would argue is a strong argument to just use EJBs and RMI and rely on the infrastructure provided by J2EE. Here are a couple of other ways to solve this problem that I have seen successfully deployed in large-scale applications: 1. Remote HTTP Server Physically split the HTTP server from the servlet engine, putting the combined servlet engine/business object (EJB container, if the business objects are EJBs) into a more protected location and leaving only the HTTP server exposed. This configuration is supported by most commerncal application servers. I don't know if you can do this using Apache and Tomcat or JBOSS. The IBM site below is a bit cumbersome to navigate, but it includes a fairly comprehensive treatment of the deployment topology alternatives, nost of which can be deployed on non-WebSphere app servers: http://www-106.ibm.com/developerworks/patterns/ More specifically, see http://www-106.ibm.com/developerworks/patterns/u2b/at2-runtime.html 2. Dual servlet engines Deploy a front servlet engine that includes the view and controller elements (struts would run here) and handle remote communication to a model servlet engine via HTTP. The model engine can run in a more secure location. A framework implementing the Command pattern can relatively easily be developed using URL objects to make the remoting of model elements transparent to the controller. The advantage of this over a custom sockets implementation is that you don't have to worry about managing the connections, threads, etc. for the model container. The disadvantage is that you have to develop the marshalling framework. 3. Standalone RMI servers on tier 2 Use standalone RMI servers for the model implementation. The advantage of this is that you don't have to develop any custom marshalling machinery. The disadvantage is that you don't have the resource and systems management infrastructure of an application server/servlet engine to rely on. 4. Web Services Like 2., except use web services in place of the custom HTTP-based Command framework. If I were to start a new project with the requirements no EJBs+physical 3-tier, I would probably host the model components in a remote web container and expose them as web services, using Axis. See http://xml.apache.org/axis/index.html Of course, as David suggests, the important thing is to rapidly develop marshalling prototypes and benchmark. My experience has been that all of the remote marshalling methods described above can deliver very fast performance, as long as your service interfaces are not ridiculous. Performance problems almost always trace back to model component implementation or back end resource (e.g. RDBMS) response time issues. -Phil From: Aymeric Alibert [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: \Struts Users Mailing List\ [EMAIL PROTECTED] Subject: Struts application infrastructure choices Date: Sat, 14 Dec 2002 10:38:19 -0600 Hello, We are successfully running a large struts application. We designed it using a 'classic' architecture: - A Tomcat server running the application in our DMZ. - Use of Struts for our front-end and implementation of the DAO pattern to isolate our Data Access layer. Even if everything runs on the same server. - Use of DBCP pooling from Tomcat to access our Oracle database. Looking ahead, I can see needs for JMS connectivity or connection to various type of data sources within our company and to communicate with our partners. Also, our security team does not like having a Tomcat server in the DMZ accessing more and more internal information systems. We would like to take our infrastructure to the next level. I was thinking of introducing an Application Server within our firewall. It will implement our Data Access connectivity and the DAO on the Web Server will use RMI to access it. I am a little afraid of performance degradation by introducing RMI between the Web Server and Application Server. Also deployment will probably be more complex. Another solution would be to have both Web Server and App Server running on the same box in the DMZ. But that does not solve my security concerns. I don't have much
Re: Struts application infrastructure choices
Craig R. McClanahan wrote: On Sat, 14 Dec 2002, David Graham wrote: Date: Sat, 14 Dec 2002 13:23:40 -0700 From: David Graham [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Struts application infrastructure choices It should be fairly easy to implement this and do some performance testing. Your DAOs will be the only piece that changes to use RMI. You might try just using straight sockets because RMI is another layer on top of sockets which may slow you down. A completely different approach to consider would be running something like Apache in the DMZ, and put Tomcat behind the firewall as well. Then, you could continue to use your existing DAOs without exposing them on the DMZ machine. That's what I meant by my option 1. After skimming http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/jk.html, I now see that Apache-Tomcat does in fact work remotely. Right? Are there problems pushing JK through firewalls? If this works, it is probably the easiest way to go, requiring the least application change, most likely the best performance and also the best security, since there's not much exposed on the Apache server. David Craig From: Aymeric Alibert [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: \Struts Users Mailing List\ [EMAIL PROTECTED] Subject: Struts application infrastructure choices Date: Sat, 14 Dec 2002 10:38:19 -0600 Hello, We are successfully running a large struts application. We designed it using a 'classic' architecture: - A Tomcat server running the application in our DMZ. - Use of Struts for our front-end and implementation of the DAO pattern to isolate our Data Access layer. Even if everything runs on the same server. - Use of DBCP pooling from Tomcat to access our Oracle database. Looking ahead, I can see needs for JMS connectivity or connection to various type of data sources within our company and to communicate with our partners. Also, our security team does not like having a Tomcat server in the DMZ accessing more and more internal information systems. We would like to take our infrastructure to the next level. I was thinking of introducing an Application Server within our firewall. It will implement our Data Access connectivity and the DAO on the Web Server will use RMI to access it. I am a little afraid of performance degradation by introducing RMI between the Web Server and Application Server. Also deployment will probably be more complex. Another solution would be to have both Web Server and App Server running on the same box in the DMZ. But that does not solve my security concerns. I don't have much experience with application servers and would not need the full features of a J2EE app server (at least not right now). Am I on the right path? Does someone have advices or best practices to follow? Aymeric. _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [OT] Memory Footprint of DynaX vs. BO
Craig R. McClanahan wrote: On Thu, 31 Oct 2002, Jacob Hookom wrote: Date: Thu, 31 Oct 2002 22:51:32 -0600 From: Jacob Hookom [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: [OT] Memory Footprint of DynaX vs. BO By implementation, I'm assuming that DynaX uses an underlying Map to store properties. I'm wondering how using a Map to store attribute data differs from storing the same data in BO's along the lines of memory consumption? In Struts, DynaActionForm does indeed store its property values in a Map, which makes the memory occupancy pretty similar to using Maps directly, and are a little larger than using JavaBeans with properties (though not a lot, because there's a few bytes of overhead per bean instance as well). My personal advice, though, is to not stress over this kind of detail unless you're building an incredibly high-transaction-rate app. Use the development technique that takes you the least amount of time -- and use the time you save to tune your database queries instead. You'll get orders of magnitude more impact on improving response time doing this than you would saving a few bytes of temporary memory occupancy here and there. Yes, I agree strongly with Craig -- and even in high-transaction-rate apps, while reducing memory footprint can help you, not spending enough time ensuring throughput can kill you. Think of the front end of your web app as a request parking lot. If you can get the customers in and out of your store more or less as fast as they arrive, it doesn't matter all that much whether they are driving SUVs or compact cars -- they will be able to find parking. Once things start to back up, however, you are going to start losing customers, regardless of what they're driving or how large a parking lot you have. You certainly want to avoid ridiculous situations where each customer brings in a line of mobile homes; but assuming that you have done that, you're better off making sure that you have enough cashiers and they move fast enough than trying to get all your customers to drive compacts. :-) I don't mean to suggest that optimizing memory management is not an important element in performance tuning high-volume applications. It certainly is. The point is that assuming best practices (e.g. efficient use of the framework and container, minimal server-side state, etc.) have been followed in design, it is generally best to focus first on optimizing throughput, IMHO. Regards, Phil Steitz You can always go back later and tune things up if this does turn out to matter. (Or just spend a couple hundred bucks on some more memory ...). Regards, Jacob Hookom Craig -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: WebLogic/Struts/JSP performance woes...
David, Have you considered running some tests with Jmeter or some other testing tool that can tell you exactly how long it takes to deliver the HTML? This would enable you to determine whether the problem is on the server side or in the browser rendering. Regards, Phil -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: How to add a pre-action
Mohan Radhakrishnan wrote: Hi, Flow : login.jsp - mainscreen.jsp[ jsp:includes a left panel showing report parameters] The parameters are chosen by the user. Forward to the same mainscreen.jsp which is shown again with the left panel hidden (uses layers) and the report shown in the center of the screen. 1. Pre-population of the left panel with report parameters. Action mapping used is. actionpath=/mainscreen type=com.hcl.smartmanage.web.action.ReportParameterAction -- Doesn't do anything right now. name=reportParameterForm validate=false scope=session input=/mainscreen.jsp /action If I understand your setup, this action should forward to the mainscreen page. Do you have a global success forward to that page? If not, you should include a local forward in the action definition above. Also, since form validation is turned off, there is no point in including the input attribute. Form tag used is html:form action=mainscreen.action After the parameters are shown the user clicks the 'submit' button inside the above form tag and the parameters should be processed and a report fetched. But the 'action' of the form tag should be differentiated so that this action mapping takes effect. How do you do that? The action attributes of your html form elements should correspond to path attributes in your action definitions. See the Struts User's Guide and sample apps. If I understand the setup, the form above should post to the /report action defined below -- i.e., the form in mainscreen.jsp that posts the report parameters should have action=/report, not mainscreen.action (whatever that means). In the example that I posted earlier, the search parameters page, bookSearch.jsp, posts to /a/listBook. While you can certainly use the same jsp for all of these things, I would not do this personally. If the reason that you are doing this is to reuse common elements, you should consider using tiles. If you are having trouble understanding how struts dispatches actions, here is a good reference: http://www-106.ibm.com/developerworks/library/j-struts/?n-j-2151 To solidify your understanding, if you are comfortable with UML and have tools available, I would recommend documenting your use cases and creating interaction diagrams similar to the ones in the article above. That way you will get a nice design and also a better understanding of the framework :-) hth, Phil actionpath=/report type=com.hcl.smartmanage.web.action.ReportSelectionAction name=reportParameterForm validate=false scope=session input=/mainscreen.jsp /action bye, Mohan -Original Message- From: Phil Steitz [mailto:phil;steitz.com] Sent: Monday, October 21, 2002 10:45 AM To: Struts Users Mailing List Subject: Re: How to add a pre-action Mohan Radhakrishnan wrote: Hi, I am doing something similar but I have a doubt. I show selection parameters with the following action mapping. The html:form action for that is mainscreen.action. actionpath=/mainscreen type=com.hcl.smartmanage.web.action.ReportParameterAction name=reportParameterForm validate=false scope=session input=/mainscreen.jsp /action In our case the same jsp (mainscreen.jsp) is shown after getting the results based on the selected parameters. But the action should be different to retrieve the results - report.action. So initially it should be mainscreen.action and later it should be report.action. How can this be done if the the same jsp and same html:form (mainscreen.action) value is used. Am I clear ? I don't understand exactly what you are trying to do. Describe the user flow for each of the use cases. Where does the action above forward to? What is mainscreen.action? What is report.action? bye, mohan This message and any attachments have been scanned for viruses during transmission from HCL Comnet. -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: How to add a pre-action
Mohan Radhakrishnan wrote: Hi, I am doing something similar but I have a doubt. I show selection parameters with the following action mapping. The html:form action for that is mainscreen.action. actionpath=/mainscreen type=com.hcl.smartmanage.web.action.ReportParameterAction name=reportParameterForm validate=false scope=session input=/mainscreen.jsp /action In our case the same jsp (mainscreen.jsp) is shown after getting the results based on the selected parameters. But the action should be different to retrieve the results - report.action. So initially it should be mainscreen.action and later it should be report.action. How can this be done if the the same jsp and same html:form (mainscreen.action) value is used. Am I clear ? I don't understand exactly what you are trying to do. Describe the user flow for each of the use cases. Where does the action above forward to? What is mainscreen.action? What is report.action? bye, mohan Here is a simple example showing one way to deal with this type of thing. There are no doubt lots of other ways to handle this. Use case: library search. User page flow: main menu - search input page (bookSearch.jsp) - search results page (listBook.jsp). The search input page needs to be pre-populated with a list of currently defined subjects. Struts processing flow: main menu - search input pre-populate action (PrepareListBookAction) - search input page (bookSearch.jsp) - search processing action (ListBookAction) - search results page (booklist.jsp). In struts-config: !-- Prepare Book Search (populates subject list) -- action path=/a/prepareListBook name=bookSearchForm type=com.steitz.library.PrepareListBookAction validate=false scope=request forward name=success path=/a/bookSearch.jsp/ /action !-- Book Search -- action path=/a/listBook name=bookSearchForm type=com.steitz.library.ListBookAction scope=request input=/a/bookSearch.jsp validate=true forward name=success path=/a/booklist.jsp/ /action In the main menu: a href=prepareListBook.do bean:message key=index.find//a (here index.find = Find a Book.) PrepareListBookAction retrieves the list of currently defined subjects and sets a property of the (automatically created) BookSearchForm for the book search input form (bookSearch.jsp) to use. The key concept is that instead of linking/forwarding to the input jsp directly, you link/forward to the pre-population action and then have the pre-population action set up the form bean and then forward to the input jsp. Hope this helps, Phil -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org This message and any attachments have been scanned for viruses during transmission from HCL Comnet. -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: How to add a pre-action
Howard Miller wrote: I think I'm seriously missing the point here! I have looked at the example application in some detail and it appears to add a parameter (eg, ?action=new) to tell the action for a form to perform an initialising action. I don't see it using a pre- action. I am incredibly stuck with the concept of how to code an action that is not encumbered with *special* parameters to pre-load the bean data. My particular problem is that I have pages where the previous page cannot be predicted, so the jsp must have a means of loading its own data. I would really appreciated some pointers as to how to set this up. *** I particularly don't understand how to get the action to call the following JSP *** (ie, I would really appreciate some specific - example - help on this!! ). At least every method I have tried doesn't work. Here is a simple example showing one way to deal with this type of thing. There are no doubt lots of other ways to handle this. Use case: library search. User page flow: main menu - search input page (bookSearch.jsp) - search results page (listBook.jsp). The search input page needs to be pre-populated with a list of currently defined subjects. Struts processing flow: main menu - search input pre-populate action (PrepareListBookAction) - search input page (bookSearch.jsp) - search processing action (ListBookAction) - search results page (booklist.jsp). In struts-config: !-- Prepare Book Search (populates subject list) -- action path=/a/prepareListBook name=bookSearchForm type=com.steitz.library.PrepareListBookAction validate=false scope=request forward name=success path=/a/bookSearch.jsp/ /action !-- Book Search -- action path=/a/listBook name=bookSearchForm type=com.steitz.library.ListBookAction scope=request input=/a/bookSearch.jsp validate=true forward name=success path=/a/booklist.jsp/ /action In the main menu: a href=prepareListBook.do bean:message key=index.find//a (here index.find = Find a Book.) PrepareListBookAction retrieves the list of currently defined subjects and sets a property of the (automatically created) BookSearchForm for the book search input form (bookSearch.jsp) to use. The key concept is that instead of linking/forwarding to the input jsp directly, you link/forward to the pre-population action and then have the pre-population action set up the form bean and then forward to the input jsp. Hope this helps, Phil I do understand how to actually create a bean manually and put in in the scope. I don't understand how to set up a generic preload action for a given JSP/ActionForm, and what the config should look like. Again, any help much appreciated. HM On 20 Oct 2002 at 8:43, David M. Karr wrote: Howard == Howard Miller [EMAIL PROTECTED] writes: Howard Hi, Howard Can somebody kindly help me with the following... Howard I want to add a path and an Action class. The action class will then preload data into Howard a bean and then forward (do I mean forward) to the jsp that displays the bean. That's Howard it. I want this action to be in *addition* to the *normal* jsp/formbean/action setup. Howard I can't see how to do it in particular Howard 1. I don't think I fully understand how/why an action is associated with a bean in Howard struts-config. What does the action servlet do with this information. Howard 2. How do I properly forward from an action to a jsp with the bean information intact. Howard It seems to be very similar to an action returning its input form to display errors, but Howard doing this doesn't work. Whatever I do I seem to get a blank page. In fact, the best practice is to always preface a page with an action. You end up with actions that prepare information for a page, and actions which process information for a page. The actions which process the page information will always have had the form bean created before you get to the action. However, the actions which prepare the page information may have to manually create the form bean and put it into the appropriate scope. Note that the welcome page for an application would normally be something like index.jsp, which does nothing but forward to an action to start the application. You can't preface the welcome page with an action, but you can make it do nothing but go to an action to prepare the real first page. Look at the source code for the example application for some examples of using the form bean. The user guide also talks about the control flow with respect to form beans. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail
Re: How to add a pre-action
Howard Miller wrote: That helps a lot... just one question if you don't mind... can I check how you would forward from the prepareListBookAction to the bookSearch.jsp. I assume you are just using mapping.findForward( success ). That didn't work for me... which is really why I started thinking that I was doing totally the wrong thing. Could (of course) be some stupid error! Yes, on successful completion, PrepareListBookAction.perform() ends with return (mapping.findForward(success)); If you are getting a blank page, there is most likely something wrong with your jsp. Check your container logs. I'm off to try harder... thanks! HM On 20 Oct 2002 at 10:10, Phil Steitz wrote: Howard Miller wrote: I think I'm seriously missing the point here! I have looked at the example application in some detail and it appears to add a parameter (eg, ?action=new) to tell the action for a form to perform an initialising action. I don't see it using a pre- action. I am incredibly stuck with the concept of how to code an action that is not encumbered with *special* parameters to pre-load the bean data. My particular problem is that I have pages where the previous page cannot be predicted, so the jsp must have a means of loading its own data. I would really appreciated some pointers as to how to set this up. *** I particularly don't understand how to get the action to call the following JSP *** (ie, I would really appreciate some specific - example - help on this!! ). At least every method I have tried doesn't work. Here is a simple example showing one way to deal with this type of thing. There are no doubt lots of other ways to handle this. Use case: library search. User page flow: main menu - search input page (bookSearch.jsp) - search results page (listBook.jsp). The search input page needs to be pre-populated with a list of currently defined subjects. Struts processing flow: main menu - search input pre-populate action (PrepareListBookAction) - search input page (bookSearch.jsp) - search processing action (ListBookAction) - search results page (booklist.jsp). In struts-config: !-- Prepare Book Search (populates subject list) -- action path=/a/prepareListBook name=bookSearchForm type=com.steitz.library.PrepareListBookAction validate=false scope=request forward name=success path=/a/bookSearch.jsp/ /action !-- Book Search -- action path=/a/listBook name=bookSearchForm type=com.steitz.library.ListBookAction scope=request input=/a/bookSearch.jsp validate=true forward name=success path=/a/booklist.jsp/ /action In the main menu: a href=prepareListBook.do bean:message key=index.find//a (here index.find = Find a Book.) PrepareListBookAction retrieves the list of currently defined subjects and sets a property of the (automatically created) BookSearchForm for the book search input form (bookSearch.jsp) to use. The key concept is that instead of linking/forwarding to the input jsp directly, you link/forward to the pre-population action and then have the pre-population action set up the form bean and then forward to the input jsp. Hope this helps, Phil I do understand how to actually create a bean manually and put in in the scope. I don't understand how to set up a generic preload action for a given JSP/ActionForm, and what the config should look like. Again, any help much appreciated. HM On 20 Oct 2002 at 8:43, David M. Karr wrote: Howard == Howard Miller [EMAIL PROTECTED] writes: Howard Hi, Howard Can somebody kindly help me with the following... Howard I want to add a path and an Action class. The action class will then preload data into Howard a bean and then forward (do I mean forward) to the jsp that displays the bean. That's Howard it. I want this action to be in *addition* to the *normal* jsp/formbean/action setup. Howard I can't see how to do it in particular Howard 1. I don't think I fully understand how/why an action is associated with a bean in Howard struts-config. What does the action servlet do with this information. Howard 2. How do I properly forward from an action to a jsp with the bean information intact. Howard It seems to be very similar to an action returning its input form to display errors, but Howard doing this doesn't work. Whatever I do I seem to get a blank page. In fact, the best practice is to always preface a page with an action. You end up with actions that prepare information for a page, and actions which process information for a page. The actions which process the page information will always have had the form bean created before you get to the action. However, the actions which prepare the page information may have to manually create the form bean and put it into the appropriate scope. Note that the welcome page for an application would normally be something like index.jsp, which does nothing
Re: Struts Tag Request
Craig R. McClanahan wrote: On Fri, 11 Oct 2002, David Graham wrote: Date: Fri, 11 Oct 2002 11:15:06 -0600 From: David Graham [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: Struts Tag Request I'm not sure I agree with training users that the url is meaningless. This goes against everything people know about browsing. They use urls for bookmarks, look at the list in there address bar for one they recognize, etc. You could train internal people but for internet sites this seems unreasonable. A web application is *not* the same as a web site. The problem with browsers as the delivery vehicle for both is that users get confused on this issue. And developers who are confused on this issue don't help matters any :-). Interactive applications in general (both web-based and rich client based, as well as those built into hardware like the controls on your microwave or VCR) should be modelled as a set of reactions to user gestures (button clicks and so on). The set of possible gestures that are recognized at any point in time *should* be limited to the set built in to the UI, because the developer has provided reactors for those events, and only those events. I agree with your basic point -- a web app is an app and the UI should be self-contained -- but for browser-based apps targeting the public at large, you have to expect that users are going to use the back button and users are going to attempt to bookmark things. They have been *trained* to do so by their experience on the web. If my VCR works differently from others on the market, I need to anticipate that my users are going to do what they have done with other machines -- I better not, for example, chew tapes when users elect to use eject before stop, regardless of how clearly my UI steers them toward the correct sequence. I need to either disable the eject button until stop has been hit or to handle the exceptional event. (see below) Imagine writing a Swing-based app where the user had some external mechanism to cause *any* arbitrary event to happen, whenever they want. That's essentially what the back button and bookmarks do to you. This is not a good analogy, since we are not talking about any event here -- just a couple of events with high probability of ocurring. From my perspective, this is similar to exception management: the developer has a responsibility to identify and handle all exceptional conditions likely to interfere with the normal processing of an application. The tricky bit is defining the scope of these exceptional conditions. I would consider use of the back button or bookmarking in a web app as within scope. (as would millions of web users :-) I don't like the frames approach because then you can't bookmark any pages. This is really frustrating for people. Also, redirects aren't much slower than forwards so I use them when I want to make sure the user doesn't get confused and repost form data. This seems easier to me than training millions of people :-). IMHO, if your users find that they can't use your webapp effectively based on the UI controls you've built in to the user interface, without using the browser facilities, that's a pretty good clue that your UI needs some additional navigation controls and other similar features added to it. Sorry to sound so absolutist ... but this issue is critically important in good user interface design for web-based applications. It's nearly impossible to prevent users from using all the built-in functionality of the browser (even if you don't show the back button, you still have to worry abou the keyboard equivalents). Our mission needs to include minimizing their desires to do so. Dave Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [OT] Request Certificates/Security
Jacob, Assuming that you have exhausted *all* means to solve your authorization problems using container-managed security, which would eliminate the need to muck with security tokens, here are some comments on your setup: 1. Use a secure session cookie to carry the security token. You should keep this stuff out of the queryString. 2. You need to encrypt, not hash the authorization profile info in the cookie, otherwise your authorization manager will not be able to get it back. FRIDAYHave fun managing the keys!/FRIDAY 3. I would consider keeping the authorization info in a security store and encoding only the id in the security token. But then again, this is really what container-managed security does :-) 4. I would recommend keeping the authorization timeouts short -- hitting the DB to refresh auth profiles. This is more secure and also allows you to cut off access more quickly. If your tokens are valid for an hour, then privilege revocation can take up to an hour to become effective. hth, Phil Jacob Hookom wrote: I know I beat security like a dead horse, but If my app generates a menu specific to the user, i.e., a project list that they belong to, then instead of creating a link to the project.do?id=25, do you think it would be secure enough if I passed a huge certificate instead that had an hour time limit on it? The link would instead be: project.do?id=AJEIKL46642K32343OIN4 (Where the project uid is hashed with a timestamp and their role as the param) I know some developers use it when they are securing sites that span multiple servers, but for this, it would prevent redundant db access at best. Does anyone else use this method? Jacob Hookom Comprehensive Computer Science University of Wisconsin, Eau Claire --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.381 / Virus Database: 214 - Release Date: 8/2/2002 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Alternative Datsource Hot-potatoing...
Starting to look a lot like JNDI...(pronounced Gin-dy, sung to a familiar tune) Seriously, look again at Craig M's option 3 -- if your container supports it, the lookup and implementation abstraction can be handled for you. Craig Tataryn wrote: see below From: Craig R. McClanahan [EMAIL PROTECTED] Isn't that basically option 2? The only disadvantage is that, unless you're careful, your DataAdaptor class will be dependent on Struts unless you make it have a static setDataSource() method or something. But you're still tying your business logic classes to the presence of DataAdaptor in every program that uses this approach (which may or may not be a big deal). Craig. Number 2 was: * Static methods ... Most DB connection pool implementations offer a way to retrieve a DataSource or Connection via a static method. Advantage: no handing around extra method parameters. Disadvantage: ties you to that connection pool's APIs. I read this as I should use the static methods provided by the specific connection pool. What I meant was, I would create a generic DataAdaptorFactory class and a DataAdaptor interface which could be be configured off of a properties file to determine which data adaptor to use. This way I can abstract myself from implementation details. I don't think my business layer would even know about the DataAdaptor, they would be communicating with my Data layer objects, which would take care of data issues. Something like: public interface DataAdaptor { public java.sql.Connection getConnection(); } public class DataAdaptorFactory { public static DataAdaptor getDataAdaptor() { //lookup data adaptor implementation class //in DataAdaptor.properties file //do a class for name on that implemenation class //return that class. } } DataAdaptor.properties: dataAdaptor=mypackage.MySqlDataAdaptor public class MySqlDataAdaptor implements DataAdaptor { public java.sql.Connection getConnection() { //mysql specific stuff to get a connection } } public class EmployeeDataObject { public EmployeeList retrieve(String fields, String filters) { DataAdaptor data = DataAdaptorFactory.getDataAdaptor(); Connection conn = data.getConnection(); //execute a query based on the fields and filters passed in //transform the results to an 'EmployeeList' collection } } Craig. Craig From: Craig R. McClanahan [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Alternative Datsource Hot-potatoing... Date: Fri, 6 Sep 2002 11:40:48 -0700 (PDT) On Fri, 6 Sep 2002, Craig Tataryn wrote: Date: Fri, 06 Sep 2002 12:41:26 -0500 From: Craig Tataryn [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Alternative Datsource Hot-potatoing... I was wondering if someone could give me a heads up on some alternative means for which to give my data access layer access to my datasource. I don't really like the idea of my controller grabbing the Datasource, passing it off to my business layer, who in turn passes it along to my data layer. I guess I'm sort of a purest, but I don't think the Business layer should know anything about the database, and that means it shouldn't even have methods that take connections or datasourses as parameters. I think the only thing I like about the Controller passing along a connection to my business/data layer is the fact that I can first open a transaction before passing the connection along, and then I can commit the transaction when everything is done. Thus my transactions are at the controller level, and can be managed there. Back in my old VB/COM days, we had a sort of DB Utilities class which could be accessed from the datalayer. You would ask it to give you a connection, and it would get it for you. Should I make my own class for datasource access which is intitalized upon application start with the Datasource object found by struts? Then the rest of my datalayer can simply use it? Three basic options exist: * Hand a DataSource (I normally prefer to send a Connection instead, but either works) to your business logic method as a parameter to each call that needs it. Advantage: no binding to anything. Disadvantage: can be a pain to hand it around. * Static methods ... Most DB connection pool implementations offer a way to retrieve a DataSource or Connection via a static method. Advantage: no handing around extra method parameters. Disadvantage: ties you to that connection pool's APIs. * JNDI resources -- All J2EE app servers (and some servlet containers like Tomcat 4)
Re: how do I integrate struts with container managed security?
Ho-Ki Au wrote: I read in the mail archive that it was possible to apply container managed security on struts action. Can someone give me an example on how this can be done? I have a servlet-mapping like this: servlet-mapping servlet-nameaction/servlet-name url-pattern*.do/url-pattern /servlet-mapping and I would like to trigger a container-managed login whenever an action is done. Please help. -hoki Hoki, The key thing to understand is that struts actions invoked by URL's can be protected like any other URL resource using container-managed security. Check out http://jakarta.apache.org/tomcat/tomcat-4.0-doc/realm-howto.html for a nice description of how to set up container-managed security using Tomcat 4.0. Here is a very simple example using struts 1.02. In this example, actions requiring authentication have /a/ at the start of their paths, others do not. The URL request to the protected resource forces a login. The constraint below forces *everything* (including HTML pages, jsps) down the /a/ path to be authenticated. If you want to protect just the actions, you need to modify the security constraint. In web.xml: !-- Security Constraints -- security-constraint web-resource-collection web-resource-nameSecure Area/web-resource-name url-pattern/a/*/url-pattern /web-resource-collection auth-constraint role-nameadministrator/role-name role-namereader/role-name /auth-constraint /security-constraint In struts-config: !-- Register reader **non-authenticated action** -- action path=/register type=com.steitz.library.SaveReaderAction name=readerForm scope=request input=/Register.jsp forward name=success path=/welcome.html/ forward name=error path=/registrationError.jsp/ forward name=cancel path=/registrationCancel.jsp/ls /action !-- Edit book (Update or Create) **action requires authentication** -- action path=/a/editBook type=com.steitz.library.EditBookAction name=bookForm scope=request input=/a/book.jsp validate=false forward name=success path=/a/editBook.jsp/ /action hth, Phil -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to Build error messages dynamically??
Vivek Sundararaman wrote: Hello all I would appreciate any/ all help for my problem. We are storing all the errors messages displayed to the users in a database. We are having a controller making the calls to the database and returning the presentation layer asset of errors or messages to be displayed. In my actionclass, after I make the call to the controller, based on the success or failure of the call, I build the actionerrors with the message sent back from controller call. These messages are not maintained in the appresources.properties The code in my actionclass looks like: ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.tablemessage, Pass My message)); saveErrors(request, errors); In my appresources.properties error.tablemessage={0} In my jsp html:errors/ This does not print the error messagePass My message on the page. How to make a dynamic error or message appear in the page? (I tried to look in the archives for answers, but couldn't find one. May be I missed it too.) Thank you Vivek -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] Vivek, I have used syntax nearly identical to yours successfully in Struts 1.02. Could be a problem with your jsp or control flow. Do you see the errors header and footer displayed or are you getting a blank page? I would suggest the following: 0. Inspect your container logs 1. Verify that you have the struts bean and html tag libs referenced in your jsp and there are no other problems in the jsp 2. Add some logging to verify that the ActionErrors constructor is getting the actual parameters that you think it is getting 3. Add logging to verify that the saveErrors is getting executed hth, Phil -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: forms, security,read only fields,autopopulation
John Rothfield wrote: I have an account information screen that lets the user change their address. The screen displays account # also, but account # is a read only field. Question: should account # be in the form bean? I need to populate account #, but I'm afraid the user will hack the form and add an accountNo input field which would then automatically set the accountNo field. One approach is to have the form object contain the model as a variable, and to have a get method but no set method. The example that came with struts uses the following: bean:write name=user property=username filter=true/ where user is the formname. Any comments? Thanks, John First, you should ask yourself whether the user needs to see the full account number. You might want to consider displaying a masked version, showing only enough to distinguish between multiple accounts that a user may have (e.g. xxx--1234). Second, and most importantly, you need to maintain the separation of the model and the view. Security is one of the primary motivators for Model II/MVC. Updates to the model should be handled by business objects, not form beans or even action classes. Finally, the mapping between accounts and logged in users should if possible be maintained by the security system. If you are using container-managed security, you can get the identity of the logged-on user using J2EE APIs in either the web container or the EJB container. Before making any model updates, you should verify that the logged in user actually owns the associated account, using the J2EE (or application) APIs to get the identity of the user and either your durable security store or a session object that is not bound to the view, loaded at login, read-only thereafter, to do the check. The closer you do the account authorization check to the actual model update, the better. If you choose not to implement account-level authorization control in your business objects, you should certainly avoid exposing the session account data of record in your form beans. You can still present the data; but the form bean getter() should just access the *real* session data and the setter() should be limited to setting an index into the *real* list of accounts for the user stored elsewhere in the session. This is the main point -- the set of accounts associated with a logged in user should in no case (other than account enrollment) be modifiable by the user. Just my -- admitedly conservative -- opinion. Phil Steitz -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: architecture question
Craig R. McClanahan wrote: My personal feeling (as primary author of Struts) is that I only care about supporting Struts on J2EE-compatible platforms (currently J2EE 1.3), or on a web container supporting Servlet 2.2 and JSP 1.1 if you don't need EJBs directly. I'm not at all interested in supporting bastardized versions -- although BroadVision (or anyone else) is of course free to fork it and maintain their own copy. If BroadVision doesn't support the standard capabilities of Servlet 2.2 and JSP 1.1 so that standard Struts runs on it, I wouldn't ever willingly use it for anything. It's not just Struts and all of the innovation there that you give up -- you also give up the ability to utilize any other technology based on standard servlet and JSP APIs. You're basically stuck with a proprietary infrastructure that is going to get increasingly farther from the future standards of J2EE. If unmodified Struts will run on BroadVision and they still prefer a roll your own MVC framework -- well, everyone likes to recommend what they are familiar with. You might find yourself though, being one of the many people who started down the road of building their own framework and coming back to Struts because it was costing too much effort that was spent on the framework instead of the application :-). Craig McClanahan I agree that proprietary infrastructure should be avoided as much as possible -- it's just that these products (BroadVision, Vignette, etc.) offer some business functionality that is very appealing to business partners (e.g. business user management of content, 1-1 marketing support) and very well-marketed (slick GUIs, nice slideware, etc...). For obvious reasons, the vendors are not rushing to abandon their proprietary infrastructure ;-) The best practical approach, therfore, IMHO, is to limit deployment of the proprietary stuff and to engineer interoperability. For example, the marketing pages could be hosted on BroadVision (so the business users can manage the content) with links, POSTs or XML messaging interfaces into transactional pages/ business services hosted by a real J2EE container. Session management can be tricky in this case, but the problems are not insurmountable. Regarding the value of frameworks in a large multi-team environment, this is something that I have seen first hand pay off big time. To be successful, however, you need to invest significantly in training, evangelism, operational readiness and support. As struts continues to gain steam, the training and evangelism aspect will get easier and easier (like J2EE already has), since so many developers and architects will already be familiar with the framework when they start projects. This represents a HUGE potential development and maintenance cost save. In terms of training and support, you can either cultivate the necessary resources in-house or get outside help. Check out http://jakarta.apache.org/struts/resources/consultants.html. hth, Phil Steitz On Sat, 10 Nov 2001, Sandeep Takhar wrote: Date: Sat, 10 Nov 2001 07:36:36 -0800 (PST) From: Sandeep Takhar [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Mailing List [EMAIL PROTECTED] Subject: architecture question hello! need your help again... The bank I work at has semi-finalized it's plans for employee facing and customer facing applications. The problem I am having is for customer facing applications. The application is the banks main customer web site. This web site will be maintained by many different groups, each group having a link from the home page. Also note that since this web site will go a long way towards promising what our current CEO wants -- there are a lot of groups and a lot of important people affected by any architectural decision, which means that any change to a recommendation will have to be clearly justified and better work properly. The problem stems from the architecture to use when there are all these different groups. We hired some expensive consultants and what they recommended was as follows: The bank is already decided to use Broadvision so they have not told us to use anything different than this for the servlet container and the 1:1 publishing/content management. WebLogic will be used for EJB's. Because of the many different groups and because they are rolling out with 5.5 of broadvision (which does not contain any J2EE services yet) and also because of the update problem associated with having many different groups maintaining their own code they recommended: Use J2EE framework with the different tiers and specifically a MVC Model II approach for the web-tier. Because of the bastardized version of Struts and some particular problem of Broadvision needing the session (not sure how) -- they don't recommend going with Struts, but have recommended including a servlet in a jsp where the servlet acts identically to an action class where it redirects
Re: data-source problem
Look at your servlet engine log (servlet.log if you are using Tomcat with the default setup). Most likely the ActionServlet associated with your web app is not loading because the data source initialization is failing. The mappings aren't there because the initialization failed. The error message will (hopefully) tell you why. Make sure that you have the Oracle JDBC driver jar in your application's WEB-INF/lib. slickdev wrote: I have a problem with the data-source properties in struts-config.xml This is for the sample email portal application. I configured the properties to use my localhost oracle installation, which does work with jdbc from command-line java apps as well as with sql*plus. Here is the suspect layout: data-sources data-source set-property property=autoCommit value=false/ set-property property=description value=Oracle Data Source Configuration/ set-property property=maxCount value=4/ set-property property=minCount value=2/ set-property property=driverClass value=oracle.jdbc.driver.OracleDriver/ set-property property=url value=jdbc:oracle:thin:@localhost:1521:oracle/ set-property property=user value=system/ set-property property=password value=manager/ /data-source /data-sources PROBLEM When clicking the initial logon link to invoke logon.jsp, an exception occurs: javax.servlet.ServletException: Cannot find ActionMappings orActionFormBeans collection at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:460) at logon_1._jspService(logon_1.java:691) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java) --- --- --- The exception does not occur if the stuff between data-source --- /data-source is commented out. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: You suck! No, You suck!
Craig All, The fragment below from Craig is a great clear answer - and it came out of Craig's knowledge, AND James's knowledge and Micael's stubbornness - altogether a good team effort. How about a beer and a group hug :) Regards, Phil I don't know anything specific about Flash, so this is a repeat of an answer to this question from someone else that got lost in the shuffle. Background Issue - Things inside /WEB-INF are visible to your application (i.e. you can do request dispatcher include and forward calls with them) but not to your client. Therefore - *IF* the Flash client tries to do a second HTTP request to get the referenced file, it will fail. I suspect this is probably what happens, but really don't have a clue. The same thing will happen in a non-Flash scenario if your JSP page /WEB-INF/mypage.jsp contains a relative reference to an image in the same directory: img src=logo.gif The image retrieval (done by the browser as a separate HTTP request) will fail, because the absolute URL will be something like: http://www.mycompany.com/myapp/WEB-INF/logo.gif and the container will disallow direct client access to the context-relative path /WEB-INF/logo.gif. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Automatic way of transferring to login screen - Ryan Norman
Hi Ryan, Check out the example application struts-example.war which is in the current struts distribution. Each JSP page uses the custom tag app:checkLogon/ to determine if a user is logged in. If not, the user is redirected to a login page. Phil -Original Message- From: Ryan Norman [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 11:03 AM To: Struts User Mailing List; LA Java User Group Subject: Automatic way of transferring to login screen - Ryan Norman Hi, I am running Win 2K advanced server, JDK 1.3, Tomcat 4.0 and struts framework. I would like to know whether there is an automatic way of transferring the user to the login screen in the below given scenarios. . The first time he enters the application. . When the session variables expire. . When an intruder tries to get into the application by typing an valid URL without loging into the application. Thanks in advance Ryan Norman -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to Pre-fill a formbean
Hi, In mainAction, where form is passed in by the method header, the code form.setProperty1(Dog); compiles. In loginAction, the code: MainForm mainForm = new MainForm(); mainForm.setProperty1(Dog); as suggested by Viplava, fails to compile with: [javac] Found 2 syntax errors in ...: [javac] [javac] 36. mainForm.Property1(Dog); [javac] [javac] [javac] *** Syntax: misplaced construct(s) [javac] [javac] [javac] [javac] 36. mainForm.setProperty1(Dog); [javac]--- [javac] [javac] *** Syntax: Unexpected symbol ignored Am I missing something obvious in struts or am I missing something obvious about java (or more likely both :) What code do I have to include to trigger struts to give me a reference to the formbean? Phil -Original Message- From: Nekkalapudi, Viplava [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 12:14 PM To: 'Struts Users Mailing List' Subject: RE: How to Pre-fill a formbean // Create a form with the name given in struts-config.xml MainForm mainForm = new MainForm(); mainForm.setProperty1(..); ... request.setAtribute(mainForm, mainForm); // **// Struts Action Servlet creates mainForm just before displaying the main.jsp, if it is not in the request/session. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 1:56 PM To: [EMAIL PROTECTED] Subject: RE: How to Pre-fill a formbean Hi All, And Thanks. So in my loginAction, I can create a reference to mainForm and pre-populate it with defaults from the database. Would someone be able to provide a snippet of code that I can use in loginAction to create a reference to mainForm? Thanks, Phil -Original Message- From: Jay sissom [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 6:01 AM To: Struts Users Mailing List Subject: Re: How to Pre-fill a formbean You can do it this way, but I would use a Struts tag instead of a jsp tag. Instead of using jsp:useBean and jsp:getProperty, all you need to do is bean:write name=mainForm property=mfProperty/ and that will write out the mfProperty to the JSP. Jay On Thu, 14 Mar 2002, Joe Lee wrote: Phil, Your loginAction should create and populate a mainForm bean and then saves it in the request scope. In the main.jsp, get a reference to this form by: jsp:useBean name=mainForm scope=request class=com.MainForm and the input fields on that jsp get the defaults from this form bean. You have to use class (not type) so that if you come from a differene route to main.jsp rather than Login and the mainform bean may not be there already, a new one will be created for u. Then your jsp won't bombs and the input fields still get blank defaults. - Joe RE: How to Pre-fill a formbean -- -- From: HERSHKOWITZ,PHIL (A-Sonoma,ex1) Subject: RE: How to Pre-fill a formbean Date: Thu, 14 Mar 2002 18:14:30 -0800 -- -- Hi, From the loginAction, I am calling the database to retrieve default values for some of the fields the use must fill out on mainAction.jsp. The default values depend on the user ID. Phil __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to Pre-fill a formbean - correction
I mistyped the compiler output. It should read: [javac] Found 2 syntax errors in ...: [javac] [javac] 36. mainForm.setProperty1(Dog); [javac] [javac] [javac] *** Syntax: misplaced construct(s) [javac] [javac] [javac] [javac] 36. mainForm.setProperty1(Dog); [javac]--- [javac] [javac] *** Syntax: Unexpected symbol ignored Phil -Original Message- From: HERSHKOWITZ,PHIL (A-Sonoma,ex1) [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 4:10 PM To: 'Struts Users Mailing List' Subject: RE: How to Pre-fill a formbean Hi, In mainAction, where form is passed in by the method header, the code form.setProperty1(Dog); compiles. In loginAction, the code: MainForm mainForm = new MainForm(); mainForm.setProperty1(Dog); as suggested by Viplava, fails to compile with: [javac] Found 2 syntax errors in ...: [javac] [javac] 36. mainForm.Property1(Dog); [javac] [javac] [javac] *** Syntax: misplaced construct(s) [javac] [javac] [javac] [javac] 36. mainForm.setProperty1(Dog); [javac]--- [javac] [javac] *** Syntax: Unexpected symbol ignored Am I missing something obvious in struts or am I missing something obvious about java (or more likely both :) What code do I have to include to trigger struts to give me a reference to the formbean? Phil -Original Message- From: Nekkalapudi, Viplava [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 12:14 PM To: 'Struts Users Mailing List' Subject: RE: How to Pre-fill a formbean // Create a form with the name given in struts-config.xml MainForm mainForm = new MainForm(); mainForm.setProperty1(..); ... request.setAtribute(mainForm, mainForm); // **// Struts Action Servlet creates mainForm just before displaying the main.jsp, if it is not in the request/session. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 1:56 PM To: [EMAIL PROTECTED] Subject: RE: How to Pre-fill a formbean Hi All, And Thanks. So in my loginAction, I can create a reference to mainForm and pre-populate it with defaults from the database. Would someone be able to provide a snippet of code that I can use in loginAction to create a reference to mainForm? Thanks, Phil -Original Message- From: Jay sissom [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 6:01 AM To: Struts Users Mailing List Subject: Re: How to Pre-fill a formbean You can do it this way, but I would use a Struts tag instead of a jsp tag. Instead of using jsp:useBean and jsp:getProperty, all you need to do is bean:write name=mainForm property=mfProperty/ and that will write out the mfProperty to the JSP. Jay On Thu, 14 Mar 2002, Joe Lee wrote: Phil, Your loginAction should create and populate a mainForm bean and then saves it in the request scope. In the main.jsp, get a reference to this form by: jsp:useBean name=mainForm scope=request class=com.MainForm and the input fields on that jsp get the defaults from this form bean. You have to use class (not type) so that if you come from a differene route to main.jsp rather than Login and the mainform bean may not be there already, a new one will be created for u. Then your jsp won't bombs and the input fields still get blank defaults. - Joe RE: How to Pre-fill a formbean -- -- From: HERSHKOWITZ,PHIL (A-Sonoma,ex1) Subject: RE: How to Pre-fill a formbean Date: Thu, 14 Mar 2002 18:14:30 -0800 -- -- Hi, From the loginAction, I am calling the database to retrieve default values for some of the fields the use must fill out on mainAction.jsp. The default values depend on the user ID. Phil __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED
RE: How to Pre-fill a formbean
Hi Jay, And Thanks. But if I understand struts correctly, the form you are casting from is loginForm. My struts-config.xml looks like: form-beans form-bean name=mainForm type=com.mainForm/ form-bean name=loginForm type=com.loginForm/ /form-beans action input=/login.jsp name=loginForm path=/login type=com.loginAction / action input=/main.jsp name=mainForm path=/mainAction type=com.mainAction / So the form in public ActionForward perform(ActionMapping mapping, ActionForm form, ... is loginForm. I need a reference to mainForm. Thanks, Phil -Original Message- From: Jay sissom [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 6:12 PM To: Struts Users Mailing List Subject: Re: How to Pre-fill a formbean The form bean has already been created by the time your mainAction perform method is called if you have defined the form bean in your struts-config.xml file. All you would do is this: mainForm mf = (mainForm)form; // where form is passed to the perform method mf.setProperty1(asdfasdf); mf.setProperty2(asdffdf); mf.setProperty3(asdfasdf); Then in the JSP that you forward to, you can use bean:write/ to write out the properties from the bean. Jay On Thu, 14 Mar 2002 [EMAIL PROTECTED] wrote: Hi, My jsp application begins at a login page. I call the login page action loginAction and I have defined loginForm to process the user details. If the login is successful, the action forwards to mainAction.jsp, whose form action is /mainAction Before I display the mainAction.jsp I want to pre-load some form values from the java code that processes the login action (loginAction.java) by using the Set methods of mainForm. Is the best way to do this to get a reference to the not-yet-created mainForm bean? If so, would someone give a code snippet showing how to refer to a bean that is not the struts form bean for the loginAction? Or is there a better way to do this? Thanks, Phil -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to Pre-fill a formbean
Hi, From the loginAction, I am calling the database to retrieve default values for some of the fields the use must fill out on mainAction.jsp. The default values depend on the user ID. Phil -Original Message- From: John Menke [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 6:28 PM To: Struts Users Mailing List Subject: RE: How to Pre-fill a formbean How do you know what record in the database this will retrieve? Where does it get it's data. the form bean that is instantiated will be empty unless you put data into it correct? -Original Message- From: Jay sissom [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 9:12 PM To: Struts Users Mailing List Subject: Re: How to Pre-fill a formbean The form bean has already been created by the time your mainAction perform method is called if you have defined the form bean in your struts-config.xml file. All you would do is this: mainForm mf = (mainForm)form; // where form is passed to the perform method mf.setProperty1(asdfasdf); mf.setProperty2(asdffdf); mf.setProperty3(asdfasdf); Then in the JSP that you forward to, you can use bean:write/ to write out the properties from the bean. Jay On Thu, 14 Mar 2002 [EMAIL PROTECTED] wrote: Hi, My jsp application begins at a login page. I call the login page action loginAction and I have defined loginForm to process the user details. If the login is successful, the action forwards to mainAction.jsp, whose form action is /mainAction Before I display the mainAction.jsp I want to pre-load some form values from the java code that processes the login action (loginAction.java) by using the Set methods of mainForm. Is the best way to do this to get a reference to the not-yet-created mainForm bean? If so, would someone give a code snippet showing how to refer to a bean that is not the struts form bean for the loginAction? Or is there a better way to do this? Thanks, Phil -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Newbie question. Can action mappings intercept requests that are not part of forms?
Thank you, that solved the problem Phil Rice -Original Message- From: Kanoza, Douglas (NCI) [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 21:23 To: 'Struts Users Mailing List' Subject: RE: Newbie question. Can action mappings intercept requests that are not part of forms? If you've done your *.do extension mapping in web.xml, you just need to append '.do' to the page parameter: html:link page=/logout.do bean:message key=mainMenu.logout / /html:link -Original Message- From: Phil Rice [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 4:21 PM To: [EMAIL PROTECTED] Subject: Newbie question. Can action mappings intercept requests that are not part of forms? The problem: I am trying to make a logout button work by proving a link: html:link page=/logout bean:message key=mainMenu.logout / /html:link Things I have tried I have tried a number of variations of the following part of struts-config.xml: actionpath=/logout type=com.conformNow.calibrate.actions.LogoutAction name=logoutForm scope=request forward name=success path=/Welcome.jsp/ /action When I try and use the link above, the address browser of the browser shows /logout as the last part of the url and LogoutAction is not executed. I have managed to get LogoutAction to execute by creating a form, and submitting the form. I have fairly sure this is not a simple capitalisation problem I have looked in the FAQ and the mailing archives. Summary Is there a way to intercept a hypertext link, rather than a post? Thanks Phil Rice -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
bean:message as content of template:put tag
Hi, I am developing an internationalized program using struts, and am using bean:message tags to display copy in different languages. On my site index page, I'd like to use the template:put tag on line 4 below to insert my locale specific page title. It seems that struts does not support this. Is there a workaround to this problem? index.jsp. 1. %@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' % 2. %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % 3. template:insert template='/template/template.jsp' 4. template:put name='title' content='bean:message key=index.title/'/ 5. template:put name='advert' content='advert here' direct='true'/ 6. template:put name='nav' content='/inc/nav.jsp'/ 7. template:put name='body' content='body here' direct='true'/ 8. /template:insert Any help would be greatly appreciated, Phil, Chamonix, France -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: ActionError problem
Do you have error.noCurrentObject in your ApplicationResources.properties file? In your struts config, if there is a validate=true then there needs to be and input=a jsp or action to populate that jsp cheers, Phil Maher -Original Message- From: Bryan P. Glennon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 4:19 PM To: Struts Users Mailing List Subject: RE: ActionError problem Alex- I do need to get the session object from the request, so that I can insure that an object has been set for the operation. It seems to make no difference if I use it or not - I tried just creating/populating the ActionErrors object and doing nothing else, and I got the same results... Thanks, Bryan -- Bryan Glennon (mailto:[EMAIL PROTECTED]) BPG Consulting, Inc. (http://www.bpgc.com) Tech Question? (mailto:[EMAIL PROTECTED]) -Original Message- From: Brown, Alex [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 6:13 PM To: 'Struts Users Mailing List' Subject: RE: ActionError problem Does this approach work for you? Make sure your messages are filled in (eng.admin.group.error.groupname.required) etc. You should have no need to play with Request, the GET/SET methods should be populated. -Alex public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); try { if (this.group_name == null) { errors.add(group_name, new ActionError(eng.admin.group.error.groupname.required)); } return errors; } catch (Exception e) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(eng.error.general,e.getMessage())); return errors; } } -Original Message- From: Bryan P. Glennon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 7:09 PM To: [EMAIL PROTECTED] Subject: ActionError problem Sorry to keep bugging this list, but you have all been so helpful... I am getting an HTTP error 500 (internal server error) sometime after the validate method in my form bean returns. I see all of my logging messages, and there is one entry in the errors list. I see no indication of problems in any of the tomcat or application logs. The validate method looks like this: public ActionErrors validate(ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { cat.debug(Validate); ActionErrors errors = new ActionErrors(); cat.debug(errors created); Object o = request.getSession().getAttribute(currentObject); o = null; // Force error for testing... if(o == null) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.noCurrentObject)); } cat.debug(Returning error with + errors.size() + entries.); return errors; } Any ideas? Thanks, Bryan -- Bryan Glennon (mailto:[EMAIL PROTECTED]) BPG Consulting, Inc. (http://www.bpgc.com) Tech Question? (mailto:[EMAIL PROTECTED]) -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Anyone using STUTS with Webgain's Visual Cafe?
Just wondering if anyone has setup a STRUTS project template in Visual Cafe? Thanks! Phillip Jackson Programmer/Analyst Enterprise Data Warehouse -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Tiles, ActionComponentServlet, WebLogic 6.0sp1, NoSuchMethodError
I'm having a problem replacing the struts 'ActionServlet' with tiles 'ActionComponentServlet', I keep getting this exception (using WebLogic 6.0sp1) : -=-=- Error loading servlet: 'action' java.lang. NoSuchMethodError at org.apache.commons.digester.Digester.getReader(Digester.java:527) at org.apache.commons.digester.Digester.parse(Digester.java:120) at org.apache.struts.tiles.xmlDefinition.XmlParser.parse(XmlParser.java:255 ) -=-=- I've tried to upgrade some library files, including: 1. add jaxp_1.1 to my /WEB-INF/lib directory 2. add xerces_1.4.3 to my /WEB-INF/lib directory (before the weblogic classes...to overide the default SAX parser, this just gave me a java.lang.AbstractMethodError, instead of the java.lang.NoSuchMethodError 3. added the below to web.xml init-param param-nameSAXParser/param-name param-valueorg.apache.xerces.parsers.SAXParser/param-value /init-param ...but I keep getting the same error...anyone ideas? Philip Maher -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
resin and struts example
Hello, I was trying to get the struts example to work with Resin 1.2.5, and was having some difficulty. When I run the web app I get the following stack trace ... java.lang.NoSuchMethodError: javax.servlet.UnavailableException: method init(Ljava/lang/String;)V not found at org.apache.struts.example.DatabaseServlet.init(DatabaseServlet.java:183) at javax.servlet.GenericServlet.init(GenericServlet.java:172) at com.caucho.server.http.Application.createServlet(Application.java:1734) at com.caucho.server.http.Application.loadServlet(Application.java:1698) at com.caucho.server.http.Application.initServlets(Application.java:1115) at com.caucho.server.http.Application.init(Application.java:1068) at com.caucho.server.http.VirtualHost.restartApplication(VirtualHost.java:865) at com.caucho.server.http.VirtualHost.getInvocation(VirtualHost.java:613) at com.caucho.server.http.ServletServer.getInvocation(ServletServer.java:654) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:236) at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:157) at com.caucho.server.TcpConnection.run(TcpConnection.java:140) at java.lang.Thread.run(Thread.java:484) It seems like this should be a no brainer to get the web app example working. Can anyone point me in the right direction?Thanks,Phil Phillip DiCorpoSoftware Engineer SkyGo, Inc.1235 Radio Road1st FloorRedwood City, CA 94065 (650) 232-1192 Direct(650) 232-1100 Main(650) 232-1200 Fax[EMAIL PROTECTED]
RE: resin and struts example
Thanks for your feedback. It's not really my web app. It's the one provided as an example with struts ("struts-example"). When I run the example in Tomcat in work perfectly, however in Resin-1.2.5 I get the error I posted. I'll try looking at the config files you mentioned. Thanks, Phil Phillip DiCorpoSoftware Engineer SkyGo, Inc.1235 Radio Road1st FloorRedwood City, CA 94065 (650) 232-1192 Direct(650) 232-1100 Main(650) 232-1200 Fax[EMAIL PROTECTED] -Original Message-From: Tharwat Abdul-Malik [mailto:[EMAIL PROTECTED]]Sent: Thursday, April 26, 2001 11:03 PMTo: [EMAIL PROTECTED]Subject: Re: resin and struts example It looks like the DatabaseServlet is not being loaded. If you are configuring your web app using resin.conf, you will need to add the DatabaseServlet to it and have it loaded at startup. I'm using Resin also, but I use an web.xml file as follows: !-- Initialization Database Servlet Configuration -- servlet servlet-nameDatabaseServlet/servlet-name servlet-classwhatever.package.DatabaseServlet/servlet-class init-param param-namedebug/param-name param-value2/param-value /init-param load-on-startup1/load-on-startup /servlet I hop this helps. - Original Message - From: Phil DiCorpo To: '[EMAIL PROTECTED]' Sent: Thursday, April 26, 2001 10:31 PM Subject: resin and struts example Hello, I was trying to get the struts example to work with Resin 1.2.5, and was having some difficulty. When I run the web app I get the following stack trace ... java.lang.NoSuchMethodError: javax.servlet.UnavailableException: method init(Ljava/lang/String;)V not found at org.apache.struts.example.DatabaseServlet.init(DatabaseServlet.java:183) at javax.servlet.GenericServlet.init(GenericServlet.java:172) at com.caucho.server.http.Application.createServlet(Application.java:1734) at com.caucho.server.http.Application.loadServlet(Application.java:1698) at com.caucho.server.http.Application.initServlets(Application.java:1115) at com.caucho.server.http.Application.init(Application.java:1068) at com.caucho.server.http.VirtualHost.restartApplication(VirtualHost.java:865) at com.caucho.server.http.VirtualHost.getInvocation(VirtualHost.java:613) at com.caucho.server.http.ServletServer.getInvocation(ServletServer.java:654) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:236) at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:157) at com.caucho.server.TcpConnection.run(TcpConnection.java:140) at java.lang.Thread.run(Thread.java:484) It seems like this should be a no brainer to get the web app example working. Can anyone point me in the right direction?Thanks,Phil Phillip DiCorpoSoftware Engineer SkyGo, Inc.1235 Radio Road1st FloorRedwood City, CA 94065 (650) 232-1192 Direct(650) 232-1100 Main(650) 232-1200 Fax[EMAIL PROTECTED]