ParameterNameAware issue
Hi, I am trying to upgrade my application from 2.3.15.2 to 2.3.16.3. Some of my actions implement the ParameterNameAware interface to check if a parameter will be accepted. I have parameters of the form like user.username (e.g. loginform) which will be passed to the acceptableParameterName(String) function of the LoginAction class. The LoginAction has a User Object with a setUsername method. I didn't want to use the model-driven approach. When upgrading to struts 2.3.16.3 the acceptableParameterName function is getting called multiple times with different combinations: user.username, user and username. Is it wrong to use dots in parameter names? Any suggestions? Best regards, Markus Demetz - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Hibernate problem with OGNL
Hi, I have situations, where the getId() method of my model class returns null when navigating through OGNL e.g. when calling s:property value=#user.gallery.id/. Have you tried s:property value=user.gallery.id/ or s:property value=%{user.gallery.id}/ No luck :-( I also tried with JSTL now without success. It's very strange, since sometimes it works and then it reappears again. I'll ask at the hibernate forum. Regards, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Hibernate problem with OGNL
Hi, I think I've found the problem. I had javassist 3.17.1 (latest) in my project but hibernate 4.2 ships with version 3.15.0 Now it seems to work! Thank you, and sorry for misplacing my question here! Regards, Markus Am 27.03.2013 17:23, schrieb Steve Higham: On 27/03/2013 10:42, Markus Demetz wrote: Hi, I have situations, where the getId() method of my model class returns null when navigating through OGNL e.g. when calling s:property value=#user.gallery.id/. Have you tried s:property value=user.gallery.id/ or s:property value=%{user.gallery.id}/ No luck :-( I also tried with JSTL now without success. It's very strange, since sometimes it works and then it reappears again. I'll ask at the hibernate forum. Regards, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org I've seen this behavior on newly created instances. Hibernate doesn't know the ID until the object is persisted to the DB. Hibernate tries to delay this as long as possible to minimise DB writes. You would have thought a request for the ID would force a DB write but Hibernate doesn't seem to implement this behavior. If you want the ID you need to force the DB write first. Steve - 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
Hibernate problem with OGNL
Hi, I don't know if this is the right place to ask, but maybe there is anyone who has experienced the same problem. I'm using Struts2 (latest version), with Hibernate (latest version) My database models all have getId(). I have situations, where the getId() method of my model class returns null when navigating through OGNL e.g. when calling s:property value=#user.gallery.id/. When I call getId() from the method in my action class (e.g. UserListAction iterating though users and calling user.getGallery().getId()), it returns the id as expected. If I do that first in my action class, then also my s:property.../ renders the id as expected; so I thought about a lazy loading issue... all my getId() methods are public, NOT final, and the Long id members are protected. I also tried to add a getMyId() method in the model which calls getId() from within the same class. getMyId() { return getId(); } This surprisingly works and outputs the correct id when calling s:property value=#user.gallery.myId/ Did anyone experience something simliar or has any suggestions? OGNL 3.0.6, Hibernate 4.2, Struts 2.3.12 Thanks, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2
Hi, you have no result named success for your user action defined in struts.xml, but you return success in your execute method. also check the case sensitivity of login.jsp and Login.jsp defined as result. Markus Markus Am 03.07.2012 20:31, schrieb Avinash: login.jsp %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% %@taglib prefix=s uri=/struts-tags% !DOCTYPE html PUBLICquot;-//W3C//DTD HTML 4.01 Transitional//ENquot; quot;http://www.w3.org/TR/html4/loose.dtdquot; html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 titleInsert title here/title /head body s:form action=user s:textfield name=username value=UserName/ s:textfield name=password value=Password/ s:submit name=submit value=submit/ /s:form /body /html web.xml ?xml version=1.0 encoding=UTF-8? web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://java.sun.com/xml/ns/javaee; xmlns:web=http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd; id=WebApp_ID version=3.0 display-namecrs1/display-name welcome-file-list welcome-fileLogin.jsp/welcome-file /welcome-file-list filter filter-namestruts2/filter-name filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter/filter-class /filter filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern /filter-mapping /web-app LoginAction --- package com.it.action; import com.opensymphony.xwork2.ActionSupport; public class LoginAction extends ActionSupport { private static final long serialVersionUID = 1L; private String username; private String password; public String execute() { return SUCCESS; } public String getUsername() { return username; } public void setUsername(String username) { this.username=username; } public String getPassword() { return password; } public void setPassword(String password) { this.password=password; } } struts.xml -- ?xml version=1.0 encoding=UTF-8? !DOCTYPE struts PUBLIC quot;-//Apache Software Foundation//DTD Struts Configuration 2.0//ENquot; quot;http://struts.apache.org/dtds/struts-2.0.dtdquot; struts package name=default extends=struts-default action name=user class=com.it.action.LoginAction result name=input/Login.jsp/result result name=error/Login.jsp/result /action /package /struts -- View this message in context: http://struts.1045723.n5.nabble.com/Struts2-tp5710145p5710153.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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: nested property tag in action tag
ok, for now I got it working by doing it in this way: s:action name=myAction var=#myAction / s:property value=#myAction.myProperty/ the thing is that I use the OpenSessionInView pattern with hibernate, so I get lazy exceptions here since the action already executed (now I prepared my specific properties in non lazy mode). I'm doing so, beacause I need the computation of another action (or other actions) to show some common things (e.g. an account summary shown in the left column for every action in the /account namespace) while executing my action without needing to provide a custom view for every call of s:action..., so I thought I could put it inline. regards, markus Am 21.03.2012 02:17, schrieb vEnkaTa mohAna rAo SriperumbUdUru: I think, you need to reconsider your design let us what you want to do? why are you doing so? On Tue, Mar 20, 2012 at 6:19 PM, Markus Demetzmar...@demetz.eu wrote: hi all, when I use thes:action ... tag inside a jsp with executeResult=true, so I can access the properties of that action with thes:property ... tag inside the result. but is there a way to to access the same property without forwarding to a result, say doing it inline like this: // jsp code s:action name=myAction executeResult=false s:property value=somePropertyOfMyAction**/ /s:action I assume that when executeResult=false the action is not put onto the stack... I know I can put it manually onto the value stack like the docs say, but this currently confuses me... is there a better way or maybe one has a clear explanation? thanks, markus --**--**- To unsubscribe, e-mail: user-unsubscribe@struts.**apache.orguser-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
nested property tag in action tag
hi all, when I use the s:action ... tag inside a jsp with executeResult=true, so I can access the properties of that action with the s:property ... tag inside the result. but is there a way to to access the same property without forwarding to a result, say doing it inline like this: // jsp code s:action name=myAction executeResult=false s:property value=somePropertyOfMyAction/ /s:action I assume that when executeResult=false the action is not put onto the stack... I know I can put it manually onto the value stack like the docs say, but this currently confuses me... is there a better way or maybe one has a clear explanation? thanks, markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Call a function after invocation but before jsp rendering
hi there, my application uses struts2 (latest version), siles with JSP and hibernate. what I am trying to do is to call a method after the action has been executed, but before the JSP is getting rendered. to be concrete, I want to call a createTitle() method which is common for all my actions (extending BaseAction with a default implementation of createTitle()), but when I use an Interceptor for that and call it after the action invocation, the JSP has already been rendered. So my question is, at which point is the JSP rendered? can I do something between? since I want to be able to set the title according to eventual errors, I cannot do that before the action invocation. any suggestions? thanks, markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Call a function after invocation but before jsp rendering
perfect, didn't know that interceptor..! thank you!! Am 15.02.2012 21:54, schrieb Dave Newton: On Wed, Feb 15, 2012 at 3:52 PM, Markus Demetz wrote: to be concrete, I want to call a createTitle() method which is common for all my actions (extending BaseAction with a default implementation of createTitle()), but when I use an Interceptor for that and call it after the action invocation, the JSP has already been rendered. So my question is, at which point is the JSP rendered? can I do something between? Yes, your interceptor can use a PreResultListener to wedge itself in-between the invocation and render. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Access namespace-name or/and action name from jsp in Struts2
Hi, I would like to retrieve the name of the current namespace and possibly the action from the jsp page using Struts2. My intention is to assign a css class to a container to have a better control of the layout. e.g. div id=maincontainter class=current-namespace.../div Any hints? Thank you, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
XML Validation and slashes in action name
Hello, I have slashes in my Action names, e.g. ModelName/save What I want to do is to add validation only for the save action. As far as I understand, I can create a validation file specifically for the action name, and not for the method to be invoked. ModelAction-save-validation.xml does not seem to work. ModelAction-ModelName_save-validation.xml neither works. Is there any workaround? Or do I have to change my action names? Regards, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: XML Validation and slashes in action name
following post cleared my question: http://www.mail-archive.com/user@struts.apache.org/msg77238.html thanks. Am 24.06.2011 12:58, schrieb Markus Demetz: Hello, I have slashes in my Action names, e.g. ModelName/save What I want to do is to add validation only for the save action. As far as I understand, I can create a validation file specifically for the action name, and not for the method to be invoked. ModelAction-save-validation.xml does not seem to work. ModelAction-ModelName_save-validation.xml neither works. Is there any workaround? Or do I have to change my action names? Regards, Markus - 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: Creating menu bar based on session information
you could do something like this: s:if test=hasPrivilege(#user.roles).../s:if where (bool) hasPrivilege(ListRoles,...) is a function in your action. Markus Am 15.04.2011 13:57, schrieb Christian Grobmeier: Hi all, this is probably a trivial question, but I am unsure how to solve it best. I have an object User user. It has the properties name, password and ListRoles roles. Now I would like to create a navigation bar in my struts 2.2.1 jsp pages. I wanted to avoid huge chunks of logic in my code. Therefore java code in my templates should be avoided. I have thought if the if/else struts tag would help me. But can I access a list and look if a specific role is there? How do others do that? Thanks in advance, Christian - 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
Accessing VelocityEngine in action (struts2)
Dear everyone, I've setup my Webapp with Struts2 using Tiles, but I also want to use Velocity to read a template and send a newsletter email. It would be good if I could access the already configured VelocityEngine from within my action. Otherwise I would need to inject the ServletContext by myself when initializing Velocity since I want to use the WebappResourceLoader. The result type velocity work properly, but how can I read a Template? Thank you for any hint, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Keep Objects over request
Hi all! I'm looking for a convenience way to keep an Object over a single request. I know that i could put it into the session and remove it afterwards, but is there another way to handle this, without needing to remove it explicitely? For those who know Symfony (php framework) there is a setFlash(..) method which keeps objects alive over a request and deletes them afterwards. Is there something similar in Struts (ver.1) or some approach? Thank you, Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problems with html:image enclosed by a html:link
Hi, I'm trying to do a link over an image like this: html:link page=%= /myAction.do?id=+c.getId()% html:image page=/images/image.jpg / /html:link But it doesn't work. It leads to a strange behaviour in Internet Explorer... The browser shows the link (in the statusbar) when the mouse is over the image, but the link doesn't work. When rightclicking-open in new window.. it works. In Mozilla it seems to work correctly... When replacing html:image with img src ... everything works fine, but i need the image to be context-root relative. Whats wrong? Thank you very much, Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: problems with html:image enclosed by a html:link
What does the raw html look like? html:link page=%= /common/myAction.do?id=+c.getId()% html:image page=/images/mf.jpg / /html:link produces: a href=/common/myAction.do?id=10input type=image name= src=/images/mf.jpg/a it works in mozilla but not in IE. markus [EMAIL PROTECTED] 3/13/2006 9:38:48 AM Hi, I'm trying to do a link over an image like this: html:link page=%= /myAction.do?id=+c.getId()% html:image page=/images/image.jpg / /html:link But it doesn't work. It leads to a strange behaviour in Internet Explorer... The browser shows the link (in the statusbar) when the mouse is over the image, but the link doesn't work. When rightclicking-open in new window.. it works. In Mozilla it seems to work correctly... When replacing html:image with img src ... everything works fine, but i need the image to be context-root relative. Whats wrong? Thank you very much, Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Confidentiality Statement: This email/fax, including attachments, may include confidential and/or proprietary information and may be used only by the person or entity to which it is addressed. If the reader of this email/fax is not the intended recipient or his or her agent, the reader is hereby notified that any dissemination, distribution or copying of this email/fax is prohibited. If you have received this email/fax in error, please notify the sender by replying to this message and deleting this email or destroying this facsimile immediately. - 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]
AW: problems with html:image enclosed by a html:link
ok thank you for your answers. I'll fix it in some way... thanks, markus -Ursprüngliche Nachricht- Von: Michael Jouravlev [mailto:[EMAIL PROTECTED] Gesendet: Montag, 13. März 2006 18:40 An: Struts Users Mailing List Betreff: Re: problems with html:image enclosed by a html:link I think the proper way is to have a regular link and to make it look like an image with CSS. This way a link will stay a legible link in text-only mode. Same works with a button. Image button is an atavism. On 3/13/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: per http://struts.apache.org/struts-taglib/tagreference-struts-html.html # html:image Render an input tag of type image Renders an HTML input tag of type image # html:img Render an HTML img tag Renders an HTML img element with the image at the specified URL -Original Message- From: Markus Demetz [mailto:[EMAIL PROTECTED] Sent: Monday, March 13, 2006 11:38 AM To: Struts Users Mailing List Subject: AW: problems with html:image enclosed by a html:link What does the raw html look like? html:link page=%= /common/myAction.do?id=+c.getId()% html:image page=/images/mf.jpg / /html:link produces: a href=/common/myAction.do?id=10input type=image name= src=/images/mf.jpg/a it works in mozilla but not in IE. markus [EMAIL PROTECTED] 3/13/2006 9:38:48 AM Hi, I'm trying to do a link over an image like this: html:link page=%= /myAction.do?id=+c.getId()% html:image page=/images/image.jpg / /html:link But it doesn't work. It leads to a strange behaviour in Internet Explorer... The browser shows the link (in the statusbar) when the mouse is over the image, but the link doesn't work. When rightclicking-open in new window.. it works. In Mozilla it seems to work correctly... When replacing html:image with img src ... everything works fine, but i need the image to be context-root relative. Whats wrong? Thank you very much, Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Confidentiality Statement: This email/fax, including attachments, may include confidential and/or proprietary information and may be used only by the person or entity to which it is addressed. If the reader of this email/fax is not the intended recipient or his or her agent, the reader is hereby notified that any dissemination, distribution or copying of this email/fax is prohibited. If you have received this email/fax in error, please notify the sender by replying to this message and deleting this email or destroying this facsimile immediately. - 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] - 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]
remove ActionForm from session
Hi all, i have some ActionForms which I declared with a session scope. This because I validate them over more steps. After a completed task (i.e. registration) I would like to remove them to keep session small. is there a simple way to do that? thanks! markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FormFile validation
Hi all, I have a formfile html:file property=foto/ and a bean with getters and setters. When validation fails, the other fields get the values already inserted, but the file input field gets empty and must be reselected. Is this normal, or is there a way to keep the file location in the input field? thanks, Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: html:link passing parameters
ok thanks, but I forgot that it should be dynamically, e.g: /myAction?action=%= MyCons.EDIT % but so it does not work. markus -Ursprüngliche Nachricht- Von: Gareth Evans [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 1. Februar 2006 12:14 An: Struts Users Mailing List Betreff: Re: html:link passing parameters html:link action=myAction?action=editYour Text/html:link Should do the trick. Note: You do not need the .do Gareth Markus wrote: Hi all, just a simple question. I would like to pass a single parameter with a html:link tag. I've searched the net, but there I understand that it is only possible to pass parameters via beans. Is the a simpler way to redender the following with html:link: /myAction.do?action=edit I'm just a little confused now. Thank You, Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Gareth Evans MSoft eSolutions Limited Technology Centre Inward Way Rossmore Business Park Ellesmere Port Cheshire CH65 3EN -- Tel:+44 (0)870 0100 704 Fax:+44 (0)870 9010 705 E-Mail: [EMAIL PROTECTED] Web:www.msoft.co.uk -- Terms: Please note that any prices quoted within this e-mail are subject to VAT. All program details and code described in this e-mail are subject to copyright © of MSoft eSolutions Limited and remain the intellectual property of MSoft eSolutions Limited. Any proposal or pricing information contained within this e-mail are subject to MSoft eSolutions' Terms and Conditions -- Disclaimer: This message is intended only for use of the addressee. If this message was sent to you in error, please notify the sender and delete this message. MSoft eSolutions Limited cannot accept responsibility for viruses, so please scan attachments. Views expressed in this message do not necessarily reflect those of MSoft eSolutions Limited who will not necessarily be bound by its contents. - 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]