Inconstency in declaring log instance
Hi, What is the 'best practice' followed in declaring the class-wide log instance in Struts? LookupDispatchAction for example, doesn't have it declared explicitly since DispatchAction has a protected instance which it can use (and subsequently a subclass of LookupDispatchAction can use it as well). OTOH, MappingDispatchAction (a sibling of LookupDispatchAction and having similar functionality) has one declared explicitly and that is marked private. I was trying to figure out (and learn) the convention followed in declaring the scope of log instances in a framework like Struts (private, protected) and also, if protected, is there any design force that guides how they would be used in the subclasses or is it going to be purely need driven. Regards, Indrajit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT - book on Java patterns
As mentioned, Core J2EE Patterns 2d is quite good. The other key tests are Design Patterns and Patterns in Enterprise Architecture. We list such books here: http://jakarta.apache.org/struts/resources/related_books.html HTH, Ted. Sasha Borodin wrote: 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 -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Keeping Actions clean - separating actions from business model from persistence
First, I'd suggest studying the JPetstore3 application. http://www.ibatis.com/jpetstore/jpetstore.html It demonstrates a clean separate of concerns between the logical layers of an application. It also uses a DAO framework and shows how you can you easily switch between data persistence implementations. JP3 shows switching between a simple (JDBC) and remote (EJB) implementations, but you could also be switching between a memory-based model (like the Struts Mailreader Example) and OJB, or anything else. Quite neat. In my own current work, I use iBATIS DAO to switch between memory-based persistence (a hashmap) and a JBDC database. It works quite well, all I do is change a comment in a properties file. I'm using Commons Chain http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/chain/ to manage access to the business logic. The controller action calls a Command/Chain from the catalog using a logical name. I use the form name and the Command name, since the form name is also tied to validation, and validation is tied to what Command you are going to call. So the same token is used for all three constructs (Form, Validation, Command). Often, the Command is just a wrapper around a call to the DAO. Here's one for selecting a record by an id number: public boolean execute(Context context) throws Exception { CpuPermitDao dao = DaoConfig.getInstance().getCpuPermitDao(); CpuPermitContext ctx = dao.findByPermitNo(((CpuPermitContext) context).getPermitNo1()); if (null == ctx) return false; // couldn't find it context.putAll(ctx); return true; } The first line is the DAO discovery bit. DaoConfig is a singleton that uses a XML configuration to instantiate itself. Here's the bit that selects the DAO implementation: dao-factory dao name=CpuPermitDao implementation=${cpu-permit.impl} / !-- other factories here -- /dao-factory The XML configuration in turn can read in properties from a file, which is where the ${cpu-permit.impl} comes from them. This makes it quite easy to switch between implementations just by changing one line a properties file. The DAO class, findByPermitNo is responsible for fulfilling the findByPermitNo: public CpuPermitContext findByPermitNo(String permitNo) throws DaoException { return find(Tokens.CN_PERMIT_NO, permitNo, true); } Here, it just calls a more generic member of the DAO class, filling in the attribute name for permitNo. The find method does the actually persistence work: public CpuPermitContext find(String column, String equals, boolean sensitive) throws DaoException { return (CpuPermitContext) executeQueryForObject(Tokens.CPU_PERMIT_SELECT_COLUMN, select(column, equals)); } The executeQueryForObject method is where the rubber meets the road. This is a call to the iBATIs SqlMaps framework. It looks up the SQL query for CPU_PERMIT_SELECT_COLUMN, and fills in the replacement parameters using the value of the column parameter. In the Mock implementation, I can reuse the findByPermitNo method and just replace the find method: public CpuPermitContext find(String property, String equals, boolean sensitive) { List list = search(property, equals, sensitive); if (0 == list.size()) return null; return (CpuPermitContext) list.get(0); } public search(String property, String equals, boolean sensitive) { MockDatabase db = MockDatabase.getInstance(); Iterator i = db.keySet().iterator(); String match = Utils.conform(equals, sensitive); List list = new ArrayList(); while (i.hasNext()) { CpuPermitContext ctx = (CpuPermitContext) db.get(i.next()); if (match.equals(Utils.conform(ctx.get(property), sensitive))) list.add(ctx); } return list; } The key is to create a sensible, high-level API for your application, like this: public interface CpuPermitDao extends Dao { public CpuPermitContext findByPermitNo(String permitNo) throws DaoException; public CpuPermitContext findBySystemId(String systemId) throws DaoException; void insert(CpuPermitContext context) throws DaoException; public List listApplicants() throws DaoException; public List listByApplicantName(String applicantName) throws DaoException; public List listPermitNo() throws DaoException; void update(CpuPermitContext context) throws DaoException; } that you can instantiate for different persistance strategies. If some methods can be reused between strategies, you can isolate those in a base class. Each strategy can then implement whatever abstract methods are left. Essentially, this API interface *is* your application. The Actions are just adapters that ferry data between HTTP and your business layer. We're calling them DAOs, since that's the most common use. But, they are really API objects that may also access the persistence layer. Don't think of it as just
Re: Keeping Actions clean - separating actions from business mode l from persistence
Mahesh Joshi wrote: I have always wondered where is the best place to do connection management with the dataStore. Should the business Logic do connectionManagement (e.g. opening a connection (via a connection pool or otherwise)) or should that be the responsibility of the persistence layer. Doing it in the latter(PersistenceLayer) frees up the BusinessLayer of connection Mgt code. If you are implementing connectionpool, the overhead is the time to return the connection to the pool and get it back. The iBATIS DAO splits the difference and makes transaction management part of the logical DAO API. So you can specify different connection mechanisms at instantiation, and the implementating code does not need to know the details. The DAO implementation can just call high-level methods like startTransaction, commitTransaction, or rollbackTrnasction. This strategy limits what the implementaton needs to know about the connection management, but still lets the business logic determine what constitutes a transaction (which is often a business decision). -Ted. -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Keeping Actions clean - separating actions from business mode l from persistence
Would it be possible or at least usefull if the SQL objects in that example be used for the Form Beans and for the forms (using XForms). That would really cut don't the amount of work to a minimum Mike |-+ | | Ted Husted | | | [EMAIL PROTECTED]| | | g | | || | | 11/10/2003 11:13 | | | AM | | | Please respond to| | | Struts Users| | | Mailing List| |-+ --| | | | To: Struts Users Mailing List [EMAIL PROTECTED] | | cc: | | Subject: Re: Keeping Actions clean - separating actions from business mode l from persistence | --| Mahesh Joshi wrote: I have always wondered where is the best place to do connection management with the dataStore. Should the business Logic do connectionManagement (e.g. opening a connection (via a connection pool or otherwise)) or should that be the responsibility of the persistence layer. Doing it in the latter(PersistenceLayer) frees up the BusinessLayer of connection Mgt code. If you are implementing connectionpool, the overhead is the time to return the connection to the pool and get it back. The iBATIS DAO splits the difference and makes transaction management part of the logical DAO API. So you can specify different connection mechanisms at instantiation, and the implementating code does not need to know the details. The DAO implementation can just call high-level methods like startTransaction, commitTransaction, or rollbackTrnasction. This strategy limits what the implementaton needs to know about the connection management, but still lets the business logic determine what constitutes a transaction (which is often a business decision). -Ted. -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The information in this message is confidential and may be legally privileged. It is intended solely for the addressee; access to this email by anyone else is unauthorised. If you are not the intended recipient: (1) you are kindly requested to return a copy of this message to the sender indicating that you have received it in error, and to destroy the received copy; and (2) any disclosure or distribution of this message, as well as any action taken or omitted to be taken in reliance on its content, is prohibited and may be unlawful. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[FRIDAY] YA Stuts In Action Triva Quiz
Last time, we asked the immortal question: Open source developers don't make backups, they ... and received several very good answers: ... make branches. [Heya Gosper] ... know that a re-write every now and again is good for the design. [Adam Hardy] ... either create nonbreakable software or they love big time to work all night long when their application crashes. [Koni Roth] ... just keep a spare pair of trousers by their computer. [Adam Hardy] And, of course, the expected answer: ... they upload it via ftp and let the world mirror it, as attributed to Linus Torvalds. There were several entries of the expected answers. The winner arbitrary selected from these is ... Denis of BestWay.net As a special bonus, we also selected a winner from the unexpected answers ... Heya Gosper. * Denis and Heya, please send me your mailing addresses by private email to [EMAIL PROTECTED] NEXT: What famous (or perhaps infamous) computer scientist advises: When you've got a bug, don't fix it. Write another piece of code to recognize that it's about to happen and head it off. PLEASE be sure to reply to [EMAIL PROTECTED] The winner will be selected at random (or at least arbitrarily) from the correct responses. [The correct response being the one I expected =:)] The contest will run until Friday, October 17, 2003, 23:59:59, so everyone has a chance to participate. The lucky winner selected from the correct responses will receive a signed copy of Struts in Action. PLEASE be sure to reply to [EMAIL PROTECTED] If you have an interesting science fiction or computer science quote that is hard to google, please send it to me. The first to suggest a quote that we use also wins! -Ted. PLEASE be sure to reply to [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Keeping Actions clean - separating actions from business mode l from persistence
Allow maybe have a couple of generic actions that can save/retrieve and list these objects instead of having to write a action for each form. ie : instead of have to write a form bean/jsp page/edit action/search action/delete action etc.. you just create the xml sql object with some extra details like the search field/edit fields etc. and in you pageflows link the object to the correct type of action like edit/add/search and as these are standard action you do not need to code them? Mike |-+ | | Ted Husted | | | [EMAIL PROTECTED]| | | g | | || | | 11/10/2003 11:13 | | | AM | | | Please respond to| | | Struts Users| | | Mailing List| |-+ --| | | | To: Struts Users Mailing List [EMAIL PROTECTED] | | cc: | | Subject: Re: Keeping Actions clean - separating actions from business mode l from persistence | --| Mahesh Joshi wrote: I have always wondered where is the best place to do connection management with the dataStore. Should the business Logic do connectionManagement (e.g. opening a connection (via a connection pool or otherwise)) or should that be the responsibility of the persistence layer. Doing it in the latter(PersistenceLayer) frees up the BusinessLayer of connection Mgt code. If you are implementing connectionpool, the overhead is the time to return the connection to the pool and get it back. The iBATIS DAO splits the difference and makes transaction management part of the logical DAO API. So you can specify different connection mechanisms at instantiation, and the implementating code does not need to know the details. The DAO implementation can just call high-level methods like startTransaction, commitTransaction, or rollbackTrnasction. This strategy limits what the implementaton needs to know about the connection management, but still lets the business logic determine what constitutes a transaction (which is often a business decision). -Ted. -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The information in this message is confidential and may be legally privileged. It is intended solely for the addressee; access to this email by anyone else is unauthorised. If you are not the intended recipient: (1) you are kindly requested to return a copy of this message to the sender indicating that you have received it in error, and to destroy the received copy; and (2) any disclosure or distribution of this message, as well as any action taken or omitted to be taken in reliance on its content, is prohibited and may be unlawful. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JavaServer Faces
I have been triing to avoid this issue, but I can't help stick my foot in my mouth. Struts works but so do a lot of technologies. Struts is about the COMMUNITY. I have never been on a more supportive, active, relevant communitity of developers. As long as the community keeps producing stuff which is relevant to the community it will continue to be relevant. Edgar -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED] Sent: Friday, October 10, 2003 6:25 PM To: Struts Users Mailing List Subject: Re: JavaServer Faces Susan Bradeen wrote: Thank you, Craig, for the umpteenth time for saying this. Why are so many - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ot] Time format and time picking?
I would definitely use a javascript utility if it's allowed in the spec. Adds to user friendliness and saves a bit of validation hassle with locales / 12 or 24 hour clock etc. On the server side you should be able to set up a parser with a standard date/time pattern string that fits the javascript output. Adam On 10/10/2003 07:08 PM James Mitchell wrote: I don't recall any handy dandy utilities for time. Sure, there are plenty for dates, but I don't seem to recall that being requested very often or I just have missed it since it hasn't been a requirement in any of my latest projects. -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 770.822.3359 AIM:jmitchtx - Original Message - From: Mick Knutson [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 10, 2003 12:55 PM Subject: Re: [ot] Time format and time picking? No, I understand how to get the time correct, I am just hoping someone has a utility that will help me do this, as well as convert it back to 12 hour formatted time. Just so I don't have to re-invent the wheel. --- Thanks Mick Knutson The world is a playground...Play Hard, Play Smart. Visit http://www.YourSoS.com to learn how our Personal Emergency Alert Contact System can help you Play Smart. +00 1 (708) 570-2772 Fax MSN: mickknutson ICQ: 316498480 ICQ URL: http://wwp.icq.com/316498480 --- - Original Message - From: James Mitchell [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 10, 2003 9:38 AM Subject: Re: [ot] Time format and time picking? Add 12 to the hour. 8:30 AM == 830 8:30 PM == 2030 1:00 PM == 1300 ...is that what you wanted? -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 770.822.3359 AIM:jmitchtx - Original Message - From: Mick Knutson [EMAIL PROTECTED] To: struts [EMAIL PROTECTED] Sent: Friday, October 10, 2003 11:59 AM Subject: [ot] Time format and time picking? I need the ability to have a user choose their own Time. But, I can only seem to get 24 hour time to work. So, Either I need to find a JavaScript Time Chooser, or I need help to figure out how to convert the time (8:56PM) to the Military time. Any help on this? --- Thanks Mick Knutson -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RES: Struts and Tomcat JDBC Realms
On 10/10/2003 07:45 PM Michel Bertrand wrote: Tks for your answer. Now I understood what's happing (I hope so) ... I have a multipart/form-data and it has in its action a forward to a common text form, like: forward name=List redirect=true path=/list.do/ I believe when it reaches the redirect=true, Struts clear the request attributes and lost my user. So I have the authentication authorization problem that you advised me. Am I right ? I really need to have the parameter redirect because without it I have the MulpartIterator error. How could I workaround this situation ? Is possible to matain the user after the redirect ? And what about setting the roles for my actions ? I could simply do : action path=/upload type=com.ecommerce.album.PhotoUploadAction name=uploadForm scope=request validate=true role=user Here ? input=/album/upload.jsp Thanks in advance and regards ... Michel. I am still not sure what security mechanism you are using, but if you are working with tomcat's (or whichever server's) container-managed security, a user login will set up a session for the user with an ID, the user name and the user roles. These are accessible via the request or session object. They won't be lost if you do a redirect. The action mapping's role attribute will only work like your example above if you are using this. If you have a manually coded login module for security, it won't work. So your user object which you lose during a redirect is actually not something you can use for the struts authorization, only for your own purposes. You should set up your user object by getting the login name from the request as I mentioned above, and you should store it in the session, so it won't be lost between requests. Good luck, Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ugly ugly ugly
On 10/10/2003 11:09 PM Evan Schnell wrote: From my experience working with human translators this might be a better approach. Translators like to be able to manipulate word order and punctuation. It is a little more code but I'll argue that it is not any less readable. Most importantly it works with Struts links and will properly encode the URL: applicationResources.properties: message.benefits=The FedEx Custom Criticalnbsp;{0}nbsp;enables ... mainPage.shippingLinkName=Shipping Toolkit Put this at the top of the JSP: fmt:setBundle basename=com.nvisia.training.struts.resources.ApplicationResources/ bean:define name=stLink scope=page html:link action=/shipping bean:message key=mainPage.shippingLinkName/ /html:link /bean:define In the body of the jsp: fmt:message key=message.benefits param value=stLink/ /fmt:message Regards, Evan. Very elegant solution. -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
communication between control layer factory/model
I've been happy until now passing objects backwards and forwards between my actions and my factories, and occasionally a int with the number of updates or deletes done, for example, to include in the status messages I show to the user, and throwing exceptions for anything else. However I've just programmed a page with nested beans and the factory does the whole process in one transaction, covering three different operations which I would like to give three different status messages for. In brief it is the realm user admin page and the list of nested beans are users - on which the admin op can update the email address, reset the password or delete the user entirely. I want to tell the admin how many of each operation were done. I could either pass back an ActionMessages, but I don't want to mix struts into my factory layer, or I could pass back a string with different parts: # of email updates # of password resets # of deletions Which is not exactly elegant, since I have to tokenize it. Anybody got any better solutions? Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
pull-down menu item question
I have seen some pull-down menus in the past that have allowed there to be a prompt text displayed first when you look at the menu, but then a soon as you go to select an item, that prompt is no longer available. How does this work? Is this possible in struts? --- Thanks Mick Knutson The world is a playground...Play Hard, Play Smart. Visit http://www.YourSoS.com to learn how our Personal Emergency Alert Contact System can help you Play Smart. +00 1 (708) 570-2772 Fax MSN: mickknutson ICQ: 316498480 ICQ URL: http://wwp.icq.com/316498480 ---
Re: communication between control layer factory/model
How about the Commons MessageResources? http://jakarta.apache.org/commons/sandbox/resources/index.html We ported the message collection over there for precisely this reason. :) HTH, Ted. Adam Hardy wrote: I've been happy until now passing objects backwards and forwards between my actions and my factories, and occasionally a int with the number of updates or deletes done, for example, to include in the status messages I show to the user, and throwing exceptions for anything else. However I've just programmed a page with nested beans and the factory does the whole process in one transaction, covering three different operations which I would like to give three different status messages for. In brief it is the realm user admin page and the list of nested beans are users - on which the admin op can update the email address, reset the password or delete the user entirely. I want to tell the admin how many of each operation were done. I could either pass back an ActionMessages, but I don't want to mix struts into my factory layer, or I could pass back a string with different parts: # of email updates # of password resets # of deletions Which is not exactly elegant, since I have to tokenize it. Anybody got any better solutions? Adam -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles help please...
I am getting a bean into a tile that has a checkbox in it. I get the NAME of the checkbox, but I need to see if the value is on or off, then set the disabled flay in an html:img. But, I always get null errors. Can someone help please? tiles:useAttribute id=beanName name=property classname=java.lang.String ignore=true / tiles:importAttribute name=bean / bean:define id=isChecked name=bean property='%= beanName %' type=java.lang.String value= / % if( isChecked == null || !isChecked.equals( true ) ) { //isChecked = false; % html:img bundle=IMAGE_RESOURCES_KEY height=15 width=15 srcKey=default.checked / % } else { % html:img bundle=IMAGE_RESOURCES_KEY height=15 width=15 srcKey=default.unchecked / % } % --- Thanks Mick Knutson The world is a playground...Play Hard, Play Smart. Visit http://www.YourSoS.com to learn how our Personal Emergency Alert Contact System can help you Play Smart. +00 1 (708) 570-2772 Fax MSN: mickknutson ICQ: 316498480 ICQ URL: http://wwp.icq.com/316498480 ---
Re: communication between control layer factory/model
On 10/11/2003 04:31 PM Ted Husted wrote: How about the Commons MessageResources? http://jakarta.apache.org/commons/sandbox/resources/index.html We ported the message collection over there for precisely this reason. :) HTH, Ted. That seems to fit the spec perfectly! Thanks Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How To Work Out This Action Mapping?
Caroline Jen wrote: To answer your questions: 1. The LOGON button links to a forward: html:link forward=logonLOGON/html:link and in my struts-config.xml, I have forward name=logon path=/do/admin/Menu/ Well, that's the first problem ... security constraints are only applied on an original request from the client, not on a forward. You'll need to add redirect=true to this, in order to get the client to request it. 2. the security-constraint in my web-xml is: security-constraint web-resource-collection web-resource-nameAdministrative/web-resource-name !-- The URLs to protect -- url-pattern/do/admin/*/url-pattern /web-resource-collection auth-constraint !-- The authorized users -- role-nameadministrator/role-name role-namecontributor/role-name /auth-constraint /security-constraint By the way, there is another problem -- after the insertion of the security-constraint, the application totally stops functioning. No welcome page displayed. In the browser, I have HTTP Status 404 -/PracticeVersion description: The requested resource(/PracticeVersion) is not availabe. and in the Tomcat log file, I have: LifecycleException: Container StandardContext[/PracticeVersion] has not been started That means you did not obey the required element order in the web.xml file. You'll undoubtedly see a stack trace in the log files that talks about an XML parsing error. The correct order is defined by the DTD for web.xml files. Among other places, you'll find a copy of the DTDs for Servlet 2.2 and Servlet 2.3 in the lib directory of your Struts distribution. Open either web_app_2_2.dtd or web_app_2_3.dtd (depending on which version you're using) and look for the line that starts !ELEMENT webapp The list of element names in parentheses is the required order for elements in your own web.xml files. Thereafter, I deleted the security-constraint element from the web.xml file. I have the welcome page displayed. After I click on the LOGON button in the welcome page, the welcome page remains in the browser. The logon.jsp, which collects j-username, j_password, does not get displayed and http://localhost:8080/PracticeVersion/do/admin/Menu shows in the address bar. Change your forward to add redirect=true and put the security constraint in the correct order, and you should be good to go. --Caroline Craig --- Craig R. McClanahan [EMAIL PROTECTED] wrote: Caroline Jen wrote: Thank you very much for the detailed explanation. Yet, I still have hard time to make my application work -- I am able to display the welcome page (no problem). And I have http://localhost:8080/PracticeVersion/do/Menu;jsessionid=0A6E76A8F3E849BC8DAAC45BFB72F72E in the address bar. However, after I click on the LOGON button in the welcome page, the welcome page Where does this LOGON button submit to? If it submits to j_security_check, you are doing this wrong. It should submit to some resource that is protected by a security constraint. remains in the browser. The logon.jsp, which collects j-username, j_passwor, does not get displayed and http://localhost:8080/PracticeVersion/do/admin/Menu shows in the address bar. I do not know what went wrong. Could it be that the JDBCRealm is not configured correctly? Because the LOGON button links to a forward: html:link forward=logonLOGON/html:link and in my struts-config.xml, I have forward name=logon path=/do/admin/Menu/ The /do/admin/Menu is my protected resources. I keep it unchanged. It's only protected if it's listed in a security-constraint in web.xml. 1. I configured the Tomcat JDBCRealm and prepared the users table, user-roles table according the instructions found at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html Which Realm you use does not make any difference. 2. Because I want to use FORM based container managed authentication, I inserted login-config auth-methodFORM/auth-method form-login-config form-login-page/signin/logon.jsp/form-login-page form-error-page/signin/logon.jsp?error=true/form-error-page /form-login-config /login-config in the web.xml file. What does your security-constraint in web.xml look like? This is the critical ingredient. 3. I put logon.jsp in the ApplicationRoot/signin folder. Here is the code of the logon.jsp (I took out all the Struts tags) and I know the code works well because I have tested it: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTML HEAD TITLEContainer Managed Authentication/TITLE /HEAD BODY H1Sign in, Please/H1 HR FORM action=j_security_check method=post focus=j_username TABLE border=0 width=50% cellspacing=3 cellpadding=2 TR TH align=rightUser Name:/TH TD align=leftINPUT TYPE=text
Re: Inconstency in declaring log instance
Indrajit Raychaudhuri wrote: Hi, What is the 'best practice' followed in declaring the class-wide log instance in Struts? LookupDispatchAction for example, doesn't have it declared explicitly since DispatchAction has a protected instance which it can use (and subsequently a subclass of LookupDispatchAction can use it as well). OTOH, MappingDispatchAction (a sibling of LookupDispatchAction and having similar functionality) has one declared explicitly and that is marked private. I was trying to figure out (and learn) the convention followed in declaring the scope of log instances in a framework like Struts (private, protected) and also, if protected, is there any design force that guides how they would be used in the subclasses or is it going to be purely need driven. Best practice really depends on how fine-grained you want your logger names to be, so that you can individually manage the level of detail to be produced for that logger (which is controlled by the logger name). The typical convention on Struts and Commons code is to use the fully qualified class name of the containing class to be the logger name (that's what happens when you pass a Class to the getLog() method, but you can also pass a String). This leverages the fact that most logging systems allow you to specify hierarchical control over the logging detail level by specifying just the early part of the name. Consider the following log detail levels, which might show up in a JDK 1.4 logging.properties file: # Establish overall level for all Commons packages org.apache.commons.level = SEVERE # Establish overall level for all Struts packages org.apache.struts.level = INFO # I want to trace the RequestProcessor to figure out a problem org.apache.struts.action.RequestProcessor.level = FINEST When a class inherits the logger from its base class, that means they are also sharing the same logger name (the one from the base class), and you can't control the logging levels independently. But normally that is not a problem. (Note that the base class logger would need to be protected rather than private in order for it to be shared, just like any other base class variable.) Nothing at all *requires* you to use class names as logger names -- you can name the loggers whatever you want. Class names provide an easy way to avoid name clashes, but they don't help you as much if you've got more than one user of the same class, and you'd like to log differently for them. Or, you might want to have two or more different loggers in the same class. Or, you might want to share the same logger between all classes in a package. There's lots of options. I'd suggest starting with the logger-per-class paradigm and become familiar with tuning the logging of the classes individually. Then, you can look at tweaking things for particular needs. One note, however; if you decide to use a different convention (either locally to a few classes, or globally in your app), you should note the logger names you're using in the class Javadocs, so people using your classes know what logger names they can configure. Regards, Indrajit Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: communication between control layer factory/model
Adam Hardy wrote: On 10/11/2003 04:31 PM Ted Husted wrote: How about the Commons MessageResources? http://jakarta.apache.org/commons/sandbox/resources/index.html We ported the message collection over there for precisely this reason. :) HTH, Ted. That seems to fit the spec perfectly! One of the tasks along the 1.2 path is to make Struts itself use this package, in the same way that we use the beanutils and digester packages that were originally in org.apache.struts.util. Among other things, that means we all benefit when additional Resources implementations are created for different data sources (like one to read resources from a database). Thanks Adam Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How can I compute data for html:select choices?
Hi, I can't seem to understand how to declare things correctly to do what I want to do. Can anyone tell me where I am going wrong? I'm trying to use a simple Java method as the source of the choices in a html:select box in a form. The method returns a java.util.List, where each item is a org.apache.struts.util.ValueLabelBean object, just what I need for this. Here's one way I tried to use it: = %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=months property=value labelProperty=label / /html:select = The problem is that useBean looks up the attribute months in the page context, and since it can't find it, throws an exception. But without the useBean tag, the html:options tag can't find the data it needs. I've read the docs until my eyes hurt, and I can't find any technique to tell useBean to merely create a new bean, not fetch an existing one. This seems so easy, I can't believe I haven't done it before, but I can't find an example in any of my previous code. What am I missing? Thanks in advance... -- Bob Langford Silicon Masters Consulting, Inc.8207 Stone River Court, Richmond, VA 23235 phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I compute data for html:select choices?
Hi Bob, I think you could try bean:define/ or, better, JSTL tag c:set/. I'm not a JSTL expert but i know you can determine scope to be used by c:set/. And i'm not sure, but i think you can do that also with bean:define/. Hope it helped you. Regards, Daniel. --- Bob Langford [EMAIL PROTECTED] wrote: Hi, I can't seem to understand how to declare things correctly to do what I want to do. Can anyone tell me where I am going wrong? I'm trying to use a simple Java method as the source of the choices in a html:select box in a form. The method returns a java.util.List, where each item is a org.apache.struts.util.ValueLabelBean object, just what I need for this. Here's one way I tried to use it: = %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=months property=value labelProperty=label / /html:select = The problem is that useBean looks up the attribute months in the page context, and since it can't find it, throws an exception. But without the useBean tag, the html:options tag can't find the data it needs. I've read the docs until my eyes hurt, and I can't find any technique to tell useBean to merely create a new bean, not fetch an existing one. This seems so easy, I can't believe I haven't done it before, but I can't find an example in any of my previous code. What am I missing? Thanks in advance... -- Bob Langford Silicon Masters Consulting, Inc.8207 Stone River Court, Richmond, VA 23235 phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ 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]
Re: How can I compute data for html:select choices?
The point of MVC is to pre-populate the bean in Action. You should unit test the bean in the model layer, once it works, put it in Struts. (MVC layered aproach allows for unit testing of a layer) So if you say something like: MyBean b = new MyBean(); b.populate(); Collection c = b.getOptions(); out.println(b); -what do you get? .V A bean that does not work outside of Struts, will not work once you put it in Struts. Daniel H. F. e Silva wrote: Hi Bob, I think you could try bean:define/ or, better, JSTL tag c:set/. I'm not a JSTL expert but i know you can determine scope to be used by c:set/. And i'm not sure, but i think you can do that also with bean:define/. Hope it helped you. Regards, Daniel. --- Bob Langford [EMAIL PROTECTED] wrote: Hi, I can't seem to understand how to declare things correctly to do what I want to do. Can anyone tell me where I am going wrong? I'm trying to use a simple Java method as the source of the choices in a html:select box in a form. The method returns a java.util.List, where each item is a org.apache.struts.util.ValueLabelBean object, just what I need for this. Here's one way I tried to use it: = %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=months property=value labelProperty=label / /html:select = The problem is that useBean looks up the attribute months in the page context, and since it can't find it, throws an exception. But without the useBean tag, the html:options tag can't find the data it needs. I've read the docs until my eyes hurt, and I can't find any technique to tell useBean to merely create a new bean, not fetch an existing one. This seems so easy, I can't believe I haven't done it before, but I can't find an example in any of my previous code. What am I missing? Thanks in advance... -- Bob Langford Silicon Masters Consulting, Inc.8207 Stone River Court, Richmond, VA 23235 phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- Victor Cekvenich, Struts Instructor (215) 312-9146 Advanced Struts Training http://basebeans.com/do/cmsPg?content=TRAINING Server Side Java training with Rich UI, mentoring, designs, samples and project recovery in North East. Simple best practice basic Portal, a Struts CMS, Membership, Forums, Shopping and Credit processing, http://basicportal.com software, ready to develop/customize; requires a db to run. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
META-INF vs WEB-INF
I notice in the struts.jar that the tld's are kept in META-INF/tlds, rather than any WEB-INF I'm using an include file in my JSPs that contains the %@ taglib prefix=html uri=/WEB-INF/tld/struts-html.tld % Since I'm not using too many, I just include thist tagdecl.jspf in all my JSPs I'm using maven and I'd like to avoid all that versioning stuff in the web.xml, for example: taglib taglib-uri/WEB-INF/tld/struts-html.tld/taglib-uri taglib-location/WEB-INF/tld/struts-html-1.1.tld/taglib-location /taglib it's far more convenient to just use the taglibs that comes with the struts-#.jar So, two questions: 1) taglib taglib-uri/META-INF/tld/struts-html.tld/taglib-uri taglib-location/META-INF/tld/struts-html-1.1.tld/taglib-location /taglib 2) Is struts going to continue to keep the taglibs in META-INF, or is this a temporary thing? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Anyone still use the layout component ?
I didn't see my reply shown up on this mail list. I post it again as the followings. Thanks Ted for your response. To my knowledge, the Tiles and the component serve the same functionality but doing thing differently. I am not sure what your compatible mean here. In regarding of i18n, the Tiles forces us to use the a set of JSP files per locale approach while the one doesn't. We can't afford to use the approach since we don't have enough man power to maintain a large set of JSP files. The problem we have with the component is the TC tag pool configuration must be false at TC 4.1 up to 5.0 beta. According to the TC online document, the cause very likely is on the tag implementation. We need to find out what need to be fixed. Any suggestions? Thanks, v. -- - Original Message - DATE: Wed, 08 Oct 2003 20:58:39 From: Ted Husted [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: Tiles was designed to be backwardly compatible, so it's liable to drop right in you want to migrate. HTH, Ted. Vernon Smith wrote: Anyone out there still use the layout component, the one before the Tile? Any usage problem on Tomcat 4.1.x up? I believe it was contributed by David Geary. Thanks, Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! http://login.mail.lycos.com/r/referral?aid=27005 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! http://login.mail.lycos.com/r/referral?aid=27005 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: META-INF vs WEB-INF
khote wrote: I notice in the struts.jar that the tld's are kept in META-INF/tlds, rather than any WEB-INF I'm using an include file in my JSPs that contains the %@ taglib prefix=html uri=/WEB-INF/tld/struts-html.tld % Since I'm not using too many, I just include thist tagdecl.jspf in all my JSPs I'm using maven and I'd like to avoid all that versioning stuff in the web.xml, for example: taglib taglib-uri/WEB-INF/tld/struts-html.tld/taglib-uri taglib-location/WEB-INF/tld/struts-html-1.1.tld/taglib-location /taglib Note that the taglib-location you provide can have any value ... whether or not you include a version number is up to you. it's far more convenient to just use the taglibs that comes with the struts-#.jar So, two questions: 1) taglib taglib-uri/META-INF/tld/struts-html.tld/taglib-uri taglib-location/META-INF/tld/struts-html-1.1.tld/taglib-location /taglib On a JSP 1.2 or later container, tag library declarations are automatically recognized by the container if they are present in the META-INF directory (or any of its subdirectories) in a JAR file that is loaded with the application. Thus, on such a container, you do not *have* to use taglib directives in web.xml at all. The key to making this work is that the URI attribute on your %@ taglib % directives must match the uri element embedded within the TLD itself. The following lines illustrate the standard tag library URIs for Struts tlds: %@ taglib prefix=bean uri=http://jakarta.apache.org/struts/tags-bean; % %@ taglib prefix=html uri=http://jakarta.apache.org/struts/tags-html; % %@ taglib prefix=logic uri=http://jakarta.apache.org/struts/tags-logic; % %@ taglib prefix=nested uri=http://jakarta.apache.org/struts/tags-nested; % %@ taglib prefix=tiles uri=http://jakarta.apache.org/struts/tags-tiles; % For more information on automatic TLD identification, see Section 7.3 of the JSP Specification. 2) Is struts going to continue to keep the taglibs in META-INF, or is this a temporary thing? It's permanent, but can only be taken advantage of (as described above) on a JSP 1.2 or later container. Of course, the original mechanism still works as well. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Anyone still use the layout component ?
Vernon Smith wrote: I didn't see my reply shown up on this mail list. I post it again as the followings. Thanks Ted for your response. To my knowledge, the Tiles and the component serve the same functionality but doing thing differently. I am not sure what your compatible mean here. In regarding of i18n, the Tiles forces us to use the a set of JSP files per locale approach while the one doesn't. We can't afford to use the approach since we don't have enough man power to maintain a large set of JSP files. I don't see why you are drawing this conclusion. The individual pages produced via Tiles can be localized by the same mechanisms as non-Tiles and non-Template pages (such as using the bean:message tag to look up localized text in a resource bundle). The problem we have with the component is the TC tag pool configuration must be false at TC 4.1 up to 5.0 beta. According to the TC online document, the cause very likely is on the tag implementation. We need to find out what need to be fixed. The Tiles implementation included in Struts 1.1, like all the other Struts 1.1 tag libraries, should run fine with tag instance pooling enabled. Any suggestions? Thanks, v. -- Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HOW and WHERE do I call my EJB from
Hi All ! I am trying to start out with struts. I have successfully deployed an EJB in JBOSS and want to call it from my Struts-based web app. My current setup: ActionForm: GetSearchCriteriaForm extends org.apache.struts.action.ActionForm Action: SearchAction extends org.apache.struts.action.Action SearchAction.execute( ... ) { String vehicleID = ((au.com.carsales.carsales.GetSearchCriteriaForm)form).getVehicleID(); request.setAttribute( vehicleID, vehicleID ); return( mapping.findForward(searchUsedCars ) ); } Effectively (from the code above), I have a form, from where the user enters the vehicleID and set it as a session attribute. Now, I want to call my UsedVehicleEJB's findByPrimaryKey() method with the vehicleID as the parameter. My Questions: = 1. Should I call my EJB from the execute method and set the attributes of the UsedVehicleEJB as session variables? 1.1 Can I make the entire EJB a session variable? 2. Should I be using the bean tag library in my view searchUsedCars.jsp to call my EJB ? What I think: = Given that the view should be independent of the model, I should not call the EJB from searchUsedCars.jsp and hence, I should call the EJB from the execute method. Please comment. TIA, Kunal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Anyone still use the layout component ?
Thanks very much Craig for you response. To my knowledge, the Tiles and the component serve the same functionality but doing thing differently. I am not sure what your compatible mean here. In regarding of i18n, the Tiles forces us to use the a set of JSP files per locale approach while the one doesn't. We can't afford to use the approach since we don't have enough man power to maintain a large set of JSP files. I don't see why you are drawing this conclusion. The individual pages produced via Tiles can be localized by the same mechanisms as non-Tiles and non-Template pages (such as using the bean:message tag to look up localized text in a resource bundle). We use the JSTL fmt tag to retrieve locale messages/strings, but not the bean:message tag. Last time, that was about eight,nine months ago, we had spent a quite chunk of time testing out Tiles on localization. The Tiles didn't work with the resource bundle approach. In response of our question, the Tiles creator stated that the Tiles could be used in i18n with the different JSP files per locale approach. The problem, I recall, is that Tiles cachs a single locale region content of a JSP file in the server. When a user access the same JSP file with a different locale, what s/he gets isn't a page with the desired locale but the one cached on the server. I also had experienced different language regions shown up on a page due to the mechanism. I don't know whether this Tiles mechanism has been changed or not in the past some months. The problem we have with the component is the TC tag pool configuration must be false at TC 4.1 up to 5.0 beta. According to the TC online document, the cause very likely is on the tag implementation. We need to find out what need to be fixed. The Tiles implementation included in Struts 1.1, like all the other Struts 1.1 tag libraries, should run fine with tag instance pooling enabled. The component I indicated here is the layout component by David Geary, not Tiles. Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! http://login.mail.lycos.com/r/referral?aid=27005 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Hi Ted, where is scaffold.ExistsAttributeAction??
Hi Ted, I'm studying your artimus_1_1 codes. I'm confused by some scaffold classes, such as org.apache.struts.scaffold.ExistsAttributeAction. I cannot find it's source code, compiled class file and it's documentation anywhere. There are some other classes like this one. I noticed that scaffold's last update was about one year ago. Is scaffold still being working on? Sincerely, Bruce.
RE: How can I compute data for html:select choices?
i am not sure if you have tried this out: %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=%=months% property=value labelProperty=label / /html:select Cheers ! Ram -Original Message- From: Bob Langford [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Saturday, October 11, 2003 11:05 PM To: [EMAIL PROTECTED] Subject: How can I compute data for html:select choices? Hi, I can't seem to understand how to declare things correctly to do what I want to do. Can anyone tell me where I am going wrong? I'm trying to use a simple Java method as the source of the choices in a html:select box in a form. The method returns a java.util.List, where each item is a org.apache.struts.util.ValueLabelBean object, just what I need for this. Here's one way I tried to use it: = %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=months property=value labelProperty=label / /html:select = The problem is that useBean looks up the attribute months in the page context, and since it can't find it, throws an exception. But without the useBean tag, the html:options tag can't find the data it needs. I've read the docs until my eyes hurt, and I can't find any technique to tell useBean to merely create a new bean, not fetch an existing one. This seems so easy, I can't believe I haven't done it before, but I can't find an example in any of my previous code. What am I missing? Thanks in advance... -- Bob Langford Silicon Masters Consulting, Inc.8207 Stone River Court, Richmond, VA 23235 phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/ http://www.silicon-masters.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. **
Re: How To Work Out This Action Mapping?
Craig, thank you for your very strong support in the past day or two to guide me through problems with the container-managed authentication. I looked at my web.xml file again and again. There is nothing wrong with the order of the elements in that file. And there is no stack trace in the log files that talks about an XML parsing error. I did some experiments. I found that as long as I have the JDBCRealm in the $TOMCAT_HOME/conf/server.xml, the Tomcat does not accept security-constraint element in the application's web.xml file. And the Tomcat gives me the required resouce /MyApplication is not availabel HTTP Status 404. Have you seen this kind of problem before? I have posted the question at the tomcat-user discussion forum. --Caroline --- Craig R. McClanahan [EMAIL PROTECTED] wrote: Caroline Jen wrote: To answer your questions: 1. The LOGON button links to a forward: html:link forward=logonLOGON/html:link and in my struts-config.xml, I have forward name=logon path=/do/admin/Menu/ Well, that's the first problem ... security constraints are only applied on an original request from the client, not on a forward. You'll need to add redirect=true to this, in order to get the client to request it. 2. the security-constraint in my web-xml is: security-constraint web-resource-collection web-resource-nameAdministrative/web-resource-name !-- The URLs to protect -- url-pattern/do/admin/*/url-pattern /web-resource-collection auth-constraint !-- The authorized users -- role-nameadministrator/role-name role-namecontributor/role-name /auth-constraint /security-constraint By the way, there is another problem -- after the insertion of the security-constraint, the application totally stops functioning. No welcome page displayed. In the browser, I have HTTP Status 404 -/PracticeVersion description: The requested resource(/PracticeVersion) is not availabe. and in the Tomcat log file, I have: LifecycleException: Container StandardContext[/PracticeVersion] has not been started That means you did not obey the required element order in the web.xml file. You'll undoubtedly see a stack trace in the log files that talks about an XML parsing error. The correct order is defined by the DTD for web.xml files. Among other places, you'll find a copy of the DTDs for Servlet 2.2 and Servlet 2.3 in the lib directory of your Struts distribution. Open either web_app_2_2.dtd or web_app_2_3.dtd (depending on which version you're using) and look for the line that starts !ELEMENT webapp The list of element names in parentheses is the required order for elements in your own web.xml files. Thereafter, I deleted the security-constraint element from the web.xml file. I have the welcome page displayed. After I click on the LOGON button in the welcome page, the welcome page remains in the browser. The logon.jsp, which collects j-username, j_password, does not get displayed and http://localhost:8080/PracticeVersion/do/admin/Menu shows in the address bar. Change your forward to add redirect=true and put the security constraint in the correct order, and you should be good to go. --Caroline Craig --- Craig R. McClanahan [EMAIL PROTECTED] wrote: Caroline Jen wrote: Thank you very much for the detailed explanation. Yet, I still have hard time to make my application work -- I am able to display the welcome page (no problem). And I have http://localhost:8080/PracticeVersion/do/Menu;jsessionid=0A6E76A8F3E849BC8DAAC45BFB72F72E in the address bar. However, after I click on the LOGON button in the welcome page, the welcome page Where does this LOGON button submit to? If it submits to j_security_check, you are doing this wrong. It should submit to some resource that is protected by a security constraint. remains in the browser. The logon.jsp, which collects j-username, j_passwor, does not get displayed and http://localhost:8080/PracticeVersion/do/admin/Menu shows in the address bar. I do not know what went wrong. Could it be that the JDBCRealm is not configured correctly? Because the LOGON button links to a forward: html:link forward=logonLOGON/html:link and in my struts-config.xml, I have forward name=logon path=/do/admin/Menu/ The /do/admin/Menu is my protected resources. I keep it unchanged. It's only protected if it's listed in a security-constraint in web.xml. 1. I configured the Tomcat JDBCRealm and prepared the users table, user-roles table according the instructions found at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html