Error creating form bean
Howdy, I'm having a bizarre problem with a new ActionForm I've just created: when I hit a jsp that uses this form, the RequestUtils say there's an error creating form bean of my class. 2003-12-01 17:01:33,432 [Thread-2] ERROR org.apache.struts.util.RequestUtils Error creating form bean of class com.ponyprinting.web.manager.UploadForm java.lang.ClassNotFoundException: com.ponyprinting.web.manager.UploadForm The class file is there (I checked the build directory that tomcat's being pointed to for docBase of my web app). And it obviously compiled fine. Sigh. It's the little problems that take up 80% of the time :-( Please help! Thank you, -Sasha Borodin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error creating form bean
Attention Todd Thorner! :-) It look like you had very similar problem, but I saw no replies to your post. Did you ever get this fixed: http://www.mail-archive.com/[EMAIL PROTECTED]/msg86103.html I'm working under an extreme deadline, please help :-( - Howdy, I'm having a bizarre problem with a new ActionForm I've just created: when I hit a jsp that uses this form, the RequestUtils say there's an error creating form bean of my class. 2003-12-01 17:01:33,432 [Thread-2] ERROR org.apache.struts.util.RequestUtils Error creating form bean of class com.ponyprinting.web.manager.UploadForm java.lang.ClassNotFoundException: com.ponyprinting.web.manager.UploadForm The class file is there (I checked the build directory that tomcat's being pointed to for docBase of my web app). And it obviously compiled fine. Sigh. It's the little problems that take up 80% of the time :-( Please help! Thank you, -Sasha Borodin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error creating form bean
Just to be explicit, you have a file in tomcat as: WEB-INF/classes/com/ponyprinting/web/manager/UploadForm.class ? Yep. WEB-INF/classes/com/ponyprinting/web/manager/forms/UploadForm.class ...just to be precise. Thanks, -Sasha On 12/1/03 6:27 PM, David Friedman [EMAIL PROTECTED] wrote: Just to be explicit, you have a file in tomcat as: WEB-INF/classes/com/ponyprinting/web/manager/UploadForm.class ? Regards, David -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: Monday, December 01, 2003 7:22 PM To: Struts Users Mailing List Subject: Re: Error creating form bean Attention Todd Thorner! :-) It look like you had very similar problem, but I saw no replies to your post. Did you ever get this fixed: http://www.mail-archive.com/[EMAIL PROTECTED]/msg86103.html I'm working under an extreme deadline, please help :-( - Howdy, I'm having a bizarre problem with a new ActionForm I've just created: when I hit a jsp that uses this form, the RequestUtils say there's an error creating form bean of my class. 2003-12-01 17:01:33,432 [Thread-2] ERROR org.apache.struts.util.RequestUtils Error creating form bean of class com.ponyprinting.web.manager.UploadForm java.lang.ClassNotFoundException: com.ponyprinting.web.manager.UploadForm The class file is there (I checked the build directory that tomcat's being pointed to for docBase of my web app). And it obviously compiled fine. Sigh. It's the little problems that take up 80% of the time :-( Please help! Thank you, -Sasha Borodin - 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: Error creating form bean
And I think you just found my problem - it was a small typo: In struts-config, I had: type=com.ponyprinting.web.manager.UploadForm / Instead of: type=com.ponyprinting.web.manager.forms.UploadForm / Thanks a lot David! Sorry to bother the list with such a stupid mistake. But when you've been looking at something for 15 hours... -Sasha On 12/1/03 6:38 PM, Sasha Borodin [EMAIL PROTECTED] wrote: Just to be explicit, you have a file in tomcat as: WEB-INF/classes/com/ponyprinting/web/manager/UploadForm.class ? Yep. WEB-INF/classes/com/ponyprinting/web/manager/forms/UploadForm.class ...just to be precise. Thanks, -Sasha On 12/1/03 6:27 PM, David Friedman [EMAIL PROTECTED] wrote: Just to be explicit, you have a file in tomcat as: WEB-INF/classes/com/ponyprinting/web/manager/UploadForm.class ? Regards, David -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: Monday, December 01, 2003 7:22 PM To: Struts Users Mailing List Subject: Re: Error creating form bean Attention Todd Thorner! :-) It look like you had very similar problem, but I saw no replies to your post. Did you ever get this fixed: http://www.mail-archive.com/[EMAIL PROTECTED]/msg86103.html I'm working under an extreme deadline, please help :-( - Howdy, I'm having a bizarre problem with a new ActionForm I've just created: when I hit a jsp that uses this form, the RequestUtils say there's an error creating form bean of my class. 2003-12-01 17:01:33,432 [Thread-2] ERROR org.apache.struts.util.RequestUtils Error creating form bean of class com.ponyprinting.web.manager.UploadForm java.lang.ClassNotFoundException: com.ponyprinting.web.manager.UploadForm The class file is there (I checked the build directory that tomcat's being pointed to for docBase of my web app). And it obviously compiled fine. Sigh. It's the little problems that take up 80% of the time :-( Please help! Thank you, -Sasha Borodin - 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]
Types supported by DynaActionForm (or DynaValidatorForm)
OK, in the Struts manual, it says: The types supported by DynaActionForm include: - java.sql.Date - java.sql.Time - java.sql.Timestamp ...(among others)... What does supported mean though? Cause if I try to specify a java.sql.Date field in my form in struts-config: form-bean name=commissionReport type=org.apache.struts.validator.DynaValidatorForm form-property name=payDate type=java.sql.Date/ /form-bean ...and then submit a form, I get a ConversionException: org.apache.commons.beanutils.ConversionException at org.apache.commons.beanutils.converters.SqlDateConverter.convert(SqlDateConv erter.java:162) And upon searching the archives, I found suggestions to use SimpleDateFormat to do convert Strings--Dates manually. So what does support mean? Is there any automated (non-custom) way to do this, so I can just say (Date) dynaForm.get('dateField') :-) Thanks! -Sasha Borodin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dallas struts user groups?
Are there any struts groups in the area? Or at least java web development groups that anyone knows of, or is a part of? Thanks, -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: more than one condition using logic tags...
Or you could use the JSTL conditional tag: c:if test=${condition1 AND condition2 AND condition3} your html /c:if -Sasha On 10/29/03 09:43, Jeff Kyser [EMAIL PROTECTED] wrote: sure - just nest them. On Wednesday, October 29, 2003, at 09:38 AM, [EMAIL PROTECTED] wrote: Hello, I asked this before - Is it possible to have more than one condition using struts logic tags...like If A B C then { do something... } how to achieve this in the jsp using logic tags? Please 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: far reaching db question
You could use a PreparedStatement, which automatically escapes single quotes, I believe: String sqlStmt = INSERT INTO table1 (col1) VALUES (?); pstmt = con.prepareStatement(sqlStmt); pstmt.setString(1, someStringWhichMightHaveQuotes); rs = pstmt.executeQuery(); HTH, -Sasha On 10/24/03 09:42, Manuel Lenz [EMAIL PROTECTED] wrote: I create DB-Inserts from my struts application. But If an user types in the sign ' any dynamicly created inserts fail. This ist because of the sql-syntax which divides the string which will be saved with '. For example: insert into table test (name, number) values ('mr burns', '01723256477'); How can I handle inserts in html-formulars which have the typed sign ' ? Greetings, Manuel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OT - book on Java patterns
All this talk lately of various official patterns has my brain hurting from the Unknown again. Can anyone recommend a good book on *patterns* - business delegate, visitor, dao, etc. etc. etc. Thanks, -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Keeping Actions clean - separating actions from business model from persistence
Ted, Matt, Joe, and all the other helpful folks that chimed in earlier on persistence mechanisms: In trying to keep with best practices, I've managed to remove all model related code (business logic, and persistence) out of the Actions' execute() method. Now I'd like to take it one step further and decouple the business model classes from the implementing persistence technology (btw, settled on OJB for now :). From Joe's post, it seems like the DAO pattern is called for to accomplish this. My (slightly off topic) question is this: who develops their own DAO framework (like the dao and dao factory interfaces), and who uses a 3rd party framework (like iBATIS's Database Layer) and why? There was something mentioned about the discovery of the persistence mechanism as well... Any references to webpages/books would be appreciated. BTW, I've been shamelessly posting to this list questions that are probably better directed elsewhere. What would be a more appropriate list? Thank you, -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Keeping Actions clean - separating actions from business model from persistence
Matt, thanks for your quick feedback. I use my own framework because I don't know any better. public abstract class DaoManager { public abstract IRecordDao createDao(Connection conn, String daoClassName) throws DaoException; Which tier calls your DaoManager? It seems from your code that the caller of DaoManager is responsible to knowing the database configuration information, as well as the implementing DAO class. Is it the Action? In other words, who orchestrates the interaction of business and dao classes? Does the action instantiate a business class and populate it from your ActionForm, then get a dao instance from a factory, and pass it the business class? Or is there another pattern to this? Thanks. Matt -Sasha - Original Message - From: Sasha Borodin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 10, 2003 6:44 PM Subject: Keeping Actions clean - separating actions from business modelfrom persistence Ted, Matt, Joe, and all the other helpful folks that chimed in earlier on persistence mechanisms: In trying to keep with best practices, I've managed to remove all model related code (business logic, and persistence) out of the Actions' execute() method. Now I'd like to take it one step further and decouple the business model classes from the implementing persistence technology (btw, settled on OJB for now :). From Joe's post, it seems like the DAO pattern is called for to accomplish this. My (slightly off topic) question is this: who develops their own DAO framework (like the dao and dao factory interfaces), and who uses a 3rd party framework (like iBATIS's Database Layer) and why? There was something mentioned about the discovery of the persistence mechanism as well... Any references to webpages/books would be appreciated. BTW, I've been shamelessly posting to this list questions that are probably better directed elsewhere. What would be a more appropriate list? Thank you, -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How To Work Out This Action Mapping?
I think you may be doing two things wrong: 1. j_security_check is a special URL. If you have a security realm defined in your web application, and authentication method specified as FORM, then the container will automatically forward any requests for protected resources to a configurable login form. This login form collects the username and password, and posts to this special URL; the post to j_security_check gets intercepted by your servlet container, which performs Container Managed Authentication - it looks for the j_username and j_password, authenticates the combination, and forwards to the originally requested resource, or to a configurable error page if the authentication fails. All this to say that you can not map an action to j_security_check. Furthermore, you can't even aggressively authenticate using CMA (Container Managed Authentication) - if you go directly to your login page (without being forwarded there by you container), and try to submit the form, you'll get an error. 2. If you were trying to map a legitimate URL, then you'd have your action properties wrong. action path=/someLegitimatePath type=your.action.class name=name of a previously defined ActionForm if needed for this action /action HTH, -Sasha On 10/10/03 20:21, Caroline Jen [EMAIL PROTECTED] wrote: Because there is such a statement (shown below) in my signinForm.jsp: html:form action=j_security_check method=post focus=j_username I put action name=j_security_check path=/do/admin/Menu/ in my struts-config.xml file. When I ran the application, I got: [ServletException in:/article/content/signinForm.jsp] Cannot retrieve mapping for action /j_security_check' I know that I did not specify the action properly. What is the correct way to do it? __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.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: Keeping Actions clean - separating actions from business model from persistence
What I'm trying to grasp is where it it best for the business object --- dao interaction to take place. OK, let's make an example, cause I'm having trouble thinking abstractly tonight... An online store customer selects several products, clicks check out, which calls a CheckOutAction. From there: 1. The CheckOutAction retrieves a Customer and a List of Product's from the session; it creates an Order out of those components; it then calls placeOrder(Order) on a Store business class. 2. Store.placeOrder(Order) saves the Order to persistent storage; then uses an Emailer business class to emailOrderConfirmation(Order). --now the question: 1. Which component is responsible for discovering the DaoManager, retrieving the OrderDao from that manager, and telling the dao to save()? Is it: a. the Store.placeOrder() method? -or- b. the Order business object itself? Is it the business entity object's responsibility to discover and use its dao's, or that object's *user's* responsibility? Matt, you seem to forgo business entity classes and create DAO's right in your action, passing those to business use case classes... Mahesh, your business use case components seem to be the ones responsible for discovering the right DaoManager implementation, and retrieving the needed DAO classes... Anyone make the business entity classes themselves responsible for finding and using their respective dao's (say, when an Order is issued a save() command)? Thanks for all your input! -Sasha On 10/10/03 20:25, Sgarlata Matt [EMAIL PROTECTED] wrote: I have a 4 tier architecture. PRESENTATION TIER - Struts - Action classes BUSINESS TIER - Business Objects INTEGRATION PERSISTENCE TIER - DAO Manager - DAOs - Other database access mechanisms (I do some JDBC using a fancy home-grown SQL building mechanism when dealing with particularly complex queries) RESOURCE TIER - Databases - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Page flow dependence on html:error(s)/
A common scenario I've encountered is that some check made in an action's execute() method correlates to what needs to be displayed in the view. But how can I control page flow (i.e. this section of page gets displayed, this one doesn't) based on the accumulated ActionError's? Right now, I check-for/add error once in the action's execute(), then use html:error/ tag to display error (if any), then perform the same check AGAIN via c:if to determine the page flow. Just wondering if there's a good way to use the ActionErrors object for this purpose. Thanks for your help. -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
EJB's vs. Hibernate vs. Torque vs. custom DTO's
I hope I'm not comparing apples and oranges; if I am, please excuse the ignorance, and slap me upside the head... The subject line says it all - I'm investigating the appropriate uses of the above technologies to move data between databases and objects. Thus far in my development career, I've relied on my own DTO's - homegrown primitive lazy loading, caching, etc. As I'm starting projects for other companies, I'm realizing that no one wants home-grown solutions where standards and proven products have already filled the niche. Thus, I'd like to get some opinions as to the level of complexity and appropriate use of EJBs and other object-relational bridging technologies. Who uses what, why, and where? :-) -Sasha Borodin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OT - estimating man-hours for a development project
To follow up my 'pricing structure' question of earlier this week... How do the pro's estimate the amount of time a particular project will take? I know you'll say 'experience'. But is there any kind of a rough formula? How much do you usually pad your estimate to take into account any unexpected turns? I understand this is subjective and based on many factors. Again, I'm just looking for a starting point. Thank you, -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OT - how much to java web developers charge?
I though this would be an appropriate group of people to ask: What is the industry-standard compensation structure/level for java web application development? Like if a company said they need a shopping cart e-store, and the developer has to design the database, beans, actions, jsp's, etc.? Do the professionals charge per hour? If so what's the range? Or by the size of the project? Thanks for any insight. -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT - how much to java web developers charge?
I'm really just trying to understand the per/hour vs. per/project difference. But... -I'm in Dallas, TX -I'd be working for myself -I've got 3 medium sized projects under my belt with java, much more with other web-app technologies. The problem is that these clients are medium-size businesses; they aren't offering a rate, it's up to me to tell them how much I charge, what they can expect the total to come out to, etc. Being new to *paid* work ;-) I'm just trying to understand what's reasonable. -Sasha From: Andrew Hill [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 29 Sep 2003 23:12:46 +0800 To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: OT - how much to java web developers charge? Another shopping cart? ye gods. Im surprised sun havent made it a primitive: private shoppingcart _bob; public shoppingcart getBob() {... It also rather depends on whether you are a highly experienced developer with a portfolio of previous contract successes or a lowly salaried keyboard monkey trying in vain to escape the cube farm. Rates and prices do vary considerably between regions. The rate in California for example is unlikely to be the same as the rate in London and certainly not the same as the rate in Chennai. You may want to give a bit of info on where you are and such like. Over here I reckon a new contractor would be lucky to find anything over $2k a month (1.1k US) for something as ordinary as a shopping cart now that the economy has gone up a certain creek without a manual propulsion aid... (Thats being a slave to a bodyshop. Trying to contract on your own? hehe good luck...) -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Monday, 29 September 2003 22:39 To: 'Struts Users Mailing List' Subject: RE: OT - how much to java web developers charge? It really depends on what clients are willing to pay. In Denver, the going rate for Java Developers is 45-55 hour. A few years ago, it was easy to get 75-100/hour. Times a changin'. HTH, Matt -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: Monday, September 29, 2003 8:24 AM To: Struts Users Mailing List Subject: OT - how much to java web developers charge? I though this would be an appropriate group of people to ask: What is the industry-standard compensation structure/level for java web application development? Like if a company said they need a shopping cart e-store, and the developer has to design the database, beans, actions, jsp's, etc.? Do the professionals charge per hour? If so what's the range? Or by the size of the project? Thanks for any insight. -Sasha - 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: OT - how much to java web developers charge?
Thanks for the suggestions so far. -Sasha From: Andrew Hill [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 29 Sep 2003 23:12:46 +0800 To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: OT - how much to java web developers charge? Another shopping cart? ye gods. Im surprised sun havent made it a primitive: private shoppingcart _bob; public shoppingcart getBob() {... It also rather depends on whether you are a highly experienced developer with a portfolio of previous contract successes or a lowly salaried keyboard monkey trying in vain to escape the cube farm. Rates and prices do vary considerably between regions. The rate in California for example is unlikely to be the same as the rate in London and certainly not the same as the rate in Chennai. You may want to give a bit of info on where you are and such like. Over here I reckon a new contractor would be lucky to find anything over $2k a month (1.1k US) for something as ordinary as a shopping cart now that the economy has gone up a certain creek without a manual propulsion aid... (Thats being a slave to a bodyshop. Trying to contract on your own? hehe good luck...) -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Monday, 29 September 2003 22:39 To: 'Struts Users Mailing List' Subject: RE: OT - how much to java web developers charge? It really depends on what clients are willing to pay. In Denver, the going rate for Java Developers is 45-55 hour. A few years ago, it was easy to get 75-100/hour. Times a changin'. HTH, Matt -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: Monday, September 29, 2003 8:24 AM To: Struts Users Mailing List Subject: OT - how much to java web developers charge? I though this would be an appropriate group of people to ask: What is the industry-standard compensation structure/level for java web application development? Like if a company said they need a shopping cart e-store, and the developer has to design the database, beans, actions, jsp's, etc.? Do the professionals charge per hour? If so what's the range? Or by the size of the project? Thanks for any insight. -Sasha - 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]
struts-faces
Can someone tell me why I'd need a struts integration version of the JSF implementation? Why can't one just add the RI JAR files, TLD documents, config files and just starting using the tags? Thanks, -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts-faces
Thanks Craig. You can, but the integration library lets you use Struts Actions on the back end, creates form beans automatically, and so on. Reading through Sun's Web Services Tutorial section on JSF, things are starting to come into focus: JSF provides functionality that overlaps that of Struts (my misconception was that JSF was strictly a UI component tag library). .: Anyone know of a resource that summarizes/contrasts solutions provided by both frameworks? i.e.: -UI Components -controller components -model components -Page Flow -etc. Thanks, -Sasha From: Craig R. McClanahan [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Tue, 16 Sep 2003 10:16:22 -0700 (PDT) To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: struts-faces On Tue, 16 Sep 2003, Sasha Borodin wrote: Date: Tue, 16 Sep 2003 11:30:40 -0500 From: Sasha Borodin [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: struts-faces Can someone tell me why I'd need a struts integration version of the JSF implementation? Why can't one just add the RI JAR files, TLD documents, config files and just starting using the tags? You can, but the integration library lets you use Struts Actions on the back end, creates form beans automatically, and so on. Thanks, -Sasha Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts-faces
Great website, thanks James! -Sasha From: James Holmes [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Tue, 16 Sep 2003 15:10:36 -0400 To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: struts-faces Hi Sasha, I don't have a specific resource in mind for you to look at, but I have compiled the most comprehensive listing of Java Server Faces resources on my website. http://www.jamesholmes.com/JavaServerFaces/ Hope that helps, -James -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 12:35 PM To: Struts Users Mailing List Subject: Re: struts-faces Thanks Craig. You can, but the integration library lets you use Struts Actions on the back end, creates form beans automatically, and so on. Reading through Sun's Web Services Tutorial section on JSF, things are starting to come into focus: JSF provides functionality that overlaps that of Struts (my misconception was that JSF was strictly a UI component tag library). .: Anyone know of a resource that summarizes/contrasts solutions provided by both frameworks? i.e.: -UI Components -controller components -model components -Page Flow -etc. Thanks, -Sasha From: Craig R. McClanahan [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Tue, 16 Sep 2003 10:16:22 -0700 (PDT) To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: struts-faces On Tue, 16 Sep 2003, Sasha Borodin wrote: Date: Tue, 16 Sep 2003 11:30:40 -0500 From: Sasha Borodin [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: struts-faces Can someone tell me why I'd need a struts integration version of the JSF implementation? Why can't one just add the RI JAR files, TLD documents, config files and just starting using the tags? You can, but the integration library lets you use Struts Actions on the back end, creates form beans automatically, and so on. Thanks, -Sasha Craig - 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: What's the best strategy to handle this kind of thread issues ?
Consider this timeline as a possible solution: 1. Form is submitted, token is invalidated. 2. Form submitted again; error cause token is invalid; sit there and check lost and found for HttpServletResponse that original request will generate and leave there. 3. Request A is processed and response generated. 4. IOException thrown, HttpServletResponse saved in a lost and found. 5. Second request finally finds the HttpServletResponse in the lost and found, and returns that to the browser. This way, there's no duplicate records in the database, and the origian requests's response is returned for any subsequent (stupid user!) submits. The only design that's gotta be done is this global lost and found where responses are left and picked up. Comments? -Sasha From: Jing Zhou [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Wed, 10 Sep 2003 11:23:47 -0500 To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: What's the best strategy to handle this kind of thread issues ? - Original Message - From: Mainguy, Mike [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, September 10, 2003 9:14 AM Subject: RE: What's the best strategy to handle this kind of thread issues ? I think, however that this proposed solution (almost) entirely defeats the purpose of having a multithreaded environment. If you try and synchronize all responses and disregard duplicates, you will most likely end up with a slow and cumbersome application. Swing takes advantages of multithreaded environments. But its event handling model does use single thread to execute queued events. Such mechanism does not cause slow responses at all, both in theory and in reality. How to get it done in web tiers is an open challenging. my $.02 Jing I would say to achieve the sort of efficiencies you are describing one would be better served to look into the app/web server code. Doing this at a servlet level will most likely just get one into a big mess. It actually seems like a good idea (if it isn't already there) for a caching proxy or appserver, but certainly not a web application. Just my $.02 -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2003 4:18 AM To: Struts Users Mailing List Subject: RE: What's the best strategy to handle this kind of thread issues? My undertsanding was that the browser will only show the response to the the second of the requests - forgetting about the first. The server of course hasnt forgetten about it and keeps processing (one hopes). Im not quite sure what happens to its response stream (null?) but the browser is now only waiting for the second requests response - which I presume is a seperate connection? Now if we are using tokens or some such mechanism to detect that its a second request and thus illigitimate then we can of course return some kind of error to the user instead of processing the request (since we know its already been processed). This however isnt very friendly. What we really want to do is to have the second request return the same response as would have been returned by the first request after it did its work. I have no practical solution for this :-( Hmm. Actually I have an idea. Not a good one, but maybe worth a passing thought: (Thinking off the top of my head here btw (and the following will not work in a distributed environment unless one has sticky sessions so that all requests for a particular session are gauranteed to be processed by the same JVM)): 0. Requests A,B,C,N come in in rapid succession and cause threads to be started in the container to process the requests - probably but not necessarily in the order they came in. 1. Thread B (or any other thread) is lucky enough to start running first and. Synchronizing on some global object (probably its own Class object if its a singleton) it checks the session for a token (under a key that was generated earlier and submitted as a request param in a hidden field). Not finding it, it creates it and stores it in the session, and proceeds to marshall the data needed to render a response - whatever it is the action is supposed to actually do. 2. Threads A,C,N also sync on the global object and check the session. Unlike thread B, they find the token, so they all call wait() on the token object. 3. Having doing the processing read/updated the db (or whatever), and obtained the necessary info, etc... Thread B is finally ready to render a response. It doesnt know however if it is the 'lucky last' thread that the browser is actually waiting for. What it does then is to add the necessary information to render the response to the session (perhaps the token could provide getters for it?), and having done so it calls notifyAll() on the token object, and then proceeds itself to
How to reset servlet in ActionForm
I'm really at my wit's end on this, I can't believe no one's ran into this problem before... How does one reset the servlet transient variable of an ActionForm? It's null after serialization. And why does the programmer have to do this? -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: basic struts question...
If your context root is /taglib, then you should specify the action mapping relative to this root - /jsp/submit. -Sasha From: Pady Srinivasan [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Tue, 2 Sep 2003 15:34:54 -0400 To: [EMAIL PROTECTED] Subject: basic struts question... If I have an action-mapping defined as action-mappings actionpath=/taglib/jsp/submit type=com.heroix.firenze.webui.actions.TabChangeAction forward name=success path=/jsp/tiles_insert.jsp/ /action /action-mappings When I access http://myserver/taglib/jsp/submit.do I get an error Invalid path /jsp/submit was requested. My web.xml does have *.do mapped to ActionServlet. What am I doing wrong ? Thanks -- pady [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Resetting ActionForm transient props
From Struts release notes 1.1 b1: The ActionForm class is now truly serializable, because the two non-serializable instance variables (servlet and multipartRequestHandler) have been made transient. However, if you actually do serialize and deserialize such instances, it is your responsibility to reset these two properties. 1. Seems like this sould be the job of the framework; is there a reason that it's left up to the developer? 2. Where would I place the reset code in the ActionForm...constructor/reset/etc.? Thanks, -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Formatting form data inside the *view* (JSP's)
That's what I use when just outputting the contents of a bean; but I'm trying to format the data in form fields. If I can't combine html:text and bean:write (or JSTL's fmt:format) tags, is there another way to achieve this? Thanks, -Sasha On 8/27/03 11:17, Steve Raeburn [EMAIL PROTECTED] wrote: The Struts bean:write tag offers a format attribute (or formatKey if you want to use a resource file). But JSTL would be a better option if you can use it in your environment. Steve http://www.ninsky.com/struts/ -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: August 27, 2003 8:43 AM To: Struts Users Mailing List Subject: Formatting form data inside the *view* (JSP's) Thought I'd throw this out in the middle of the week again... Kind of a conceptual question: how do you format Dates, Numbers, Currencies, etc. for *form fields* inside the JSP? I know I could do in in the ActionForm getters, but: 1. I don't know the locate of the user at that point 2. I'd have to recompile the ActionForm every time I want to make a change to the *view* - seems like a bad practice. What I'm looking to achieve is something similar to fmt:format JSTL tag, where you can specify a format mask, or even a format style defined elsewhere. Thanks, -Sasha On 8/22/03 12:30, Sasha Borodin [EMAIL PROTECTED] wrote: I would like to state a basic assumption I deduced in learning struts, then pose a question. Assumption: ActionForm property getters and setters should return and take Strings. My initial impulse was to try passing the actual data types (Dates, Numbers, etc.); however, the Struts mechanism seems to pass Strings to the ActionForm setter methods on form submission (which throws a conversion Exception of course). Then I tried making the setters take Strings, and getters return the actual data types, but this seemed to confuse the introspection mechanism; plus I didn't see any way to apply formatting inside the html:text tags (like you can in JSTL's fmt:format tags). Question: How does one handle formatting data (custom formatting or i18n) for (pre/re)population of a form? Ex.: An update form; a user's information is loaded from the database into classes (Strings, Dates, Numbers, etc.). If you want to format this data, you have to do it in the Model, as the ActionForm only takes and gives Strings - which seems to be a Bad Practice. Even if you had additional special setters for the explicit purpose of populating the ActionForm from original data types, you still don't know what Locale the client is from. Is my assumption incorrect? Is there a basic flaw in my understanding of the use of ActionForm? Or there an actual short-coming, and workaround? In short, How Can You Format Data For Strut's Form Tags Inside The Actual JSP :-) ? Thank you for any input. -Sasha - 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: Accessing MessageResources
Lars, Struts loads the property files you declared in struts-config into a class called PropertyMessageResources, then binds that object to the ServletContext; that's where bean:message tags get their data from. The functionality you're looking for (retrieving a collection of keys) is not part of the PropertyMessgeResources class, and there is no tag support for it (struts or JSTL). What I've done is load two copies of a properties file at startup: 1. Since it's declared in struts-config, one copy gets loaded by Struts into PropertyMessageResources, which can then be used by bean:message tags. 2. I also have a plug-in (which gets executed at startup) where I load my own copy of the properties file into a custom data structure (but you can use a simple HashMap), and bind it to ServletContext. I use the ResourceBundle.getBundle() mechanism to find and load the file. The first copy supports struts message tags. The second copy (my custom data structure) I can use to extract all or a range of keys/values, sort keys/values, and other more complex tasks. I've also written methods to return a Collection of Map.Entry's to feed to html:optionsCollection, and other goodies for the html tag lib. -Sasha On 8/28/03 8:52, Lars Bergström [EMAIL PROTECTED] wrote: Hi, I would like to retrieve all message resource keys held by Struts read from my application.properties file. Not only for one proprety. What I am looking for is something like the method propertyNames in java.util.Properties. BR Lasse - 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]
ActionForm transient variables
I have not been able to use a reserialized ActionForm (ex. after restarting a context). Most methods (reset, validate, etc.) were throwing NullPointerExceptions. I have traced/researched the problem down to transient variables that aren't reinitialized. From Struts release notes 1.1 b1: The ActionForm class is now truly serializable, because the two non-serializable instance variables (servlet and multipartRequestHandler) have been made transient. However, if you actually do serialize and deserialize such instances, it is your responsibility to reset these two properties. My questions: 1. If this is not done automatically by struts, should it be done at all? Or am I trying to do something that's incorrect/unnecessary? 2. If ActionForms are made to be serialized (I tend to think so since the default scope of a form is session), could someone refresh me on how/where to reinitialize the transient variables after reserialization (specifically servlet and multipartRequestHandler)? Thank you very much. -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Formatting form data inside the *view* (JSP's)
Kris, Brandon: Thank you for your replies; I understand your code, and am able to access the form properties from within the JSP. My question is more about combining formatting tags (like bean:message and fmt:format with html:text and the like. I want to format the default values of form elements (the part that Struts automates). This is where I'm coming up short on ideas. Thanks, -Sasha On 8/27/03 23:53, Kris Schneider [EMAIL PROTECTED] wrote: Haven't tried this yet, but it's a bit more concise and should be equivalent: %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % jsp:useBean id=configHelper class=org.apache.struts.config.ConfigHelper/ c:set target=${configHelper} property=request value=${pageContext.request}/ c:set var=form value=${configHelper.actionForm}/ Brandon Goodin wrote: yes, you can use jstl to locate your form. then you can access it's properties via el and use the jstl tags for display. Here is the jsp code to accomplish this code start [EMAIL PROTECTED] prefix=c uri=/WEB-INF/tld/c.tld % c:set var=formName value=${requestScope['org.apache.struts.action.mapping.instance'].name}/ c:set var=formScope value=${requestScope['org.apache.struts.action.mapping.instance'].scope} / c:if test=${formScope=='request'} c:set var=form value=${requestScope[formName]} scope=request / /c:if c:if test=${formScope=='session'} c:set var=form value=${sessionScope[formName]} scope=request / /c:if --- code end --- I usually place this code in a jsp and include it my page when i need to expose the FormBean easily to the page. ex. jsp:include page=/jsp/common/form.jsp / Then i use the following syntax in my page: c:out value=${form.myValue}/ This would allow you to use all the jstl stuff to format values stored in your FormBean. Brandon Goodin -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 9:29 PM To: Struts Users Mailing List Subject: Re: Formatting form data inside the *view* (JSP's) That's what I use when just outputting the contents of a bean; but I'm trying to format the data in form fields. If I can't combine html:text and bean:write (or JSTL's fmt:format) tags, is there another way to achieve this? Thanks, -Sasha On 8/27/03 11:17, Steve Raeburn [EMAIL PROTECTED] wrote: The Struts bean:write tag offers a format attribute (or formatKey if you want to use a resource file). But JSTL would be a better option if you can use it in your environment. Steve http://www.ninsky.com/struts/ -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: August 27, 2003 8:43 AM To: Struts Users Mailing List Subject: Formatting form data inside the *view* (JSP's) Thought I'd throw this out in the middle of the week again... Kind of a conceptual question: how do you format Dates, Numbers, Currencies, etc. for *form fields* inside the JSP? I know I could do in in the ActionForm getters, but: 1. I don't know the locate of the user at that point 2. I'd have to recompile the ActionForm every time I want to make a change to the *view* - seems like a bad practice. What I'm looking to achieve is something similar to fmt:format JSTL tag, where you can specify a format mask, or even a format style defined elsewhere. Thanks, -Sasha On 8/22/03 12:30, Sasha Borodin [EMAIL PROTECTED] wrote: I would like to state a basic assumption I deduced in learning struts, then pose a question. Assumption: ActionForm property getters and setters should return and take Strings. My initial impulse was to try passing the actual data types (Dates, Numbers, etc.); however, the Struts mechanism seems to pass Strings to the ActionForm setter methods on form submission (which throws a conversion Exception of course). Then I tried making the setters take Strings, and getters return the actual data types, but this seemed to confuse the introspection mechanism; plus I didn't see any way to apply formatting inside the html:text tags (like you can in JSTL's fmt:format tags). Question: How does one handle formatting data (custom formatting or i18n) for (pre/re)population of a form? Ex.: An update form; a user's information is loaded from the database into classes (Strings, Dates, Numbers, etc.). If you want to format this data, you have to do it in the Model, as the ActionForm only takes and gives Strings - which seems to be a Bad Practice. Even if you had additional special setters for the explicit purpose of populating the ActionForm from original data types, you still don't know what Locale the client is from. Is my assumption incorrect? Is there a basic flaw in my understanding of the use of ActionForm? Or there an actual short-coming, and workaround
Re: Formatting form data inside the *view* (JSP's)
Jonathan, I like your system; if I understand it correctly, it automates conversion between Strings and other primitive data types. However, this formatting still takes place inside the ActionForm, not the JSP. I guess I've traditionally had a different view of best practice. To me, it seems appropriate to let the page designer dictate the format of Dates, Numbers, etc. If you ever want to change those formats, you've got to recompile the ActionForm; and if you want to have different formats using the same form, you'd be out of luck. Right? Thanks for taking the time to respond. All: Is the consensus to keep the formatting out of the JSP and in the ActionForm? That doesn't seem to jive...everything else (localized messages, regular bean values) have ways of being formatted inside the JSP. -Sasha P.S. I'm a bit puzzled that you say that you can't get the user's locale in your ActionForm. You're right, my mistake. On 8/27/03 23:51, Jonathan Lehr [EMAIL PROTECTED] wrote: Hi Sasha, An alternative approach would be to create a generic mechanism to populate the ActionForm with properly formatted string values. The idea here is to write a method that transfers values from a bean to an ActionForm, automatically applying default type conversion and formatting based on the bean's property types. Another method can be added to provide a way to override the default formatting behavior. I write about this subject extensively in my book Jakarta Pitfalls (Wiley). Chapter 2, ActionForms, begins with this problem and its solution. Later sections in the same chapter show how to extend the mechanism to automatically validate inbound request values (without the need for declarative specification), and then populate the JavaBean with converted values using the inverse of the formatting scheme. The value of this approach is that you don't have to encode the formatting logic in your JSPs at all. All the formatting code is in one place, and new JSPs automatically get the formatting behavior without adding any new code. It helps ensure consistency too, especially if you have a lot of pages/developers. A free, downloadable implementation is provided in the example solutions for Chapter 2, at http://www.wiley.com/compbooks/dudney/jakarta/index.html under the Chapters 2,3,4 link. I'm a bit puzzled that you say that you can't get the user's locale in your ActionForm. I would think you should be able to do something like this in your Action to get the locale and set it on the form instance: public ActionForward execute(...) { ... Locale currLocale = (Locale) request.getSession().getAttribute(Globals.LOCALE_KEY); form.setLocale(currLocale); ... } Jonathan -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: August 27, 2003 8:43 AM To: Struts Users Mailing List Subject: Formatting form data inside the *view* (JSP's) Thought I'd throw this out in the middle of the week again... Kind of a conceptual question: how do you format Dates, Numbers, Currencies, etc. for *form fields* inside the JSP? I know I could do in in the ActionForm getters, but: 1. I don't know the locate of the user at that point 2. I'd have to recompile the ActionForm every time I want to make a change to the *view* - seems like a bad practice. What I'm looking to achieve is something similar to fmt:format JSTL tag, where you can specify a format mask, or even a format style defined elsewhere. Thanks, -Sasha On 8/22/03 12:30, Sasha Borodin [EMAIL PROTECTED] wrote: I would like to state a basic assumption I deduced in learning struts, then pose a question. Assumption: ActionForm property getters and setters should return and take Strings. My initial impulse was to try passing the actual data types (Dates, Numbers, etc.); however, the Struts mechanism seems to pass Strings to the ActionForm setter methods on form submission (which throws a conversion Exception of course). Then I tried making the setters take Strings, and getters return the actual data types, but this seemed to confuse the introspection mechanism; plus I didn't see any way to apply formatting inside the html:text tags (like you can in JSTL's fmt:format tags). Question: How does one handle formatting data (custom formatting or i18n) for (pre/re)population of a form? Ex.: An update form; a user's information is loaded from the database into classes (Strings, Dates, Numbers, etc.). If you want to format this data, you have to do it in the Model, as the ActionForm only takes and gives Strings - which seems to be a Bad Practice. Even if you had additional special setters for the explicit purpose of populating the ActionForm from original data types, you still don't know what Locale the client is from. Is my assumption incorrect? Is there a basic flaw in my understanding of the use of ActionForm
Formatting form data inside the *view* (JSP's)
Thought I'd throw this out in the middle of the week again... Kind of a conceptual question: how do you format Dates, Numbers, Currencies, etc. for *form fields* inside the JSP? I know I could do in in the ActionForm getters, but: 1. I don't know the locate of the user at that point 2. I'd have to recompile the ActionForm every time I want to make a change to the *view* - seems like a bad practice. What I'm looking to achieve is something similar to fmt:format JSTL tag, where you can specify a format mask, or even a format style defined elsewhere. Thanks, -Sasha On 8/22/03 12:30, Sasha Borodin [EMAIL PROTECTED] wrote: I would like to state a basic assumption I deduced in learning struts, then pose a question. Assumption: ActionForm property getters and setters should return and take Strings. My initial impulse was to try passing the actual data types (Dates, Numbers, etc.); however, the Struts mechanism seems to pass Strings to the ActionForm setter methods on form submission (which throws a conversion Exception of course). Then I tried making the setters take Strings, and getters return the actual data types, but this seemed to confuse the introspection mechanism; plus I didn't see any way to apply formatting inside the html:text tags (like you can in JSTL's fmt:format tags). Question: How does one handle formatting data (custom formatting or i18n) for (pre/re)population of a form? Ex.: An update form; a user's information is loaded from the database into classes (Strings, Dates, Numbers, etc.). If you want to format this data, you have to do it in the Model, as the ActionForm only takes and gives Strings - which seems to be a Bad Practice. Even if you had additional special setters for the explicit purpose of populating the ActionForm from original data types, you still don't know what Locale the client is from. Is my assumption incorrect? Is there a basic flaw in my understanding of the use of ActionForm? Or there an actual short-coming, and workaround? In short, How Can You Format Data For Strut's Form Tags Inside The Actual JSP :-) ? Thank you for any input. -Sasha - 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: keys of MessageResources
There are no public methods that return a collection view of keys (I think this is what you want to get at). If you subclass PropertyMessageResources, you can write your own method to return the keys from the implementing HashMap. Then you'd need to write a new Factory for your PropertyMessageResources subclass. All in all, since I don¹t see a way to get at that Collection using struts or JSTL tags, it's not worth the work. I ended up creating a custom class to load and serve the same properties file, which I bind to the ServletContext on startup with a plug-in. This way you're still getting at the same properties file, but loaded into a more useful class. Email me if you want the source. -Sasha On 8/27/03 14:55, Gandle, Panchasheel [EMAIL PROTECTED] wrote: How to get keys of MessageResources of the properties file in the action class Panchasheel - 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: keys of MessageResources
Well, I do use the ResourceBundle mechanism to load the properties file. I think what Panchasheel was looking for is a method of *MessageResources* that returns a collection of keys. That way those properties files can be declared in struts-config and there's only one copy of them loaded at startup. I don't see any benefit to extending PropertyMessageResources, since there's not tag support for the additional functionality you'd add. The startup plug-in but was just to stress efficiency: even if you place your code in the ActionForm's constructor, the properties file would be reloaded every time the form is instantiated. I think it's better to load the file once, then retrieve the HashMap (or whatever Class you load the data into) from ServletContext. -Sasha P.S. Does no one have any thoughts on my Formatting form data inside the *view* (JSP's) post :-( On 8/27/03 16:52, Shane Mingins [EMAIL PROTECTED] wrote: Huh? Why not just do: // my file is called resources.properties ResourceBundle myResources = ResourceBundle.getBundle(resources, Locale.getDefault()); Enumeration enum = myResources.getKeys(); while (enum.hasMoreElements()) { String key = (String) enum.nextElement(); System.out.println(key = + key); } Shane -Original Message- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: Thursday, 28 August 2003 9:23 a.m. To: Struts Users Mailing List Subject: Re: keys of MessageResources There are no public methods that return a collection view of keys (I think this is what you want to get at). If you subclass PropertyMessageResources, you can write your own method to return the keys from the implementing HashMap. Then you'd need to write a new Factory for your PropertyMessageResources subclass. All in all, since I don¹t see a way to get at that Collection using struts or JSTL tags, it's not worth the work. I ended up creating a custom class to load and serve the same properties file, which I bind to the ServletContext on startup with a plug-in. This way you're still getting at the same properties file, but loaded into a more useful class. Email me if you want the source. -Sasha On 8/27/03 14:55, Gandle, Panchasheel [EMAIL PROTECTED] wrote: How to get keys of MessageResources of the properties file in the action class Panchasheel - 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: ActionForm null after context restart?
Howdy ya'll, I posted this Friday but no one's biting so far... Has anyone had problems with session-scoped ActionForms being null after (de)Serialization (context restart). I have confirmed that running myForm.reset(...) on my ActionForm after restart throws a NullPointerException via debugging filter I've got set up. As soon as I try to request either action that utilizes the ActionForm, I get problems. If I request the forward action (which just forwards to the jsp with form tags), I get this: begin log javax.servlet.ServletException: Exception thrown by getter for property applicationDateMin of bean org.apache.struts.taglib.html.BEAN end log applictionDateMin is the FIRST form element in my jsp. Suspicious? If I request the action that processes the submitted form, I get this: begin log java.lang.NullPointerException at com.amfllc.web.forms.SearchPipelineActionForm.reset(Unknown Source) end log Please see below for further details. Thank you for any help. -Sasha On 8/22/03 17:54, Sasha Borodin [EMAIL PROTECTED] wrote: I've been beating my head against this for a couple of days now, if someone can help me out, that would really make my weekend :-) I am having a problem with an ActionForm after restarting the context. Here's some details: 1. I have a jsp with struts form tags. 2. This form has an ActionForm associated with it. 3. One forward action that takes you to the jsp. 4. One custom action that processes the submission of this form (has action form declared in action-mapping in struts-config.xml) If I have a fresh session, and play around, the ActionForm is bound to the session as an attribute. Everything works fine. If I reload the context, everything appears to get Serialized successfully (I get no exceptions anywhere, there's a SESSIONS.ser file created in the work dir). If I check the session after reload, my ActionForm is once again listed as one of the attributes. -BUT- As soon as I try to request either action that utilizes the ActionForm, I get problems. If I request the forward action (which just forwards to the jsp with form tags), I get this: begin log javax.servlet.ServletException: Exception thrown by getter for property applicationDateMin of bean org.apache.struts.taglib.html.BEAN end log applictionDateMin is the FIRST form element in my jsp. Suspicious? If I request the action that processes the submitted form, I get this: begin log java.lang.NullPointerException at com.amfllc.web.forms.SearchPipelineActionForm.reset(Unknown Source) end log To a newbie like me, it looks like Struts wants to use the ActionForm bound to the session, but it's null after context restart for some reason. I've got a debugging filter set up that does some logging of request and session properties - that's how I know that the form is there in session. I've even gone as far as to check it for being null - it appears not to be == null. I've marked all the usual suspects transient (logger, etc.). What am I missing here? Thanks so much for any help. -Sasha - 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]
Formatting data for Struts form tags at the JSP layer - is thisright/possible?
I would like to state a basic assumption I deduced in learning struts, then pose a question. Assumption: ActionForm property getters and setters should return and take Strings. My initial impulse was to try passing the actual data types (Dates, Numbers, etc.); however, the Struts mechanism seems to pass Strings to the ActionForm setter methods on form submission (which throws a conversion Exception of course). Then I tried making the setters take Strings, and getters return the actual data types, but this seemed to confuse the introspection mechanism; plus I didn't see any way to apply formatting inside the html:text tags (like you can in JSTL's fmt:format tags). Question: How does one handle formatting data (custom formatting or i18n) for (pre/re)population of a form? Ex.: An update form; a user's information is loaded from the database into classes (Strings, Dates, Numbers, etc.). If you want to format this data, you have to do it in the Model, as the ActionForm only takes and gives Strings - which seems to be a Bad Practice. Even if you had additional special setters for the explicit purpose of populating the ActionForm from original data types, you still don't know what Locale the client is from. Is my assumption incorrect? Is there a basic flaw in my understanding of the use of ActionForm? Or there an actual short-coming, and workaround? In short, How Can You Format Data For Strut's Form Tags Inside The Actual JSP :-) ? Thank you for any input. -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActionForm null after context restart?
I've been beating my head against this for a couple of days now, if someone can help me out, that would really make my weekend :-) I am having a problem with an ActionForm after restarting the context. Here's some details: 1. I have a jsp with struts form tags. 2. This form has an ActionForm associated with it. 3. One forward action that takes you to the jsp. 4. One custom action that processes the submission of this form (has action form declared in action-mapping in struts-config.xml) If I have a fresh session, and play around, the ActionForm is bound to the session as an attribute. Everything works fine. If I reload the context, everything appears to get Serialized successfully (I get no exceptions anywhere, there's a SESSIONS.ser file created in the work dir). If I check the session after reload, my ActionForm is once again listed as one of the attributes. -BUT- As soon as I try to request either action that utilizes the ActionForm, I get problems. If I request the forward action (which just forwards to the jsp with form tags), I get this: begin log javax.servlet.ServletException: Exception thrown by getter for property applicationDateMin of bean org.apache.struts.taglib.html.BEAN end log applictionDateMin is the FIRST form element in my jsp. Suspicious? If I request the action that processes the submitted form, I get this: begin log java.lang.NullPointerException at com.amfllc.web.forms.SearchPipelineActionForm.reset(Unknown Source) end log To a newbie like me, it looks like Struts wants to use the ActionForm bound to the session, but it's null after context restart for some reason. I've got a debugging filter set up that does some logging of request and session properties - that's how I know that the form is there in session. I've even gone as far as to check it for being null - it appears not to be == null. I've marked all the usual suspects transient (logger, etc.). What am I missing here? Thanks so much for any help. -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variable assigning?
This is how I'd do it using JSTL: c:set var=prevName scope=request value=/ c:forEach var=person items=personlist c:if test=${person.name != prevName} c:out value=${person.name}/ /c:if c:set target=${prevName} value=${person.name}/ /c:forEach Hope this helps. -Sasha On 8/20/03 6:53, Terje Hopsø [EMAIL PROTECTED] wrote: Hello, I have a logic:iterate loop listing out a lists of name++. For each line the name is written but I want to write it only when I get a different name than previous line. I want to do it like this: c:set prevName = scope=request value=/ logic:iterate id=person name=personlist type=Person ??Compare prevName to name bean:write name=id property=name/ ?? somehow update prevName /logic:iterate I have tried but could not figure out how to do it. Is this possible? - Terje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: login request
You can use a filter to intercept all requests to a particular URL pattern and check for your object in session. A filter is similar to a servlet in that it's a piece of code that gets passed the request and response objects and operates on them; but it's invocation is unique, because it's called by the container before honoring the original request. You can write your own filter or use something like www.securityfilter.org Or, as Craig McClanahan wrote: subclass RequestProcessor and override one of the processXxx methods to perform this check for you. See his full post below. HTH, -Sasha Craig's post: If you have followed the recommended Struts design practice of flowing *all* requests through the controller servlet, then it's really easy to do this -- subclass RequestProcessor and override one of the processXxx methods to perform this check for you. If you have direct hyperlinks to JSP pages, then you can use a Filter if you're on a Servlet 2.3 or later container; otherwise, you're stuck having to modify your 60 pages. If you have to modify things anyway, you're strongly encouraged to follow the recommended design pattern and flow things through the controller, so you can do things like this in one place. Craig On 8/20/03 8:46, Andy Richards [EMAIL PROTECTED] wrote: Hi, i have created a form and a action which checks to see if a user exists in my database and if so a value object is placed into the session. What i am unsure of is how to a action called everytime a request is made? Can i configure struts-config.xml to send all requests via an action to see if this session object exists, and if not redirect the user to the login page? many thanks Andy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session expired
log.info(Entering LoginFilter.doFilter().); HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; HttpSession session = httpRequest.getSession(false); if(session != null) { log.info(Sending to log in...); httpResponse.sendRedirect(login.jsp); } else { log.info(Honoring request...); chain.doFilter(request, response); } log.info(Exiting LoginFilter.doFilter().); On 8/19/03 14:43, Mike Deegan [EMAIL PROTECTED] wrote: Sloan, Can you provide example code from com.symbol.mc.oms.servlet.SessionFilter Or is that asking too much ?? TIA, Mike - Original Message - From: Sloan Seaman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 12:17 PM Subject: Re: Session expired How about a filter? That is what I use. Anything within a certain path first gets checked by my filter and if the user doesn't have a valid session object it redirects them to the login page... This way the code doesn't even know it is happening... You define one in your web.xml like so: filter filter-nameSessionFilter/filter-name filter-classcom.symbol.mc.oms.servlet.SessionFilter/filter-class /filter filter-mapping filter-nameSessionFilter/filter-name url-pattern/app/*/url-pattern /filter-mapping This way anything within the /app dir goes through the filter first... - Original Message - From: Filip Polsakiewicz [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 8:12 AM Subject: RE: Session expired My problem is, that I already have something around 60 jsps. Now it would be nice to have a workaround so that i don't have to adapt all my jsps and actions. -Original Message- From: Kwok Peng Tuck [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 12:58 PM To: Struts Users Mailing List Subject: Re: Session expired What if you check from your action before redirecting to a jsp ? Filip Polsakiewicz wrote: Hi, is there any way to redirect y user to a jsp if the session is expired without checking for an expired session within each single jsp? Thanks, Filip - 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] This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PropertyMessageResources - have I outgrown it?
Thank you, this example is exactly what I was looking for. On 8/16/03 16:41, James Mitchell [EMAIL PROTECTED] wrote: You might also have a look at OJB. There is a DBMessageResources which allows you to swap out your properties files for a database table. The underlying data access is handled via OJB. This extension fully supports multiple keyed bundles and modules. It is open source and you can find it here: http://sourceforge.net/project/showfiles.php?group_id=49385release_id=15497 2 -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - Original Message - From: Sgarlata Matt [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, August 15, 2003 6:56 PM Subject: Re: PropertyMessageResources - have I outgrown it? You have definitely outgrown PropertyMessageResources ;-) You would be much better off with some sort of object-to-relational mapping tool. I use Torque, but I have heard a lot of talk about Hibernate on this list. Good luck, Matt - Original Message - From: Sasha Borodin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 15, 2003 6:38 PM Subject: PropertyMessageResources - have I outgrown it? Howdy, I'd like to pose a design question to the web-developers using Struts, concerning the functionality and proper usage of MessageResources. This is a really cool out of the box feature - I love the ease with which one can maintain libraries of messages, and the seamless integration of these resources with html:message tags. However, I've come across some functional requirements that I can's seem to negotiate without doing additional coding: 1. Getting message for a given key is great. But I'd like to be able to extract collections of keys - this way I can use these lists as not only lookup tables, but also the control lists - one place to maintain values/options for pull-down lists and other similar applications. Looking through the JavaDocs for MessageResources and PropertyMessageResources, I don't see this functionality; the implementing HashMap is protected, so I'd have to subclass; is using a custom sub-class of MessageResources supported in Struts (still being able to declare in struts-config, etc.)? 1. In other projects I'll eventually be migrating to Struts, the key/value pairs for numerous lists are stored in a database. Is there an existing variant of MessageResources, which can be declared in struts-config, which can be configured to extract messages out of a database (similar to DataSource realms in Tomcat)? In the future I'm foreseeing more and more customization needs (ex. Sorting and extracting the collection of keys, extracting a sub-set of the sorted keys, etc.). Giving the direction that I'm headed in, is MessageResources still an appropriate choice? Or should I move to some custom data structures, and settle for the less specialized bean-like access to them? Any other suggestions? Thanks in advance, -Sasha - 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]
PropertyMessageResources - have I outgrown it?
Howdy, I'd like to pose a design question to the web-developers using Struts, concerning the functionality and proper usage of MessageResources. This is a really cool out of the box feature - I love the ease with which one can maintain libraries of messages, and the seamless integration of these resources with html:message tags. However, I've come across some functional requirements that I can's seem to negotiate without doing additional coding: 1. Getting message for a given key is great. But I'd like to be able to extract collections of keys - this way I can use these lists as not only lookup tables, but also the control lists - one place to maintain values/options for pull-down lists and other similar applications. Looking through the JavaDocs for MessageResources and PropertyMessageResources, I don't see this functionality; the implementing HashMap is protected, so I'd have to subclass; is using a custom sub-class of MessageResources supported in Struts (still being able to declare in struts-config, etc.)? 1. In other projects I'll eventually be migrating to Struts, the key/value pairs for numerous lists are stored in a database. Is there an existing variant of MessageResources, which can be declared in struts-config, which can be configured to extract messages out of a database (similar to DataSource realms in Tomcat)? In the future I'm foreseeing more and more customization needs (ex. Sorting and extracting the collection of keys, extracting a sub-set of the sorted keys, etc.). Giving the direction that I'm headed in, is MessageResources still an appropriate choice? Or should I move to some custom data structures, and settle for the less specialized bean-like access to them? Any other suggestions? Thanks in advance, -Sasha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]