Re: Need help in fixing issue with Url refresh

2015-06-12 Thread Preetham Mallavarapu
HI Christoph,

Sorry for the delayed response.

Thanks a lot for your assistance on this issue. Now its working for me.

My Classes are almost similar to what you said except that I was
redirecting to the home page from the login action which was causing the
issue. I have made tweaks in my code as per your suggestion and it
perfectly works now.

Tons of Thanks again.

Thanks,
Hari Krishna

On Wed, Jun 10, 2015 at 1:34 PM, Christoph Nenning 
christoph.nenn...@lex-com.net wrote:

 Hi,


 well, I would create more files for that:

 - LoginAction
 - login.jsp
 - LoginManager
 - UserDataAction
 - userData.jsp


 And flow would be like this:
 - Send GET request to LoginAction
 - LoginAction uses some result to show login.jsp (e.g. dispatcher-result,
 tiles, sitemesh, ...)
 - login.jsp shows a login form
 - when user submits that form a POST request is sent to LoginAction
 - LoginAction uses LoginManager to check if user is valid
 - LoginAction must somehow remember that user is logged in. It could put
 an object in http-session or set a custom cookie, ...
 - LoginAction redirects to UserDataAction (by using a redirect-result)
 - This causes the Browser to send a new GET request to UserDataAction
 - UserDataAction checks that user is logged in (by checking the session,
 cookie, ...) and uses LoginManager to load user-data
 - UserDataAction uses some result to show userData.jsp (again: e.g.
 dispatch, tiles, sitemesh, ...)
 - userData.jsp uses struts tags and OGNL to display user-data which has
 been loaded into UserDataAction



 That shows how the MVC-pattern is handled in struts:
 - Action classes are controllers, all URLs point to actions
 - Action classes use Logic classes (like LoginManager) and let them do
 busines logic
 - JSPs are just used for the View part, they are only invoked through
 actions


 It also shows how 'login to a web app' is usually done: by using session
 or cookies.



 Regards,
 Christoph




  From: Preetham Mallavarapu preethamreddy.mallaar...@gmail.com
  To: Struts Users Mailing List user@struts.apache.org,
  Date: 09.06.2015 17:49
  Subject: Re: Need help in fixing issue with Url refresh
 
  Hi Christoph,
 
  Thanks for your quick response..I am briefing the issue once again..
 
 
  The inital flow was like this before...
 
  I have login.jsp(username and password) - checkUser
 method(loginManager)-
  Method calls a function in DB class and gets the user details if exist -
 
  returns success to strus.xml - now user details gets displayed in UI
 page..
 
  here the url comes as said before..
  http://localhost:8081/NewApp/checkUserLoginManager
 
  and when I refresh it throws exception which might be due to calling the
  checkUsermethod..
 
  After the suggestion I have used a redirectAction
 
  I have login.jsp(username and password) - checkUser
 method(loginManager)-
  Method calls a function in DB class and gets the user details if exist -
  returns success to strus.xml -now I have used a redirect action to
  another Action class which inturn redirects to homepage (but the problem
 is
  that it doesnt display the user details now) and the url issue got
 fixed..
 
  Now the url is like below
  http://localhost:8081/ExamCentre/displayManager.action
 
 
  Now if I try to move the login validation to second action, I am unclear
 on
  how to pass the data from login.jsp to the second action..
 
 
 
  The project is in initial stage so I have 2 action class one for
  registrtaion and one for login apart from the new one created for
  redirection.
 
 
  Below is my struts.xml for reference
 
 
  action name=*LoginManager class=com.project.manager.LoginManager
  method={1}
  result name=displayLoginPage type=redirect
  param name=locationlogin.jsp/param
  /result
 
  result name=studentHomePage type=redirectAction
param name=actionNamedisplayManager/param
  /result
  /action
   action name=displayManager
 class=com.project.manager.DisplayManager
  result name=successstudent/studentHomePage.jsp/result
  /action
 
 action name=*RegistrationManager
  class=com.project.manager.RegistrationManager method={1}
 
 
  result name=displayLoginPagelogin.jsp/result
  result
 name=newUserRegistrationFailedsignup.jsp/result
 
  /action
 
 
 
 
 
  Thanks,
  Hari Krishna
 
 
 
 
  On Tue, Jun 9, 2015 at 8:10 PM, Christoph Nenning 
  christoph.nenn...@lex-com.net wrote:
 
From: Preetham Mallavarapu preethamreddy.mallaar...@gmail.com
To: Struts Users Mailing List user@struts.apache.org,
Date: 09.06.2015 16:27
Subject: Re: Need help in fixing issue with Url refresh
   
Hi Christoph,
   
I have tried working in the way login-post-request (using
redirectAction)..It successfully redirects to the required page but
 its
   not
displaying the data in that..
   
ex:
   
In jsP I have s:text name=firstName/
   
when I do without redirect it 

Re: Need help in fixing issue with Url refresh

2015-06-12 Thread Christoph Nenning
 From: Preetham Mallavarapu preethamreddy.mallaar...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org, 
 Date: 12.06.2015 09:38
 Subject: Re: Need help in fixing issue with Url refresh
 
 HI Christoph,
 
 Sorry for the delayed response.
 
 Thanks a lot for your assistance on this issue. Now its working for me.
 
 My Classes are almost similar to what you said except that I was
 redirecting to the home page from the login action which was causing the
 issue. I have made tweaks in my code as per your suggestion and it
 perfectly works now.
 
 Tons of Thanks again.
 
 Thanks,
 Hari Krishna
 


:)


This Email was scanned by Sophos Anti Virus


Re: Struts 1.1 issues after moving to tomcat 7.0.57 from Tomcat 5.0.28

2015-06-12 Thread RAJ
Hi,
Can someone please provide me re solution.

Thanks
Raj


 On Jun 10, 2015, at 6:54 PM, Raj bsudershan...@gmail.com wrote:
 
 I am facing this issue after porting my application from the existing Tomcat 
 5.0.28 to the new tomcat 7.0.57. 
 I am using Struts version 1.1 is something particular, the app in both the 
 old and new environments work except for a few pages in the new env where 
 when I click on the submit button it is directing to 
 http://calculators/CertSsCalculator.do if I see the source of the page I see.
 
 new environment (bombs due to //)
 form name=CalculatorForm method=post 
 action=//calculators/Calculator.do onsubmit=return validateForm();
 
 old environment (works fine)
 form name=CalculatorForm method=post action=/calculators/Calculator.do 
 onsubmit=return validateForm();
  
 The jsp is the same with no changes
 html:form action=/calculators/Calculator onsubmit=return validateForm(); 
 
 
 Has any one see something like this and can suggest what can be tried and 
 totally at a loss.
 
 Thank You