how to get the version of struts during runtime
hi, i would need to check the version of struts running during runtime, to be more specific when my derived action servlet runs through its init method (derived from ActionServlet of course). reason is, if the minor version has changed, a warning should be written to the logs; if a major change of the version happened, my action servlet will refuse to start until somebody checked the code of the servlet and made sure that it's running with the new version. any ideas? kr, guenther -- Günther Wieser creative-it Guglgasse 6/1/11/1 A-1110 Wien Austria http://www.creative-it.com 2 Dinge sind unendlich: Das Universum und die Dummheit der Menschheit, aber beim Universum bin ich mir nicht so ganz sicher. Albert Einstein
RE: problem with forwardPattern and modules
hi, just for future reference (in case somebody searches for the same problem), i found the solution in the README.txt for verson 1.2.8. = KNOWN LIMITATIONS: = The following items identify functionality areas that have not yet been fully implemented or tested: * Use of the forwardPattern or pagePattern attributes on the controller element. seems to me this feature has not been implemented yet i was able to solve this by using tiles for page layouting, cause tiles doesn't use any module prefixes etc. but loads a jsp directly from the file system (while a forward action in struts-config.xml sends the servlet container the URI that is prefixed with the module path, and the container loads the page/URI from filesystem). kr, guenther -Original Message- From: Günther Wieser [mailto:[EMAIL PROTECTED] Sent: Friday, January 27, 2006 2:23 PM To: 'Struts Users Mailing List' Subject: problem with forwardPattern and modules hi, i'm trying to configure the controller using controller forwardPattern=/$P pagePattern=/$P/ so that it looks for jsp pages in the webroot folder, no matter if we are inside a module or not. but whatever i enter in the forwardPattern or pagePattern properties, no changes in the behaviour. went through the source code of 1.2.8, and in RequestProcessort.internalModuleRelativeForward() i can see that this methd doesn't take care of any patterns, just combines the module prefix with the URI to get the new URI. any ideas? kr, guenther -- Günther Wieser creative-it Guglgasse 6/1/11/1 A-1110 Wien Austria http://www.creative-it.com 2 Dinge sind unendlich: Das Universum und die Dummheit der Menschheit, aber beim Universum bin ich mir nicht so ganz sicher. Albert Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:cancel question
seems that the browser stops the form from being able to do ANYTHING with it... one solution, but it seems dirty to me, is to add another form with only a cancel button... kr, guenther -- Günther Wieser creative-it Guglgasse 6/1/11/1 A-1110 Wien Austria http://www.creative-it.com -Original Message- From: Derrick Koes [mailto:[EMAIL PROTECTED] Sent: Monday, April 11, 2005 10:42 PM To: [EMAIL PROTECTED] Subject: html:cancel question I have a function to disable buttons onsubmit because I don't want the user to keep clicking, especially for long running actions. However, this seems to interfere when the button is an html:cancel, which is a type of submit. It seems to ignore the correct behavior of cancelling and attempts to do a validated submit. What do I need to do to disable buttons AND get cancel to work properly? function disable(form) { var buttons = form.getElementsByTagName(input); for (i = 0; i buttons.length; i++) { if (buttons[i].type == button || buttons[i].type == reset || buttons[i].type == submit) { buttons[i].disabled = true; } } return true; } Thanks, Derrick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to make HttpSession thread-safe????
maybe you could tell us more about what you want to achieve, because it might be the case that you don't have to care that your session is thread safe... kr, guenther -Original Message- From: leonnewsgroup [mailto:[EMAIL PROTECTED] Sent: Sunday, April 10, 2005 8:08 AM To: Struts Users Mailing List Subject: Re: How to make HttpSession thread-safe Hi BAL, Thanks for reply. Does it mean synchronized(session) { session.setAttribute(..., ); // do whatever else } ?? Leon - Original Message - From: Brian Lee [EMAIL PROTECTED] To: user@struts.apache.org Sent: Saturday, April 09, 2005 4:06 PM Subject: RE: How to make HttpSession thread-safe You can put an object in session and lock on it using synchronized. But this won't work over a cluster. BAL From: leonnewsgroup [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Subject: How to make HttpSession thread-safe Date: Sat, 9 Apr 2005 15:26:30 -0400 Hi All, Quick question, What is the strategies to make HttpSession thread-safe? Thanks. Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
generic validation on map backed property
hi, i've a form bean with a map backed propery namend orderedNumber. This property returns the number of ordered items for a given product id, eg. getOrderedNumber(423) returns the number of ordered items for the product with id=423. i want to validate the input (which is stored int the property orderedNumer(xx)) of a user for a product if it is a valid integer. the html form contains a list of html input tags with name=orderedNumber(xx) where xx is an integer (the product id). problem is, for validation, i don't know the product id beforehand as this is NOT a list backed property. how can i write a validation for such a map backed property if i don't know the parameter for the getter, what do i need to define in the field property=yyy attribute? kr, guenther
RE: Concatinating 2 strings for a bean:message???
try to use bean:message key='label.owner.section.info.${ownerNumber}' / instead (assuming ownerNumber is a defined bean in any context of this JSP) kr, guenther -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, April 04, 2005 10:21 PM To: user@struts.apache.org Subject: Concatinating 2 strings for a bean:message??? I am trying to make the following work without success: bean:message key='label.owner.section.info.%= ownerNumber %' / for a property of... label.owner.section.info.1 = Owner One Details -- Thanks... Mick Knutson Systems Developer Business Direct Services, Wells Fargo Bank 333 Market Street, SF, CA 94103 (415) 371-2553 [EMAIL PROTECTED] MAC A0103-223 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. -- -Original Message- From: BLiNC Magazine [mailto:[EMAIL PROTECTED] Sent: Monday, April 04, 2005 12:11 PM To: [EMAIL PROTECTED] Subject: error bean:message key='label.owner.section.info.%= ownerNumber %' / %= ownerNumber % - 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]
RESEND: RE: Load message resources from DB???
resend because i didn't receive it on the list. sorry if this comes to you for the second time. hi, as it isn't possible to send zip files to the list, i need to copy and paste the most important things out of our implementation: the factory is simple: public class DBPropertyMessageResourcesFactory extends MessageResourcesFactory { /* (non-Javadoc) * @see org.apache.struts.util.MessageResourcesFactory#createResources(java.lang.Str ing) */ public MessageResources createResources(String config) { return new DBPropertyMessageResources(this, config, this.returnNull); } } also, the DBMessageResources class is quite simple, here's the most important method: public String getMessage(Locale locale, String key) { String result = DBPropertyMessageService.getMessage(locale, key, returnNull); // we need to flush the cache of the super class MessageResource as we want to have real // dynamic data here (no caches // except the one in DBPropertyMessageService) formats.clear(); return result; } so the REAL thing is happening in DBPropertyMessageService, and this class just loads everything at startup (static constructor) into a hashmap. we have implemented the service class in such way that it's the one and only point where changes to a property have to go. this allows us to change values during runtime, and even add new key value pairs during runtime without reloading from the db. it's also easy to implement a feature that reloads the db entries ater a given period of time. kr, guenther -- Günther Wieser creative-it Guglgasse 6/1/11/1 A-1110 Wien Austria http://www.creative-it.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 30, 2005 2:52 AM To: user@struts.apache.org; [EMAIL PROTECTED] Subject: RE: Load message resources from DB??? Even if I could just get some general directions on what method to pull the data in, and what method to put the data into what type of container. Just something would be good. -- Thanks... Mick Knutson Systems Developer Business Direct Services, Wells Fargo Bank 333 Market Street, SF, CA 94103 (415) 371-2553 [EMAIL PROTECTED] MAC A0103-223 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. -- -Original Message- From: Jason Long [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 4:41 PM To: 'Struts Users Mailing List' Subject: RE: Load message resources from DB??? I am still waiting for an example of this as well. I would very much like to add this feature, but is not critical and I have other things to work on. If you find an example please let me know. Thank you for your time, Jason Long CEO and Chief Software Engineer BS Physics, MS Chemical Engineering http://www.supernovasoftware.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 6:38 PM To: user@struts.apache.org Subject: RE: Load message resources from DB??? Does anyone ahve any examples of extending the PropertyMessageResources and PropertyMessageResources Factory? -Original Message- From: Daniel Lipofsky [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 15, 2005 1:35 PM To: Struts Users Mailing List Cc: [EMAIL PROTECTED] Subject: RE: Load message resources from DB??? Yes, just extend the PropertyMessageResources and overide the loadLocale() method. You should extend the factory too and specify the new factory in struts-config.xml. Add a method to clear the cache in the PropertyMessageResources and clear it when the user changes something. - Dan -Original Message- From: Jason Long [mailto:[EMAIL PROTECTED] Sent: Monday, March 14, 2005 11:21 PM To: 'Struts Users Mailing List' Subject: Load message resources from DB??? Is it possible to load the message resources from a database instead of a file? If so can this be done without reloading the entire application? I would like to let users manage these. Thank you for your time, Jason Long CEO and Chief Software Engineer BS Physics, MS Chemical Engineering http://www.supernovasoftware.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands
RE: download finished
how do you send the file to the user? is it going through a servlet, or is it just normal file download through e.g. apache? in the later case, it will get complicated easy solution is to serve the file through a servlet, and if your servlet doesn't get any ioexception during sending the file, and exits normally from eg. doGet() or doPost(), than the file should've been received by the user's browser. but there is still a small chance that the user didn't get it if there is a proxy inbetween, which gets the whole file even if the user cancels the download. but normaly that shouldn't happen as most proxies do not cache files, expecially if you set the cache http headers correctly. kr, guenther -- Günther Wieser creative-it Guglgasse 6/1/11/1 A-1110 Wien Austria http://www.creative-it.com -Original Message- From: Kelly C. Goedert [mailto:[EMAIL PROTECTED] Sent: Monday, March 28, 2005 1:13 PM To: user@struts.apache.org Subject: download finished Hi I have an application that allows users to download some files. Is it possible to know if the download finished correctly (if the file was really received by the user)? Kelly. - 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: user management
i for one put the user object into the session, as i have a lot of method calls against this use object on each page. if you don't use the user object often, put some identifier in the session to mark that the user has logged in, eg. key=user, value=username. if you need to access the user data later on, you can user the value of this session object to retrieve the real user object from a service or whatever. but there is nothing like built in support in struts as far as i know. kr, guenther -Original Message- From: wo_shi_ni_ba_ba [mailto:[EMAIL PROTECTED] Sent: Friday, March 11, 2005 12:55 AM To: user@struts.apache.org Subject: user management do struts developers usually store user as an object in session? or does struts have additional framework for handling user management. thanks in advance __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ - 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 and request scope
as long as you don't have a clustered environment or session persistence enabled in your servlet container, there shouldn't be much difference in adding an object to a session or request. but it doesn't make sense to put it in session scope if you don't use it is session scope, but only in request scope. this could make your life harder than you want it to be (e.g. if you forget to delete such objects). this leads to one issue for session scope: if you store things in session, you HAVE TO REMOVE them as soon as you don't need them anymore, otherwise you can run out of memory because these objects won't be garbage collected. and usually it's very hard to make sure that your web app DEFINITELY reaches the point of deleting things from a session (think about a user just pressing back or going to a different page before hitting your remove page). of course, everything will be dumped when the session expires, but if you have a lot of users in your web app and they stay for a long time, the memory consuption can become significant if you have a lot of session objects. kr, guenther -Original Message- From: wo_shi_ni_ba_ba [mailto:[EMAIL PROTECTED] Sent: Thursday, March 10, 2005 10:52 PM To: user@struts.apache.org Subject: session and request scope In terms of performance, does storing an attribute into the session cost more than storing it into the request? how significant is the overhead? __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts DB Access :: Best Practices
i prefer to use OJB for persistence, because i like the approach of coming from the object world and define the mapping to the database, while hibernate (and others) tend to come from the database and help you generate classes. OJB is very easy to use, and you won't see anything related like PK-FK or id within your java code which makes it easy to read and has nothing database related in it. but if you have the need to tune performance etc. OJB gives you access to everything, inluding using stored procedures. kr, guenther -- Günther Wieser creative-it Guglgasse 6/1/11/1 A-1110 Wien Austria http://www.creative-it.com -Original Message- From: karthikeyan balasubramanian [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 09, 2005 9:19 AM To: user@struts.apache.org Subject: Struts DB Access :: Best Practices Hi all, I am planning to use Tomcat/Struts/MySQL in my project. Database operation's can involve more selects and little bit of update/insert operations. I want to know what is the best way to access database using struts. I did a research and found few good ways: 1. Struts using Castor. 2. Struts using JDO. I found Struts with Castor easy to use. What you guys/gals think on What is the best practices to access DB from Struts?. Any inputs here would enable me to make good decision :) Looking forward for yours response. Have a great day. Karthikeyan B - 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.invaludate(); not working in LogoffAction
i prefer to write my own RequestProcessor which does all the checking and handling in case of user not logged in. and even more preferable is to implement J2EE security which was suprisingly simple (at least for Resin). i wrote an example for the request processor stuff a few days ago here in the list, here it is again: -- public class MyRequestProcessor extends TilesRequestProcessor { public void process(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HttpSession session = req.getSession(); String path = super.processPath(req, res); String url = req.getRequestURL().toString(); String queryString = req.getQueryString(); // the next lines are there to allow deep linking // we store the url that has been requested for future use if ((queryString!=null) (!.equals(queryString))) { url = url + ? + queryString; } if (session.getAttribute(Constants.SESSION_LOGIN_REFER_KEY) == null) { if (url != null) { session.setAttribute(Constants.SESSION_LOGIN_REFER_KEY, url); } else { //TODO: get main URL from property session.setAttribute(Constants.SESSION_LOGIN_REFER_KEY, http://localhost:8080/WebCreator/index.do;); } } // no comes the important stuff if (!checkForRealm(session)) { if (!/login.equals(path)) { super.doForward(/login.do, req, res); } } super.process(req, res); } protected boolean checkForRealm(HttpSession session) throws ServletException, IOException { if (session.getAttribute(Constants.SESSION_USER_KEY) != null ) { return true; } else { return false; } } } so what it does is: - get the current requested url for further reference and stores it in the session if an atrribute with the same key does not exist (see deep linking below) - then it checks the session for the realm (that is the attribute that you use to say the user is logged in) - if it does not exist and if the request didn't go to /login.do, it forwards the request to the action /login.do (which is a simple html with username/password field) - if it exists it redirects to the super class to process the request as usual - you need to implement the checkRealm() method with whatever you need to check, my example is really simple but very common with extending TileRequestProcessor (don't care that i extend TilesRequestProcessor, you can extend the standard request processor the same way) and adding the lines in struts-config.xml, each request that hits the struts action servlet will go through MyRequestProcessor BEFORE the typical struts tasks (action, form beans filling, etc) start. so this is the right place to check security, authorization and authentication. regarding deep linking: i want my customers to be able to store a bookmark that points deep into the system. when they request this bookmark, they of course need to login first. so i store the requested url in the session, and if the login is successfull, i send a redirect to the browser to disply the page the user requested with his bookmark. this is done by sending a meta refresh command in the head of the resulting login ok page, with the url containing the session attribute that has been store with session.setAttribute(Constants.SESSION_LOGIN_REFER_KEY, url) hope that helps, feel free to ask more if something is unclear. --- kr, guenther -Original Message- From: Leon Rosenberg [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 10:52 PM To: 'Struts Users Mailing List' Subject: Re: session.invaludate(); not working in LogoffAction Graig will blame for not using Filters (they would do the job too), but I'd say yes: Create a BaseAction, all your actions are extending from, with: public ActionForward execute( ActionMapping mapping, ActionForm bean, HttpServletRequest req, HttpServletResponse res) throws Exception { if (isAuthorizationRequired()){ boolean authorized = checkAuthorization(req); if (!authorized){ String redUrl = req.getContextPath()+your_login_action_path; res.sendRedirect(redUrl); return null; } } ActionForward
RE: Tags in the body of other tags
yes, it's not possible to open a tag within the body of another tag and close it somewhere else. look at the tag lifecycle in the j2ee api doc and then you'll understand why. shortly spoken: tags can only be nested in a hierarchy. kr, guenther -Original Message- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: Friday, March 04, 2005 5:03 PM To: Struts User List (struts-user@jakarta.apache.org) Subject: Tags in the body of other tags In my JSP I want to conditionally make an image and some text into a hyperlink, depending on conditions. So I've written this code: c:if test=${HistoryBean.noPayGroups == 2} html-el:link href=entryForm.do?respondent=${HistoryBean.respondent}payGroup=1 /c:if html-el:img page=/images/step1a.jpg/br Pay Group 1 c:if test=${HistoryBean.noPayGroup == 2} /html-el:link /c:if I'm getting a syntax error, pointing to the first /c:if line. I don't see any syntax problems. Is it impermissible to open a tag within the body of another tag, but not close it there? -- Tim Slattery [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: How can I forward from an Action to a URL outside application
tell us more! how did you do it? -Original Message- From: Jim Theodoridis [mailto:[EMAIL PROTECTED] Sent: Thursday, March 03, 2005 6:41 PM To: Struts Users Mailing List Subject: Re: How can I forward from an Action to a URL outside application Sorry. It is so simply i found it. Jim Theodoridis wrote: Hi I want to forward from an action to a url outside the application I am having the followin entry at struts-config.xml action path=/farmacy type=gr.tera.teramobile.actions.FarmacyAction forward name=success path=http://www.tera.gr/ /action by i am getting the error java.lang.IllegalArgumentException: Path www.tera.gr does not start with a / character org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.j ava:1062) Is there any way to do this? - 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: how to use tag value for another tag's value
do this instead: td width=50% align=center html:submit property=productName value=${downloadInfo.name} / _ From: Burns, Scott [mailto:[EMAIL PROTECTED] Sent: Thursday, March 03, 2005 8:11 PM To: Struts Users Mailing List Subject: how to use tag value for another tag's value I would like the value of the button to be the value of the tag. Can this be done? It reads it as text using the single quotes. Thanks Scott td width=50% align=center nested:root name=downloadInfo html:submit property=productName value='nested:write property=name /' / /nested:root /td
RE: html:form complains of bean missing
hi scott, well, i'll try my best. here's the code from the execute method of MyRequestProcessor (that's the one included in the struts-config.xml): public class MyRequestProcessor extends TilesRequestProcessor { public void process(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HttpSession session = req.getSession(); String path = super.processPath(req, res); String url = req.getRequestURL().toString(); String queryString = req.getQueryString(); // the next lines are there to allow deep linking // we store the url that has been requested for future use if ((queryString!=null) (!.equals(queryString))) { url = url + ? + queryString; } if (session.getAttribute(Constants.SESSION_LOGIN_REFER_KEY) == null) { if (url != null) { session.setAttribute(Constants.SESSION_LOGIN_REFER_KEY, url); } else { //TODO: get main URL from property session.setAttribute(Constants.SESSION_LOGIN_REFER_KEY, http://localhost:8080/WebCreator/index.do;); } } // no comes the important stuff if (!checkForRealm(session)) { if (!/login.equals(path)) { super.doForward(/login.do, req, res); } } super.process(req, res); } protected boolean checkForRealm(HttpSession session) throws ServletException, IOException { if (session.getAttribute(Constants.SESSION_USER_KEY) != null ) { return true; } else { return false; } } } so what it does is: - get the current requested url for further reference and stores it in the session if an atrribute with the same key does not exist (see deep linking below) - then it checks the session for the realm (that is the attribute that you use to say the user is logged in) - if it does not exist and if the request didn't go to /login.do, it forwards the request to the action /login.do (which is a simple html with username/password field) - if it exists it redirects to the super class to process the request as usual - you need to implement the checkRealm() method with whatever you need to check, my example is really simple but very common with extending TileRequestProcessor (don't care that i extend TilesRequestProcessor, you can extend the standard request processor the same way) and adding the lines in struts-config.xml, each request that hits the struts action servlet will go through MyRequestProcessor BEFORE the typical struts tasks (action, form beans filling, etc) start. so this is the right place to check security, authorization and authentication. regarding deep linking: i want my customers to be able to store a bookmark that points deep into the system. when they request this bookmark, they of course need to login first. so i store the requested url in the session, and if the login is successfull, i send a redirect to the browser to disply the page the user requested with his bookmark. this is done by sending a meta refresh command in the head of the resulting login ok page, with the url containing the session attribute that has been store with session.setAttribute(Constants.SESSION_LOGIN_REFER_KEY, url) hope that helps, feel free to ask more if something is unclear. kr, guenther -- Günther Wieser creative-it Guglgasse 6/1/11/1 A-1110 Wien Austria http://www.creative-it.com -Original Message- From: Scott Purcell [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 02, 2005 3:07 PM To: Struts Users Mailing List Subject: RE: html:form complains of bean missing Hello Gunther, I read last night about the tiles tempating functionality, so I have a little better handle on it today. It actually is a nice way to create some parts of my app, so I will revisit it today and try and prototype a couple of pages together. But as far as handling the session expires, etc, I do not completely understand how this is accomplished. What I have today, is a extended Action class which I can call a method eg: if (obj.isLoggedIn()) { type of method. So each of my pages has to go to the action servlet. Anyway, if you could show me how you are handling this, or be a litle more precise that would really help me out. I sincerely appreciate your time, Scott -Original Message- From: Günther Wieser [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 01, 2005 12:40 PM To: 'Struts Users Mailing List' Subject: RE: html:form complains of bean missing hi if you want a single point where you can check if a user is logged in or not, you
AW: Tooltips in Struts
you can use the title attribute of the span tag like this way: span class=reportTooltip title=yout tooltip textyour text or your elements/span and with using CSS you can set up the tooltip behaviour: .reportTooltip { COLOR: gray; CURSOR: help; TEXT-DECORATION: none; } if you use cursor: help the cursor in the browser will change to a cursor plus question mark when the user moves over any element that has a tooltip, showing the user that a tooltip exists. kr, guenther -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 13:14 An: Struts Users Mailing List Betreff: Re: Tooltips in Struts No what I have is an application which is no means intuitive and I need to make some explanations in order to make the workflow more understandable. I need the explenations to be part of elements like lists and buttons. Regards, Peter Yes, sort of. If you simply want little yellow popups when your mouse hovers over an image, use the title attribute for that image. You can do the same for just about anything else, but it may require being creative with some div tags and such. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: [EMAIL PROTECTED] To: user@struts.apache.org Sent: Tuesday, March 01, 2005 3:09 AM Subject: Tooltips in Struts Hello, is there a simple way to include tooltips in a web-application with Struts? Regards, Peter -- Lassen Sie Ihren Gedanken freien Lauf... z.B. per FreeSMS GMX bietet bis zu 100 FreeSMS/Monat: http://www.gmx.net/de/go/mail - 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] -- DSL Komplett von GMX +++ Superg?nstig und stressfrei einsteigen! AKTION Kein Einrichtungspreis nutzen: http://www.gmx.net/de/go/dsl - 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: html:form complains of bean missing
hi if you want a single point where you can check if a user is logged in or not, you can do something like the following: create a class MyRequestProcessor extends TilesRequestProcessor (in this case it is because i use tiles) and implement the process() method. within this method check for the login var that you e.g. put into the session. in the struts-config.xml add controller processorClass=com.creative_it.webcreator.strutsext.MyRequestProcessor / and everythings fine. what you need to do in the MyReqestProcessor class is to exclude all URLs from checking that are used for e.g. the login form, or an error message in case something went wrong. if you want to be very nice to your users, store the URL that the user requested in the session, than redirect to the login form, and if everything went fine with the login, send him to the page that he/she originally requested. if you want the code for this, let me know, i can provide it. kr, guenther -Original Message- From: Scott Purcell [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 01, 2005 7:17 PM To: user@struts.apache.org Subject: html:form complains of bean missing First off, as I am learning Struts I just wanted to thank those, for bearing with my learning curve and helping out so far. Here is the issue: I want to pass all my forms, even forms without params to the com.skp.action.LoginAction action class, because this class handles the isLoggedIn issue through a subclass of Action. Anyway, I have a jsp page that has no params, so I have no bean to collect user data, so I configured my action like so: action path=/mainAdmin type=com.skp.action.LoginAction forward name=Success path=/jsp/admin/main.jsp redirect=true/ /action Anyway, I just want to always use the LoginAction as a Front Controller to my web app, and catch the status of logged-in etc. This works well, but I have to use conventional html code and not the html:form tag: works: !-- form name=foo action=/uniquepear/action/mainAdmin method=POST -- does not work: html:form action=mainAdmin When I use the above I get this error in the browser: javax.servlet.ServletException: Cannot retrieve definition for form bean null at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:495) at org.apache.jsp.main_jsp._jspService(main_jsp.java:175) But I have no reason to have a bean for this action. How does one handle this problem? Thanks Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts and EJB integration question?
i for one suggest to put it in a delegate class (maybe something with static methods), something you would call a service, that gives you access to your ejb stuff. putting it directly into the action class is not recommended, the action class should be seen as the connection between your business layer and the view, so it should ust delegate, not process anything. as mentioned, this is my private opinion and i'm sure there are may different opinions out there kr, guenther -Original Message- From: leonnewsgroup [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 01, 2005 10:40 PM To: Struts Users Mailing List Subject: Struts and EJB integration question? Hi there, I am building a Struts based application with EJB model. I want to know the strategy of find and call the EJBs in model layer. My model layer is implemented by a stateless or stateful session bean that accesses to entity beans. and there is a service locator object to find the session beans. My questions are where to put the code to use the service loactor to find the session beans? is it in the Struts Action classes or another delegate class? Thanks. Tim - 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]
caching of message resources when using bean:message tag
hi, we are using struts version 1.2.4 and we implemented our own MessageResources and MessageResourceFactory. we needed to have a database based system for managing message resources for different locales so that we can change valued on the fly without the need to restart the app. these implementation work quite well, but we found one issue when using bean:message key=whatever/: it seems that the message with the key whatever gets cached somewhere. the first call to this bean with key=whatever results in a getMessage() call to our implementation of MessageResources. the message gets delivered and inserted into the JSP. but all further calls to the message tag do NOT query MessageResources.getMessage(), so we assume that the message value is cached somewhere. what we see from the source code of the message tag is that TagUtils.message() is called. so far we haven't found anything that caches in TagUtils. and there's no caching in the message tag . anyone an idea where the caching takes place? am i missing something fundamentally when i assume that it's possible (with my own implementation of MessageResources) to change message resources in struts dynamically during runtime? kr, guenther
AW: AW: Multi-select file chooser
just in case you wonder: it's not a text field, it's file field (input type=file name=Name maxlength=length accept=Mime-Type) -Ursprüngliche Nachricht- Von: Nic Werner [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 00:24 An: Struts Users Mailing List Betreff: Re: AW: Multi-select file chooser Ah, I looked at it that he was selecting files from a directory tree, not entering into a text field Günther Wieser wrote: this is standard browser behaviour, haven't seen any browser who would allow you to select more than one file. reason for that is that your form only includes one form field of type file, so how can the browser add more than one file in a way that your app understands this? the only chance for multiple file selection is to ask the user before generation of the form how many files do you want to upload, or by adding another file field to the form as soon as the user selects one (using javascript; but this is quite ugly and can make a lot of troubles with different browser or javascript-disabled ones...) or he/she upload a zip file... if there is someone outside who knows a better solution, let us know, this is a very common problem. kr, guenther -Ursprüngliche Nachricht- Von: Nic Werner [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 00:17 An: Struts Users Mailing List Betreff: Re: Multi-select file chooser Wow, what browser is that? Can they hold down CTRL? (assuming Windows) Rakefet Bitton wrote: Hi, I'm using the file tag to select a file from my jsp. The default browser allows the user to select only 1 file at a time. The user can not multi select files or a directory. Does anyone know of a multi-select file and directory chooser? Thanks very much. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: AW: Multi-select file chooser
another solution would be to use (signed) java applets, which is (for the enduser) the best looking solution, but the effort to do so is REALLY BIG, so if you don't get paid like mad forget it -Ursprüngliche Nachricht- Von: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 00:29 An: Struts Users Mailing List Cc: [EMAIL PROTECTED] Betreff: Re: AW: Multi-select file chooser You can have as many file elements in a form as you want, and you can process them all at once. My web host (LunarPages) has a decent file manager, one of the functions it has is the ability to upload up to 12 files at a time. I don't know of any single tag to render such a form, but that's really what you need, and it should be trivial to write (although I'd bet it exists somewhere). It's the server-side processing that *could* be tricky (although I think Commons Upload would deal with it just fine, probably give you a collection or something, I forget what the interface looks like.) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Günther Wieser wrote: this is standard browser behaviour, haven't seen any browser who would allow you to select more than one file. reason for that is that your form only includes one form field of type file, so how can the browser add more than one file in a way that your app understands this? the only chance for multiple file selection is to ask the user before generation of the form how many files do you want to upload, or by adding another file field to the form as soon as the user selects one (using javascript; but this is quite ugly and can make a lot of troubles with different browser or javascript-disabled ones...) or he/she upload a zip file... if there is someone outside who knows a better solution, let us know, this is a very common problem. kr, guenther -Ursprüngliche Nachricht- Von: Nic Werner [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 00:17 An: Struts Users Mailing List Betreff: Re: Multi-select file chooser Wow, what browser is that? Can they hold down CTRL? (assuming Windows) Rakefet Bitton wrote: Hi, I'm using the file tag to select a file from my jsp. The default browser allows the user to select only 1 file at a time. The user can not multi select files or a directory. Does anyone know of a multi-select file and directory chooser? Thanks very much. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: AW: AW: Multi-select file chooser
for sure there is no doubt on my side ;-) this is exactly what i meant if you keep the number of files constant. but as the originator of this thread alreay said: he looks for a solution of multiple file SELECTION. beside the applet i have no idea how to solve that -Ursprüngliche Nachricht- Von: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 00:42 An: Günther Wieser Cc: 'Struts Users Mailing List' Betreff: Re: AW: AW: Multi-select file chooser Just in case there was any doubt, here's the form from my web hosts' file manager I was referring to: form action=doupload.html method=POST ENCTYPE=multipart/form-data target=infofr input type=file name=file1 input type=file name=file2 input type=file name=file3 input type=file name=file4 input type=file name=file5 input type=file name=file6 input type=file name=file7 input type=file name=file8 input type=file name=file9 input type=file name=file10 input type=file name=file11 input type=file name=file12 br Overwrite existing files: input type=checkbox name=overwrite value=1 br input type=submit value=Upload /form I could think of some better ways to do present the UI, but that's the basic idea. Heck, throw that in a .tag file and your all set (in a basic way). -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Günther Wieser wrote: another solution would be to use (signed) java applets, which is (for the enduser) the best looking solution, but the effort to do so is REALLY BIG, so if you don't get paid like mad forget it -Ursprüngliche Nachricht- Von: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 00:29 An: Struts Users Mailing List Cc: [EMAIL PROTECTED] Betreff: Re: AW: Multi-select file chooser You can have as many file elements in a form as you want, and you can process them all at once. My web host (LunarPages) has a decent file manager, one of the functions it has is the ability to upload up to 12 files at a time. I don't know of any single tag to render such a form, but that's really what you need, and it should be trivial to write (although I'd bet it exists somewhere). It's the server-side processing that *could* be tricky (although I think Commons Upload would deal with it just fine, probably give you a collection or something, I forget what the interface looks like.) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Günther Wieser wrote: this is standard browser behaviour, haven't seen any browser who would allow you to select more than one file. reason for that is that your form only includes one form field of type file, so how can the browser add more than one file in a way that your app understands this? the only chance for multiple file selection is to ask the user before generation of the form how many files do you want to upload, or by adding another file field to the form as soon as the user selects one (using javascript; but this is quite ugly and can make a lot of troubles with different browser or javascript-disabled ones...) or he/she upload a zip file... if there is someone outside who knows a better solution, let us know, this is a very common problem. kr, guenther -Ursprüngliche Nachricht- Von: Nic Werner [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 00:17 An: Struts Users Mailing List Betreff: Re: Multi-select file chooser Wow, what browser is that? Can they hold down CTRL? (assuming Windows) Rakefet Bitton wrote: Hi, I'm using the file tag to select a file from my jsp. The default browser allows the user to select only 1 file at a time. The user can not multi select files or a directory. Does anyone know of a multi-select file and directory chooser? Thanks very much. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: caching of message resources when using bean:message tag
thanks very much for this solution. i'm using ojb plus a hashmap for heavy caching, there is NO database acccess for reading values after initialization, as all operations on key-value-pairs go through a service that fills the cache with new or changed values. kr, guenther -Ursprüngliche Nachricht- Von: James Mitchell [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 01. März 2005 02:08 An: Struts Users Mailing List Betreff: Re: caching of message resources when using bean:message tag Yes, I have also written a database implementation or three ;) http://sourceforge.net/project/showfiles.php?group_id=49385package_id=76369 In addition to this one, I have also written several impls for commons-resources (which Struts will be moving to very soon). There were license issues so I had to host them elsewhere (same link above) but I haven't released these as of yet. That's on my todo list ;) The workaround for Struts 1.1 and 1.2.x is to clear the hashmap of formatted messages. Look at org.apache.struts.util.MessageResources#getMessage(Locale locale, String key, Object args[]). In that method you'll see where if the formatted message (param replacement already done) is found, then that is returned. That certainly is a nice way to speed up things, but the impl fails to make that configurable, so you are just stuck with it :( My impl simply does formats.clear() on each call to getMessage(), so, in effect, unless the very next call to your getMessage() is asking for the last one you just gave it, the cache is (basically) disabled. You also might consider implementing your own cache or taking advantage of caching available via O/R Mapping tools like Hibernate. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Günther Wieser [EMAIL PROTECTED] To: user@struts.apache.org Sent: Monday, February 28, 2005 5:57 PM Subject: caching of message resources when using bean:message tag hi, we are using struts version 1.2.4 and we implemented our own MessageResources and MessageResourceFactory. we needed to have a database based system for managing message resources for different locales so that we can change valued on the fly without the need to restart the app. these implementation work quite well, but we found one issue when using bean:message key=whatever/: it seems that the message with the key whatever gets cached somewhere. the first call to this bean with key=whatever results in a getMessage() call to our implementation of MessageResources. the message gets delivered and inserted into the JSP. but all further calls to the message tag do NOT query MessageResources.getMessage(), so we assume that the message value is cached somewhere. what we see from the source code of the message tag is that TagUtils.message() is called. so far we haven't found anything that caches in TagUtils. and there's no caching in the message tag.. anyone an idea where the caching takes place? am i missing something fundamentally when i assume that it's possible (with my own implementation of MessageResources) to change message resources in struts dynamically during runtime? kr, guenther - 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]