Re: Bookmarking functionality in struts
Thanks for the reply Jim I was trying to do whatever you said.. taking ur idea when session expires what I did was I redirected to login page passing request.getServletPath(); parameter as redirect param. But problem I had was every thing in application has to go through the login action class which put some values in the session. First I will tell you what I did CODE I wrote for base action class # * if* (authuser == *null*){ String redirectUri = request.getServletPath(); actionRedirect.addParameter(redirectUri, redirectUri); messages.add(message, *new* ActionMessage(session.expired)); saveMessages(request, messages); *return* actionRedirect; } After redirecting to login Jsp the thing I did is ## String redirectUri = request.getParameter(redirectUri); System.out.println(redirectUri+redirectUri); *if*(redirectUri != *null*) { % input type=hidden name=redirectUri value=%=redirectUri% % } % ## This I did because I have to go through the login action class as I load all the session values in that page... Login Action Class ## *if*(redirectUri != *null*){ *return* mapping.findForward(redirectUri11); } ## and in my struts config.xml what i Wrote was ### action path=/web/jsp/admin/Logon type= edu.louisiana.cbit.capture.Admin.action.LogonSubmitAction name=LoginActionForm input=/web/jsp/login.jsp forward name=success path=mainlayout.page/ forward name=/web/jsp/Reviewer/AddUser.do path=/web/jsp/Reviewer/AddUser.do/ forward name=/web/jsp/admin/ViewUsers.do path=/web/jsp/admin/ViewUsers.do/ /action ### This is like when I click AddUser which is link /web/jsp/Reviewer/AddUser.do if session donot exist then it is redirected to the login page passing the value /web/jsp/Reviewer/AddUser.do. Then in login action class it is forwarded using mapping.findForward(/web/jsp/Reviewer/AddUser.do). and for that action mapping I am forwarding to appropriate page. Is this the right way to do... THis will put lot of entries in the config file..other thing is in the adress bar even if I am redirecting its still showing as If I am in login page like even if I am in web/jsp/Reviewer/AddUser.do its showing as if am in web/jsp/Reviewer/Login.do...Please give me a hint if there is any better way. Laurie, Thanks for the suggestion but unfortunately I was forced to use application managed security so I have to sort out my own logic to bookmark pages. Regards Viplav Kallepu On 10/15/07, Laurie Harper [EMAIL PROTECTED] wrote: You could also consider using container managed security, which handles this use case transparently, or one of a number of existing authentication frameworks (e.g. Spring Security) which can also take care of it. Basically, the exact solution depends on your requirements, particularly with respect to authentication. L. Jim Cushing wrote: It's been a while since I've used Struts 1.x, but back in the day, I did implement this type of functionality. Basically, the app would redirect to the login action, with the destination what the user tried to access) as an encoded parameter in the URL. Something like /login.do?destination=http://...;. The login action would look for the destination parameter, and send a redirect to that URL if present. I don't have specific code for you (again, it's been a while since I've used Struts 1.x), but that gives you an outline of what you'd need to do. On Oct 15, 2007, at 12:47 PM, Viplav Kallepu wrote: Hi all, I am using struts 1.3.8. I was trying bookmarking functionality out of curiosity.(User will bookmark a page then if he clicks that link he should be informed to login which is the entry point into application and then he should be forwarded to the page he bookmarked) . I wish to do it even when session is expired. Any one who achieved this functionality before please help me in knowing the solution. I did google but I wasn't able to find any thing useful. If you can give me any tutorial kind of thing that would be a great help. -- Regards Viplav Kallepu - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Regards Viplav Kallepu
Bookmarking functionality in struts
Hi all, I am using struts 1.3.8. I was trying bookmarking functionality out of curiosity.(User will bookmark a page then if he clicks that link he should be informed to login which is the entry point into application and then he should be forwarded to the page he bookmarked) . I wish to do it even when session is expired. Any one who achieved this functionality before please help me in knowing the solution. I did google but I wasn't able to find any thing useful. If you can give me any tutorial kind of thing that would be a great help. -- Regards Viplav Kallepu
Re: Struts debug mode
Thanks for the help I am able to debug action classes. Dave, If you find how to debug jsp's please post it in the forum as it would be helpful to lot of guys like me. Regards Vipalv Kallepu On 10/5/07, Dave Newton [EMAIL PROTECTED] wrote: You should be able to debug your JSPs, too, although I haven't tried that with Europa (Europa, so far, is kind of kicking my butt; can't even re-format a JSP page :/ But as Wes said, unless something is really wrong in your setup debugging your actions should be really easy. --- Wes Wannemacher [EMAIL PROTECTED] wrote: right-click on your server (Tomcat) and choose 'Debug' ? You can put breakpoints in your action, etc. -Wes On 10/5/07, Viplav Kallepu [EMAIL PROTECTED] wrote: but I am not able debug my action classes(I atleast understood that i cant debug my jsp's). thats what is the problem. If anybody has any good material for knowing how to debug in eclipse(WTP) suggesting me would be a great help. On 10/4/07, Dave Newton [EMAIL PROTECTED] wrote: --- Viplav Kallepu [EMAIL PROTECTED] wrote: why do we need source files of third party jars. So you can see the source if you're debugging/executing something in a class contained in one of the third party jars. You don't *have* to have them, especially if you don't care about what's going on in them. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Regards Viplav Kallepu -- Wesley Wannemacher President, Head Engineer/Consultant WanTii, Inc. http://www.wantii.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] -- Regards Viplav Kallepu
Re: Struts debug mode
hi Joao, Finally I understood the requirement of sourcefiles for the third party libraries. I added jadeclipse to my project. It is working fine, by that i mean if I click *.class files javasource code is opening. But can you please tell me how to add this source to the libraries. becoz even after adding the jadeclipse I am still getting the error source path not found. On 10/8/07, Viplav Kallepu [EMAIL PROTECTED] wrote: Thanks for the help I am able to debug action classes. Dave, If you find how to debug jsp's please post it in the forum as it would be helpful to lot of guys like me. Regards Vipalv Kallepu On 10/5/07, Dave Newton [EMAIL PROTECTED] wrote: You should be able to debug your JSPs, too, although I haven't tried that with Europa (Europa, so far, is kind of kicking my butt; can't even re-format a JSP page :/ But as Wes said, unless something is really wrong in your setup debugging your actions should be really easy. --- Wes Wannemacher [EMAIL PROTECTED] wrote: right-click on your server (Tomcat) and choose 'Debug' ? You can put breakpoints in your action, etc. -Wes On 10/5/07, Viplav Kallepu [EMAIL PROTECTED] wrote: but I am not able debug my action classes(I atleast understood that i cant debug my jsp's). thats what is the problem. If anybody has any good material for knowing how to debug in eclipse(WTP) suggesting me would be a great help. On 10/4/07, Dave Newton [EMAIL PROTECTED] wrote: --- Viplav Kallepu [EMAIL PROTECTED] wrote: why do we need source files of third party jars. So you can see the source if you're debugging/executing something in a class contained in one of the third party jars. You don't *have* to have them, especially if you don't care about what's going on in them. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Regards Viplav Kallepu -- Wesley Wannemacher President, Head Engineer/Consultant WanTii, Inc. http://www.wantii.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] -- Regards Viplav Kallepu -- Regards Viplav Kallepu
Re: Struts debug mode
but I am not able debug my action classes(I atleast understood that i cant debug my jsp's). thats what is the problem. If anybody has any good material for knowing how to debug in eclipse(WTP) suggesting me would be a great help. On 10/4/07, Dave Newton [EMAIL PROTECTED] wrote: --- Viplav Kallepu [EMAIL PROTECTED] wrote: why do we need source files of third party jars. So you can see the source if you're debugging/executing something in a class contained in one of the third party jars. You don't *have* to have them, especially if you don't care about what's going on in them. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Regards Viplav Kallepu
Re: Struts debug mode
Thanks for the replies. I haven't tried jadeclipse and eclipse europa. I will try them to and see how debug mode works. One thing I wansn't able to figure out. why do we need source files of third party jars. Even the java jre we include is like third party to eclipse. Still it is able to debug the core java application. I am trying to understand if my understanding is wrong please excuse me. If I keep a breakpoint in action class it should stop there and show me the values that was what I was expecting with my past experience using eclipse. On 10/3/07, Stephen Boudreaux [EMAIL PROTECTED] wrote: I've found that Eclipse can be confusing when you want to attach the source of a library. Namely, you can't right click a library and select properties when in the J2EE view. You can go to the Java view and go there to attach the source there. If you are still having mysterious issues, you might want to consider jumping onto Eclipse Europa (3.3) WTP (I think they made it alot easier to get set up), or alternatively use the Red Hat Developer Studio (which is Eclipse 3.3 plus WTP plus several other plugins). On 10/3/07, João Vieira da Luz [EMAIL PROTECTED] wrote: in order to go third party classes you must have source attached those third party jars or you could use jad plugin ( http://jadclipse.sourceforge.net/). On 10/2/07, Viplav Kallepu [EMAIL PROTECTED] wrote: Thanks for the reply.. when I put breakpoints in my action class and start the server in debugging mode and run my application in browser.. its stopping at the breakpoint and not going forward(It is showing it in the debug console)..I feel it is not able to find the source files as in .deployables donot contain source files.. Can anyone help me sorting out this.. On 10/2/07, João Vieira da Luz [EMAIL PROTECTED] wrote: Remote debugging is the keyword. WTP already supports that. On 10/2/07, Viplav Kallepu [EMAIL PROTECTED] wrote: Hi, I am using struts 1.3.8 with eclipse 3.1 (wtp) and tomcat 5.5 . Can anyone please tell me how to enable debugging in it like we debug the core java application in eclipse. I googled it but the I wasn't able to find a single correct solution to try (I cant use myeclipse because I have to use eclipse in my work). -- Regards Viplav Kallepu -- Regards Viplav Kallepu - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Regards Viplav Kallepu
Struts debug mode
Hi, I am using struts 1.3.8 with eclipse 3.1 (wtp) and tomcat 5.5. Can anyone please tell me how to enable debugging in it like we debug the core java application in eclipse. I googled it but the I wasn't able to find a single correct solution to try (I cant use myeclipse because I have to use eclipse in my work). -- Regards Viplav Kallepu
Re: Struts debug mode
Thanks for the reply.. when I put breakpoints in my action class and start the server in debugging mode and run my application in browser.. its stopping at the breakpoint and not going forward(It is showing it in the debug console)..I feel it is not able to find the source files as in .deployables donot contain source files.. Can anyone help me sorting out this.. On 10/2/07, João Vieira da Luz [EMAIL PROTECTED] wrote: Remote debugging is the keyword. WTP already supports that. On 10/2/07, Viplav Kallepu [EMAIL PROTECTED] wrote: Hi, I am using struts 1.3.8 with eclipse 3.1 (wtp) and tomcat 5.5. Can anyone please tell me how to enable debugging in it like we debug the core java application in eclipse. I googled it but the I wasn't able to find a single correct solution to try (I cant use myeclipse because I have to use eclipse in my work). -- Regards Viplav Kallepu -- Regards Viplav Kallepu
Re: how populate form from database ?
Hi, If you are using struts 1.x then u need to have a database code.Call that from your action get the values. Set them to your action form thats itexample if u want... let your action form be someActionform extends ValidatorForm{ private String name; public String getName(){ return name; } public String setName(String name) { this.name = name; } } public someAction extends Action{ function extends... { someActionForm form = (SomeActionForm)form; uploadName(form); } } thats it... If I am not able to represent idea in right way sorry.. and as Rick said there are many ways to do this..what I showed is the basic way... Regards Viplav public uploadName(SomeActionForm f){ //use connection string to connect to database and return a resultset for example resultset = dbcon.getResult(select name from //name); f.setName(resultSet.getString(name)); } On 9/21/07, A. Lotfi [EMAIL PROTECTED] wrote: Hi, I need to populate a form with data from database, is there any example. thank you your help is appreciated. - Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV. -- Regards Viplav Kallepu
Struts 1.X validwhen
Hi, I am using struts 1.3.8 for my application. For validation I am using validator framework. In one of my pages my form is submitted either by submit button or changing the dropdown list value. action is the name of the property in the corresponding actionform which stores the submit button's value for example if the submit button's value is Modify then action property value is Modify and action property value is null if I submit the page using change in the dropdown list value. I am using validwhen to check if the action property is Modify as shown below, form name=EditUserForm field property=firstName depends=validwhen var var-nametest/var-name var-value((action != Modify) or (*this* != null))/var-value /var arg key=ApplicantInfoDisplayActionForm.firstName/ /field /form My doubt is can I use two validations using the which will be called only when action != modify. like I want to check whether the email address is in right format so I used field property=emailAddress depends=validwhen,email and rest of the code as shown above but it is checking for email format even if action is not equal to Modify. By seeing the code it seems that validwhen it is taking different and email it is taking different. Then how can I use both. Can any one please help me whether I can use validwhen In this situation. If not validwhen how can I use the validator framework. -- Regards Viplav Kallepu -- Regards Viplav Kallepu
Re: Simple authentication/authorization with Struts 2 using annotation
Hi, Thank you for sharing the idea. I am also working on the authorization and authentication of my application. The authentication interceptor checks the action method for @Secured annotation and checks the session to see if the user has logged in. If not, the target page and parameters are saved in the session and the user is redirected to the login page. There is a login action that authenticates the user (using database, files, ...) and saves any needed data in the session. It then uses a LoginResult that redirects to the target page (the secured page that the user was redirected from) and sets the saved parameters for that page. My application contains lot of values in the session.So i need to populate the session after logging in using Action class of the login page. I am thinking of a design for allowing users to bookmark a page. After he selects a bookmarked page, if he is not logged in he should be redirected to login page and after logging in , he should come to the bookmarked page which is like what you explained above. Can you please tell me how did you do this. Regards Viplav Kallepu Mahdi Milani Fard [EMAIL PROTECTED] wrote: Hi, I'm developing a Struts 2 application which needs non-role-based authorization (e.g. a user can see the messages of a group if he is a member, etc.) Realm is not enough in such case and you need to add some authorization code to each action if you use realm. I developed an authentication/authorization mechanism using annotation for this problem. I thought it's good to share this with other struts users. I use two interceptors: The authentication interceptor along with @Secured annotation: @Secured public String getMessageList() { ... } The authentication interceptor checks the action method for @Secured annotation and checks the session to see if the user has logged in. If not, the target page and parameters are saved in the session and the user is redirected to the login page. There is a login action that authenticates the user (using database, files, ...) and saves any needed data in the session. It then uses a LoginResult that redirects to the target page (the secured page that the user was redirected from) and sets the saved parameters for that page. The second interceptor is authorization interceptor along with the @Authorizer annotation: @Secured @Authorizer(isMember) public String getMessageList() { ... } boolean isMember() { ... } Here the interceptor checks the action method for @Authorizer interceptor. If such annotation exists it uses reflection to call the indicated methods (e.g. isMember) on the same action object. If you add the authorization interceptor in the correct place in the interceptor stack, at the time the authorizer method is called, the action bean is populated using the setters. So the authorizer can use the filled values to check for authorization and returns a boolean indicating if the current user (saved in session) is authorized to do the action (with respect to the filled parameters.) Although it looks like re-inventing the wheel, I think this mechanism is good enough for simple authentication/authorization. -- View this message in context: http://www.nabble.com/Simple-authentication-authorization-with-Struts-2-using-annotation-tf4109818.html#a11687101 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Regards Viplav Kallepu
Re: Struts design best practice issue
Thanks for the reply.. but the variables in the actionform's datatype will be string and DTO's will be corresponding oracle dataType. I am not able to understand the advantage of writing the interface. May be I am missing the concept. Actually my doubt is whether I can write type conversion codes in Action Class and pass the variables to DTO or should I write another class where datatype conversions are made. My understanding says we shouldn't write type conversion code in Action Class . Even if I use BeanUtils.copyProperties where should I place this code. Please help me. On 7/13/07, Yoge [EMAIL PROTECTED] wrote: Write an interface with all the methods in your actionform. Your DTO bean class and actionform class should implement the interface. Now you dont need to do any type casting in your action class. Sorry if my understanding is wrong. --Yoge On 7/13/07, Viplav Kallepu [EMAIL PROTECTED] wrote: Hi All, I am new to struts and I am using struts 1.3.8. I am using a bean class for every table in oracle as a Data Transfer Object and a actionform for every jsp. Now my problem is I have to do data type conversion from my actionform to DTO and DTO to actionform, for example I have date in my jsp which is split into three drop down fileds(year,month,day) and in the DTO its a single field. How can manage this. Is it a standard that we can do data type conversions in Action Class.?? I was trying to find out best practice. Please help me in sorting out the issue. Is there any design changes I have to do?? -- Regards Viplav Kallepu -- Yoge, AdventNet, Inc. 925-965-6528 [EMAIL PROTECTED] site24x7.com -- Regards Viplav Kallepu
dynamic text fields in jsp
Hi All, I am new to struts and I am using struts 1.3.8. I am using a bean class for every table in oracle as a Data Transfer Object and a actionform for every jsp. Now my problem is I have to do data type conversion from my actionform to DTO and DTO to actionform, for example I have date in my jsp which is split into three drop down fileds(year,month,day) and in the DTO its a single field. How can manage this. Is it a standard that we can do data type conversions in Action Class.?? I was trying to find out best practice. Please help me in sorting out the issue. Is there any design changes I have to do?? -- Regards Viplav Kallepu
Struts design best practice issue
Hi All, I am new to struts and I am using struts 1.3.8. I am using a bean class for every table in oracle as a Data Transfer Object and a actionform for every jsp. Now my problem is I have to do data type conversion from my actionform to DTO and DTO to actionform, for example I have date in my jsp which is split into three drop down fileds(year,month,day) and in the DTO its a single field. How can manage this. Is it a standard that we can do data type conversions in Action Class.?? I was trying to find out best practice. Please help me in sorting out the issue. Is there any design changes I have to do?? -- Regards Viplav Kallepu
Struts 1.x Best Practices...
Hi, I am new to struts. I am using struts 1.3.8 for my project. Where can I found the appropriate best practices to maintain while devlopment. I found lot of material while browsing but wasn't able to figure out which was the good one. My doubt is I am using a bean for every oracle table. Now the dataType of variables set in the bean are same as the datatype as in the oracle table. My form uses all the strings as recommended. What is the best place to make dataType conversions that is what making me confused. As I have to use the same beanClass for updating values in oracle and also to set values for form, I cant put dataType conversion code in setter methods of the Class. If I put dataType Conversions in ActionClass.. its becoming messy, (which I feel is intended for business logic ).. I wish to use the best MVC architecture suggested by struts team.. So can anyone please help me figuring out this issue. Thanks in advance. -- Thanks Viplav
Re: Struts 1.x Best Practices...
Thanks for the Article. I read the article, In the section of DTO he said to use either BeanUtils copy properties or do data type convesrions in the setter methods. I wish to handle it with dataType conversions in setter methods and that was my doubt. I cant make two way conversion i mean from database to form and form to database in the same setter method.Can you please tell me how to handle this issue. Regards Viplav Kallepu On 6/29/07, Sean Conlon [EMAIL PROTECTED] wrote: A good article is up right now on JavaWorld.com that addresses some of Struts' best practices. http://www.javaworld.com/javaworld/jw-09-2004/jw-0913-struts.html Sean Conlon Credera www.credera.com Direct: 972.692.0010 Mobile: 254.644.3587 [EMAIL PROTECTED] The Power of Perspective -Original Message- From: Viplav Kallepu [mailto:[EMAIL PROTECTED] Sent: Friday, June 29, 2007 9:23 AM To: Struts Users Mailing List Subject: Struts 1.x Best Practices... Hi, I am new to struts. I am using struts 1.3.8 for my project. Where can I found the appropriate best practices to maintain while devlopment. I found lot of material while browsing but wasn't able to figure out which was the good one. My doubt is I am using a bean for every oracle table. Now the dataType of variables set in the bean are same as the datatype as in the oracle table. My form uses all the strings as recommended. What is the best place to make dataType conversions that is what making me confused. As I have to use the same beanClass for updating values in oracle and also to set values for form, I cant put dataType conversion code in setter methods of the Class. If I put dataType Conversions in ActionClass.. its becoming messy, (which I feel is intended for business logic ).. I wish to use the best MVC architecture suggested by struts team.. So can anyone please help me figuring out this issue. Thanks in advance. -- Thanks Viplav - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Regards Viplav Kallepu
sub-Menu in struts
Hi, I am using struts 1.3.8. I have menu buttons on the left side of the page. What I have to is when I click the menu a submenu should open below it. Can anyone please help me how to do this in struts without refreshing page. Any help is appreciated. Thanks and Regards Viplav Kallepu
datagrid doubt
Hi , i wish to implement datagrid in struts ...query's, validations, type of boxes and other things will be in XML file ...I have to parse it and know the query and depending on the query i have to get the fields. I have to give an edit option for the fields. At present what I am doing is I am putting all the values in the arraylist and keeping that arraylist in Map this map I am keeping in session and changing the values in session after user edits and after he clicks save I am commiting to database. I feel the implementation is not generic. Can you please give me a better way to implement datagrid. I am not using struts layout. Struts 1.3.8 is the version. thanks and regards Viplav Kallepu