Re: Action Execute Being called 2 times

2008-08-04 Thread aum strut
Hi,

I tried all things and its again not working still action is getting called
2 times for each call to this Register Action i am attaching the
Register.jsp,Struts.xml as well as the action class please have a look at it
and point me where i am doing the mistake.


Thanks in Advance
-aum

On Fri, Aug 1, 2008 at 5:37 PM, Joachim Ansorg [EMAIL PROTECTED] wrote:

 Hi,
 you use the same action to render the welcome screen and Registrer.jsp.

 So this means that when you display the welcome screen execute() is called
 and when you display the Registrer.jsp page.

 Either use two separate actions or just return null in execute and have
 another action method (i.e. save()) which writes into the db.
 In the page with the submit button link to the action's save method. So
 execute is used for welcome and save for the registration.

 Hope that helps,
 Joachim

 Hi All,

 While developing an application in struts2 i am facing a strange problem
 with one of my action namely RegsitrationAction.
 i have a jsp page for user registration where there are certain fields for
 the user to be filled for the registration purpose.
 i have created a UserProfile bean class with the bean properties for all
 the
 user registration field.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


package actionsfolder;

import com.opensymphony.xwork2.ActionSupport;

public class UserRegistrationAction extends ActionSupport{

/**
 * 
 */
private static final long serialVersionUID = -4632666801257988218L;

private String username=null;
private String password=null;
private String email=null;
/**
 * @return the username
 */
public String getUsername() {
return username;
}
/**
 * @param username the username to set
 */
public void setUsername(String username) {
this.username = username;
}
/**
 * @return the password
 */
public String getPassword() {
return password;
}
/**
 * @param password the password to set
 */
public void setPassword(String password) {
this.password = password;
}
/**
 * @return the email
 */
public String getEmail() {
return email;
}
/**
 * @param email the email to set
 */
public void setEmail(String email) {
this.email = email;
}

public String execute() throws Exception{
System.out.println(**in Action***);
return SUCCESS;
}

}
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration 2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;
struts
  
package name=actionsfolder extends=struts-default
action name=Login class=actionsfolder.LoginAuthenticationAction
result name=success/welcome/welcome.jsp/result
result name=input/index.jsp/result
/action

action name=Logout class=actionsfolder.LogoutAction
result name=success/welcome/welcome.jsp/result

/action
action name=ReLogin
  result/index.jsp/result
  /action
  
  action name=RegisterNewUser class=actionsfolder.UserRegistrationAction
  result name=success/index.jsp/result
  /action
  
  action name=Registration
  result/registration/Registrer.jsp/result
  /action
/package  
 
/struts
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Action Execute Being called 2 times

2008-08-04 Thread Gabriel Belingueres
can't see the jsp file.
In the action class you are not using modeldriven as you said in the
first email.

2008/8/4 aum strut [EMAIL PROTECTED]:
 Hi,

 I tried all things and its again not working still action is getting called
 2 times for each call to this Register Action i am attaching the
 Register.jsp,Struts.xml as well as the action class please have a look at it
 and point me where i am doing the mistake.


 Thanks in Advance
 -aum

 On Fri, Aug 1, 2008 at 5:37 PM, Joachim Ansorg [EMAIL PROTECTED] wrote:

 Hi,
 you use the same action to render the welcome screen and Registrer.jsp.

 So this means that when you display the welcome screen execute() is called
 and when you display the Registrer.jsp page.

 Either use two separate actions or just return null in execute and have
 another action method (i.e. save()) which writes into the db.
 In the page with the submit button link to the action's save method. So
 execute is used for welcome and save for the registration.

 Hope that helps,
 Joachim

 Hi All,

 While developing an application in struts2 i am facing a strange problem
 with one of my action namely RegsitrationAction.
 i have a jsp page for user registration where there are certain fields
 for
 the user to be filled for the registration purpose.
 i have created a UserProfile bean class with the bean properties for all
 the
 user registration field.

 -
 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]



Action Execute Being called 2 times

2008-08-01 Thread aum strut
Hi All,

While developing an application in struts2 i am facing a strange problem
with one of my action namely RegsitrationAction.
i have a jsp page for user registration where there are certain fields for
the user to be filled for the registration purpose.
i have created a UserProfile bean class with the bean properties for all the
user registration fields.

in the Action class i am using Model Driven Approach for the Data Transfer
but my action execute method is being called 2 times and i am unable to
figure out the exact problem,but i can find the same data twice in the
database.below is the snapshot of my action calss as well as the Struts.xml
file for the Registration Process.

*ACTION CLASS

public class UserRegistration extends ActionSupport implements
ModelDrivenUserProfile {

/**
 *
 */
private static final long serialVersionUID = 4619853901735738145L;
private boolean status=false;
public String execute()throws Exception{

RegisterUser registerUser=new RegisterUser();
status=registerUser.registerNewUser(userProfile);

System.out.println(***Status is*
+status);
if(status){
return SUCCESS;
}
else{
return INPUT;
}
}

private UserProfile userProfile=new UserProfile();

public UserProfile getModel(){
return userProfile;
}



}


Struts.xml

action name=Register class=actionsfolder.UserRegistration
result name=success/welcome/welcome.jsp/result
result name=input/registration/Registrer.jsp/result

/action

Any help in this regard will be much appriciated..


Thanks in advance
-aum
*


Re: Action Execute Being called 2 times

2008-08-01 Thread Joachim Ansorg

Hi,
you use the same action to render the welcome screen and Registrer.jsp.

So this means that when you display the welcome screen execute() is 
called and when you display the Registrer.jsp page.


Either use two separate actions or just return null in execute and have 
another action method (i.e. save()) which writes into the db.
In the page with the submit button link to the action's save method. So 
execute is used for welcome and save for the registration.


Hope that helps,
Joachim

Hi All,

While developing an application in struts2 i am facing a strange problem
with one of my action namely RegsitrationAction.
i have a jsp page for user registration where there are certain fields for
the user to be filled for the registration purpose.
i have created a UserProfile bean class with the bean properties for all the
user registration field.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]