session is not working with jsp
Hi, I am are trying to call session object in tiles page, but it returns null. Is there any specific methodology to call session in jsp page. Since I am just using session.getAttribute("Parameter") in session. -- Jignesh Patel Project Leader Bang Software Technolgy Pvt. Ltd. (E) [EMAIL PROTECTED] (T) 091 484 3942132 B-4, Smart Business Centre, Infopark, SDF IT Building, Kusumagiri P.O.,Kakkanad, Kochi - 682030, Kerala, India. Information contained in this transmission to the named addressee, including any attachments thereto, should be considered the proprietary and confidential information of the sender. As a condition for viewing the information, the sender agrees to keep the information confidential, to refrain from disclosing the information, directly or indirectly, and to refrain from any actions that would constitute or facilitate unauthorized access to the information without express permission from the sender. The recipient also acknowledges and agrees to respect sender's intellectual property rights in and to the information. If the recipient of this transmission is not the named addressee, the recipient should immediately notify the sender and destroy the information transmitted without making any copy or distribution thereof. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Detecting browser close
Youre right, they may not explicitly log off. And you are right that you need to handle the occasion that they go away without saying anything to you. But you shouldn't be worried about the occasion that this happens. You should be handling it with an entirely different paradigm. But being able to successfully detect a browser close isn't enough to solve this problem. Here's what I mean: The browser could stay OPEN. The user could be at lunch, or gone home for the night or weekend. Hours later, are you going to be letting the cleaning crew loose inside of your app? What happens if he has 3 windows open in 4 different web applications and shuts down the computer? Shouldn't all those webapps get notified so they can shut down the session? What sort of mechanism in the browser would do such a thing? Here's a good one: What happens if the user's browser window becomes slow? Say he clicks on "Open a New Window", creating a copy of the same screen inside of your application, and closes the original browser window so as not to have two of them up? This means he effectively "tells you the lie" that he's gone away. Would you throw away all the session information about a user who is still inside of the app? Seem what youre wanting is the browser to tell you about things that happen outside of your application. Don't attempt it. No way. No how. The browser is a dumb thin client. It only knows to tell you what you tell it to say. Youre wanting thick client functionality on the browser, which you would have to implement via an applet or some such. This is just asking for trouble. You can't control the horizontal and the vertical in a browser. Accept this limitation and design accordingly. Seriously, this is a path well traveled. If the user doesn't do anything for a certain amount of time, make him log in again. You don't know what happened to him. Don't keep resources open just for him. If youre doing that, then you've got design issues. HTH -Joe > -Original Message- > From: ksitron [mailto:[EMAIL PROTECTED] > Sent: Saturday, June 19, 2004 9:06 PM > To: Struts Users Mailing List > Subject: Re: Detecting browser close > > > > Thanks for the reply. But, I find it hard to accept that it > can't be done. And, users may not be computer savy or follow > good etiquette and log off. > > Bill Siggelkow wrote: > > > AFAIK this cannot be done -- your best bet is to provide a > Logoff link > > and a reasonable session timeout. > > > > ksitron wrote: > > > >> > >> Is there a way to detect when the user closes the browser. What I > >> want to do is do clean-up and destroy the session. > >> > >> > >> Thanks in advance. > >> > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- > > Kevin J Citron > Sr. Object Imagineer > Optimized Objects, Inc. > EL Paso, Texas 79930 > (915) 565-7785/566-2403 > > > > - > 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 1.0.2 Dynamic Forward
Rick, Sorry if I the problem def I supplied wasn't complete enough. I was trying to avoid keyboard diarrhea. I'm sure that I'm making this more difficult than it need be. :-) I have a number of mappings. Each with its own unique action, form, and set of forwards comprising the jsp screens of a use case. All actions extend a base action. All forms extend a base form. Based on the data situation in any action, I may need to present a common data entry page. This need could occur in any of the use cases. I've defined the common data entry page as its own mapping with its own unique form and path. Struts supplies me with a mapping and a form. I'm confused as to how I can switch to the common data entry page mapping while prepoulating its form with data taken from the form of the invoked action.--- In [EMAIL PROTECTED], Rick Reumann <[EMAIL PROTECTED]> wrote: > Can you be a little more specific about what you want to accomplish from > a "user's perspective." You might be making this more complicated than > it needs to be. In other words what exactly do you want to have > happen... A user selects something from a drop down list... and then > what? I just think we can work out something that might be a lot easier > and cleaner. > > -- > Rick > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
insert tile from other web module
Hi all, I'm looking for a way to insert in a JSP from a web module an other JSP from an other web module. For example: example.jsp : <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> where exampleLayout.jsp, header.jsp and footer.jsp are in the main web module with context-root=/main and menu.jsp and mainBody.jsp are in another web module with context-root=/specific exampleLayout.jsp: Of course, I get a ServletException because /menu.jsp and /mainBody.jsp can't be found in /main context. The solution would be a way to tell struts that these two pages are in /specific context. Can somebody help me? Philippe. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Detecting browser close
There are ways, if you are so adamant about this that you want to use a lot of resources. Are you? At 04:53 PM 6/19/2004, Bill Siggelkow wrote: AFAIK this cannot be done -- your best bet is to provide a Logoff link and a reasonable session timeout. ksitron wrote: Is there a way to detect when the user closes the browser. What I want to do is do clean-up and destroy the session. Thanks in advance. - 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: bean defines
Bill - The point of my discussion was the following premise: public class MyCheckboxForm extends ActionForm public class MyForm1 extends MyCheckboxForm public class MyForm2 extends MyCheckboxForm I want to be able to pass MyForm1 or MyForm2 to the same JSP and have it work because the JSP is only concerned with the contents within MyCheckboxForm, but I dont think I can do this, at least not cleanly. So what I have considered is the following alternative: public class MyForm1 extends ActionForm public class MyForm2 extends ActionForm public class MyCheckboxForm extends ActionForm Then, when MyForm1 is posted to my action, it will instantiate a MyCheckboxForm object in the request scope, transfer the MyForm1 object from request to session scope for later retreival and note the bean name in the MyCheckboxForm. Populate the needed data from MyForm1 into MyCheckboxForm and finally forward to this common JSP. This JSP will do its thing and finally posts its data back to an action with a flag that says, "we're done, transfer data back". The MyCheckboxForm contains the bean-name of MyForm1 which was in the session scope, the action retreives it, transfers the data from the MyCheckboxForm back into MyForm1, updating it accordingly and then removes the session-scope MyForm1 and puts it back into the request scope forwarding the user to the final JSP which renders the changes made by the checkbox logic. The point is we want to have a single form which we can manipulate label/value(s) via checkbox selection and pagination. Once the user have selected "save/return", the data of all their selections gets passed back to the original form which will later be used for a search query. Like I said, I think what I decided on as an alternative seems to be a much cleaner and easier approach as it removes any "ties" between the forms themselves and really lets the "core logic" of the checkbox form stand alone for usability for any other future purpose. Thanks in advance! Chris - Original Message - From: "Bill Siggelkow" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, June 19, 2004 3:22 PM Subject: Re: bean defines > Chris, your running into the problem because when you use > where the value is specified in the body of that tag, it create a new > String scripting variable as well as a page-scoped attribute that is > also a String. > > Instead, you want the actual form bean itself. I am not too sure about > how tiles fits into the mix but for a normal action mapping where the > form was specified as "MyForm" in the name attribute you could simply do > the following: > > The Page Number: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Detecting browser close
Thanks for the reply. But, I find it hard to accept that it can't be done. And, users may not be computer savy or follow good etiquette and log off. Bill Siggelkow wrote: AFAIK this cannot be done -- your best bet is to provide a Logoff link and a reasonable session timeout. ksitron wrote: Is there a way to detect when the user closes the browser. What I want to do is do clean-up and destroy the session. Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Kevin J Citron Sr. Object Imagineer Optimized Objects, Inc. EL Paso, Texas 79930 (915) 565-7785/566-2403 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Detecting browser close
AFAIK this cannot be done -- your best bet is to provide a Logoff link and a reasonable session timeout. ksitron wrote: Is there a way to detect when the user closes the browser. What I want to do is do clean-up and destroy the session. Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] JavaOne Struts User Gathering
Hi Everyone, Depending upon the interest level, I'm willing to organize a social gathering at a bar or restaurant in San Francisco during the upcoming JavaOne conference. It would either be around 8:30pm on Sunday, June 27th, after the Welcome Reception ends. Or it would be around 8:00PM on Thursday, July 1st, at the very end of the conference. It would be separate from JavaOne, but, somewhere not too far from Moscone. That way, anyone attending the conference and local folks that aren't attending the conference could both participate. If this is something you would participate in, please email directly to me (no need to spam the struts-user list with count-me-in messages) at [EMAIL PROTECTED] with the subject "JavaOne Struts User Gathering." Whatever I decide upon, I'll announce it again here on the mailing list. However, your responses to me now will give me an indication of size of venue required for the gathering. I will choose between Sunday and Thursday evening based upon the preferences I get back from the people that contact me. Also, I am not that familiar with our options in the city. So, I would appreciate recommendations for local bars/restaurants that would be a good venue for this gathering. Besides being big enough for the expected number of people, I'm looking for a place with good *beer* and at least some decent food options too. Thanks, Van Mike "Van" Riper Silicon Valley Struts User Group http://www.baychi.org/bof/struts/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Detecting browser close
Is there a way to detect when the user closes the browser. What I want to do is do clean-up and destroy the session. Thanks in advance. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean defines
Chris, your running into the problem because when you use where the value is specified in the body of that tag, it create a new String scripting variable as well as a page-scoped attribute that is also a String. Instead, you want the actual form bean itself. I am not too sure about how tiles fits into the mix but for a normal action mapping where the form was specified as "MyForm" in the name attribute you could simply do the following: The Page Number: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How To Get the 'initial' in the form-property?
Hmm .. in your Action's execute method you should be able to do: DynaValidatorForm myForm = (DynaValidatorForm) form; String sort = myForm.get("sort"); String order = myForm.get("order"); This will get the current values on the form -- if the form was just created than these will be the initial values. If you need to reset a DynaActionForm (or subclass) to its initial values you can the initialize method: myForm.initialize(mapping); Caroline Jen wrote: In my struts-config.xml, I provided some initial values: name="threadForm" type="org.apache.struts.validator.DynaValidatorForm"> name="sort" initial="thread_last_post_date" type="java.lang.String"/> name="order" initial="DESC" type="java.lang.String"/> How do I get the initial value in my servlet that extends Action? I tried: form.get( "sort" ); form.get( "order" ); and form.getProperty( "sort" ); form.getProperty( "order" ); The compiler complains "cannot resolve symbol: method get" and "cannot resolve symbol: method getProperty". __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean defines
Is anyone familiar with this that can help? - Original Message - From: "Chris Cranford" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, June 18, 2004 3:47 PM Subject: Re: bean defines > And it may be important that I point out if I use: > > > The value does get outputted. So it has to do with what Paul pointed out, > but I dont know how to solve it. > - Original Message - > From: "Chris Cranford" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Friday, June 18, 2004 3:45 PM > Subject: Re: bean defines > > > > It is as if the c-taglib is seeing the bean as a "string" and not as an > > ActionForm. I can write: > > > > > > And the output is value in formid. What I'm trying to do is create a > > reference to an ActionForm in this JSP which has it's name passed in by > this > > page's container as a tiles attribute. > > > > - Original Message - > > From: "Chris Cranford" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > Sent: Friday, June 18, 2004 3:39 PM > > Subject: Re: bean defines > > > > > > > This is my class: > > > > > > public class PagedCheckboxForm extends ActionForm > > > { > > > private long pageNumber; > > > public long getPageNumber() { return this.pageNumber; } > > > public void setPageNumber(long value) { this.pageNumber = value; } > > > } > > > > > > In the JSP > > > > name="formid"/> > > > <%=formBean%> > > > The Page Number: > > > > > > [ServletException in: /pages/cctest-body.jsp] > > > An error occured while evaluating custom action attribute "value" with > > value > > > "${cfb.pageNumber}": > > > Unable to find a value for "pageNumber" in object of class > > > "java.lang.String" using operator "." (null) > > > > > > HTH > > > Chris > > > > > > - Original Message - > > > From: "Slattery, Tim - BLS" <[EMAIL PROTECTED]> > > > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > > > Sent: Friday, June 18, 2004 3:33 PM > > > Subject: RE: bean defines > > > > > > > > > > > Ok, well if I do the following: > > > > > > > > > > > > > > > > > > > > The name of the form object is written out. But if I want to > > > > > access a property on my form cfb, how would I output that > > > > > value? If I write , I get > > > > > a servlet exception saying that it is unable to find > > > > > "pageNumber" in object of class "java.lang.String" > > > > > > > > Do you have a getter function for the pageNumber property? A method > > within > > > > the cfb object that looks like this: > > > > > > > > public String getPageNumber() > > > > { > > > > return ; > > > > } > > > > > > > > > > > > -- > > > > Tim Slattery > > > > [EMAIL PROTECTED] > > > > > > > > > > > > - > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > - > > 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: Theoretical debate
Thanks for a very interesting thread. An elucidation of many of the topics in this thread can be found in Ted Husted's book, Struts in Action; especially see chapter 5, Coping with Action Forms. It is very tempting when you first come to Struts to do a great deal of processing in the Action classes, especially if the application is "simple". However, this approach is not optimal for the long term. We try to keep our Action classes as thin as possible. The Action classes are used primarily as controllers; business logic processing takes place in worker classes or factory classes. Also, we use our business model classes simply as data transfer objects to pass data between different components of the system. This is contrary to pure object-oriented design (i.e., objects have both state and behavior); however, this approach leads to a more modular and extensible system (many components can act on the same business model data). There have been other threads in this newsgroup discussing the pros and cons of Struts vs JSF. There is definitely overlap in the two frameworks with JSF going beyond Struts to create a component model that can be applied to the web. In my judgment, the promise of JSF will be realized when advanced tools greatly simply the process of creating applications. The "Sun Java Studio Creator" (http://wwws.sun.com/software/products/jscreator/), formerly known as "Project Rave", will be worth evaluating. Actually, if Sun gets this right, it will be incredibly cool. If we knew the "inside game" at Sun, I think the story would be that they decided to develop a system to compete against the MS Visual Studio tools, and in making that decision they realized they needed a robust, extensible framework. JSF is being created for the "Sun Java Studio Creator". Hopefully, this will be good for us all. Mike --- "Pilgrim, Peter" <[EMAIL PROTECTED]> wrote: > > > -Original Message- > > From: mike [mailto:[EMAIL PROTECTED] > > Sent: 18 June 2004 15:31 > > To: Struts Users Mailing List; [EMAIL PROTECTED] > > Subject: Re: Theoretical debate > > > > > > At 07:18 AM 6/18/2004, Bill Schneider wrote: > > > > >Form beans can be thought of as a special case of DTOs: they are the > > >argument the client (web browser) passes to the remote > > method call (HTTP > > >POST). So passing form beans directly to business logic is _almost_ > > >reasonable, putting the dependency issue aside for now (form > > beans have to > > >extend ActionForm). > > > > > >The difference is, form beans are a model of the /user > > input/, and since > > >there may be invalid inputs (for example: "asdfjkjkd" in a > > field that's > > >supposed to be numeric) form bean fields often need to be > > Strings when the > > >corresponding field in a "real" DTO would be a Date or Integer. > > > > > >To deal with this, I've used a tool called XSnapshot (just > > released to > > >SourceForge: http://xsnapshot.sourceforge.net) to generate > > form beans and > > >other DTOs from XDoclet tags in a POJO data model. That way you get > > >_both_ real DTOs and Form Beans without writing all the > > classes by hand, > > >and you can copy between DTOs and form beans with > > BeanUtils.copyProperties. > > > > > >-- Bill > > >-- > > >Bill Schneider > > >Chief Architect > > > > I don't think we should be thinking of action forms as DTOs. > > DTOs or VOs > > have a special use and a special problem that they are meant to > > solve. Action forms are related to an entirely different set > > of issues > > about data farming. I don't think we can put the dependency issue > > aside. That is really the whole point of frameworks like > > Struts. If you > > can put the dependency issues aside, you probably don't need > > Struts. If > > you don't need a hammer, that is not a critique of a hammer. > > Likewise, > > Struts has an objective and, with clear areas that could be > > improved, does > > that really well. There is a good reason that Struts is so > > successful. Craig is a sweetheart, but that is not the > > reason for the > > success of Struts. > > > > I think that a lot of the problems people have with > > repetitive programming > > is not the fault of the framework but the failure to use > > coding techniques > > that are readily available, such as dynamic proxies. > > > > Michael > > > > > > Yes I could not agree more. This why Commons BeanUtils > and PropertyUtils was invented. It sound like people > have an itch for a mapping properties that converts > ActionForm (Dyna also) to a Value Object. Convert me X into Y whilst > copying the attributes as best I can from X to Y. > Sounds like a very old OO problem: Morphing Eclispe into > Round Rectangle into a Triangle. I wonder. > > > -- > Peter Pilgrim > Operations/IT - Credit Suisse First Boston, > 10 South Colonnade, London E14 4QJ, United Kingdom > Tel: +44 (0)207 883 4447 > > ===