Re: Dynamic forward in tiles
On 25/03/2004 13:22, Mariano García [EMAIL PROTECTED] wrote: El mié, 24-03-2004 a las 20:21, Pedro Salgado escribió: Below is a reply sent to this mailing list about something very similar to what you are looking for. but there is any way to use dynamic content only using tiles tags? In my case, I have a 'setAttribute(serverLocation, Location)' function in an Action in order to store a bean with a location information. Location is a string (an url), so I want to use this url into a tile definition, like this: definition name=tracebox.def.encoderconfig extends=tracebox.def.menu put name=title value=encoderconfig / put name=body value=LOCATION / /definition I think it must be a easy solution, using tile tags. The way I presented to you is the cleaner one :) If you define the put declaration in Tiles it will always be static (at least for what I understood and read so far). If you want to make a tiles attribute dynamic, you must specify and implement the tiles controller (described in the other mail). The not so clean solution is to use a tiles template with a c:import url='${request.dynamicTilesAttribute}'/ inside. what do you think? I guess this is not a question of what I think... It is more of how it works :) This could be a nice feature to Tiles though. One could implement a Tiles controller that made this possible. You just needed to parse all of attributes for ${scope.Attribute} values = it would be inneficient most of the attributes are static. If the put declaration had a dynamic attribute (true/false) it would certainly much more interesting/efficient. Maybe I will try and do this on my weekend ;) Pedro Salgado - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Retrieve a Variable From the DynaActionForm
On 24/03/2004 06:07, Caroline Jen [EMAIL PROTECTED] wrote: In my Struts application, postForm is of the DynaActionForm type: DynaActionForm postForm = ( DynaActionForm )form; Later on, I want to save one of the fields receiver, which is a String, in the request context. Which is the following is the correct syntax? request.setAttribute( Receiver, postForm.get( receiver) ); Or request.setAttribute( Receiver, ( String )postForm.get( receiver) ); I think they are equivalent. Later, if you use request.getAttribute(Receiver); (getAttribute always returns an object) you would still need to cast to String, if you wanted to do something with the object. If you just want to print you just need to use c:out value='${request.Receiver}'/ in any of the cases described above. Pedro Salgado __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html - 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:messages jstl equivalent
On 23/03/2004 23:39, Joe Germuska [EMAIL PROTECTED] wrote: At 12:06 PM + 3/23/04, Pedro Salgado wrote: html:messages id=error ... /html:messages Does anyone know how do I fill the ${???} to have a JSTL equivalent for the previous html tag? c:forEach items='${???}' var='error' ... /c:forEach The keys are defined in org.apache.struts.Globals: org.apache.struts.Globals.ERROR_KEY = org.apache.struts.action.ERROR org.apache.struts.Globals. MESSAGE_KEY = org.apache.struts.action.ACTION_MESSAGE Until recently, the messages were always stored in request scope, so ${requestScope['org.apache.struts.action.ERROR']} This was what I was looking for :) In recent nightly builds, the ability to store the messages in the session instead was added. If something changes in the future (it seems like so) then it would only need a test to check if the messages were on the session or request scope. Please correct me if I am wrong. I'm not sure I believe that this is a case where using the JSTL is better than using the Struts tags. It seems to me that leaving the coordination inside Struts classes is the way to go. Also, there is no JSTL solution as clean as using the property attribute of html:messages to filter to only include messages associated with a specific property. I'm all for people using the JSTL wherever its better, but I'm not sure its better here... You're right but it is easier for someone to start playing with JSTL (specially if you had experience in JSP), learn the basics and start producing code and, in parallel, making a step-by-step understanding of how Struts works. In a team, I think this will work better (at least I hope so). To learn Struts tags right away it requires a double effort: understanding Struts and taglibs (I have seen this happen and it didn't turn out very well). Thank you for your help, Pedro Salgado - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic forward in tiles
Below is a reply sent to this mailing list about something very similar to what you are looking for. Hope it helps, Pedro Salgado Hi Robert.. I guess you could achieve the same using the controllerClass attribute and building your class.. For instance, I have this definition in the tiles-defs.xml file: --- definition name=.layout path=/common/layout.jsp controllerClass='com.dars.XTileAction' put name=title value=Encabezado primario/ put name=leftsidevalue=/common/leftside.jsp/ put name=rightside value=/common/rightside.jsp/ put name=header value=/common/header.jsp/ put name=footer value=/common/footer.jsp/ put name=bodyvalue=/common/body.jsp/ /definition --- And I have this controllerClass --- package com.dars; import org.apache.struts.tiles.actions.TilesAction; import org.apache.struts.tiles.ComponentContext; import org.apache.struts.tiles.Controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletContext; import javax.servlet.ServletException; import java.io.IOException; public class XTileAction extends TilesAction implements Controller{ public void perform(ComponentContext tilesctx, HttpServletRequest request, HttpServletResponse response, ServletContext servctx) throws ServletException, IOException{ /* GetAttributes */ String titulo= (String)tilesctx.getAttribute(title); String derecha= (String)tilesctx.getAttribute(rightside); /* GetAttributes */ System.out.println( Titulo: +titulo); System.out.println( Derecha: +derecha); /* SetAttributes */ tilesctx.putAttribute(title, Titulo nuevo de esta vaina..); tilesctx.putAttribute(rightside, /common/footer.jsp); /* SetAttributes */ } } --- You can change the values of those attributes at runtime. I prefer to do it using this method. Atte. Domingo A. Rodriguez S. --- Robert Taylor [EMAIL PROTECTED] escribió: Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Información de Estados Unidos y América Latina, en Yahoo! Noticias. Visítanos en http://noticias.espanol.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] On 24/03/2004 18:14, Mariano García González [EMAIL PROTECTED] wrote: Hi all, I am newbie using tiles, so maybe this question is too easy for you. I want to use a tile definition in which, one of the attribute values is dynamic. It is something like this: definition name=tracebox.def.encoderconfig extends=tracebox.def.menu put name=title value=encoderconfig / put name=body value=DYNAMIC CONTENT / /definition I want to use a dynamic url in body attribute, depending of a bean attribute. I hope you understand me. Could you help me? Thanks, Mariano. - 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: Dynamic forward in tiles
On 24/03/2004 22:45, Mike Foody [EMAIL PROTECTED] wrote: I apologize if I didn't mention it but I'm using the Velocity tiles tool. Maybe that would be a better place for this question. Well the solution for your problem is the one below. I don't if your using velocity to generate your tiles file (I use velocity just to build SQL/DAOs with the OJB framework). If this is true, then you just have to make it generate a tiles file with a controller class defined by you. The runtime argument must be handled by you, programatically, in your own tiles controller class. Pedro Salgado Mike Mike Foody wrote: I have a similar question. I would like to insert at runtime multiple instances of the same layout and set a property at that time. I didn't see a way to do this via the documentation and so extended the TilesTool with the following code. Is there something I've missed? If not is the code below a reasonable way to do this? Thank you, Mike public class TilesTool extends org.apache.velocity.tools.struts.TilesTool { public String get(Object obj) { if (obj instanceof ComponentDefinition) { try { return processDefinition((ComponentDefinition)obj); } catch (Exception e) { Velocity.error(Exception while rendering ComponentDefinition + e.getMessage()); } } return super.get(obj); } public ComponentDefinition getDefinition(String name) { ComponentDefinition definition = null; try { definition = TilesUtil.getDefinition(name, this.request, this.application); } catch (DefinitionsFactoryException dfe) { } return definition; } } Pedro Salgado wrote: Below is a reply sent to this mailing list about something very similar to what you are looking for. Hope it helps, Pedro Salgado Hi Robert.. I guess you could achieve the same using the controllerClass attribute and building your class.. For instance, I have this definition in the tiles-defs.xml file: --- definition name=.layout path=/common/layout.jsp controllerClass='com.dars.XTileAction' put name=title value=Encabezado primario/ put name=leftsidevalue=/common/leftside.jsp/ put name=rightside value=/common/rightside.jsp/ put name=header value=/common/header.jsp/ put name=footer value=/common/footer.jsp/ put name=bodyvalue=/common/body.jsp/ /definition --- And I have this controllerClass --- package com.dars; import org.apache.struts.tiles.actions.TilesAction; import org.apache.struts.tiles.ComponentContext; import org.apache.struts.tiles.Controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletContext; import javax.servlet.ServletException; import java.io.IOException; public class XTileAction extends TilesAction implements Controller{ public void perform(ComponentContext tilesctx, HttpServletRequest request, HttpServletResponse response, ServletContext servctx) throws ServletException, IOException{ /* GetAttributes */ String titulo= (String)tilesctx.getAttribute(title); String derecha= (String)tilesctx.getAttribute(rightside); /* GetAttributes */ System.out.println( Titulo: +titulo); System.out.println( Derecha: +derecha); /* SetAttributes */ tilesctx.putAttribute(title, Titulo nuevo de esta vaina..); tilesctx.putAttribute(rightside, /common/footer.jsp); /* SetAttributes */ } } --- You can change the values of those attributes at runtime. I prefer to do it using this method. Atte. Domingo A. Rodriguez S. --- Robert Taylor [EMAIL PROTECTED] escribió: Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Información de Estados Unidos y América Latina, en Yahoo
html:messages jstl equivalent
html:messages id=error ... /html:messages Does anyone know how do I fill the ${???} to have a JSTL equivalent for the previous html tag? c:forEach items='${???}' var='error' ... /c:forEach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Object Design Question
On 12/03/2004 21:26, Avinash Gangadharan [EMAIL PROTECTED] wrote: People, I have a design question. It is regarding the retrieval of parent and child objects in the best possible manner. For eg. Let's say there is a Person object with properties such as ssn, lastName and firstname. It also has a list child objects ( Address ) of addresses and a list of previous employees ( Employee ). The Person, Address and Employee objects are separate tables in the DB linked thru ssn. Now what do you guys think is the most efficient way of retrieving a complete Person. If you're talking about SQL, can't you issue one or two SQL queries (with subselects, inner or outer joins) or write a stored procedure to retrieve all the info? (I am used to work with MySQL so my advanced SQL is a bit rusty) Continuing with simple SQL queries only... You could do this in a 2 step mode: - retrieve all persons who have addresses and employees (1 query per person) - for the remaining people (1-2 queries per person) - get the addresses (select... where person.ssn = address.ssn and id ...) (1 query per person) - get the employees (similar to the previous case) (1 query per person) (anyway you get 3 full table search) If you had to had 2 flags on the Person - hasAddresses and hasEmployees - you could make the queries more simple - fetch for (1-1), (1-0) and (0-0) - but maybe it would be more difficult to maintain. If you are talking about a persistence layer (like OJB - see ojb-user mailing list) some of them have lazy loading: it only loads the Person collection of Addresses only if you use them. This will certainly be simpler... And if you have object cache it could even things up (maybe you could issue a great number SQL queries but if the objects were already in cache then there would be no need for any SQL query). The simplest way is ofcourse issue 3 queries one for person, other for the list of address and the third for previous employees. But this does not scale well with increasing size of the table data. For 100 rows of Person 201 queries are issued. 1 which gets 100 persons, 100 each for there subequent address and previous employees. Similarly for a 1000, 2001 queries. Complex queries may be a solution which relies on filtering the resultset but is there a more simple and intelligent approach. Is there a problem with the inherent design itself or is this a common problem. I don¹t see any problem on the design itself (well maybe... it seems you have the social security number has the primary key... pks are not supposed to have any real meaning - what would happen if all of the social security numbers were to be changed? It would generate a huge number of cascade updates. Do whatever you like maybe I am raising a false issue here). Hope it helps, Pedro Salgado Thanks and Regards Avinash - 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 - delegate - facade
On 17/03/2004 13:33, HG [EMAIL PROTECTED] wrote: Hi Adam.. Well, I haven't experienced any problems whatsoever with this approach...so I guess it is safe. Sometimes I use BeanUtils to copy attributes but not very often...in my opinion DTOs (or Value Objects) and the form bean is two totally different concepts..therefore I like to keep them separate and sometimes with different attribute names...Just my way of doing it ..might be silly...I dunno..:-) (sorry to jump in to the conversation) I have been doing this but using a xml configuration file, using a Struts plugin. It falls on something like this: ?xml version='1.0' encoding='utf-8'? !DOCTYPE views PUBLIC -//04Web//DTD Horizon Configuration 1.0//EN http://www.04web.com/dtd/horizon-config_1_0.dtd; views view name=usersView dyna-property property=users type=java.util.Collection/ dyna-property property=flag type=java.lang.Boolean/ /view /views (similar to struts-config) I did this because I found it a bit confusing mixing bean attributes to retrieve html form data and attributes to deliver the intended presentation. I use a view factory to retrieve the bean definitions and then do something like: view.set(property, object); (I extended the DynaBean and implement the Map interface to achieve this - much simpler and JSTL friendly) ...you could also use BeanUtils for setting the properties. A simple module aware configuration: !-- HORIZON PLUGIN -- plug-in className=com.ohforweb.horizon.HorizonPlugin set-property property=config-files value=/WEB-INF/horizon-config.xml/ set-property property=parser-validate value=true/ set-property property=module-aware value=true/ /plug-in When I send the request I usually send a view. If aa prepopulated html form is to be presented I send a view and a form bean. Voila :) Pedro Salgado (http://www.04web.com/) - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 2:07 PM Subject: Re: action - delegate - facade Is it safe? I really don't know. You'd have to ask someone else or wait until I've got a couple of years experience with the service locator pattern, and I'll let you know ;) but regarding value objects - you use BeanUtils to copy the properties into the form beans? On 03/17/2004 12:34 PM HG wrote: ehh..Correction to third answer... Actually the plugin caches the reference to the EJB Facade and the Service Locator caches the home looked up from JNDI... Is this really safe..?? :-) - Original Message - From: HG [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 12:31 PM Subject: Re: action - delegate - facade Hi Adam. Your first question, regarding packaging I keep that part simple, so I place all value objects in a model package, say com.mycompany.myproduct.model. Both the ejb-jar and the web-jat contain these classes. Your second question, regarding generation value objects I use xDoclets facilities to generate value objects. If I need special services/attributes in the value objects I subclass the one generated by xDoclet and roll my changes. Your third question, regarding home lookups. I use the ServiceLocator pattern from my business delegates(plugins). The service locator is implemented as a Singleton and contains only Facades. I have antoher another singleton ServiceLocator for Entities. Each plugin caches the home of the Business Services it uses (ie. the Facades). Hope to help...otherwisefeel free to ask. Best regards Henrik - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 11:01 AM Subject: Re: action - delegate - facade I am surprised to see that the xpetstore @ sourceforge has a direct interface between Actions and the session beans. The delegate does make sense to me now and I'm going to implement it. One think I've been wondering is about packaging all the classes. Do you put the delegate classes and the transfer / value object classes in a seperate jar file from the action classes, and from the EJBs? While on the subject, what do you use for value objects? Form beans or something generated by xdoclet? I've been using an xml schema to generate my value objects so far (not with EJB) via JAXB, but this isn't going to work with EJB because the things aren't serializable. Another question (my last!): what is the best way to handle home interfaces in the delegate? Do you cache them? Do you treat them like a logger object or a singleton? Or do you just instantiate them fresh each call? Thanks! Adam On 03/17/2004 09:22 AM HG wrote: Hi Robert and Adam... Guess I am paranoid or prepared.. :-) I use nearly
Re: Role based access?
If you need this kind of behaviour (Container Managed Security) I already implemented a very simple, free and open framework that allows to manage security over your application. I haven't made any documentation besides javadoc but, if you need any help, just send me an email. Pedro Salgado On 19/02/2004 06:04, Navjot Singh [EMAIL PROTECTED] wrote: in this case, Form is decalratively saying that it can be accessed only by userRole. Now when you use CMA, every user will be bound to to a role. RequestController compare the two roles one from user-in-request and other from ActionMapping/ActionConfig and continue.. However, you can also override the default behaviour of processRoles and go your own way. HTH Navjot Singh -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 18, 2004 8:49 PM To: Struts Users Mailing List Subject: Role based access? Hi Guys, Struts-config.xml action attribute=Form roles=userRole How do i use this 'roles' attribute to implement role-based access. Thanks and Regards Subramaniam Olaganthan Tata Consultancy Services Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem moving a form page into tiles
Maybe you're setting your action to redirect=true in your struts-config? (but if you're storing your form-bean in session - your action scope attribute is session - this should be irrelevant) Another maybe :), I think you have to put an action class between your JSP and your tiles definition? Is this the case? Pedro On 12/02/2004 04:20, Vic Cekvenich [EMAIL PROTECTED] wrote: I have a page with a form that works on it's own, I can submit and will take me to the next page corrctly. However, I am trying to forward to a tile definition now and my submit will cause a null pointer exception and doesn't seem to find my bean in session. can anyone tell me what i'm doing wrong? does the tile pageScope have something to do with 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]
Re: AW: Orkut
Can anyone explain me what is the Orkut Social Network :) Pedro Salgado On 09/02/2004 23:41, Oliver Thiel [EMAIL PROTECTED] wrote: ... me too ... thanks! -Ursprüngliche Nachricht- Von: Ramadoss Chinnakuzhandai [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 10. Februar 2004 00:22 An: Struts Users Mailing List Betreff: RE: Orkut add me too :-) -R -Original Message- From: Babu, Bharathi [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 6:21 PM To: 'Struts Users Mailing List' Subject: RE: Orkut Please add me. -Original Message- From: Srinivas Kusunam [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 3:47 PM To: [EMAIL PROTECTED] Subject: RE: Orkut Can some one add me to the list please?? Thanks, Sree [EMAIL PROTECTED] 02/09/04 02:11PM Hi, Can someone please add me to Orkut Thanks in advance Cheers, Matthias -Original Message- From: Wiebe de Jong [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 6:33 PM To: 'Struts Users Mailing List' Subject: RE: Orkut Hello, Please add me to Orkut. Thanks -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Vic Cekvenich Sent: Sunday, February 08, 2004 8:16 PM To: [EMAIL PROTECTED] Subject: Orkut If you want to join Struts in Orkut Social Network send me an e-mail saying so. .V (if you do not know what it is don't worry) - 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] - 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: AW: Orkut
that seems interesting. can anyone add me? Pedro Salgado On 10/02/2004 14:01, Michael McGrady [EMAIL PROTECTED] wrote: Try google? http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=orkut At 04:15 AM 2/10/2004, Pedro Salgado wrote: Can anyone explain me what is the Orkut Social Network :) Pedro Salgado On 09/02/2004 23:41, Oliver Thiel [EMAIL PROTECTED] wrote: ... me too ... thanks! -Ursprüngliche Nachricht- Von: Ramadoss Chinnakuzhandai [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 10. Februar 2004 00:22 An: Struts Users Mailing List Betreff: RE: Orkut add me too :-) -R -Original Message- From: Babu, Bharathi [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 6:21 PM To: 'Struts Users Mailing List' Subject: RE: Orkut Please add me. -Original Message- From: Srinivas Kusunam [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 3:47 PM To: [EMAIL PROTECTED] Subject: RE: Orkut Can some one add me to the list please?? Thanks, Sree [EMAIL PROTECTED] 02/09/04 02:11PM Hi, Can someone please add me to Orkut Thanks in advance Cheers, Matthias -Original Message- From: Wiebe de Jong [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 6:33 PM To: 'Struts Users Mailing List' Subject: RE: Orkut Hello, Please add me to Orkut. Thanks -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Vic Cekvenich Sent: Sunday, February 08, 2004 8:16 PM To: [EMAIL PROTECTED] Subject: Orkut If you want to join Struts in Orkut Social Network send me an e-mail saying so. .V (if you do not know what it is don't worry) - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Jrun4 Server start up error
Two months ago, I had to configure a Struts application on a JRun Server and I had some problems to make it work correctly. If your using Tomcat then some of the libs will be in its proper location /WEB-INF/lib (commons-*, struts-*, and some other) but on Jrun I had to place log4j.properties commons-beanutils* commons-collections* commons-digester* commons-validator* commons-upload* struts* log4j* on the ${JRUN_HOME}/servers/lib. For what I unserstood this is a JRun issue... something about loading classes priority (servers lib, then website lib... ?! and not implementing a Sun's specification... In conclusion, something that Tomcat does right and JRun doesn't). Have you tried this? Have you checked the log files for more specific errors? Regards, Pedro Salgado On 16/01/2004 14:28, Sandy Bingham-Porter [EMAIL PROTECTED] wrote: Hello, We are in the process of developing a Struts web application running on Jrun 4. As we add more components to the struts configuration file, particularly dynaform properties, the startup time for the server is increasing. We've now hit a time out and receive the following error: The sever did not finish starting up in the expected amount of time; it may have failed to start. Is there anyone on this list familiar with Jrun that could give me an idea how to increase time for start up? Thanks for your time and help, Sandy Bingham-Porter Eastern Illinois University - 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]
JSTL: equivalent for errors and javascript
Does anyone know the JSTL equivalent for: logic:messagesPresent fmt:message key='errors.header'/ ul class=err html:messages id=error libean:write name=error bundle=ERROR_BUNDLE//li /html:messages /ul fmt:message key='errors.footer'/ /logic:messagesPresent And html:javascript/ ? What I need is to know where the errors are stored... ? The equivalent must be something like: c:if test='${request.???}' fmt:message key='errors.header'/ ul class=err c:forEach items='${request.?}' var='err' lifmt:message key='${err.??}'//li /html:messages /ul fmt:message key='errors.footer'/ /c:forEach For the javascript version... I think it would be something like: c:out value='${.}'/ Pedro Salgado - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic Tiles?
I have a problem with my battery that makes the system date reset to 1970!!! So if you continue see my mails on the bottom of the maildir it means that... my hardware vendor hasn't solved my problem :) Pedro Salgado On 12/01/2004 08:37, Christian Schlaefcke [EMAIL PROTECTED] wrote: Could you check your system date (01.01.1970). Its bad getting new mails for a thread at the very bottom of a maildir. Thanks and Regards, Chris Here goes a response to your question... Pedro Salgado - PREVIOUS MESSAGE (on this mailing list) Hi Robert.. I guess you could achieve the same using the controllerClass attribute and building your class.. For instance, I have this definition in the tiles-defs.xml file: --- definition name=.layout path=/common/layout.jsp controllerClass='com.dars.XTileAction' put name=title value=Encabezado primario/ put name=leftsidevalue=/common/leftside.jsp/ put name=rightside value=/common/rightside.jsp/ put name=header value=/common/header.jsp/ put name=footer value=/common/footer.jsp/ put name=bodyvalue=/common/body.jsp/ /definition --- And I have this controllerClass --- package com.dars; import org.apache.struts.tiles.actions.TilesAction; import org.apache.struts.tiles.ComponentContext; import org.apache.struts.tiles.Controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletContext; import javax.servlet.ServletException; import java.io.IOException; public class XTileAction extends TilesAction implements Controller{ public void perform(ComponentContext tilesctx, HttpServletRequest request, HttpServletResponse response, ServletContext servctx) throws ServletException, IOException{ /* GetAttributes */ String titulo= (String)tilesctx.getAttribute(title); String derecha= (String)tilesctx.getAttribute(rightside); /* GetAttributes */ System.out.println( Titulo: +titulo); System.out.println( Derecha: +derecha); /* SetAttributes */ tilesctx.putAttribute(title, Titulo nuevo de esta vaina..); tilesctx.putAttribute(rightside, /common/footer.jsp); /* SetAttributes */ } } --- You can change the values of those attributes at runtime. I prefer to do it using this method. Atte. Domingo A. Rodriguez S. --- Robert Taylor [EMAIL PROTECTED] escribió: Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] On 08/01/2004 20:22, Anderson, James H [IT] [EMAIL PROTECTED] wrote: I'm wondering if Tiles provides support for choosing a Tile dynamically, i.e., programatically at runtime. Our business users have the capability to not only modify include files, but to create new include file directories based on client defined data. We're looking for a way to support this in Struts. Thanks. jim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic Tiles?
Here goes a response to your question... Pedro Salgado - PREVIOUS MESSAGE (on this mailing list) Hi Robert.. I guess you could achieve the same using the controllerClass attribute and building your class.. For instance, I have this definition in the tiles-defs.xml file: --- definition name=.layout path=/common/layout.jsp controllerClass='com.dars.XTileAction' put name=title value=Encabezado primario/ put name=leftsidevalue=/common/leftside.jsp/ put name=rightside value=/common/rightside.jsp/ put name=header value=/common/header.jsp/ put name=footer value=/common/footer.jsp/ put name=bodyvalue=/common/body.jsp/ /definition --- And I have this controllerClass --- package com.dars; import org.apache.struts.tiles.actions.TilesAction; import org.apache.struts.tiles.ComponentContext; import org.apache.struts.tiles.Controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletContext; import javax.servlet.ServletException; import java.io.IOException; public class XTileAction extends TilesAction implements Controller{ public void perform(ComponentContext tilesctx, HttpServletRequest request, HttpServletResponse response, ServletContext servctx) throws ServletException, IOException{ /* GetAttributes */ String titulo= (String)tilesctx.getAttribute(title); String derecha= (String)tilesctx.getAttribute(rightside); /* GetAttributes */ System.out.println( Titulo: +titulo); System.out.println( Derecha: +derecha); /* SetAttributes */ tilesctx.putAttribute(title, Titulo nuevo de esta vaina..); tilesctx.putAttribute(rightside, /common/footer.jsp); /* SetAttributes */ } } --- You can change the values of those attributes at runtime. I prefer to do it using this method. Atte. Domingo A. Rodriguez S. --- Robert Taylor [EMAIL PROTECTED] escribió: Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] On 08/01/2004 20:22, Anderson, James H [IT] [EMAIL PROTECTED] wrote: I'm wondering if Tiles provides support for choosing a Tile dynamically, i.e., programatically at runtime. Our business users have the capability to not only modify include files, but to create new include file directories based on client defined data. We're looking for a way to support this in Struts. Thanks. jim - 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: Dynamic Tiles?
Here goes a response to your question... Pedro Salgado - PREVIOUS MESSAGE (on this mailing list) Hi Robert.. I guess you could achieve the same using the controllerClass attribute and building your class.. For instance, I have this definition in the tiles-defs.xml file: --- definition name=.layout path=/common/layout.jsp controllerClass='com.dars.XTileAction' put name=title value=Encabezado primario/ put name=leftsidevalue=/common/leftside.jsp/ put name=rightside value=/common/rightside.jsp/ put name=header value=/common/header.jsp/ put name=footer value=/common/footer.jsp/ put name=bodyvalue=/common/body.jsp/ /definition --- And I have this controllerClass --- package com.dars; import org.apache.struts.tiles.actions.TilesAction; import org.apache.struts.tiles.ComponentContext; import org.apache.struts.tiles.Controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletContext; import javax.servlet.ServletException; import java.io.IOException; public class XTileAction extends TilesAction implements Controller{ public void perform(ComponentContext tilesctx, HttpServletRequest request, HttpServletResponse response, ServletContext servctx) throws ServletException, IOException{ /* GetAttributes */ String titulo= (String)tilesctx.getAttribute(title); String derecha= (String)tilesctx.getAttribute(rightside); /* GetAttributes */ System.out.println( Titulo: +titulo); System.out.println( Derecha: +derecha); /* SetAttributes */ tilesctx.putAttribute(title, Titulo nuevo de esta vaina..); tilesctx.putAttribute(rightside, /common/footer.jsp); /* SetAttributes */ } } --- You can change the values of those attributes at runtime. I prefer to do it using this method. Atte. Domingo A. Rodriguez S. --- Robert Taylor [EMAIL PROTECTED] escribió: Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] On 08/01/2004 20:22, Anderson, James H [IT] [EMAIL PROTECTED] wrote: I'm wondering if Tiles provides support for choosing a Tile dynamically, i.e., programatically at runtime. Our business users have the capability to not only modify include files, but to create new include file directories based on client defined data. We're looking for a way to support this in Struts. Thanks. jim - 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: Dynamic Tiles?
:D... Fortunately I flag the best/most usefull answers I read... This way I can also help someonelse... It was also a big help for me :) ... Pedro Salgado On 08/01/2004 21:17, Domingo A. Rodriguez S. [EMAIL PROTECTED] wrote: I definitively agree with that answer :P --- Pedro Salgado [EMAIL PROTECTED] escribió: Here goes a response to your question... Pedro Salgado - PREVIOUS MESSAGE (on this mailing list) Hi Robert.. I guess you could achieve the same using the controllerClass attribute and building your class.. For instance, I have this definition in the tiles-defs.xml file: --- definition name=.layout path=/common/layout.jsp controllerClass='com.dars.XTileAction' put name=title value=Encabezado primario/ put name=leftsidevalue=/common/leftside.jsp/ put name=rightside value=/common/rightside.jsp/ put name=header value=/common/header.jsp/ put name=footer value=/common/footer.jsp/ put name=bodyvalue=/common/body.jsp/ /definition --- And I have this controllerClass --- package com.dars; import org.apache.struts.tiles.actions.TilesAction; import org.apache.struts.tiles.ComponentContext; import org.apache.struts.tiles.Controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletContext; import javax.servlet.ServletException; import java.io.IOException; public class XTileAction extends TilesAction implements Controller{ public void perform(ComponentContext tilesctx, HttpServletRequest request, HttpServletResponse response, ServletContext servctx) throws ServletException, IOException{ /* GetAttributes */ String titulo= (String)tilesctx.getAttribute(title); String derecha= (String)tilesctx.getAttribute(rightside); /* GetAttributes */ System.out.println( Titulo: +titulo); System.out.println( Derecha: +derecha); /* SetAttributes */ tilesctx.putAttribute(title, Titulo nuevo de esta vaina..); tilesctx.putAttribute(rightside, /common/footer.jsp); /* SetAttributes */ } } --- You can change the values of those attributes at runtime. I prefer to do it using this method. Atte. Domingo A. Rodriguez S. --- Robert Taylor [EMAIL PROTECTED] escribió: Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] On 08/01/2004 20:22, Anderson, James H [IT] [EMAIL PROTECTED] wrote: I'm wondering if Tiles provides support for choosing a Tile dynamically, i.e., programatically at runtime. Our business users have the capability to not only modify include files, but to create new include file directories based on client defined data. We're looking for a way to support this in Struts. Thanks. jim - 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] _ Do You Yahoo!? Información de Estados Unidos y América Latina, en Yahoo! Noticias. Visítanos en http://noticias.espanol.yahoo.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]
Re: Please Help - ClassCastException
On 04/01/2004 05:04, Caroline Jen [EMAIL PROTECTED] wrote: Thank you for trying to help. I have added import org.apache.artimus.message.PostForm; to my action class. I do not fully follow what I should check in the struts-config.xml file. And should I use name=postForm with lowercase 'p' or uppercase 'P'? In my struts-config.xml file, I have: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm Here is the problem. Replace org.apache.struts.validator.DynaValidatorForm for org.apache.artimus.message.PostForm That should work Pedro Salgado form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ form-property name=title type=java.lang.String/ form-property name=postTopic type=java.lang.String/ form-property name=postBody type=java.lang.String/ /form-bean and action roles=administrator,editor,contributor path=/message/NewTopic type=org.apache.artimus.message.StoreMessage name=postForm scope=request validate=true input=.message.Form forward name=success path=.article.View/ /action Do you see any problems? --- Pedro Salgado [EMAIL PROTECTED] wrote: On your struts config file check if the form bean for StoreMessage action is of type pkg.pkg.PostForm and if the action name is pointing to the correct form bean... It also seems to be missing the import of the PostForm on your action class. Pedro Salgado On 04/01/2004 03:22, Caroline Jen [EMAIL PROTECTED] wrote: The statement shown below encountered a ClassCastException: PostForm postForm = ( PostForm )form; I cannot figure out the reason. Please help. Allow me to show more code of the class where the exception occurred: ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; int postID; String postCreationIP; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); PostForm postForm = ( PostForm )form; } } __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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] __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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]
dynaform populate
Can anyone help me on this? I am trying to pass a populated DynaActionForm to a JSP file and I can't figure out how can I populate the form... I have the following sequence: - form A (name : gotoUserPrefsForm, id : String - user id) - action ViewUserPreferences (uses form A) - form B (name : userPrefsForm, severall attributes) ViewUserPreferences { /** @param form this is form A. */ ... execute(..., form, ...) { int id = FormUtils.getIntValue(form, id); UserPreferences prefs = service.getUserPreferences(id); // here starts the problem!!! // gets the form bean configuration FormBeanConfig fc = config.findFormBeanConfig(mapping.getName()); // this is supposed to be form B DynaValidatorForm dynaForm = // how do I create a new instance with the FormBeanConfig?... dynaForm.set(background, prefs.getBackground()); request.setAttribute(userPrefsForm, dynaForm); } } Any ideas? Pedro Salgado - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynaform populate
On 04/01/2004 16:55, Matthias Wessendorf [EMAIL PROTECTED] wrote: Hi Pedro, with: FormBeanConfig fbc = new FormBeanConfig(); fbc.setName(myForm); DynaActionFormClass dafc = DynaActionFormClass.createDynaActionFormClass(fbc); DynaActionForm formBean = (DynaActionForm) dafc.newInstance(); formBean.set(property, businessObject.getProperty()); request.setAttribute(userPrefsForm,formBean); //End you can create a dynaBean. i had the problem long time ago two. why are willing to use dynaBeans for populating a JSP-Form-Page? i use ValueObjects or HelperBeans instead, which i store in request and with there properties the formfilds get filled to! What you are telling me is that if I store a bean with the same name as the form, the html tag lib will interpret it as being the form, right? Thank you very much! Pedro Salgado look http://rollerjm.free.fr/images/ClassStruts1_1.gif an nice diagramm :-) greetings Matthias -Original Message- From: Pedro Salgado [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 5:29 PM To: Struts Users Mailing List Subject: dynaform populate Can anyone help me on this? I am trying to pass a populated DynaActionForm to a JSP file and I can't figure out how can I populate the form... I have the following sequence: - form A (name : gotoUserPrefsForm, id : String - user id) - action ViewUserPreferences (uses form A) - form B (name : userPrefsForm, severall attributes) ViewUserPreferences { /** @param form this is form A. */ ... execute(..., form, ...) { int id = FormUtils.getIntValue(form, id); UserPreferences prefs = service.getUserPreferences(id); // here starts the problem!!! // gets the form bean configuration FormBeanConfig fc = config.findFormBeanConfig(mapping.getName()); // this is supposed to be form B DynaValidatorForm dynaForm = // how do I create a new instance with the FormBeanConfig?... dynaForm.set(background, prefs.getBackground()); request.setAttribute(userPrefsForm, dynaForm); } } Any ideas? Pedro Salgado - 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: dynaform populate
On 04/01/2004 17:16, Matthias Wessendorf [EMAIL PROTECTED] wrote: Hi Pedro, the properties are!!! important!!! i do the following in an action: request.setAttribute(helperBean,myValueObject); return mapping.findForward(updateFormularPage); and have something like that in the forwarded jsp struts-html:form action=/myActionPath struts-html:text name=helperBean property=foo/ I didn't knew html:text had a name attribute :) I usually use html:text property=background styleClass=field_required/ (I supposed, in this case, the name attribute is the form-bean name defined on the struts config file)... One more question, if you have validation errors (after submitting the form), you still have to pass the form properties to your helperBean or the JSP page automatically presents the previous sent values (just like doing a back on the browser)? Thank you again, Pedro Salgado ... /struts-html:form it works fine! Regards, Matthias -Original Message- From: Pedro Salgado [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 6:08 PM To: Struts Users Mailing List Subject: Re: dynaform populate On 04/01/2004 16:55, Matthias Wessendorf [EMAIL PROTECTED] wrote: Hi Pedro, with: FormBeanConfig fbc = new FormBeanConfig(); fbc.setName(myForm); DynaActionFormClass dafc = DynaActionFormClass.createDynaActionFormClass(fbc); DynaActionForm formBean = (DynaActionForm) dafc.newInstance(); formBean.set(property, businessObject.getProperty()); request.setAttribute(userPrefsForm,formBean); //End you can create a dynaBean. i had the problem long time ago two. why are willing to use dynaBeans for populating a JSP-Form-Page? i use ValueObjects or HelperBeans instead, which i store in request and with there properties the formfilds get filled to! What you are telling me is that if I store a bean with the same name as the form, the html tag lib will interpret it as being the form, right? Thank you very much! Pedro Salgado look http://rollerjm.free.fr/images/ClassStruts1_1.gif an nice diagramm :-) greetings Matthias -Original Message- From: Pedro Salgado [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 5:29 PM To: Struts Users Mailing List Subject: dynaform populate Can anyone help me on this? I am trying to pass a populated DynaActionForm to a JSP file and I can't figure out how can I populate the form... I have the following sequence: - form A (name : gotoUserPrefsForm, id : String - user id) - action ViewUserPreferences (uses form A) - form B (name : userPrefsForm, severall attributes) ViewUserPreferences { /** @param form this is form A. */ ... execute(..., form, ...) { int id = FormUtils.getIntValue(form, id); UserPreferences prefs = service.getUserPreferences(id); // here starts the problem!!! // gets the form bean configuration FormBeanConfig fc = config.findFormBeanConfig(mapping.getName()); // this is supposed to be form B DynaValidatorForm dynaForm = // how do I create a new instance with the FormBeanConfig?... dynaForm.set(background, prefs.getBackground()); request.setAttribute(userPrefsForm, dynaForm); } } Any ideas? Pedro Salgado - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help - ClassCastException
On your struts config file check if the form bean for StoreMessage action is of type pkg.pkg.PostForm and if the action name is pointing to the correct form bean... It also seems to be missing the import of the PostForm on your action class. Pedro Salgado On 04/01/2004 03:22, Caroline Jen [EMAIL PROTECTED] wrote: The statement shown below encountered a ClassCastException: PostForm postForm = ( PostForm )form; I cannot figure out the reason. Please help. Allow me to show more code of the class where the exception occurred: ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; int postID; String postCreationIP; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); PostForm postForm = ( PostForm )form; } } __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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: *.do mapping using JRun
Maybe the problem isn't web.xml. A two months ago, I had to configure a Struts application on a JRun Server and I had some problems to make it work correctly. If your using Tomcat then some of the libs will be in its proper location /WEB-INF/lib (commons-*, struts-*, and some other) but on Jrun I had to place log4j.properties commons-beanutils* commons-collections* commons-digester* commons-validator* commons-upload* struts* log4j* on the ${JRUN_HOME}/servers/lib. In your case, maybe this isn't possible. For what I unserstood this is a JRun issue... something about loading classes priority (servers lib, then website lib... ?! and not implementing a Sun's specification... In conclusion, something that Tomcat does right and JRun doesn't). You can try using Jrun locally also to check this... You can download the software from Macromedia (the license is free for development anyway) and check what's happening. Pedro Salgado On 02/01/2004 03:11, Mike Steigerwald [EMAIL PROTECTED] wrote: Hi, all, I'm a struts newbie trying to learn with struts-example. I've got it working great locally with Tomcat, but I'm struggling to deploy it on my ISP's JRun server. I can't seem to figure out some configuration property to get JRun to understand the *.do mapping. All of my .jsp links work great, but I get 404 errors for any link such as: editRegistration.do?action=Create I'm sure the solution is obvious, but I'm going blind scouring the documentation. Thanks in advance for any help. - 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: Dynamic form property names
Sorry but I haven't quite catch what you looking for... Do you want to create a form in runtime? Is that it? If you're using a DynaForm it already has map. You can't set new properties to the form (it was built based on a DynaClass) but, if you extend DynaForm to a XDynaForm and make XDynaForm implement Map maybe you can set new properties on your new form. I used this approach (the DynaBean/Map extension) to start using DynaBeans with JSTL and, maybe... just maybe it can help you set new properties on your form. I can send you the class, if you want. As I said, I haven't tried this (the runtime form approach) and I don't know if this is what you are looking for... Pedro Salgado On 30/12/2003 13:34, Paul-J Woodward [EMAIL PROTECTED] wrote: Anyone got any ideas? Thanks, Paul Paul-J Woodward paul-j.woodward+exterTo: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED] cc: Subject: Dynamic form property names 29/12/2003 19:55 Please respond to Struts Users Mailing List Dear All, I have been struggling with this all day, It'll take a bit of background to explain what I am trying to do: I am creating an online wizard to populate templatised web pages, and hence create a dynamic struts/tiles-based site. Each template has various containers for content, each container can be filled by a set of different tiles. The templates are defined in a database. The definition for a template associates each container with the category of tile that it can hold, for instance a template may have containers for navigation and menu tiles. The database also contains a list of tiles that fit into each category of container. I would like to create a single form that lists the categories, that has radio button for every tile in each category. My code looks like this: logic:iterate id=elementCategory name=selectedTemplate property=elementCategories type=com.db.gci.ge.epg.actions.addcontent.TemplateElementCategory p bbean:write name=elementCategory property=category //b bean:write name=elementCategory property=description / Compatible elements in this category:br ul logic:iterate id=compatibleElement name=elementCategory property=compatibleElements type=com.db.gci.ge.epg.actions.addcontent.TemplateElement html:radio property=value(%= elementCategory.getName() %) idName=compatibleElement value=name bbean:write name=compatibleElement property=name //bbr bean:write name=compatibleElement property=description / /html:radio /logic:iterate /ul /p /logic:iterate The issue is this: I need to make the action form map-backed (I think) because the number of radio buttons is only know at runtime, but I can't find any way to name the radio buttons by the name of the category that is being selected. What I would like to use is value(%= elementCategory.getName() %) where my action form has a map and a setValue(String key, Object object) function. Thanks in advance, Paul -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - 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: RequestProcessor problem
On 30/12/2003 11:22, Kelly Goedert [EMAIL PROTECTED] wrote: Can anyone give me an example on how to use the RequestProcessor? I want to use the RequestProcessor to check on action roles. Do I have to subclass it? Or I can use it as it is? To use roles to I have to configure anything in the container too? Or just setting the roles parameter and using the RequestProcessor, will allow mw to check the roles that the user might have to access that action? I made a framework for this purpose. If you want it I can send you the source so you can reuse in any way you like. Pedro Salgado Thanks - 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: RequestProcessor problem
Dependencies: struts servlet log4j plugincompanion log4j junit... I use a UserContainer to set login, roles and user variables. The RoleRequestProcessor tests the user roles against your struts defined roles... simple. I use it in order to have a simple role restriction on my actions... and in order to have a servlet container independent solution. Hope it helps, Pedro Salgado On 30/12/2003 17:01, Kelly Goedert [EMAIL PROTECTED] wrote: If you can send it'll appreciate it. Pedro Salgado wrote: On 30/12/2003 11:22, Kelly Goedert [EMAIL PROTECTED] wrote: Can anyone give me an example on how to use the RequestProcessor? I want to use the RequestProcessor to check on action roles. Do I have to subclass it? Or I can use it as it is? To use roles to I have to configure anything in the container too? Or just setting the roles parameter and using the RequestProcessor, will allow mw to check the roles that the user might have to access that action? I made a framework for this purpose. If you want it I can send you the source so you can reuse in any way you like. Pedro Salgado Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] Populating Tiles definition attribute at runtime
I don¹t know if it is possible to change a tiles definition at runtime but a solution to your problem could be solved by specifying a definition that uses a jsp file that does a conditional include according to a given parameter? definition name=choose.def extends=base.def put name=header value=/header.jsp/ put name=body value=/choose.jsp/ - put name=footer value=/footer.jsp/ /definition choose.jsp c:import url='/WEB-INF/com/website/tiles/choose/${request.choose}'/ Pedro Salgado On 29/12/2003 17:46, Robert Taylor [EMAIL PROTECTED] wrote: Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - 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: tiles, conditional choice of
On 27/12/2003 20:55, Brady Hegberg [EMAIL PROTECTED] wrote: Of course! I just need to forward to the def that corresponds to the user's settings. Very simple and elegant. However, theoretically, what if I had three tiles in a definition, each of which could get any one of the same 10 different values. In that case I'd need to create 1000 definitions in my tile-defs. Is there a simple way around that? Have you tried to use a definition that uses a jsp file that does a conditional include according to a given parameter? definition name=choose.def extends=base.def put name=header value=/header.jsp/ put name=body value=/choose.jsp/ - put name=footer value=/footer.jsp/ /definition choose.jsp c:import url='/WEB-INF/com/website/tiles/choose/${request.choose}'/ Pedro Salgado There are a number of options available here, i'd have a different def that extends showList , I'd call this base.list and then have different defs per list. name=user.list extends=base.list in fact i assumed you'd only have to over load body, you could even have a def as the value of body. On 27 Dec 2003, at 06:12, Brady Hegberg wrote: I've been trying to find the best way to handle a situation where you have various formats for a tile and the tile appearance is chosen at run-time. definition name=showList extends=mainLayout put name=header value=/header.jsp/ put name=body value=// put name=footer value=/footer.jsp/ /definition And I have content1.jsp, content2.jsp and content3.jsp which can be loaded into the page Should I: 1. Have a single tile with choose statements to determine the format. 2. Have a single master tile which chooses between various tiles and loads the selected one? (If possible?) 3. Have a ClassController or TilesAction class which changes the tile object and loads the chosen tile into the tile object before displaying it. (If so how is this done? Any examples available?) I found a couple similar references in the archives but no definitive answer. Thanks, Brady PS: It would be cool if you could create an action for a tile and then do an actionForward which returns the chosen tile into the correct spot on the calling page but I don't believe this is possible. At least I've never seen anything that indicated it could be done. - 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]
mapping.getForwardForward()?
Hello to everyone, I have read Chuck Cavaness's book explanation but still I still don't understand. If I extend an Action class then I can use the forward, include and type attributes in any way I like, right? (the book says something about being mutually exclusive) action path=/Action type=pkg.pkg1.classA input=.tile.before forward=.tiel.after name=form validate=true / Why I am making this question: many of my actions only use a forward (success) and use the input attribute to go back, in case of an error. Since I usually have 1 input and 1 forward, instead of defining the same forward success in every action, I was hoping that I could use the forward attribute (or any other) to send the request to a Tiles definition or JSP resource, when everything goes well... something like: execute() { return (new ActionForward(mapping.getForward())); (I still couldn't make it work properly... And I don't know if there is any way I can do this... If it stills works with modules). } On those cases that I have 1 input page and more than one action that will end up to the same input page (also very common), I solved with a DispatchAction and use the mapping.getInputForward() to solve the problem, but on the previous case, I think there is something very simple missing to make it all work. Just one more question... What is the difference of extending org.apache.struts.action.Action or org.apache.struts.actions.ForwardAction? I have looked at the source code and, if I override the execute() method then it will be pretty much the same... right? Thank you, Pedro Salgado - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Retrieving boolean properties from a DynaActionForm
Hi! Try this: Boolean bVolledig = Boolean.valueOf((String)form.get(volledig)); boolean volledig = bVolledig.booleanValue(); Should work Pedro Salgado On 16/12/2003 09:11, Engbers, ir. J.B.O.M. [EMAIL PROTECTED] wrote: Hi, I have defined a boolean property in a DynaActionForm (volledig which means complete). The value should be checked in the validate()-method. It is easy to retrieve String-properties from the hash-map but the compiler does not accept the following construct: if ((boolean)this.get(volledig)) complaining that it :Cannot cast from Object to boolean. How can I use this boolean value? Ben public class ZoekDynaActionForm extends DynaActionForm { public ZoekDynaActionForm() { super(); } private Zoek data; public void setData (Zoek data){this.data=data;} public Zoek getData() {return this.data;} protected boolean NullOfLeeg (String str){ return ((str == null) || (str.length() == 0)); } public void reset(ActionMapping mapping, HttpServletRequest request) { this.data = new Zoek(); } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){ ActionErrors errors = new ActionErrors(); if (1.equals((String)this.get(selectie))) { if (.equals((String)this.get(gemeente)).equals((String)this.get(sectie )).equals((String)this.get(perceel))) { errors.add(Perceelkeuze, new ActionError(error.Perceelkeuze)); } else { if (NullOfLeeg((String)this.get(gemeente))) errors.add(Gemeente, new ActionError(error.gemeente.verplicht)) ; if (NullOfLeeg((String)this.get(sectie))) errors.add(Sectie, new ActionError(error.sectie.verplicht)); if (NullOfLeeg((String)this.get(perceel))) errors.add(Perceel, new ActionError(error.perceel.verplicht)); } } if (2.equals((String)this.get(selectie))) { == if ((boolean)this.get(volledig)) { errors.add(Volledige naam, new ActionError(error.naam.volledig)); } else { errors.add(Beginletters, new ActionError(error.naam.deel)); } } return (errors); } } - 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: Naming conventions for Struts actions, Tiles definitions and JSPs
First of all the templates go to Templates directory and tile to a Tiles directory. I use two kinds of tiles definitions: those that are used to help build pages, those that are used see pages. For the build ones, I use .definition.def. For example, a one form definition would be .form.def, for a two form definition would be .double.form. The name of the major Tiles definition is the same as the JSP template. The name of Tiles definition properties are the same as the JSP files (for the initial values). definition name=.form.def path=/WEB-INF/classes/pkg/templates/form.jsp put name=head value=/WEB-INF/classes/pkg/tiles/head.jsp/ put name=header value=/WEB-INF/classes/pkg/tiles/header.jsp/ put name=menuvalue=/WEB-INF/classes/pkg/tiles/menu.jsp/ put name=errors value=/WEB-INF/classes/pkg/tiles/errors.jsp/ put name=form value=/WEB-INF/classes/pkg/tiles/form.jsp/ put name=footer value=/WEB-INF/classes/pkg/tiles/footer.jsp/ /definition For the presentation, I use the name of the extended build definition and then a name of the page. For example, a search form that extends .form.def would be .form.search which uses a search.jsp file. definition name=.form.search extends=.form.def put name=form value=/WEB-INF/classes/pkg/tiles/forms/search.jsp/ /definition The first name of the extended Tiles definition is the same as the major definition. The last name of the extended Tiles definition is the same as the JSP file. The directory where the JSP file is located, is the plural of the major definition name. If the project has a lot of roles I could also use the role to place the JSP file. Admin role value=/WEB-INF/classes/pkg/tiles/forms/admin/search.jsp/ User role value=/WEB-INF/classes/pkg/tiles/forms/user/search.jsp/ Common to more than one role value=/WEB-INF/classes/pkg/tiles/forms/common/search.jsp/ or value=/WEB-INF/classes/pkg/tiles/forms/search.jsp/ When the number of properties to be set are more than 1, I use the place where they will be presented to name the JSP files (t = top, b = bottom, m = middle, l = left, r = right, c = center...): Example: - major definition (build) definition name=.doubleform.def path=/WEB-INF/classes/pkg/templates/doubleform.jsp put name=head value=/WEB-INF/classes/pkg/tiles/head.jsp/ put name=menuvalue=/WEB-INF/classes/pkg/tiles/menu.jsp/ put name=errors value=/WEB-INF/classes/pkg/tiles/errors.jsp/ put name=topForm value=/WEB-INF/classes/pkg/tiles/topForm.jsp/ put name=bottomForm value=/WEB-INF/classes/pkg/tiles/bottomForm.jsp/ put name=footer value=/WEB-INF/classes/pkg/tiles/footer.jsp/ /definition - minor definition (see something) definition name=.doubleform.something extends=.doubleform.def put name=topForm value=/WEB-INF/classes/pkg/tiles/doubleforms/something_t.jsp/ put name=bottomForm value=/WEB-INF/classes/com/lusovencor/tiles/doubleforms/something_b.jsp/ /definition For the action to tiles name translation: Action = /ActionName - .some-major-definition.actionname Example: /ViewUser - .form.viewuser /User?operation=view - .form.user (I only use a dispatch action when getting an input from 1 form and having more than one action possibility that ends up on the input form (view user and edit user, for example)) Speaking of organizing a large project... how do you represent, in a UML diagram, Tiles definitions, forms, actions, in a way that you understand the flow of the application? Do you use the name/colors to differ actions components from form components? How can you represent a Tiles definition (I don¹t mean the tiles configuration file)? Pedro Salgado On 16/12/2003 13:23, Philip Mark Donaghy [EMAIL PROTECTED] wrote: Hello world, Naming conventions help organize large projects and facilitates the establishment of relationships between objects and entities configured in an XML file. My current project is using the following convention. The forward success path is similar to the action path. action path=/foo/bar/accesModifierRacine forward path=foo.bar.accesModifierRacine The Tiles definition uses the name foo.bar.accesModifierRacine so that when I see the url /foo/bar/accesModifierRacine I know which Tiles definition to see. In addition to that the body of the tiles definition is often the same. put name=body value=foo/bar/accesModifierRacine.jsp If anyone would like to contribute their naming conventions I am sure that the community would appreciate it. Phil = Java Web Application Architect mapimage.com - Java and GIS struts1.1:tomcat4.1.27:linuxRH8 __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com
Re: Struts installation problems
On 16/12/2003 14:21, beyaRecords - The home Urban music [EMAIL PROTECTED] wrote: Hi, just installed struts on os x panther (10.3), or should I say trying to! I am running apache 2, tomcat, cocoon with no problems. My problem is installing Struts (AHH) Now, following the install document it says to copy struts-documentation.war and struts-example.war to your $TOMCAT_HOME/webapps directory. Done that. On restarting tomcat, a file called tomcat-apache.conf should be generated and placed in my $TOMCAT_HOME/conf directory. Nope, this is not happening. I thought that there might be a write privilege issue with the folder, but got no joy with that. What am I doing wrong?? Finally someone else who uses mac. :) I am also using Tomcat 4.1.27 (not from ServerLogistics) but with the Apache that comes with Apple with no problems... Maybe it would be best to ask ServerLogistics what's is the problem since it seems that is a setup/configuration problem... By the way, Struts 1.2 is the development version not the final release version... In case you didn't notice. Pedro Salgado Would I be right in thinking that the tomcat-apache.conf file is not specific, in the sense that it doesn't captures machine specific data and is just a generic file? If so, could one of you kind people send me the file so I can get on with the rest of my life, please??? ;-) Uzo p.s. Setup specific is: 1. complete Apache 2.0.48 (from Server Logistics - www.serverlogistics.com) 2. complete Jakarta Tomcat (from Server Logistics) 3. Apache Coccoon (from Server Logistics) 4. Struts 1.2 (from jakarta.apache.org) On 16 Dec 2003, at 14:06, beyaRecords - The home Urban music wrote: Hi, is anybody receiving my emails? regards Uzo On 16 Dec 2003, at 14:03, Eric SCHULTZ wrote: Good morning... I need to do something similar with additional configuration properties for a particular action. I figure I need to write a plug-in that creates a thread that checks the properties file every x seconds and if changed reloads it into a context attribute. My problem is I've never done thread-safe programming before and I figure I need to handle the possibility that the plug-in's thread could be writing a new version while several actions are reading from the existing one. Does anyone have any pointers to some information on how to do this properly? Much appreciated. Thanks Eric Schultz Technical Leader Conseiller Technique Elix Telephony Web convergence at its best: http://www.talktosantaclaus.com La convergence téléphonie-web à son meilleur: http://www.parleauperenoel.com Specialist in interactive business solutions Specialiste en solutions d'affaires interactives 14 Commerce Place, 5th floor Nun's Island, QC H4E 1T5 t: 514 768-1000 f: 514 768-7680 -Original Message- From: Joe Germuska [mailto:[EMAIL PROTECTED] Sent: December 15, 2003 11:14 To: Struts Users Mailing List Subject: RE: Reloading of application resources At 11:42 AM +0200 12/15/03, Nicklas Karlsson wrote: On Mon, 15 Dec 2003, Yves Sy wrote: Create a thread in your cache manager that polls for changes in the timestamp of the properties file, say, every 5000 ms and reloads it when a new one is detected. Yes, but the problem is not at the cache end, the issues are how to trigger the components (the ActionServlet in this case) into refreshing their data from the cache. Do I have to extends the ActionServlet and manually pop in refreshed data (based on some trigger) in the message key in the ServletContext? And how does locale affect the configured key Note that although the message data is read in from Properties files, the objects in the ServletContext which resolve references to properties keys are instances of a specific Struts class, MessageResources. If you dynamically reloadable messages (which would be useful to many people), you'll want to look at the MessageResources and MessageResourcesFactory abstract classes and extend them (or their Property oriented subclasses) in order to add in your functionality... http://jakarta.apache.org/struts/api/org/apache/struts/util/ MessageResources .html http://jakarta.apache.org/struts/api/org/apache/struts/util/ MessageResources Factory.html There's an ongoing process to factor these classes out of Struts and into a commons library, and to have Struts use that library (on the roadmap, that's slated for Struts 1.3.x). http://jakarta.apache.org/commons/sandbox/resources/ http://jakarta.apache.org/struts/status.html Hope that helps. I know I'd find a dynamically reloadable messages bundle useful! Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com We want beef in dessert if we can get it there. -- Betty Hogan, Director of New Product Development, National Cattlemen's Beef Association
Re: Login Security
One idea The third time the login fails, register the time for that user. When a login gets executed, if the last registered time for the given user is less than the time interval you want - the login always fails. The user must have something like: User : id || login | password | last_failure | number_failures Hope it helps, Pedro Salgado On 16/12/2003 15:55, Ciaran Hanley [EMAIL PROTECTED] wrote: I'm writing a web application using JSP and Struts. I want to add a security feature to my login page where if a user has three unsuccessful logins they will be unable to log in for a certain period of time afterwards. I can count the number of unsuccessful logins ok but how I'm not sure how to give a timeout after 3 failures. Any ideas how I could implement this? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: iBatis DAO + Hibernate?
What do you think about OJB? Pedro Salgado On 16/12/2003 16:58, Vic Cekvenich [EMAIL PROTECTED] wrote: I would use Ibatis or Hibrenate as a DAO, not both. iBatis lets you use any SQL(corelated self join, sooner or later you will need to do a trick or tune performance), which is why I have been using it with much success; and I teach Struts with it, and there are other Struts/iBatis resources. It is ER based. Hibrenate used to be more popular before iBatis and it is more OR (which I make a minus since I work with rows of columns, for example with DisplayTag). Either will server you very well, they are both great. (bad things IMO are JDO, EJB, JDBC) .V David Erickson wrote: We're needing to roll out DAO and ORM in our webapp... been evaluating hibernate and it looks awesome, but we'd like to insulate our app from that, has anyone tried using iBatis' DAO layer then plugging hibernate underneath that? -David - 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: Reloading of application resources
I think someone mentioned an OJBMessageResources to retrieve MessageResources from a database, some days ago. I haven't tried yet (it's on my todo list) but maybe it has what you need. Here goes the link: http://nagoya.apache.org/wiki/apachewiki.cgi?StrutsMessageResourcesFromDatab ase Pedro Salgado On 16/12/2003 19:52, Joe Germuska [EMAIL PROTECTED] wrote: I'd suggest that if you can achieve the same goals by writing a PlugIn implementation that you might achieve by extending the ActionServlet, you're probably better off writing the PlugIn. You could avoid creating a thread by implementing a freshness check at an access point. That is, rather than having your action get its config out of the servletcontext, have it get a plug-in instance out of the servlet context, and have it ask the plug-in for the config. At that time, the plug-in can decide whether it needs to reload the config or not before returning it to the action, perhaps by comparing the last modified timestamp on the config file to a value stored the last time the file was read. Then you could just add a synchronized modifier to the plug-in method that the action classes call and achieve pretty simple thread safety. It's not the fanciest, but if you're not comfortable writing concurrent code, better safe than fancy! Joe I need to do something similar with additional configuration properties for a particular action. I figure I need to write a plug-in that creates a thread that checks the properties file every x seconds and if changed reloads it into a context attribute. My problem is I've never done thread-safe programming before and I figure I need to handle the possibility that the plug-in's thread could be writing a new version while several actions are reading from the existing one. Does anyone have any pointers to some information on how to do this properly? Much appreciated. Just a thought: How about extending the ActionServlet and maintain an expire-variable that is set at init-time. Then every time after a request is processed the expire variable is checked. If expired, calls the same method for loading the resources as init() does (think it's initModuleMessageResources)? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Login Security
On 16/12/2003 21:43, Ciaran Hanley [EMAIL PROTECTED] wrote: I am storing the username and password in a table in a mySql database. I think I will just add a field last_failure to the user table... and after 3 unsuccessful attempts I will record the time in the last_failure field and work out if the timeout has elapsed by querying that field and comparing it to the current time. That's the way ;D Pedro Salgado That way, I wont be using cookies, and will avoid blocking IP address. Does that sound ok? Ciaran -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 16 December 2003 20:46 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: Login Security Avoid the cookie solution, it's too easy for the user to bypass your security measures and as mentioned below, this solution won't work if the browser has disabled cookies. Don't block IP addresses because they can be easily spoofed and redirected. Dynamic IPs pose a problem as you could be blocking out a legitimate user. How are you storing your list of usernames/passwords? Would it be possible to add an extra bit of data next to each username/password indicating when the login is valid? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 9:09 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: Login Security You could put a cookie on the user's machine that expires after a certain period of time. Of course this only works when cookies are turned one and an experienced user could always manually remove their cookie. Another solution maybe is to get the user's IP address from the request Header and add it to a list of invalid IP address with their times of entry. Then upon a new request, you will have to check the list and determine how long ago the IP address was added. I'm just brainstorming here so anybody can criticize these suggestions freely. -Jonathan -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 10:55 AM To: [EMAIL PROTECTED] Subject: Login Security I'm writing a web application using JSP and Struts. I want to add a security feature to my login page where if a user has three unsuccessful logins they will be unable to log in for a certain period of time afterwards. I can count the number of unsuccessful logins ok but how I'm not sure how to give a timeout after 3 failures. Any ideas how I could implement this? Thanks - 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: Log4j with Struts
Do you have the log4j jar on the WEB-INF/lib? Do you have the log4j.properties on the WEB-INF/classes? You have: String str = new String(LogonAction.class.getName()); Logger logger = Logger.getLogger(str); Shouldn't it be: Logger logger = Logger.getLogger(LogonAction.class); Pedro Salgado On 05/12/2003 06:56, Rahul Mohan [EMAIL PROTECTED] wrote: hi nick, thanks for responding...its the logger class thats missing ithink... this is the exception i get when i try to view the page: java.lang.NoClassDefFoundError: org/apache/log4j/Logger at app.LogonAction.perform(Unknown Source) what could be the problem? please excuse my novice level... thanks again.. - Original Message - From: Nick Faiz [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, December 05, 2003 12:22 PM Subject: RE: Log4j with Struts Well, what class can't it find, the Logger or the LogonAction.class ? I use it with Struts, without a hassle, on WebLogic 7.2. Nick -Original Message- From: Rahul Mohan [mailto:[EMAIL PROTECTED] Sent: Friday, 5 December 2003 5:46 PM To: struts Subject: Log4j with Struts Hi, has anybody tried using Log4j with struts? I tried the following code and its giving a ClassDefNotFoundException during runtime.. this is inside the perform method: String str = new String(LogonAction.class.getName()); //LogonAction is an Action Class logger = Logger.getLogger(str); //this line is throwing the exception - apparently str is not having a classdef somebody please help me with this.or is there any other method to perform logging? i am using tomcat4.1 ... Thanks in advance. Rahul Mohan ~~~ MasterCraft Group Tata Consultancy Services Tata Research Development and Design Center 54B, Hadapsar Industrial Estate Pune - 411 013 Phone: +91 4042333 or 4031122 Extn 2556 +91 20 31544082 ( Mobile ) Fax: +91 20 4042399 email : [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]
JSTL and DynaBeans
I have been using the struts taglibs and have been trying to use only JSTL. When using DynaBeans the JSTL doesn't work (${bean.propertyA} doesn't print anything) I solved the problem of accessing DynaBeans extending the BasicDynaBean and implementing the Map interface but I am also using RowSetDynaClass (which builds a collection of DynaBeans from a ResultSet). I have been trying to find a solution and came to this approach: - implement a CustomizedRowSet that is a copy of RowSetDynaClass with a setDynaBeanClass(Class clazz). On the copy(...) method, use a Class.forName(this.dynaBeanClass).newInstance(); Question: - Does anyone have figured out another solution (one that is simpler and able to reuse the methods that the RowSetDynaClass uses without copy/paste?) ? Thank you, Pedro Salgado - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: R: JSTL and DynaBeans
I think that it only works for maps... I can use DynaActionForms and use ${formbean.map[key]}, but I am using BasicDynaBeans for the views. Pedro Salgado On 25/11/2003 15:34, Grassi Fabio [EMAIL PROTECTED] wrote: Would the alternative syntax ${bean[propertyA]} work better? Regards, Fabio. -Messaggio originale- Da: Pedro Salgado [mailto:[EMAIL PROTECTED] Inviato: martedì 25 novembre 2003 16:05 A: Struts Users Mailing List Oggetto: JSTL and DynaBeans I have been using the struts taglibs and have been trying to use only JSTL. When using DynaBeans the JSTL doesn't work (${bean.propertyA} doesn't print anything) I solved the problem of accessing DynaBeans extending the BasicDynaBean and implementing the Map interface but I am also using RowSetDynaClass (which builds a collection of DynaBeans from a ResultSet). I have been trying to find a solution and came to this approach: - implement a CustomizedRowSet that is a copy of RowSetDynaClass with a setDynaBeanClass(Class clazz). On the copy(...) method, use a Class.forName(this.dynaBeanClass).newInstance(); Question: - Does anyone have figured out another solution (one that is simpler and able to reuse the methods that the RowSetDynaClass uses without copy/paste?) ? Thank you, Pedro Salgado Ai sensi della Legge 675/96, si precisa che le informazioni contenute in questo messaggio sono riservate ed a uso esclusivo del destinatario. Qualora il messaggio in parola Le fosse pervenuto per errore, la preghiamo di eliminarlo senza copiarlo e di non inoltrarlo a terzi, dandocene gentilmente comunicazione. Grazie.BRBRThis message, for the law 675/96 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. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]