Re: Linking page
I personnaly prefer to use the same Action for things that are logically grouped. So in your case, I would use the execute method to return SUCCESS, pointing to the jsp, and a doSearch method with SEARCH result, pointing to the other JSP. That way, you have only one action for both JSP. I don't like going straight to the JSP, as you lose all of the struts 2 benefits, and so I prefer everybody to go through their action, even if that sometimes means having a execute method that just return SUCCESS. We are using so many struts default functionnalities that only work with the underlying actions (like resource bundles, etc..) that I really couldn't live without an action. Denis. Le 2010-05-21 07:59, Fabio Perfetti a écrit : Hi all, i am wondering what is the best way for link a page to other. Imagine this scenario: Index Page with a menu: - Search - Insert if i click on search, must show a form. so I use a href=s:url action='searchForm' /Search/a in my struts.xml i have an action action name=searchForm resultformSearch.jsp/result /action now i fill the form and on submit, i call the action doSearch action name=doSearch class=it.tesina.action.Search resultlistSearch.jsp/result /action So i have 2 actions. one for show the form and one for the true search. and the same for the Insert. is it correct? is there any other method more efficient? Thanks all Fabio - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Forms with Multiple Submit buttons (Bug or Expected?)
Why not doing that on the server side, using the s:token approach? That would prevent double submit on the server side. On the client side, I would say that your disabling the button before the form is submitted (the onsubmit technically happens before the submit, so that you can uypdate some value before the submit of the form actually happens) prevents the value of this button to be sent to the server (which makes sense, since it's disabled). I would recommend not disabling the button (as the formsubmitted var will be enough to prevent a re-submission). If you really want to disable your button, consider a timer that would do so 200ms after, leaving time for the form to be submitted *with* the value of this button. Denis. Le 2010-05-19 05:41, RogerV a écrit : For a long while I've been building forms along the lines of s:form .. s:submit id=submit type=button label=Continue action=processForm/ s:submit id=cancel type=button label=Cancel action=goSomewhereElseWithoutSubmittingTheForm/ which has worked well. Until today. Today I needed to prevent a double submit on a form so I chose the quick way by creating a javascript onsubmit handler to cancel the button after the first click and referenced it in the s:form onsubmit handler script type=text/javascript var formsubmitted=false; function preventDoubleSubmit() { if (formsubmitted) { return false; } var submitButton = document.getElementById('submit'); submitButton.disabled=true; formsubmitted=true; return true; } /script On clicking the submit button, the javascript disabled the button but the performAction was never called and the form was redisplayed. So I tried again, moving the javascript to the submit buttons onclick attribute. Same thing. Looking at the POST through Firebug I see that without any javascript handlers it looks like; form dataaction%3performAction=Submit and with the javascript handlers form data i.e the Struts action information is not being attached. Is this expected or a bug? Am I handling multiple submit buttons in the wrong way? Regards - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: spring, struts2, convention plugin, how to wire an action class
Jake, the short answer to your problem is : use the struts-spring plugin ( http://struts.apache.org/2.1.8.1/docs/spring-plugin.html ). Include the jar for that plugin in your classpath, and Struts 2 will use Spring to manage the Action lifecycle, meaning you can inject anything the way you are describing it above (including String, etc...) Denis. Le 2010-05-13 08:09, Jake Vang a écrit : thanks. example please? (when you have time). On Thu, May 13, 2010 at 6:52 AM, James Cookjames.c...@wecomm.com wrote: Ahh hmm. You can use the autowired, You just have to declare you stuff in the spring xml. E.g. bean id=myJDBCString class=java.lang.String I think you can also use the @Resource anno as well. Can't think off the top of my head. -Original Message- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 13 May 2010 11:44 To: Struts Users Mailing List Subject: Re: spring, struts2, convention plugin, how to wire an action class yes. precisely. On Thu, May 13, 2010 at 6:41 AM, James Cookjames.c...@wecomm.com wrote: Oh, did you want your action as a spring managed bean? Ah I think i massively miss read you. You want to inject predefined values etc? -Original Message- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 13 May 2010 11:38 To: Struts Users Mailing List Subject: Re: spring, struts2, convention plugin, how to wire an action class thanks. i won't go that route. i noticed your example (in the first response) and i realized that i may trying to push some business logic into the Action class. and, i don't think that's too good of a practice. i simply revised my Service class to hold these values (booleans, String, int, etc...) and now the problem goes away. it's a workaround. if anyone is reading this post and knows how to use struts2 (w/ convention plugin) + spring to construct Action classes, please let me know. the examples i've seen are only with struts1 (and though not too complicated, seem verbose with the xml). On Thu, May 13, 2010 at 6:20 AM, James Cookjames.c...@wecomm.com wrote: Yeah sorry, short on time here, didn't see your question at the bottom. Add the spring jar from the spring project. -Original Message- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 13 May 2010 11:16 To: Struts Users Mailing List Subject: Re: spring, struts2, convention plugin, how to wire an action class doesn't answer the question but thanks anyways. On Thu, May 13, 2010 at 6:12 AM, James Cookjames.c...@wecomm.com wrote: Nope, no they are not in the xml for me. I use the @Service/@Repository annotations on the class, coupled with the component scan in the Spring xml. -Original Message- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 13 May 2010 11:09 To: Struts Users Mailing List Subject: Re: spring, struts2, convention plugin, how to wire an action class well, there's something strange about struts2 (with convention plugin) + spring. if your action has a field representing a service, MyInjectedService myInjectedService, you just have to define that in the spring xml file. for example, your Action class looks like the following. public class MyAction extends ActionSupport { private Service service; @Action(value=/dummy) public String dummy() { return SUCCESS; } public Service getService() { return service; } public void setService(Service service) { this.service = service; } } in your spring xml file (i.e. applicationContext.xml), you simply define a bean with the id=service. for example, bean id=service class=my.class.Service/ that's it; you don't have to do anything else. you don't even have to explicitly say (using XML) to inject this when you are creating an instance of MyAction. now when a user accesses /dummy, MyAction will be created and its service field will actually be injected with what is specified in the spring xml file. what irks me or bothers me is that it is not obvious at the moment how to simply inject strings or booleans into the Action class. it should be just as simple. upon analyzing what i am doing, and in light of what you said, perhaps i am trying to push some logic into the Action class that shouldn't be there. perhaps i should push the logic to a service class instead. in this case, this problem goes away. BUT, the question remains, how can i use DI with struts2 (convention plugin) and spring on Action classes? or can i not? if i can't, end of story. if i can, how? On Thu, May 13, 2010 at 5:44 AM, James Cookjames.c...@wecomm.com wrote: Hmm. I use the same combo. I found at some point I could jsut do public class MyAction extends ActionSupport { private MyInjectedService service etc etc But I have started doing: public class MyAction extends ActionSupport { @Autowired private MyInjectedService service I am not sure if that alters the way Struts2/Spring does it. But it does make it a bit clearer to read. -Original Message- From:
Re: spring, struts2, convention plugin, how to wire an action class
My best guess is that the Action instance used in the web application is not actually loaded from the configuration in your applicationContext, but directly by Struts 2 (through the Spring Factory, but still Struts 2). That mean that you will have a bean named myAction in you application context, but that is not the bean that will actually be used by Struts to serve your request. Struts will create another instance, which won't have any of your configuration. This different instance is then autowired by type (defaut behaviour) which means your service (configured in your context) gets injected because it has the right type. I can't actually confirm that behaviour, but that seems like the likely explanation. I will be able to double check tomorrow. To check that, I can recommend 2 things : * Set the autowiring to be by name, create 2 beans named verbose and message, and see how that works * Leaving the autowiring by type, create 2 instances of your service, and my best guess is that Struts will crash, unable to decide between the 2 I think what your are missing is the fact that while struts uses Spring to manage the lifecycle of its action, it doesn't use the action defined in your application context, but will load its own instances, and autowire them. Denis. Le 2010-05-13 20:18, Jake Vang a écrit : roger, thanks for the steps. i went through each of those steps and made sure my settings/configurations complied. however, i still cannot initialize Action classes using Spring. as an illustration of the problem i am facing, i have created an example that you may download and verify for yourself that this does not work. http://www.box.net/shared/iycamr9uo6 this will download a zip file with an Eclipse project; unzip it. if you have Ant, you simply type in ant war and the war file will be created. if you have Tomcat, then drop the war file into the webapps directory (assuming you have Tomcat 6.0). if you go to http://localhost:8080/myapp/, you will see four lines displayed. String from Action: default boolean from Action: false String from Service: overwritten boolean from Service: true The first and second lines confirm that the String and boolean values are not injected into the Action class. The third and fourth lines confirm that the String and boolean values are injected into the service class. thanks. On Thu, May 13, 2010 at 9:32 AM, RogerVroger.var...@googlemail.com wrote: Jake Vang wrote: If you want Spring to create your action class (as opposed to Struts creating them) then you need to define your action in the applicationContext.xml file. how do you do that? here's a couple of ways i have tried that do NOT work. 1) Addconstant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / to your struts.xml file. 2) Addlistener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener to your web.xml 3) Make sure that you have the Struts2 Spring plugin installed. 4) Put something along the lines of bean id=myAction class=com.somwhere.mypackage.MyAction scope=prototype/ (The scope prototype is important otherwise Spring creates a singleton rather than a new action on each invocation which is what Struts 2 expects) and that should get Spring instantiating your action classes for you. Although I'm guessing from your response you've already got to that stage. I'm not sure that I understand what you are trying to acheive with bean name=/action class=com.services.MyAction property name=propertyA value=${propertyA}/ /bean If you're trying to inject another class, then the format is on the lines of bean name=/action class=com.services.MyAction property name=classA ref=classA/ /bean where you need a setter that matches the name parameter (setClassA(ClassA classA)) in MyAction. The ref value points to anotherbean id=classA class=com.services.classA/ HTH and I haven't completely misunderstood what you are trying to do. Regards -- View this message in context: http://old.nabble.com/spring%2C-struts2%2C-convention-plugin%2C-how-to-%22wire%22-an-action-class-tp28545412p28547552.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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Some Spring/Struts questions
A new requirement means that we need to have available across pretty much every action a separate, independent bean that carries information that may (or may not) need to be displayed on the resulting web-pages. I am wondering what the best way is to make this bean available to each JSP. We have a case which is pretty much like that. We have decided to use a static property in a configuration class to hold this instance. OGNL works pretty nicely with static members, using @com.mycl...@mybean.property syntax. We are injecting this bean onto the static member using the MethodInvokingFactoryBean (see http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/beans/factory/config/MethodInvokingFactoryBean.html). I'm happy with injecting certain beans into certain actions, but I'm not clear what I should be injecting *this* bean into. Ideally it should just pop into existence and be available to the JSPs without the Actions even being aware that it is there. It's not part of the business logic and is purely informational. If I have to make it available through the Actions then I would *like* to be able to inject it into the common base class with a single configuration and have that work automatically for all sub-classes (and this would be a useful trick for some other places in the application) but that does not seem to be possible unless I'm missing a trick? That's actually possible. We are doing that type of things by using the @Autowired annotation, which means that spring needs to find a suitable bean to inject there. If you put that annotation on your base class, the instance will get injected in all sub-classes. But in that case, it's better for the actions to be unaware of that, so I would using the static approach. Otherwise, you could use an interceptor to push that object on to the stack. Denis. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: how to set default focus field in s:form ?
I recommend attaching the focus to the relevant form element purely using Javascript, ie, including in you JSP : script type=test/javascript window.onload = function() { document.getElementById('yourInpudId').focus(); } /script That way you have a pure javascript implementation, and you can push that code to the relevant JSP without having to mess up with your template. My second recommendation is to use a Javascript framework, instead of the plain and ugly javascript as up there (since the example above will break if you want to attach more than one thing to the onload). So rewritten with jquery ( http://jquery.com/ ) script type=test/javascript $(document).ready(function() { $('yourInpudId').focus(); }); /script But the idea is the same in both case, do the focus purely in Javascript. Denis. Le 2010-05-12 14:53, Emi Lu a écrit : By using tiles,body is in global_layout.jsp page, for decedent pages, I will not be able to set body onload. Admittedly I don't know tiles, but Sitemesh will copy the body onLoad and unload functions to the decorating page and I would be suprised if Tiles didn't support this as well. For the global page.jsp: if body onload is set, it's for all decedents; no, I do not want that. (1) Do not bother to create several parents layout files (2) Only one file needs default focus; Other hundreds of .jsp foucs will be set differently or not set at all So, I do need s:form to support focus. -- Lu Ying - 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: Login redirection
Hi Mark, To implement security across multiples applications (Struts or non Struts), you will have to rely on the container. The container is really the best way to go if you want to implement a cross applications sign-on. Now, about your specific question, I guess we are missing some specifics to be able to answer. You will basically have all your login pages (L1,L2,L3... ) and I will assume that they all point to that central authentication component. Or do you call the component that does the authentication another way? Is it a web service? A post to a URL? And after that, this component will probably accept a parameter telling him where to redirect the user. Which authentication component are you planning on using? We are using Get Access from Entrust, that has this single sign on and authentication capabilities is your product the same type of product? Denis Le 2010-04-27 16:26, Mark Hansen a écrit : I am working on a Struts 1.x application that has a number of login pages L1, L2, L3, ... If a non-authenticated user requests a page - P - that requires authentication, the user will be redirected to one of these login pages L1, L2, L3, ... - depending on the context. Once authenticated, he proceeds to page P. Now, authentication is being centralized across a variety of applications (Struts and non-Struts). All the login pages from my application (L1, L2, ...) need to be redirected to this central security application (outside my control) for authentication. Once the redirected user is authenticated by the central security application, the user needs to be sent back to his originally requested page - P. What would be the best way to securely implement this redirected authentication in the Struts 1.x framework? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Issue with logic:iterate Tag
I recommend using displaytag for displaying tables in JSP : http://displaytag.sourceforge.net/1.2/ It comes with support for Grouping (see http://displaytag.homeip.net/displaytag-examples-1.2/example-grouping.jsp ) which is the feature you are looking for. I love displaytag for its ease of use, its clean implemtation which allows for extension if needed, and for its native support for paging / sorting which is pretty much always needed when it comes to long list of data. By using displaytag throughout our application we ensure the consistency of the user experience when it comes to dealing with tables. Good luck! Denis Le 2010-04-24 11:39, Thangavel Loganathan a écrit : Hi !! am newbie to struts taglib, my requirement is want display the values from DB in which there many fields includes date,resource_name, time and etc.. Based on these 3 criteria i want display in table. i am getting the values from DB with request scope... and am iterating using logic:iterate taglib, through this tag i can able to display the values one by one for eache and every row am putting a line to separate... when come to my requirement based on the date , resource name and time i want display in one row. for example , --- Date ResourceName Time 14-12-10 XXX 09:00 05:00 - YYY 01:00 02:00 --- ZZ 05:00 --- 15-12-10 AAA 04:00 - BBB 01:00 02:00 --- CC 05:00 - Like above want display in jsp.. but am usinglogic:iterate tagalib , --- Date ResourceName Time 14-12-10 XXX 09:00 -- 14-12-10 XXX 05:00 - 14-12-10 YYY 01:00 14-12-1002:00 - 14-12-10 ZZ 05:00 --- 15-12-10 AAA 04:00 --- 15-12-10 BBB 01:00 Like this am getting in jsp .. and my jsp code is below , http://www.coderanch.com/forums/jforum# logic:iterate id=item name=list type=com.bean.AppoinmentInformation scope=request li div class=agenda_datebean:write name=item property=startDate //div div class=agenda_content_container div class=agenda_content_list ul class=agenda_content li class=agenda_schedule_name divbean:write name=item property=rsc_name/ /div /li li class=appointment_schedule_info table class=schedule_list cellpadding=0 cellspacing=0 tr td width=5% div class=bean:write name=item property=status //div /td td width=18%bean:write name=item property= app_st_hr/ -bean:write name=item property=app_end_hr/ /td td width=77%---bean:write name=item property=service_name/ ***bean:write name=item property= cust_name/ (bean:write name=item property=ctitle_add / )/td /tr /table /li /ul /div /div /li /logic:iterate waiting for ur reply So i want break the condition and i want to compare two list date and resource name. how to achieve this inlogic:iterate or want to use another tag... suggest me plz .. thanks in advance --- Thanks Regards, Thangavel my skype : thangavel.nathan gtalk : lthangavel - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Setting selected with s:select tags
Hi Kartik, Remove the attribute value from your s:select tag, and in your action, preset the value of your attribute actionStatus (on your Action class) to OPEN or CLOSED. At least, it is working in my case. Let us know if it is not working for you that way, and I will put together a simple example showcasing this. Denis Le 2010-04-23 20:37, Kartik Kumar a écrit : I have some thing like this s:iterator value=actionItems tr tds:property value=creatorName //td tds:property value=assignedTo //td tds:property value=creationDate //td tds:property value=dueTo //td tds:property value=externalItemNumber //td tds:property value=description //td tds:property value=currentStatus //td td width=100s:property value=status/ *s:select name=actionStatus value = status' list=#{'OPEN':'OPEN', 'CLOSED':'CLOSED'} headerKey= headerValue=Change Status/* a href = s:url action = 'updateActionStatus.action' s:param name = 'id' value = 'id'//s:urlChange/a/td /tr /s:iterator But I don't see the preselected value, Thanks, Kartik On Fri, Apr 23, 2010 at 5:11 PM, Kartik Kumarkrishnan.1...@gmail.comwrote: Hi Struts gurus, I am have an object level attribute that is selected from the s:select tag. s:select key=search.criterion name=searchCriterion list=#{'': 'Select One', 'bean.attributeValue':'bean.attributeValue', 'abc':'abc'} required=true onchange=showSearchCriterionField() / If I want to set 'abc' to selected, then how do do that ? Any advice would be welcome. Thanks, Kartik - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Using json in Struts 2.1.8.1
As of struts 2.1.8, you have (well can, but it's recommended) use the struts2-json-plugin rather than the googlecode version (the google code one has been transferred to apache as a struts 2 plugin). To do that, just use the class name org.apache.struts2.json.JSONResult (see http://struts.apache.org/2.1.8.1/struts2-plugins/struts2-json-plugin/apidocs/org/apache/struts2/json/JSONResult.html ) for your json result. Ie : package name=package_name extends=struts-default namespace=/namespace_name result-types result-type name=json class=org.apache.struts2.json.JSONResult / /result-types And include the jar file (can be found at http://repo2.maven.org/maven2/org/apache/struts/struts2-json-plugin/2.1.8.1/struts2-json-plugin-2.1.8.1.jar or in the complete distribution of struts 2) in your classpath. So your understanding is good, but you need the struts2-json-plugin-2.1.8.1.jar file too. Denis. Le 2010-04-16 10:00, sharath karnati a écrit : Hi sameer, In struts 2.1.8.1 having 'struts2-dojo-plugin-2.1.8.1.jar' file so we don't need to use 'jsonplugin-0.34.jar' for using json. This is my understanding :) If we are not including 'jsonplugin-0.34.jar' then we cannot use com.googlecode.jsonplugin.JSONResult With new Struts 2.1.8.1 version how to use json without using any annotations in action. Can someone please send me some examples for using json in this new version of struts2. Thanks in advance. Regards, Sharath. --- On Thu, 4/15/10, hisameercool_sameer_fo...@yahoo.com wrote: From: hisameercool_sameer_fo...@yahoo.com Subject: Re: Using json in Struts 2.1.8.1 To: user@struts.apache.org Date: Thursday, April 15, 2010, 7:22 PM Do something like this: In your struts.xml define result types as follows: package name=package_name extends=struts-default namespace=/namespace_name result-types result-type name=json class=com.googlecode.jsonplugin.JSONResult / /result-types then in the action mapping: action name=action_name class=AutocompleteField method=getCities() result type=json /result /action and put annotation in the getter method in your action class: @JSON public MapString,String getJson() { return json; } and u can use this json map in the jsp page. I Hope it helps! sharath wrote: Hi All, I'm having following Action - Action(Begin) - public class AutocompleteField extends ActionSupport { private String city; private MapString,String json; public String execute() throws Exception() { return SUCCESS; } public String getCities() throws Exception() { json = new HashMapString,String(); if(city != null city.length() 0) { CityDao dao = new CityDao(); ListCity cities = dao.getCitiesStartingWith(city); for(City city : cities) { json.put(city.getId(), city.getName() + , + city.getState().getAbbreviation()); } } return SUCCESS; } public void setCity(String city) { this.city = city; } public MapString,String getJson() { return json; } } - Action(End) - In struts.xml file I given following entries action name=Autocomplete!* class=gov.action.AutocompleteField method={1} !--result type=jsonjson/result -- result name=success type=json / /action When I keep 'jsonplugin-0.34.jar' file getting below error java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/TextUtils After reading some posts, they said that we should not include this .jar in this new struts2.1.8 version. I removed this .jar file I added 'struts2-dojo-plugin-2.1.8.1.jar' file in /WEB-INF/lib folder. When I deploy the application getting below error There is no result type defined for type 'json' mapped with name 'success'. Did you mean 'json'? - result Can anyone please let me know, how to define 'json' in struts.xml file? in package level I even added 'json-default' package name=admin extends=struts-default,json-default Thanks in advance. Regards, Sharath. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [Struts 2.1.8.1] Internationalization: how to remain in the current page ?
Hi, We use a simple and empty s:url includeParam=get/ tag to loop back to the current action/url. The only thing you have to look for are those unsafe urls: we don't have any unsafe urls in our application, thanks to an extensive POST then GET approach. Whenever some action is done in the application (through a POST), we process this action, update the relevant stuff in the database, and issue a redirect answer to a GET url, that will display the result of the action. That way, we can reload the current page (be it for switching language or just a browser reload) without any issue. This approach takes care of the bookmarking issue as well. I think this approach way more robust that tinkering with URLs to define safe and unsafe URLs. We had to do a bit a workaround code so that on the redirect to a GET, we don't lose all of our context. We actually save the current action in the session, and when the get comes back, pop it out of the session to place it in the stack. If somebody is interested, I can share that code Denis. Le 2010-03-29 04:55, Alex Rodriguez Lopez a écrit : Thanks Zoran for sharing your approach, greatly appreciated, I'm thinking about implementing a similar interceptor, and maybe replace the i18n one so work is done implicitly with only a change in struts.xml and the new interceptor. Em 29-03-2010 02:58, Zoran Avtarovski escreveu: Hi Guys, We simplified it for struts to use a simple interceptor. Can’t show the exact code due to legal crap, but here’s the overview. In our base action we have a String called requestString, with appropriate getters and setters. We also have a MapString, String of unsafe URL’s and their safe counterparts. For example if the unsafe url was deleteObject.action it’s safe option would be listObject.action The interceptor uses the following code: if(unsafeUrls.get(request.getRequestURI()) != null) responseUrl = unsafeUrls.get(request.getRequestURI()); else responseUrl = request.getRequestURI(); StringBuffer rStr = new StringBuffer(responseUrl); rStr.append(“?”); for (Iterator iter = request.getParameterMap().keySet().iterator(); iter.hasNext();) { String key = (String) iter.next(); if (!request_locale.equalsIgnoreCase(key)) { if (request.getParameter(key) != null) { // you can also include your own parameter specific exceptions. With the tag we used to have a comma delimited list of excluded parameters. rStr.append(key); rStr.append(=); rStr.append((String) request.getParameter(key)); rStr.append(); } } } action.setRequestString(sStr.toString()); And then on the page we have: div class=”localeFlag”a href=${requestString}request_locale=${localeOpt.lang} img src=${pageContext.request.contextPath}/image/icons/${localeOpt.lang}_flag.gif alt=s:text name=%{“select.”+ attr.localeOpt.lang} / title=s:text name=%{“select.”+ attr.localeOpt.lang} / //a/div I had to modify the code to satisfy our people but let me know if you have any questions. We use a complex parameter filtering process to unsure that security isn’t compromised. We’ve had to do quite a bit of i18n which has involved implementing DB based properties and tighter integration with S2 and spring. Z. Hi Zoran, would you mind sharing the code of this tag? It would be helpful to me, as somehow I've been able to link to the same sction with an empty url tag but unable to retain params. Thanks! Em 24-03-2010 22:42, Zoran Avtarovski escreveu: I wrote a small custom tag which builds the link with the existing action and parameters. This way it just reloads the page. I also included a parameter that wouldn’t allow the change (a jQuery dialog would give the user feed back) to take place if there might me an issue with system integrity – for example submitting a form twice. Z. hi, I have a quick and basic question. Regarding internationalization, whenever a user clicks on a link with a flag, i want to change the locale (language) of the web application. That works well with the i18n interceptor. However i always redirect the user to the home page (home.jsp) when i do that because that is how i have setup the input result : action name=changeLanguage class=ServicesAction method=changeLocale result name=input/home/home.jsp/result /action My JSP looks like this : s:url id=url action=changeLanguage.action s:param name=request_localefr/s:param /s:url s:a href=%{url} theme=xhtmlimg src=%=request.getContextPath()%/images/flag_fr.png //s:a So my question is : how do you specify the current page in the input result name ? so that the user stays on the current page when he changes languages. Thanks for helping. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: validation xml file
Do you have a result named input tied to your LoginAction? What is it? Denis. Nguyen Xuan Son a écrit : Dear all I have these in the LoginAction-validation.xml file validators field name=txtName field-validator type=requiredstring param name=trimfalse/param messageerror/message /field-validator /field field name=txtPass field-validator type=requiredstring param name=trimfalse/param messageerror/message /field-validator /field /validators but it seems that even there is a error it still continue to implement the LoginAction.java file what should i do if i want it stop implementing the LoginAction.java whenever there is any error appear thank you very much - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [Struts 2.1.8] Message properties on SUBMIT tag not working
You should use key to change the text outputted on the screen. You should use name as well to avoid the error you are seeing: the name is being used as the property to set on your action. This error is actually a warning, that is not preventing anything from working fine in your application. It you are really worried about this warning, you can configure the params interceptor to ignore that property : see http://struts.apache.org/2.x/docs/parameters-interceptor.html or http://struts.apache.org/2.0.6/struts2-core/apidocs/com/opensymphony/xwork2/interceptor/ParametersInterceptor.html#excludeParams What is the generated HTML code in your second case (the one using key)? Denis. Celinio Fernandes a écrit : Hi, I have a message properties file in my web application. I use it for many tags such as textfield, text ... For instance : s:textfield name=client.name key=inscription.name required=true/ It works well except with the SUBMIT tag : s:submit name=inscription.button align=center/ s:submit key=inscription.button align=center/ I get this error, whether i use name or key : 20:33:21,198 INFO [BeanSelectionProvider] Loading global messages from messages 20:57:09,451 WARN [OgnlValueStack] Error setting expression 'inscription.button' with value '[Ljava.lang.String;@7c0c01' ognl.OgnlException: target is null for setProperty(null, button, [Ljava.lang.String;@7c0c01) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2219) at ognl.ASTProperty.setValueBody(ASTProperty.java:127) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220) at ognl.SimpleNode.setValue(SimpleNode.java:301) at ognl.ASTChain.setValueBody(ASTChain.java:227) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220) at ognl.SimpleNode.setValue(SimpleNode.java:301) at ognl.Ognl.setValue(Ognl.java:737) at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:198) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:161) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:149) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:276) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:187) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) at
Re: validation xml file
Everything seems to be looking good. Is your validation xml file in the same package as your action? Are you using the defaultStack interceptor stack? If you leave txtName or txtPass empty, are you still proceeding to C0002_Home.jsp? Something must not be in place, because your example seems simple enough and definitely should be working. I tried at my place, and everything's working fine, so you must have some misconfiguration somewhere. Can you share more of your code? What is your complete struts.xml? Good luck! Denis. Nguyen Xuan Son a écrit : I think i have it. here is the detail action name=login class=com.baibai.action.LoginAction result name=successC0002_Home.jsp/result result name=inputlogin.jsp/result /action Here is the HTML tag for the submit button input type=image alt=Login border=0 src=images/login_btn_arr.gif width=26 height=26 style=cursor:hand Please tell me what should i correct? thank you very much 2009/11/30 Denis Cabasson denis.cabas...@gmail.com mailto:denis.cabas...@gmail.com Do you have a result named input tied to your LoginAction? What is it? Denis. Nguyen Xuan Son a écrit : Dear all I have these in the LoginAction-validation.xml file validators field name=txtName field-validator type=requiredstring param name=trimfalse/param messageerror/message /field-validator /field field name=txtPass field-validator type=requiredstring param name=trimfalse/param messageerror/message /field-validator /field /validators but it seems that even there is a error it still continue to implement the LoginAction.java file what should i do if i want it stop implementing the LoginAction.java whenever there is any error appear thank you very much - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org mailto:user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org mailto:user-h...@struts.apache.org -- === Ritsumeikan University, Asia JinZai Project Master of Information Science Nguyen Xuan Son Add : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu Rien, Room 103 Tel/Fax : 81-(0)90-3976 2246 Email: nr000...@ed.ritsumei.ac.jp mailto:nr000...@ed.ritsumei.ac.jp Mobile : 81-(0)90-3976 2246 URL : http://www.ritsumei.jp === - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: unstatable implement
Obviously, if you don't have a session, ses.get(context) will return null. And null.toString() that's a nice NPE. I usually use StringUtils.isNotEmpty for commons-lang : http://commons.apache.org/lang/api-release/org/apache/commons/lang/StringUtils.html#isNotEmpty(java.lang.String) http://commons.apache.org/lang/api-release/org/apache/commons/lang/StringUtils.html#isNotEmpty%28java.lang.String%29 Denis. Nguyen Xuan Son a écrit : dear all I have the C0002_Home.jsp and sessionChk.jsp files. The C0002_Home.jsp's source code is s:action name=SessionCheck/s:action the meaning of this source code is to check users session whenever they enter the webpage the struts.xml is structured as: action name=SessionCheck class=com.baibai.action.SessionCheckAction result name=inputsessionChk.jsp/result /action action name=C0002_Home class=com.baibai.action.C0002_HomeAction result name=inputC0002_Home.jsp/result /action the detail of the SessionCheckAction.java file is public class SessionCheckAction extends ActionSupport{ public String execute() throws Exception { Map ses = ActionContext.getContext().getSession(); if((ses.get(context).toString()!=)(ses.get(role).toString()==admin)){ // the user is loginned as an administrator System.out.println(you have session); } else { System.out.println(you dont have session); } return SUCCESS; } } however when i tried to enter the C0002_Home.jsp without Login the error appears 2009/11/30 10:40:07 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error 致命的: Could not execute action: /SessionCheck java.lang.NullPointerException at com.baibai.action.SessionCheckAction.execute(SessionCheckAction.java:10) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) this doesnt happen if I login into the system could you tell me where did I went wrong - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: S2 Strange behaviour of validation
Hi Titus, This behaviour is the standard behaviour of struts 2. Your second message comes from the conversion error : http://struts.apache.org/2.1.8.1/docs/conversion-error-interceptor.html I suppose that your field is of type int (or any number like class). Struts will in the first try to convert the parameter value to stick it in your variable. Obviously, that won't work (abc isn't much of an int). Because if that, struts will output a stack trace in the console as warning (it is just for information, not an actual error). And will add the conversion error to the list of action errors (see interceptor above). Only after that does your validation kicks in, and of course, at that point your value is empty, thus trigerring the required validation. So, the bottom line is an int validator on a numeric field, when the type of this attribute is int is useless as it will never be reached. Either change your field to be a String, in which case all validation and conversion is up to you, or you will have to dig in Struts 2 to handle the conversion error a little more graciously. Good luck! Denis. Marsman a écrit : Hi! I'm using the Struts 2 validation for my form fields. For a required numeric input field, I've set the required and the int validator and a custom message for each of them. But when the user enters none numeric characters, the custom localized required-messages and a default Invalid field value message are displayed in the error box. Also a NoSuchMethodException occurs because Struts tries to store the alphanumeric field value in an action class property of type string. Why is a the field marked as required, when the user has entered a wrong, but has entered a value? Why is a default message instead of my custom message shown? And why is there is Struts trying to store the value in a bean property, if the value is identified as invalid? Here is my validation: field name=myNumber field-validator type=required message key=addEntry.error.myNumber.required / /field-validator field-validator type=int message key=addEntry.error.myNumber.format / /field-validator /field I'm using Struts 2.1.8.1. The valiidateion XML is assigned to the action class. The action class implements ModelDriven but myNumber is outside the model class in the of type Integer. Thanks for any hints or comments. Titus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Hibernate/Spring
From what you are saying, I would have a look at the : http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html My best guess is that this would fix your issue. If not, you probably have an issue with the way you are dealing with your entities. Denis. Chris Cranford a écrit : I have done a fair amount of reading today on the topic again and developed a few simple classes to support my service, model, and dao architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The problem I am currently facing is I get a detached error when deleting an object and I get a null pointer exception in SessionImpl.java when I try to locate an object by its id. /* GenericDAO.java */ public T findById(Object id) { return(getEntityManager().find(clazz, id)); } public void delete(T entity) { getEntityManager().remove(entity); } Some posts I have seen say for the delete, you should use getReference() or merge() in order to get an association to the entity before you call the remove() method. I attempted to use the same type of logic with getReference() during the findById() and it failed. Am I missing something in my configuration with Hibernate/Spring with respect to the session factory or something that I need to revisit? It really seems as though I may have a missing component or a poor configuration somewhere. - 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: Hibernate/Spring
Hi Martin, I am building a Struts 2 / Spring / Hibernate application, using the JPA specification as it seems to be the case here. It is not required to go through all the pain of using EJB entities. I am running this application both in Websphere and Tomcat, without using the container at all. To me the problem is only a JPA / Hibernate problem, and Spring is totally able to handle that without having to rely on the container. Denis. Martin Gainty a écrit : good morning denis i sent chris a summary of working hibernate examples in Glassfish the getReference is a method from Ejb3Configuration the merge method comes from org.hibernate.ejb.AbstractEntityManagerImpl (and implements the sessions merge) whichever app server he will be implementing will have to be configured to serve his specific Bean as an EJBEntity.. Glassfish Users list would be more helpful i hope this clarifies 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: Sat, 14 Nov 2009 08:45:46 -0500 From: denis.cabas...@gmail.com To: user@struts.apache.org Subject: Re: Hibernate/Spring From what you are saying, I would have a look at the : http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html My best guess is that this would fix your issue. If not, you probably have an issue with the way you are dealing with your entities. Denis. Chris Cranford a écrit : I have done a fair amount of reading today on the topic again and developed a few simple classes to support my service, model, and dao architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The problem I am currently facing is I get a detached error when deleting an object and I get a null pointer exception in SessionImpl.java when I try to locate an object by its id. /* GenericDAO.java */ public T findById(Object id) { return(getEntityManager().find(clazz, id)); } public void delete(T entity) { getEntityManager().remove(entity); } Some posts I have seen say for the delete, you should use getReference() or merge() in order to get an association to the entity before you call the remove() method. I attempted to use the same type of logic with getReference() during the findById() and it failed. Am I missing something in my configuration with Hibernate/Spring with respect to the session factory or something that I need to revisit? It really seems as though I may have a missing component or a poor configuration somewhere. - 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 _ Windows 7: I wanted simpler, now it's simpler. I'm a rock star. http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2.1.8 and Tiles
Make sure to use the tiles plugin as described in : http://struts.apache.org/2.1.8/docs/tiles-plugin.html I am using it, and have no issue so far with it. Your error seems to be in the result you are redirecting to. How is your action tied up? Denis. Sommers, Elizabeth a écrit : Is it possible to use 2.1.8 with tiles. I have tried everything I can think of. Currently I am getting an error from org/apache/tiles/impl/BasicTilesContainer.java It says that org.apache.tiles.definition.NoSuchDefinitionException: /tiles/layout/default.jsp org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.jav a:578) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.jav a:246) And then the rest of the stack. If 2.1.8 doesn't work with Tiles, what is the newest version that does? Thanks Elizabeth Sommers Build and Release Engineer Pragmatics, Inc. 703.761.4033 www.pragmatics.com Practical. Reliable. Secure. This e-mail message, including any attachments, is intended only for the identified recipient(s). It may contain proprietary or otherwise legally protected information of Pragmatics, Inc. Any unauthorized review, use, copying, disclosure or distribution is strictly prohibited. If you have received this communication in error and are not the intended recipient, please immediately notify the sender of this message by reply e-mail and delete or otherwise destroy the e-mail, attachments, and any copies. - 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: Struts2 on Websphere 6.1 : 404 errors
I concur. We are using struts 2.1.8 with WAS 6.1.0.27 and there is no way around this variable. It is documented in our installation procedure, and you will never get any filter based framework to work unless you set this variable. The default Websphere behaviour (without this variable that is) seems to first check for the target URL existence, before processing the filters. Or with Struts 2, there is no such target (as the filter answer the request). So yes, you have to use this variable. Denis. Struts Two a écrit : Yes, it is. If you plan to turn on container security, you need another flag as well. --- On Fri, 10/16/09, Raghuveer.V raghuve...@infotechsw.com wrote: From: Raghuveer.V raghuve...@infotechsw.com Subject: Struts2 on Websphere 6.1 : 404 errors To: user@struts.apache.org Received: Friday, October 16, 2009, 1:03 PM Hi Struts2 Users, I have problem when deploying application struts2.1.6 application on Websphere6.1 which was succefully working on apache-tomcat-5.5.23. We have used configuration option to make it work as per information available in Websphere forums and Struts2 forums on my local websphere. Could you suggest is this the ONLY possible solution to make struts2 work on Websphere?. Initially we have received 404 errors. Servlet filter is not called for URL resources on WAS 6.1 , configuration option has been set in server The webcontainer custom property com.ibm.ws.webcontainer.invokefilterscompatibility was set to true as per below links. com.ibm.ws.webcontainer.invokefilterscompatibility=true Application Servers - server - Web Container Settings - Web Container - Custom Properties Goggle Refrence: struts2 +websphere +There is no Action mapped for namespace / and action name com.ibm.ws.webcontainer.invokefilterscompatibility+struts2+websphere http://www.ibm.com/developerworks/forums/thread.jspa?threadID=264848 http://www-01.ibm.com/support/docview.wss?rs=180 http://www-01.ibm.com/support/docview.wss?rs=180uid=swg1PK27620 uid=swg1PK27620 http://www.mail-archive.com/user@struts.apache.org/msg88798.html http://www.nabble.com/Struts2-on-Websphere-portal-6.1.0.0-td18761735.html Regards, Raghu __ Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php - 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: execute() not getting executed
No out of the box way of dealing with that. You can send your jsp code / Action code to see if we can figure out what is wrong. Denis. james billa a écrit : Hi - I am using struts 2.1.6. From my jsp on submitting the form, the control goes to my action class, methods prepare() and validate() gets executed. But after that the execute() is not getting called. I don't have any error messages printed on my console. I have only system.out in prepare() and validate(). Can anyone think of any reason why it would happen or any way to debug this? Thanks. JB - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2.1.8: Do we need to escape messages?
What code are you using to output this message? Is it a s:text? a s:property? Alex Siman a écrit : I just have found that Struts 2.1.8 escapes messages, so instead of message (in browser) like: User with email u...@example.com registered successfully. now I get this one: User with email lt;stronggt;u...@example.comlt;/stronggt; registered successfully. In first example I used to escape only the inserted parameter email. I am not against automatic escaping of messages. It's good for security. But I am wonder, how to use expected HTML markup into messages? Maybe you have any another design solution? P.S. The downside of upgrades. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2.1.8 and Tiles
Make sure to use the tiles plugin as described in : http://struts.apache.org/2.1.8/docs/tiles-plugin.html I am using it, and have no issue so far with it. Your error seems to be in the result you are redirecting to. How is your action tied up? Denis. Sommers, Elizabeth a écrit : Is it possible to use 2.1.8 with tiles. I have tried everything I can think of. Currently I am getting an error from org/apache/tiles/impl/BasicTilesContainer.java It says that org.apache.tiles.definition.NoSuchDefinitionException: /tiles/layout/default.jsp org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.jav a:578) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.jav a:246) And then the rest of the stack. If 2.1.8 doesn't work with Tiles, what is the newest version that does? Thanks Elizabeth Sommers Build and Release Engineer Pragmatics, Inc. 703.761.4033 www.pragmatics.com Practical. Reliable. Secure. This e-mail message, including any attachments, is intended only for the identified recipient(s). It may contain proprietary or otherwise legally protected information of Pragmatics, Inc. Any unauthorized review, use, copying, disclosure or distribution is strictly prohibited. If you have received this communication in error and are not the intended recipient, please immediately notify the sender of this message by reply e-mail and delete or otherwise destroy the e-mail, attachments, and any copies. - 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: Struts2 on Websphere 6.1 : 404 errors
I concur. We are using struts 2.1.8 with WAS 6.1.0.27 and there is no way around this variable. It is documented in our installation procedure, and you will never get any filter based framework to work unless you set this variable. The default Websphere behaviour (without this variable that is) seems to first check for the target URL existence, before processing the filters. Or with Struts 2, there is no such target (as the filter answer the request). So yes, you have to use this variable. Denis. Struts Two a écrit : Yes, it is. If you plan to turn on container security, you need another flag as well. --- On Fri, 10/16/09, Raghuveer.V raghuve...@infotechsw.com wrote: From: Raghuveer.V raghuve...@infotechsw.com Subject: Struts2 on Websphere 6.1 : 404 errors To: user@struts.apache.org Received: Friday, October 16, 2009, 1:03 PM Hi Struts2 Users, I have problem when deploying application struts2.1.6 application on Websphere6.1 which was succefully working on apache-tomcat-5.5.23. We have used configuration option to make it work as per information available in Websphere forums and Struts2 forums on my local websphere. Could you suggest is this the ONLY possible solution to make struts2 work on Websphere?. Initially we have received 404 errors. Servlet filter is not called for URL resources on WAS 6.1 , configuration option has been set in server The webcontainer custom property com.ibm.ws.webcontainer.invokefilterscompatibility was set to true as per below links. com.ibm.ws.webcontainer.invokefilterscompatibility=true Application Servers - server - Web Container Settings - Web Container - Custom Properties Goggle Refrence: struts2 +websphere +There is no Action mapped for namespace / and action name com.ibm.ws.webcontainer.invokefilterscompatibility+struts2+websphere http://www.ibm.com/developerworks/forums/thread.jspa?threadID=264848 http://www-01.ibm.com/support/docview.wss?rs=180 http://www-01.ibm.com/support/docview.wss?rs=180uid=swg1PK27620 uid=swg1PK27620 http://www.mail-archive.com/user@struts.apache.org/msg88798.html http://www.nabble.com/Struts2-on-Websphere-portal-6.1.0.0-td18761735.html Regards, Raghu __ Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php - 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: Struts 2.1.8: Do we need to escape messages?
What code are you using to output this message? Is it a s:text? a s:property? Denis. Alex Siman a écrit : I just have found that Struts 2.1.8 escapes messages, so instead of message (in browser) like: User with email u...@example.com registered successfully. now I get this one: User with email lt;stronggt;u...@example.comlt;/stronggt; registered successfully. In first example I used to escape only the inserted parameter email. I am not against automatic escaping of messages. It's good for security. But I am wonder, how to use expected HTML markup into messages? Maybe you have any another design solution? P.S. The downside of upgrades. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: execute() not getting executed
No out of the box way of dealing with that. You can send your jsp code / Action code to see if we can figure out what is wrong. Denis. james billa a écrit : Hi - I am using struts 2.1.6. From my jsp on submitting the form, the control goes to my action class, methods prepare() and validate() gets executed. But after that the execute() is not getting called. I don't have any error messages printed on my console. I have only system.out in prepare() and validate(). Can anyone think of any reason why it would happen or any way to debug this? Thanks. JB - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2]All the methods with get prefix are invoked
Hi, The debug tag is inspecting the status of your action to build its HTML output, which include knowing the value of test1, and thus calling the corresponding getter. Take out the debug tag, and everything should be back to normal. Denis. Gábor Kovács a écrit : Hi everyone, I'm confused, because I don't understand this problem: I've made a simple Struts2 project. Here are the codes (they're short) ACTION CLASS --- package test.action; import com.opensymphony.xwork2.ActionSupport; public class TestAction extends ActionSupport{ public String getTest1(){ System.out.println(getTest1); return SUCCESS; } } STRUTS.XML struts package name=test extends=struts-default action name=test class=test.action.TestAction result/test.jsp/result /action /package /struts WEB.XML --- 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_2_5.xsd; id=WebApp_ID version=2.5 display-nameTEST/display-name filter filter-namestruts2/filter-name filter-class org.apache.struts2.dispatcher.FilterDispatcher /filter-class /filter filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern /filter-mapping welcome-file-list welcome-filetest.jsp/welcome-file /welcome-file-list /web-app TEST.JSP -- %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% %@ taglib uri=/struts-tags prefix=s % . . . . style .errorMessage { color:red; }/style /head body s:url id=test namespace=/test action=test / s:a href=%{test}TEST/s:a s:debug/ /body /html When I click the link which calls the action named test, I expect that: Struts can see the struts.xml, then calls the TestAction's execute method(). Yes, it does, but besides, it calls the TestAction's getTest1() method (it writes getTest1 to the console)...and if I write another method, which is public and it's return type is String AND it has a GET prefix (getFOO) it will be called, too. I don't get it...Why? Thanks in advance! Gábor - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Align issues in struts 2 UI atgs
Hi, I usually use s:submit theme=simple / s:reset theme=simple ... / which will generate the buttons only, allowing you to take care of the presentation your way. Denis. Murugesh a écrit : Hi guys i have tried out but not getting the solution. i need two buttons in a row like s:submit/ s:reset../ please give me a correct way to implemnt to get output in a single row.. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: pagination in struts2
Display tag is great for table pagination. If you are looking for pagination without tables, I'd recommend the pager tag library : http://jsptags.com/tags/navigation/pager/index.jsp Custom coding is my least favorite way of solving an issue. To extract a variable from an action to the page, I'd recommend using a s:set tag to set a variable holding the list in the page context. Your example of displaytag is missing : s:set name=testList scope=page value=testList id=testList/s:set (before the display tag) Denis. On Thu, Apr 23, 2009 at 1:01 PM, Stefano Tranquillini stefano.tranquill...@gmail.com wrote: i've done a pagination by myself. is an Alpha relase :D, not tested but u can set size and page to display: action: private ListItem items = new ArrayListItem(); private int tot; private int page = 0; private int size = 1; private List pages = new ArrayList(); public AllItem() { } @Override public String execute() throws Exception { ListItem temp = mgmt.getAllItem(); if (page 0) { page--; } if (size temp.size()) { size = temp.size(); } int start = Math.min(page * size, temp.size()); if (start == temp.size()) { start = start - size; } int end = Math.min((page + 1) * size, temp.size()); items = new ArrayListItem(); items = temp.subList(start, end); tot = getItems().size(); pages = new ArrayList(); for (int i = 0; i temp.size(); i = i + size) { pages.add((i / size) + 1); } return SUCCESS; } public ListItem getItems() { return items; } public int getTot() { return tot; } public int getPage() { return page; } public void setPage(int page) { this.page = page; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public List getPages() { return pages; } jsp %@ taglib uri=/struts-tags prefix=s % s:iterator value=items do your presentation of the data /s:iterator this is the menu change the action! s:iterator value=pages a href=s:url action=showShop namespace=/shop s:param name=page s:property/ /s:param s:param name=size value=%{size}/ /s:url s:property/ /a /s:iterator On Thu, Apr 23, 2009 at 18:28, Andy Sykes a.sy...@ucl.ac.uk wrote: I found I had to use the s:set tag to set the object in the request scope before displaytag could see it, since displaytag doesn't know about the Value Stack (maybe it should?). Confusingly, displaytag gives you that message if it can't see the variable you're referencing, as well as if the variable is empty. eg. s:set name=items value=items scope=request/ On 23 Apr 2009, at 17:11, Stefano Tranquillini wrote: i done this: this is the class taht create the list private ListItem items = new ArrayListItem(); private Integer resultSize; public AllItem() { } @Override public String execute() throws Exception { items= mgmt.getAllItem(); resultSize=getItems().size(); return SUCCESS; } public ListItem getItems() { return items; } public Integer getResultSize() { return resultSize; } this is the page %@ taglib uri=/struts-tags prefix=s % %@ taglib uri=http://displaytag.sf.net; prefix=display % display:table name=testList pagesize=2 partialList=true size=resultSize display:column property=name / display:column property=descitipion / display:column property=prize / /display:table the result is: Nothing found to display. On Thu, Apr 23, 2009 at 17:52, Stefano Tranquillini stefano.tranquill...@gmail.com wrote: emm i've a list in my session called items. so i'd write a ok, i'd understand, now works. anyway, how can i create the page number below? On Thu, Apr 23, 2009 at 17:40, Bhaarat Sharma bhaara...@gmail.com wrote: u have to first create TestList for the code to work On Thu, Apr 23, 2009 at 11:36 AM, Stefano elste...@gmail.com wrote: when i put % request.setAttribute( test, new TestList(2, false) ); % netbeans said: cannot find construtcto TestList(int,bool) and the application goes in a exception: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp TestList cannot be resolved to a type 1: % request.setAttribute( test, new TestList(2, false) ); % 2: %@ taglib uri=/struts-tags prefix=s % 3: 4: idea? 2009/4/23 André Diniz adi...@gmail.com: It's just a sample pages... 2009/4/22 Dave Newton newton.d...@yahoo.com
Re: s:url, s:param and german umlauts
Hi, Escape is escaping you text in an HTML friendly way. your ü was tranformed to #xFC; (which is the corresponding HTML entity). The issue is that you were using that in URL that was URL-encoded. So you #xFC; is transformed to %26%23xFC%3B (with %26= , ...). So in the case you are using the value of a property as a URL parameter, you need to set the encoding of that parameter to false (that's pretty much why this parameter exists on the property tag). Hope it helps! Denis. 2009/4/23 juergen.l...@bmw.de Hello, I have solved the problem. There is to set escape=false in s:property, like s:param name=titles:property value=%{title} escape=false //s:param But what does escape=false, actually? -Ursprüngliche Nachricht- Von: juergen.l...@bmw.de [mailto:juergen.l...@bmw.de] Gesendet: Donnerstag, 23. April 2009 07:51 An: user@struts.apache.org Cc: mgai...@hotmail.com Betreff: AW: s:url, s:param and german umlauts Does this mean there is a bug in 2.1.16? Von: Martin Gainty [mailto:mgai...@hotmail.com] Gesendet: Mittwoch, 22. April 2009 15:19 An: Leeb Juergen, TD-311 Betreff: RE: s:url, s:param and german umlauts https://issues.apache.org/struts/browse/WW-3095 Vielen Danke, Martin __ Verzicht und Vertraulichkeitanmerkung 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. From: mgai...@hotmail.com To: juergen.l...@bmw.de Subject: RE: s:url, s:param and german umlauts Date: Wed, 22 Apr 2009 09:06:58 -0400 Bestandteil, die setEncoding Methode verwenden public static final String STRUTS_I18N_ENCODING = struts.i18n.encoding; @StrutsTag(name=include, tldTagClass=org.apache.struts2.views.jsp.IncludeTag, description=Include a servlet's output + (result of servlet or a JSP page)) public class Include extends Component { @Inject(StrutsConstants.STRUTS_I18N_ENCODING) public void setDefaultEncoding(String encoding) { defaultEncoding = encoding; } aber wir sind interessiert, an, die URL Kategorie zu verschlüsseln @StrutsTag(name=url, tldTagClass=org.apache.struts2.views.jsp.URLTag, description=This tag is used to create a URL) public class URL extends ContextBean /* @Inject(StrutsConstants.STRUTS_I18N_ENCODING) public void setDefaultEncoding(String encoding) { defaultEncoding = encoding; } */ setEncoding Methode fehlt in der URL Kategorie? Martin __ Verzicht und Vertraulichkeitanmerkung 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. From: juergen.l...@bmw.de To: user@struts.apache.org Date: Wed, 22 Apr 2009 14:34:27 +0200 Subject: s:url, s:param and german umlauts Hello, I have a problem with the struts tags s:url and s:param. I want to provide a link within me JSP. Therefore I use the s:url and s:param. i.e. s:url id=url_xls action=EinlaufTypen_Bericht_XLS escapeAmp=false s:param name=titles:property value=%{title} //s:param /s:url The value of Title can include german umlauts, like ü. i.e title=Füller In this case I get the following url in the html-source: http://localhost:8080/DBLackAuswertungen/einlaufTypen/showEinlaufTypen_ Eingabe.action?title=F%26%23xFC%3Bller Can somebody help me to get here a ü? I have set constant name=struts.i18n.encoding value=ISO-8859-1 / in my struts.xml and I have %@ page contentType=text/html; charset=iso-8859-1 pageEncoding=ISO-8859-1 % In my jsps. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org Rediscover Hotmail®: Get quick friend updates right in your inbox. Check it out.http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Redi scover_Updates2_042009 Rediscover Hotmail®: Get quick friend updates right in your inbox. Check it
Re: debugging jsp pages with struts html tags
s:debug / is usually helpful (without being a real debugger). Denis. Bhaarat Sharma a écrit : Is there a way to debug jsp pages that have struts2 html tags?? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2.1][Convention] Changing the ActionNameBuilder implemetation
Thanks, I will test that and let you know how it is working out. I have supplied some useful information as a comment on the wiki page you previously mentionned. I believe this information is important for people looking for backward compatibility, as I was. Thanks for your help! On Wed, Feb 11, 2009 at 11:10 AM, Musachy Barroso musa...@gmail.com wrote: Fixed in trunk. This is the ticket: https://issues.apache.org/struts/browse/WW-2994 See Overwriting plugin classes in http://cwiki.apache.org/confluence/display/WW/Convention+Plugin for details. musachy On Tue, Feb 10, 2009 at 11:15 PM, Musachy Barroso musa...@gmail.com wrote: The implementation is defined as a bean, but we didn't provide a way to change the bean used. That means you can't plugin your implementation without building the plugin yourself. I will fix in trunk soon, if you want to build it yourself, you need to change this file: /plugins/convention/src/main/resources/struts-plugin.xml and change this line: bean type=org.apache.struts2.convention.ActionNameBuilder class=org.apache.struts2.convention.SEOActionNameBuilder/ with your actual class. musachy On Tue, Feb 10, 2009 at 10:16 PM, denis cabasson denis.cabas...@polytechnique.org wrote: Hi folks! I am using Struts 2.0.14 on a project with a fairly big existing codebase. I just tried to upgrade to struts 2.1.6 (as the release is now in GA). We were using extensively the zero configuration approach with the codebehind plugin and I am now looking at upgrading to the convention plugin. My last remaining hurdle is the change in the ActionNameBuilder. The plugin uses the SEOActionNameBuilder which is a big change from what we had in Struts 2.0.14 : The name of our action is no longer myProfile, but my-profile, which involves changing all existing references to the action by its name (and we have quite a fex of them). So I'd like to use the convention plugin, with DefaultActionNameBuilder instead of the SEO. I configured struts.xml to have this bean created, my question is how do I get the convention plugin to use that one rather than the SEO one? Thanks for your help, and keep up the good work, you the struts team! Denis. -- Hey you! Would you help me to carry the stone? Pink Floyd -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
[S2.1][Convention] Changing the ActionNameBuilder implemetation
Hi folks! I am using Struts 2.0.14 on a project with a fairly big existing codebase. I just tried to upgrade to struts 2.1.6 (as the release is now in GA). We were using extensively the zero configuration approach with the codebehind plugin and I am now looking at upgrading to the convention plugin. My last remaining hurdle is the change in the ActionNameBuilder. The plugin uses the SEOActionNameBuilder which is a big change from what we had in Struts 2.0.14 : The name of our action is no longer myProfile, but my-profile, which involves changing all existing references to the action by its name (and we have quite a fex of them). So I'd like to use the convention plugin, with DefaultActionNameBuilder instead of the SEO. I configured struts.xml to have this bean created, my question is how do I get the convention plugin to use that one rather than the SEO one? Thanks for your help, and keep up the good work, you the struts team! Denis.