Problem using scope interceptor

2009-08-18 Thread spsarolkar

I am trying apress book example chapter06. Here is my struts.xml file
struts

constant name=struts.codebehind.defaultPackage value=base-package/
constant name=struts.codebehind.pathPrefix value=/WEB-INF/jsp//
package name=base-package extends=struts-default 
default-interceptor-ref name=paramsPrepareParamsStack /
global-results
result name=unknownError/WEB-INF/jsp/error.jsp/result
result
name=dupPK/WEB-INF/jsp/user/findUser-success.jsp/result
/global-results
global-exception-mappings
exception-mapping
exception=org.hibernate.exception.ConstraintViolationException
result=dupPK /
exception-mapping exception=java.lang.Exception
result=unknownError /
/global-exception-mappings
action name=index class=org.xinus.actions.BaseAction
result name=success/WEB-INF/jsp/index.jsp/result
/action
/package
package name=enterEvent namespace=/event extends=base-package
interceptors
interceptor name=flash
class=com.opensymphony.webwork.interceptor.FlashInterceptor /
interceptor-stack name=eventStack
interceptor-ref name=scope
model
partialEvent
/interceptor-ref
interceptor-ref name=paramsPrepareParamsStack/
/interceptor-stack
/interceptors
default-interceptor-ref name=eventStack/

action name=addEventFlow
class=org.xinus.actions.event.BaseEventAction
interceptor-ref name=eventStack
start
/interceptor-ref
result/WEB-INF/jsp/event/enterEventDetails-input.jsp/result
/action
action name=endEventFlow
class=org.xinus.actions.event.BaseEventAction
interceptor-ref name=eventStack
end
/interceptor-ref
result/WEB-INF/jsp/event/eventReview.jsp/result
/action
action name=flashedSelectEventType
class=org.xinus.actions.event.SelectLocationTypeAction
interceptor-ref name=flash
Retrieve
/interceptor-ref
interceptor-ref name=eventStack /
result/WEB-INF/jsp/event/selectLocationType-input.jsp/result
/action
/package

/struts

Here is my BaseEventAction.java
public class BaseEventAction extends BaseAction implements
ModelDrivenEvent {

protected Event event = null;

public Event getModel() {
return event;
}

public void setModel(Event model) {
this.event = model;
}

}

Here is my EnterEventDetailsAction.java
@ParentPackage(enterEvent)
@Result(type=
ServletActionRedirectResult.class,value=selectLocationType,params={method,input})
@Validation
public class EnterEventDetailsAction extends BaseEventAction implements
Preparable {

private Date partialStartDate;
private String patialStartTime;
private String partialVotingStartTime;

public void prepare() throws Exception {
event = new Event();
event.setStatus(Progress.NOT_STARTED);
event.setLastUpdateTime( Calendar.getInstance().getTime() );
}

public Date getPartialStartDate() {
return partialStartDate;
}

@RequiredFieldValidator(message=Validation Error,
key=validate.notEmpty)
public void setPartialStartDate(Date partialStartDate) {
this.partialStartDate = partialStartDate;
}

public String getPatialStartTime() {
return patialStartTime;
}

@CustomValidator(type =timeValidator, key=validate.timeOfDay)
public void setPatialStartTime(String patialStartTime) {
this.patialStartTime = patialStartTime;
}

public String getPartialVotingStartTime() {
return partialVotingStartTime;
}

@CustomValidator(type =timeValidator, key=validate.timeOfDay)
public void setPartialVotingStartTime(String partialVotingStartTime) {
this.partialVotingStartTime = partialVotingStartTime;
}

@VisitorFieldValidator(message=Default message, fieldName=model,
shortCircuit=false, appendPrefix=false)
public String execute() throws Exception {

Calendar cal = Calendar.getInstance();

cal.setTime(partialStartDate);
TimeUtil timeUtil = new TimeUtil(patialStartTime);
event.setStartTime( timeUtil.resolveDate( partialStartDate,
event.getTimeZoneOffset() ) );

cal = Calendar.getInstance();
cal.setTime(partialStartDate);
timeUtil = new TimeUtil(partialVotingStartTime);
event.setVotingStartTime( timeUtil.resolveDate( partialStartDate,
event.getTimeZoneOffset() ) );

return SUCCESS;

}
}

Here is my SelectLocationTypeAction.java
@ParentPackage(enterEvent)
@Result(type=
ServletActionRedirectResult.class,value=enterLocationDetails)
public class SelectLocationTypeAction extends BaseEventAction implements
Preparable {

private Integer typeId;
private 

Creating struts2 themes

2009-08-14 Thread spsarolkar

I am learning struts2 and want to create custom themes. I am not able to find
and documentation which tells how to create new themes. Can somebody tell me
the link to the documentation where theme creation is explained step by
step.
Thanks in advance..:-) 
-- 
View this message in context: 
http://www.nabble.com/Creating-struts2-themes-tp24968978p24968978.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



How to use workflow interceptor??

2009-08-14 Thread spsarolkar

Hello everyone,
I want to write simple program using workflow interceptor where can i find
information about workflow interceptor
thanks
-- 
View this message in context: 
http://www.nabble.com/How-to-use-workflow-interceptor---tp24970880p24970880.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Scope interceptor / Practical Apache Struts 2

2009-08-14 Thread spsarolkar

Hello Ian,
I am facing the same problem. 
I tried adding dependency as selkin said as follows
 dependencies
dependency
groupIdcom.googlecode.struts2scopeplugin/groupId
artifactIdstruts2-scope-plugin/artifactId
version1.0.3/version
/dependency
/dependencies

But printing the same error

Can you please supply me another copy of the code . 

My email address is spsarol...@gmail.com

Thanks,
Sunil


Ian Roughley wrote:
 
 I just re-ran my local version of the code without problems, and 
 verified that the base class does have a getModel() and setModel() 
 methods.  If you contact me off-list I can supply another copy of the 
 code, that might be a resolution.  Did you have any problems running the 
 code from chapter 5?
 
 /Ian
 
 -- 
 Ian Roughley
 From Down  Around, Inc.
 Consulting * Training / Mentoring * Agile Process * Open Source
 web: http://www.fdar.com - email: i...@fdar.com
 
 
 
 Selckin wrote:
 Hello,

 In Chapter 6 of Practical Apache Struts 2 Web 2.0 Projects, It explains
 how to use the scope interceptor to create sort of wizard pages.
 I've been trying to figure these out, but cannot get this to work.
 Even the included example (downloadable from
 http://www.apress.com/book/view/1590599039 ) do not work for me.

 I was hoping someone could try them and tell me if they are indeed broken
 or if i am doing something wrong. And what that might be?

 Running the examples with no changes and when going to the second step in
 the workflow I get the following error:

 HTTP ERROR: 500
 Error setting expression 'model' with value
 'com.fdar.apress.s2.domain.ev...@2a163765'

 RequestURI=/app/event/selectLocation!input.action
 Caused by:
 Error setting expression 'model' with value
 'com.fdar.apress.s2.domain.ev...@2a163765' - [unknown location]
  at
 com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:171)
  at
 com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:146)
  at
 org.apache.struts2.interceptor.ScopeInterceptor.before(ScopeInterceptor.java:321)
  at
 org.apache.struts2.interceptor.ScopeInterceptor.intercept(ScopeInterceptor.java:424)
   cut 
 Caused by: No object in the CompoundRoot has a publicly accessible
 property named 'model' (no setter could be found). - [unknown location]
  at
 com.opensymphony.xwork2.util.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:68)
  at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
  at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
  at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
  cut  
 Can provide full stack trace if needed

 The following is also outputted from the example.

 SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
 caught setting 'duration' on 'class
 com.fdar.apress.s2.actions.event.EnterEventDetailsAction: Error setting
 expression 'duration' with value '[Ljava.lang.String;@602f892f'
 14-feb-2008 20:10:30
 com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
 SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
 caught setting 'name' on 'class
 com.fdar.apress.s2.actions.event.EnterEventDetailsAction: Error setting
 expression 'name' with value '[Ljava.lang.String;@50d79dfe'
 14-feb-2008 20:10:30
 com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
 SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
 caught setting 'timeZoneOffset' on 'class
 com.fdar.apress.s2.actions.event.EnterEventDetailsAction: Error setting
 expression 'timeZoneOffset' with value '[Ljava.lang.String;@52a53948'
 14-feb-2008 20:10:30
 com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters

 Thanks.

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org

   
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Scope-interceptor---Practical-Apache-Struts-2-tp15487610p24971259.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Validation does not work on redirect result

2009-08-12 Thread spsarolkar

I am new to struts2 and just wrote one small program.
I wanted to ask why Validation works for only dispatcher result and not
redirect result. 
I want it with redirect result because it will allow bookmarking of page
even when validation fails.
-- 
View this message in context: 
http://www.nabble.com/Validation-does-not-work-on-redirect-result-tp24939128p24939128.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validation does not work on redirect result

2009-08-12 Thread spsarolkar
)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313) at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506) at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514) at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381) at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)

Here are the dependencies and their versions

!-- Junit --
dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
version3.8.1/version
scopetest/scope
/dependency

!--  Struts 2 --
dependency
groupIdorg.apache.struts/groupId
artifactIdstruts2-core/artifactId
version2.0.11.2/version
/dependency
dependency
groupIdorg.apache.struts/groupId
artifactIdstruts2-sitemesh-plugin/artifactId
version2.0.11.2/version
/dependency
dependency
groupIdorg.apache.struts/groupId
artifactIdstruts2-spring-plugin/artifactId
version2.0.11.2/version
/dependency

!-- Servlet  Jsp --
dependency
groupIdjavax.servlet/groupId
artifactIdservlet-api/artifactId
version2.4/version
scopeprovided/scope
/dependency
dependency
groupIdjavax.servlet/groupId
artifactIdjsp-api/artifactId
version2.0/version
scopeprovided/scope
/dependency

!-- Jakarta Commons --
dependency
groupIdcommons-fileupload/groupId
artifactIdcommons-fileupload/artifactId
version1.1.1/version
/dependency

!-- Dwr --
dependency
groupIduk.ltd.getahead/groupId
artifactIddwr/artifactId
version1.1-beta-3/version
/dependency

!--Hibernate--
dependency
groupIdorg.hibernate/groupId
artifactIdhibernate/artifactId
version3.2.1.ga/version
/dependency
dependency
groupIdorg.hibernate/groupId
artifactIdhibernate-annotations/artifactId
version3.2.1.ga/version
/dependency
dependency
groupIdorg.hibernate/groupId
artifactIdhibernate-entitymanager/artifactId
version3.2.1.ga/version
/dependency

!--Mysql--
dependency
groupIdmysql/groupId
artifactIdmysql-connector-java/artifactId
version3.1.14/version
/dependency

!--Persistence api--
dependency
groupIdjavax.persistence/groupId
artifactIdpersistence-api/artifactId
version1.0/version
/dependency
dependency
groupIdjavax.transaction/groupId
artifactIdjta/artifactId
version1.0.1B/version
/dependency

!--Code behind--
dependency
groupIdorg.apache.struts/groupId
artifactIdstruts2-codebehind-plugin/artifactId
version2.0.9/version
/dependency

!--Jmock--
dependency
groupIdjmock/groupId
artifactIdjmock/artifactId
version1.0.1/version
scopetest/scope
/dependency 

I have used suppressed warnings at class level like follows
@SuppressWarnings({ALL})
public class RedirectMessageInterceptor extends MethodFilterInterceptor {
...
...
...
..
..
.
.
}





Greg Lindholm-2 wrote:
 
 Why do you think validation is not working?
 Is it because you are not seeing error messages?
 Error messages are not normally preserved across a redirect, if you would
 like them to be you can add an interceptor to do this.
 
 See if this helps:
 http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/
 
 
 On Wed, Aug 12, 2009 at 11:33 AM, spsarolkar spsarol...@gmail.com wrote:
 

 I am new to struts2 and just wrote one small program.
 I wanted to ask why Validation works for only dispatcher result and not
 redirect result.
 I want it with redirect result because it will allow bookmarking of page
 even when validation fails.
 --
 View this message in context:
 http://www.nabble.com/Validation-does-not-work-on-redirect-result

Re: Validation does not work on redirect result

2009-08-12 Thread spsarolkar

thanks i missed that

But i am not able to understand statement

Here is my FindUser.action
@ParentPackage(base-package)
public class FindUserAction extends UserAction implements
ServletRequestAware {
HttpServletRequest request;
public void setServletRequest(HttpServletRequest httpServletRequest) {
request=httpServletRequest;
}
public String execute(){
if(user!=null) request.getSession().setAttribute(user,user);
return SUCCESS;
}
}

Here is struts.xml

struts
constant name=struts.codebehind.defaultPackage value=base-package
/
constant name=struts.codebehind.pathPrefix value=/WEB-INF/jsp//

package name=base-package extends=struts-default
interceptors
interceptor name=redirectMessage
class=org.xinus.interceptors.RedirectMessageInterceptor /
interceptor-stack name=myStack
interceptor-ref name=redirectMessage /
interceptor-ref name=paramsPrepareParamsStack /
/interceptor-stack
/interceptors

default-interceptor-ref name=myStack /

global-results
result name=unknownError/WEB-INF/jsp/error.jsp/result 
   
/global-results
global-exception-mappings
exception-mapping exception=java.lang.Exception
result=unknownError/
exception-mapping
exception=org.hibernate.exception.ConstraintViolationException
result=dupPK/
/global-exception-mappings
action name=index class=org.xinus.actions.BaseAction
result name=success/WEB-INF/jsp/index.jsp/result
/action
/package
!--package name=myPackage extends=struts-default
action name=index class=org.xinus.IndexAction
result/jsp/index.jsp/result
/action
action name=helloWorld class=helloWorldAction 
result name=input/jsp/index.jsp/result
result/jsp/helloWorld.jsp/result
/action
/package--
/struts


Whatever that statement means I got that I need to configure input result
for FindUser.action. Can you please help me understand what is workflow
interceptor doing here. I know about workflow interceptor as it is
responsible for calling validate method on action if action implements
ValidationAware interface and collecting errors if any

maybe I should point result like this 
@ParentPackage(base-package)
@Result(name=input,value=findUser,type=ServletActionRedirectResult.class)
public class FindUserAction extends UserAction implements
ServletRequestAware {
HttpServletRequest request;
public void setServletRequest(HttpServletRequest httpServletRequest) {
request=httpServletRequest;
}
public String execute(){
if(user!=null) request.getSession().setAttribute(user,user);
return SUCCESS;
}
}



Greg Lindholm-2 wrote:
 
 No result defined for action org.xinus.actions.user.FindUserAction and
 result input at

 
 From the write up at:
 http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/
 
 The one thing you need to be aware of is: The action you are redirecting
 towards will need to configure a result with name=”input” as the added
 messages will trigger the ‘workflow’ interceptor to return a result of
 “input”.
 
 You need to configure a result of 'input' for action FindUserAction.
 
 If you don't know what this means then post your struts configuration
 (struts.xml).
 
 

-- 
View this message in context: 
http://www.nabble.com/Validation-does-not-work-on-redirect-result-tp24939128p24941557.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validation does not work on redirect result

2009-08-12 Thread spsarolkar

Yep its working wonderfully,
I shouldn't have made use of ServletRedirectAction. Following worked for me

@ParentPackage(base-package)
@Result(name=input,value=/WEB-INF/jsp/user/findUser-success.jsp)
public class FindUserAction extends UserAction implements
ServletRequestAware {
HttpServletRequest request;
public void setServletRequest(HttpServletRequest httpServletRequest) {
request=httpServletRequest;
}
public String execute(){
if(user!=null) request.getSession().setAttribute(user,user);
return SUCCESS;
}
}

Greg Lindholm-2 wrote:
 
 You are going to want to define at least the 2 results 'success' and
 'input'
 for FindUserAction.
 The 'input' result should not be a redirect, it should be to a jsp (or
 Freemarker, or velocity, etc).
 
 Here is an example from my app using struts.xml configuration:
 
 action name=UserList class=my.xxx.struts.UserListAction
   method=doList
   result/struts/UserList.jsp/result
   result name=input/struts/UserList.jsp/result
 /action
 
 I don't use annotations to define results but I think it would look like
 this:
 
 @Results({
 @Result (name=success, location=/struts/User/List.jsp),
 @Result (name=input, location=/struts/User/List.jsp)
 })
 
 
 On Wed, Aug 12, 2009 at 1:48 PM, spsarolkar spsarol...@gmail.com wrote:
 

 thanks i missed that

 But i am not able to understand statement

 Here is my FindUser.action
 @ParentPackage(base-package)
 public class FindUserAction extends UserAction implements
 ServletRequestAware {
HttpServletRequest request;
public void setServletRequest(HttpServletRequest httpServletRequest) {
request=httpServletRequest;
}
public String execute(){
if(user!=null) request.getSession().setAttribute(user,user);
return SUCCESS;
}
 }

 Here is struts.xml

 struts
constant name=struts.codebehind.defaultPackage value=base-package
 /
constant name=struts.codebehind.pathPrefix value=/WEB-INF/jsp//

package name=base-package extends=struts-default
interceptors
interceptor name=redirectMessage
 class=org.xinus.interceptors.RedirectMessageInterceptor /
interceptor-stack name=myStack
interceptor-ref name=redirectMessage /
interceptor-ref name=paramsPrepareParamsStack /
/interceptor-stack
/interceptors

default-interceptor-ref name=myStack /

global-results
result name=unknownError/WEB-INF/jsp/error.jsp/result
/global-results
global-exception-mappings
exception-mapping exception=java.lang.Exception
 result=unknownError/
exception-mapping
 exception=org.hibernate.exception.ConstraintViolationException
 result=dupPK/
/global-exception-mappings
action name=index class=org.xinus.actions.BaseAction
result name=success/WEB-INF/jsp/index.jsp/result
/action
/package
!--package name=myPackage extends=struts-default
action name=index class=org.xinus.IndexAction
result/jsp/index.jsp/result
/action
action name=helloWorld class=helloWorldAction
result name=input/jsp/index.jsp/result
result/jsp/helloWorld.jsp/result
/action
/package--
 /struts


 Whatever that statement means I got that I need to configure input result
 for FindUser.action. Can you please help me understand what is workflow
 interceptor doing here. I know about workflow interceptor as it is
 responsible for calling validate method on action if action implements
 ValidationAware interface and collecting errors if any

 maybe I should point result like this
 @ParentPackage(base-package)

 @Result(name=input,value=findUser,type=ServletActionRedirectResult.class)
 public class FindUserAction extends UserAction implements
 ServletRequestAware {
HttpServletRequest request;
public void setServletRequest(HttpServletRequest httpServletRequest) {
request=httpServletRequest;
}
public String execute(){
if(user!=null) request.getSession().setAttribute(user,user);
return SUCCESS;
 }
 }



 Greg Lindholm-2 wrote:
 
  No result defined for action org.xinus.actions.user.FindUserAction and
  result input at
 
 
  From the write up at:
 
 http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/
 
  The one thing you need to be aware of is: The action you are
 redirecting
  towards will need to configure a result with name=”input” as the added
  messages will trigger the ‘workflow’ interceptor to return a result of
  “input”.
 
  You need to configure a result of 'input' for action FindUserAction.
 
  If you don't know what this means then post your struts configuration
  (struts.xml).
 
 

 --
 View this message in context:
 http://www.nabble.com/Validation-does-not-work-on-redirect-result

RE: Validation does not work on redirect result

2009-08-12 Thread spsarolkar

FindUserAction extends UserAction which in turn extends from ActionSupport so
why add another import for ActionSupport so I directly used 

return SUCCESS;

//

Following does not work --
@ParentPackage(base-package) 
@Result(name=input,value=findUser,type=ServletActionRedirectResult.class) 
public class FindUserAction extends UserAction implements
ServletRequestAware { 
HttpServletRequest request; 
public void setServletRequest(HttpServletRequest httpServletRequest) { 
request=httpServletRequest; 
} 
public String execute(){ 
if(user!=null) request.getSession().setAttribute(user,user); 
return SUCCESS; 
} 
}

Following works --
 @ParentPackage(base-package)
 @Result(name=input,value=/WEB-INF/jsp/user/findUser-success.jsp)
 public class FindUserAction extends UserAction implements
 ServletRequestAware {
 HttpServletRequest request;
 public void setServletRequest(HttpServletRequest httpServletRequest) {
 request=httpServletRequest;
 }
 public String execute(){
 if(user!=null) request.getSession().setAttribute(user,user);
 return SUCCESS;
 }
 }
 

mgainty wrote:
 
 
 execute should return ActionSupport.SUCCESS;
 
 curious as to which document stated to use ServletRedirectAction for a
 result?
 Martin Gainty 
 __ 
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
  
 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
 Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
 dient lediglich dem Austausch von Informationen und entfaltet keine
 rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
 E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
 destinataire prévu, nous te demandons avec bonté que pour satisfaire
 informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
 copie de ceci est interdite. Ce message sert à l'information seulement et
 n'aura pas n'importe quel effet légalement obligatoire. Étant donné que
 les email peuvent facilement être sujets à la manipulation, nous ne
 pouvons accepter aucune responsabilité pour le contenu fourni.
 
 
 
 
 Date: Wed, 12 Aug 2009 12:22:24 -0700
 From: spsarol...@gmail.com
 To: user@struts.apache.org
 Subject: Re: Validation does not work on redirect result
 
 
 Yep its working wonderfully,
 I shouldn't have made use of ServletRedirectAction. Following worked for
 me
 
 @ParentPackage(base-package)
 @Result(name=input,value=/WEB-INF/jsp/user/findUser-success.jsp)
 public class FindUserAction extends UserAction implements
 ServletRequestAware {
 HttpServletRequest request;
 public void setServletRequest(HttpServletRequest httpServletRequest)
 {
 request=httpServletRequest;
 }
 public String execute(){
 if(user!=null) request.getSession().setAttribute(user,user);
 return SUCCESS;
 }
 }
 
 Greg Lindholm-2 wrote:
  
  You are going to want to define at least the 2 results 'success' and
  'input'
  for FindUserAction.
  The 'input' result should not be a redirect, it should be to a jsp (or
  Freemarker, or velocity, etc).
  
  Here is an example from my app using struts.xml configuration:
  
  action name=UserList class=my.xxx.struts.UserListAction
method=doList
result/struts/UserList.jsp/result
result name=input/struts/UserList.jsp/result
  /action
  
  I don't use annotations to define results but I think it would look
 like
  this:
  
  @Results({
  @Result (name=success, location=/struts/User/List.jsp),
  @Result (name=input, location=/struts/User/List.jsp)
  })
  
  
  On Wed, Aug 12, 2009 at 1:48 PM, spsarolkar spsarol...@gmail.com
 wrote:
  
 
  thanks i missed that
 
  But i am not able to understand statement
 
  Here is my FindUser.action
  @ParentPackage(base-package)
  public class FindUserAction extends UserAction implements
  ServletRequestAware {
 HttpServletRequest request;
 public void setServletRequest(HttpServletRequest
 httpServletRequest) {
 request=httpServletRequest;
 }
 public String execute(){
 if(user!=null) request.getSession().setAttribute(user,user);
 return SUCCESS;
 }
  }
 
  Here is struts.xml
 
  struts
 constant name=struts.codebehind.defaultPackage
 value=base-package
  /
 constant name=struts.codebehind.pathPrefix
 value=/WEB-INF/jsp//
 
 package name=base-package extends=struts-default
 interceptors
 interceptor name=redirectMessage
  class=org.xinus.interceptors.RedirectMessageInterceptor /
 interceptor-stack name=myStack
 interceptor-ref name=redirectMessage /
 interceptor-ref name=paramsPrepareParamsStack /
 /interceptor-stack

Re: Problem with paramsPrepareParamsStack

2009-08-11 Thread spsarolkar

Its working now,  User class must be Serializable. But Why it matters for
Validation?? 
Since we want to persist User class it must be serializable 
But why Validation was not working??? 
Why Validation requires a Serializable class???

Just for curiosity...



spsarolkar wrote:
 
 Hi, thanks I missed that..
 But now validation is no working/partially working i.e. when i submit
 invalid values i am redirected to input result but messages are not
 printed. Also values are not inserted to database. Here are modified files
 
 
 UpdateUserAction.java wrote:
 
 @ParentPackage(base-package)
 @Results({
 @Result(name=success,value=index,type=
 ServletActionRedirectResult.class),

 @Result(name=dupPK,value=/WEB-INF/jsp/user/findUser-success.jsp),

 @Result(name=error,value=/WEB-INF/jsp/user/findUser-success.jsp),

 @Result(name=input,value=findUser,type=ServletActionRedirectResult.class)
 })
 @Validation
 public class UpdateUserAction extends BaseUserAction {
 @Validations(visitorfield...@visitorfieldvalidator(
 message=Default message,
 fieldName=model,
 appendPrefix=false
 )}
 )
 public String execute(){
 userService.persist(user,emailId);
 return SUCCESS;
 }
 }
 
 
 User.java wrote:
 
 @Entity
 @Table(name=APP_USER,schema=s2app)
 public class User {
 private String email;
 private String firstname;
 private String lastname;
 private String password;
 @Id
 @Column(name=EMAIL)
 public String getEmail() {
 return email;
 }
 @EmailValidator(message=Validation Error, key=validate.email)
 public void setEmail(String email) {
 this.email = email;
 }
 @Column(name=FIRST_NAME)
 public String getFirstname() {
 return firstname;
 }
 @RequiredStringValidator(message=Firstname must be
 present,key=validate.firstname,trim=true)
 public void setFirstname(String firstname) {
 this.firstname = firstname;
 }
 @Column(name=LAST_NAME)
 public String getLastname() {
 return lastname;
 }
 @RequiredStringValidator(message=Lastname must be
 present,key=validate.lastname,trim=true)
 public void setLastname(String lastname) {
 this.lastname = lastname;
 }
 @Column(name=USER_PASSWORD)
 public String getPassword() {
 return password;
 }
 @RequiredStringValidator(message=Password must be
 present,key=validate.password,trim=true)
 public void setPassword(String password) {
 this.password = password;
 }
 }
 
 
 findUser-success.jsp wrote:
 
 %...@page contentType=text/html;charset=UTF-8 %
 %...@taglib prefix=s uri=/struts-tags %
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
 head
 titles:text name=home.title //title
 /head
 body
 s:form action=updateUser namespace=/user
 s:textfield name=firstname key=user.firstname /
 s:textfield name=lastname key=user.lastname /
 s:password name=password key=user.password/
 s:textfield name=email key=user.email /
 s:hidden name=emailId /
 s:if test=#session['user'].emailId==null
 s:submit value=Register/
 /s:if
 s:else
 s:submit value=Update/
 /s:else
 /s:form
 /body/html
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-paramsPrepareParamsStack-tp24895177p24912439.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Problem with paramsPrepareParamsStack

2009-08-10 Thread spsarolkar

I have a configuration in struts.xml as follows

struts.xml wrote:
 
 struts
 package name=user namespace=/user extends=struts-default
 default-interceptor-ref name=paramsPrepareParamsStack /
 action name=index class=org.xinus.action.user.BaseAction 
 result name=success/jsp/user/index.jsp/result
 /action
 action name=*User method={1}
 class=org.xinus.action.user.UserAction 
 result name=input/jsp/user/{1}User-success.jsp/result
 result name=success type=redirectActionindex/result
 /action
 /package
 /struts
 
I have User.action as follows

User.action wrote:
 
 @Entity
 @Table(name=APP_USER,schema=S2APP)
 public class User implements Serializable {
 private String email;
 private String firstname;
 private String lastname;
 private String password;
 
 

 
 @Id
 @Column(name=EMAIL)
 public String getEmail() {
 return email;
 }
 @EmailValidator(message=Validation Error, key=validate.email)
 public void setEmail(String email) {
 this.email = email;
 }
 @RequiredStringValidator(message=Validation Error,
 key=validate.notEmpty, trim=true)
 @Column(name=FIRST_NAME)
 public String getFirstname() {
 return firstname;
 }
 
 public void setFirstname(String firstname) {
 this.firstname = firstname;
 }
 @Column(name=USER_PASSWORD)
 @RequiredStringValidator(message=Validation Error,
 key=validate.notEmpty,trim=true, shortCircuit=true)
 @StringLengthFieldValidator(message=Length too short,
 key=validate.minLength.6,trim=true, minLength=6)
 public String getPassword() {
 return password;
 }
 
 public void setPassword(String password) {
 this.password = password;
 }
 @RequiredStringValidator(message=Validation Error,
 key=validate.notEmpty, trim=true)
 public String getLastname() {
 return lastname;
 }
 
 public void setLastname(String lastname) {
 this.lastname = lastname;
 }
 }
 
UserServiceImpl.java as

UserServiceImpl.java wrote:
 
 public class UserServiceImpl implements UserService {
 
 public User findByEmail(String email){
 EntityManagerFactory emf;
 EntityManager entityMgr;
 EntityTransaction tx;
 emf= Persistence.createEntityManagerFactory(s2app);
 
 entityMgr=emf.createEntityManager();
 
 tx = entityMgr.getTransaction();
 tx.begin();
 User user=entityMgr.find(User.class,email);
 tx.commit();  
 return user;
 }
 public void persist(User user, String email){
 EntityManagerFactory emf;
 EntityManager entityMgr;
 EntityTransaction tx;
 emf= Persistence.createEntityManagerFactory(s2app);
 entityMgr=emf.createEntityManager();
 
 tx = entityMgr.getTransaction();
 tx.begin();
 entityMgr.persist(user);
 tx.commit();
 
 }
 }
 
UserAction.java as

UserAction.java wrote:
 
 
 
 public class UserAction extends ActionSupport implements
 ModelDrivenUser, Preparable {
 protected User user;
 
 public User getUser() {
 return user;
 }
 
 public void setUser(User user) {
 this.user = user;
 }
 public UserService userService;
 public void setUserService(UserService userService){
 this.userService=userService;
 }
 String emailId;
 
 public String getEmailId() {
 return emailId;
 }
 
 public void setEmailId(String emailId) {
 this.emailId = emailId;
 }
 
 public void prepare(){
 if(emailId==null){
 this.user=new User(); 
 }
 else{
 this.user=userService.findByEmail(emailId);
 }
 }
 public String find() {
 return INPUT;
 }
 public String update() {
 userService.persist(this.user,emailId);
 return SUCCESS;
 }
 
 public User getModel() {
 return user;
 }
 }
 
 

Now when i insert a record using form I get a error as

attempt to create create event with null entity
RequestURI=/app/user/updateUser.action

Caused by:

java.lang.IllegalArgumentException: attempt to create create event with null
entity
at org.hibernate.event.PersistEvent.(PersistEvent.java:24)
at org.hibernate.event.PersistEvent.(PersistEvent.java:17)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
at 
org.xinus.services.impl.UserServiceImpl.persist(UserServiceImpl.java:43)
at org.xinus.action.user.UserAction.update(UserAction.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at

Re: Problem with paramsPrepareParamsStack

2009-08-10 Thread spsarolkar

Hi, thanks I missed that..
But now validation is no working/partially working i.e. when i submit
invalid values i am redirected to input result but messages are not printed.
Also values are not inserted to database. Here are modified files


UpdateUserAction.java wrote:
 
 @ParentPackage(base-package)
 @Results({
 @Result(name=success,value=index,type=
 ServletActionRedirectResult.class),

 @Result(name=dupPK,value=/WEB-INF/jsp/user/findUser-success.jsp),

 @Result(name=error,value=/WEB-INF/jsp/user/findUser-success.jsp),

 @Result(name=input,value=findUser,type=ServletActionRedirectResult.class)
 })
 @Validation
 public class UpdateUserAction extends BaseUserAction {
 @Validations(visitorfield...@visitorfieldvalidator(
 message=Default message,
 fieldName=model,
 appendPrefix=false
 )}
 )
 public String execute(){
 userService.persist(user,emailId);
 return SUCCESS;
 }
 }
 

User.java wrote:
 
 @Entity
 @Table(name=APP_USER,schema=s2app)
 public class User {
 private String email;
 private String firstname;
 private String lastname;
 private String password;
 @Id
 @Column(name=EMAIL)
 public String getEmail() {
 return email;
 }
 @EmailValidator(message=Validation Error, key=validate.email)
 public void setEmail(String email) {
 this.email = email;
 }
 @Column(name=FIRST_NAME)
 public String getFirstname() {
 return firstname;
 }
 @RequiredStringValidator(message=Firstname must be
 present,key=validate.firstname,trim=true)
 public void setFirstname(String firstname) {
 this.firstname = firstname;
 }
 @Column(name=LAST_NAME)
 public String getLastname() {
 return lastname;
 }
 @RequiredStringValidator(message=Lastname must be
 present,key=validate.lastname,trim=true)
 public void setLastname(String lastname) {
 this.lastname = lastname;
 }
 @Column(name=USER_PASSWORD)
 public String getPassword() {
 return password;
 }
 @RequiredStringValidator(message=Password must be
 present,key=validate.password,trim=true)
 public void setPassword(String password) {
 this.password = password;
 }
 }
 
 
 findUser-success.jsp wrote:
 
 %...@page contentType=text/html;charset=UTF-8 %
 %...@taglib prefix=s uri=/struts-tags %
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
 head
 titles:text name=home.title //title
 /head
 body
 s:form action=updateUser namespace=/user
 s:textfield name=firstname key=user.firstname /
 s:textfield name=lastname key=user.lastname /
 s:password name=password key=user.password/
 s:textfield name=email key=user.email /
 s:hidden name=emailId /
 s:if test=#session['user'].emailId==null
 s:submit value=Register/
 /s:if
 s:else
 s:submit value=Update/
 /s:else
 /s:form
 /body/html
 
 
-- 
View this message in context: 
http://www.nabble.com/Problem-with-paramsPrepareParamsStack-tp24895177p24911963.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Problem with xwork convertor

2009-07-22 Thread spsarolkar

I am facing the same problem 
When i use struts2 SNAPSHOT version i get error as
No converter defined
And i fails to compile


Ikya wrote:
 
 Thanks. It worked.
 
 Regards,
 Sreekanth
 
 On Wed, May 20, 2009 at 11:22 AM, Wes Wannemacher w...@wantii.com wrote:
 
 It might be easier to grab the most recent snapshot builds from here -

 http://people.apache.org/builds/struts/nightlies/2.x/

 Give them a try, they should include all of the appropriate dependencies.

 -Wes

 On Wednesday 20 May 2009 01:45:12 am Ikya Technical wrote:
  Hi All,
 
  We are working on a Struts 2 project. We are facing a problem
 whenever
  there is Double type field with Model class and field value is zero
 then
 it
  is throwing some error. After searching a lot we find out that the
 issue
 is
  with xwork2 and it is already reported and fixed. The issue comes with
  xwork-2.1.2.jar and in the http://jira.opensymphony.com/browse/XW-676 ,
 it
  stating that issue is fixed with latest jar xwork-2.1.3.jar
 
 But we are getting some strage errors when we replaced the xwork jar
  file with latest version. We haven't changed any othe library. The
 other
  major libraries we are using are struts2-core-2.1.6.jar
  xstream-1.2.2.jar
  ognl-2.6.11.jar
  oro-2.0.8.jar
  The exception thrown is :
 
  om.opensymphony.xwork2.inject.DependencyException:
 
 com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException:
 No
  mapping found for dependency [type=java.lang.String,
  name='logMissingProperties'] in public void
  com.opensymphony.xwork2.ognl.OgnlValueStack.setLogMissingProperties(
 java.la
 ng.String).
 
  at
 
 com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMembers(Contain
 erImpl.java:144)
 
  at
 
 com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMethods(Contain
 erImpl.java:113)
 
  at
 
 com.opensymphony.xwork2.inject.ContainerImpl.addInjectors(ContainerImpl.jav
 a:90)
 
 
  Please help it out.
 
  Thanks in advance,
  Sreekanth

 --

 Wes Wannemacher
 Author - Struts 2 In Practice
 Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
 http://www.manning.com/wannemacher


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-xwork-convertor-tp23629355p24619651.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org