Cookies
Two quick questions about cookies: 1. The cookie interceptor definition appears to be missing from the struts-default.xml file on 2.1.6. Is this a sign the the interceptor is on its way out? 2. The interceptor looks like it can only be used to read cookies. Do I need to grab the response object directly and add the cookie manually? Z.
Re: Problem testing my action when I’ve g ot a springbean inside the validators.xml
Anyone who can help me? -- View this message in context: http://www.nabble.com/Problem-testing-my-action-when-I%E2%80%99ve-got-a-springbean-inside-the-validators.xml-tp24862185p24894957.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
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
JSP not loading
Hi , I am facing a strange problem. I am using struts2.0 and my server side code executes well and sends the response ..but my ethereal shows empty response and hence my JSPs are not loading on the browser . This happens when user has mentioned his details in lets say chinese language . i.e. any character other than english doesnt get interpreted by my JSP code. Can anyone pls help ? Thanks, Kavita *DISCLAIMER* This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately and delete the message.
RE: Struts - Security
Ditto on Spring Security, very nice for URL auth. -Original Message- From: Dale Newfield [mailto:d...@newfield.org] Sent: Saturday, August 08, 2009 12:02 PM To: Struts Users Mailing List Subject: Re: Struts - Security Kamlesh Koringa wrote: - URL encryption (no one can modify generated URL). Impossible. You cannot prevent people from requesting URLs your system does not present to them. You should assume that any parameter that you accept from a user can be manipulated at will by that user. You can jump through hoops to make valid alternate values difficult to guess, but that's it. You should always check the inputs and make sure that the requested action is a valid one for that user before allowing the requested action to continue. - URL authorization. Spring Security formerly known as acegi. -Dale - 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
Re: JSP not loading
Hi, are you sure that the answer is sent to the correct JSP. Please check your struts.xml for the action and make sure that the correct result is chosen. In case of Chinese and if you are using the dynamic method invocation the result may be incorrect. Regards Eduard Kavita Mehta schrieb: Hi , I am facing a strange problem. I am using struts2.0 and my server side code executes well and sends the response ..but my ethereal shows empty response and hence my JSPs are not loading on the browser . This happens when user has mentioned his details in lets say chinese language . i.e. any character other than english doesnt get interpreted by my JSP code. Can anyone pls help ? Thanks, Kavita *DISCLAIMER* This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately and delete the message. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: JSP not loading
JSPs are 'precompiled' by container to $TOMCAT_HOME/work/Catalina/localhost/webappName folder if your FileSystem is not setup to accomodate chinese characters any chinese characters that your filesystem sees will not produce the desired UnknownChineseCharacters_jsp.java so container will be unable to serve that file try a localhost reference on the AppServer via http://localhost:Port/webappName/NameOfChineseJsp.jsp and notice the failure.. 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: Mon, 10 Aug 2009 14:53:46 +0200 From: eduard.neuw...@googlemail.com To: user@struts.apache.org Subject: Re: JSP not loading Hi, are you sure that the answer is sent to the correct JSP. Please check your struts.xml for the action and make sure that the correct result is chosen. In case of Chinese and if you are using the dynamic method invocation the result may be incorrect. Regards Eduard Kavita Mehta schrieb: Hi , I am facing a strange problem. I am using struts2.0 and my server side code executes well and sends the response ..but my ethereal shows empty response and hence my JSPs are not loading on the browser . This happens when user has mentioned his details in lets say chinese language . i.e. any character other than english doesnt get interpreted by my JSP code. Can anyone pls help ? Thanks, Kavita *DISCLAIMER* This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately and delete the message. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Get back to school stuff for them and cashback for you. http://www.bing.com/cashback?form=MSHYCBpubl=WLHMTAGcrea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1
Re: Java URL Batch Application
Embedding Quartz in application that is deplpoyed on a non clustered environment is a nice solution. But not good for cluster deployment with multiple JVMs. John Feng On Fri, Aug 7, 2009 at 9:58 AM, Manos Batsismanos_li...@geekologue.com wrote: Tom Holmes Jr. wrote: Sorry ... this might be off topic. I'm a Struts1/2 and Spring MVC Java developer myself. And yes, I am Googling for this information as well. I am looking for some Java open-source app that does some batching. I basically want a java web-app where I can schedule a URL to be called at a certain time with certain parameters and then store those results? I'd like this to record the start-time when this was called, and the stop time of when the results come back. It doesn't matter which framework this uses, so long as it's java and open-source. In case you dont find something ridiculously fitting your task, it should be fairly easy to patch up exactly what you want using jakarta httpclient and then schedule your java code to be called using Quartz/timer/cron whatever. hth, Manos - 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
Re: Problem with paramsPrepareParamsStack
spsarolkar wrote: public void prepare(){ if(emailId==null){ this.user=new User(); } else{ this.user=userService.findByEmail(emailId); } } So if emailId is null you construct a new one, but if it is not null and findByEmail() fails, it is still null. java.lang.IllegalArgumentException: attempt to create create event with null entity When i tried to debug it I am getting user object in prepare() function i.e. user is not null but when i check the same value in update method it comes out to be null s:hidden name=emailId / s:if test=email==null s:submit value=Register / /s:if This generates input type=hidden name=emailId value=/, right? So it'll submit a parameter emailId=, which will result in emailId not being null, but rather being the empty string. The prepare lookup fails, so user is still null. Try these two fixes: s:if test=%{email == null} s:submit value=Register / /s:if s:else s:hidden name=emailId / s:submit value=Update / /s:else public void prepare() { if (emailId != null) { this.user=userService.findByEmail(emailId); } if (this.user == null) { this.user = new User(); } } -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Client-side AND server-side validation
Hi everybody, I'm trying to implement validation using the standard mecanism provided by Struts 2. I understood that it's possible to use the same XML file to perform both client side (JS being generated) and server side validation. I don't need to do AJAX validation. Another constraint : We don't want to rely on the DOJO plugin since it has been deprecated. Any configuration tips or documentation link to implement this kind of validation ? Thanks in advance, Nicolas
Re: Problem with paramsPrepareParamsStack
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