Re: Question about Struts 2 Flow Control
actually, S2 have a equivelent to spring's command object. S2 can populate the model object for you, if you get right interceptor. and when a invalid submissiom comes in, s2 action can forward you back to the input page with error messages. s2 also has an oblivious advantage against spring mvc, that is s2 can do whatever spring mvc can do with only one type of action. 2008/1/30, Musachy Barroso [EMAIL PROTECTED]: I am feeling really dumb now, that doesn't sound very easy at all :). Could you re-write your question for non-spring mvc users? musachy On Jan 30, 2008 2:36 PM, claym [EMAIL PROTECTED] wrote: One of the things I really liked about Spring MVC was the fact that it was very easy to control the flow of a request. You could use referenceData() to add data that was needed on the page but not necessarily form related, then formBackingObject() for the actual pre-submission form population, and then control the processing of pre-submit and post-submit with showForm() and onSubmit() It was also smart enough to repopulate things like referenceData if there was an invalid submission. Part of this was due to the fact that there were lots of different types of controllers - all the referenceData and formBackingObject wasn't necessary if you're just displaying a non-form page, but you could always use SimpleFormController if you needed it. I'm not seeing that kind of behavior in Struts 2. I'm not saying it's required functionality, but I certainly appreciated it in Spring MVC. Is it there and I'm not seeing it? How would you control the request like this? -- View this message in context: http://www.nabble.com/Question-about-Struts-2-Flow-Control-tp15190024p15190024.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Best Regards Wong Tseng - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: #request scope
in S2, inside iteration, the item object is push onto the VS, so just remove the pound key. -- Best Regards Wong Tseng - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Struts2] Ajax anchor tag problem
since the request is sent via ajax, so the browser side redirect can not work. i suggest you don't redirect you user directly, instead you send back a piece of js, let the js redirect the browser. script window.location='xxx'; /script 2008/1/21, Raghuveer Rawat [EMAIL PROTECTED]: Thanks Robi, I think you are right but how to come out of this ajax call if something goes wrong.sometimes I am getting some technical error and error page is also opening under target div. Is there anyone who faced this issue early? On Jan 21, 2008 3:29 PM, Roberto Nunnari [EMAIL PROTECTED] wrote: oopss.. sorry.. I read your post to fast and didn't notice you already tried redirect-action.. I believe the problem is that it's not the browser who is getting the redirect message from the server, but the ajax async call system, and so it puts the login form in the div, as it was instructed.. but as I'm not an ajax guru, I could be wrong. Best regards. -- Robi Roberto Nunnari wrote: try this: result name=login type=redirect-actionlogin/result Best regards. -- Robi Raghuveer Rawat wrote: Hi, I have a requirement where only logged in users are allowed to put their comment. I have implemented that form with struts2 ajax theme...anchor has theme=ajax If logged in user puts his comment then everything works fine perfectly..I am able to see text message returned from action in target div But when a user who is not logged in and try to put this comment..I want to redirect user to login page..*but there what is happening here is that login page is also streaming back and it is opening in target div..* Any idea how to redirect user to login page.. Below is my action class method.. public String addComment() { try{ UserTO userTo = null; Object user = this.getSession().get(user); if(user == null){ return Action.LOGIN; }else{ userTo = (UserTO) user; } this.getCommentTo().setUserId(userTo.getUserId()); this.getCommentTo().setArticleId(this.getArticleId()); this.getCommentService().addComment(this.getCommentTo()); HttpServletResponse response = ServletActionContext.getResponse (); //inputStream = new StringBufferInputStream(Comment Posted Successfully.); String successMsg = Thanks for posting comment. Your comment has been added successfully.; byte[] contents = successMsg.getBytes(); response.getOutputStream().write(contents); }catch(Exception ex){ LOG.error(Exception in myArticles():+ ex); return Action.ERROR; } return null; } This is my comment form... div id='commentResponse' /div s:form action=comments_addComment method=post table width=583 border=0 cellspacing=2 cellpadding=2 tr td width=99 align=leftstrongYour Comments/strong /td td width=470 align=left s:textarea name=commentTo.comments rows=5 cols=40/s:textarea s:hidden name=articleId value=${ article.articleId }//td /tr tr td align=leftnbsp;/td td width=470 align=left s:a theme=ajax targets=commentResponseAdd Comment/s:a /td /tr /table /s:form Below is struts.xml entry..I am using tiles and default results are tile definitionsI also tried using redirect-action and redirect but that also give same problem.. action name=comments_* method={1} class= com.rawatsoft.write4smile.webapp.action.CommentAction result name=loginlogin/result /action - 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] -- Best Regards Wong Tseng - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to make tabs in JSP
The action which is mapped to the url status.do should forward to the jsp in which you have used the JSPTagControl. In this way several actions can share a single tabbed jsp. So don't put the content of the a tab in a separate jsp. 2007/6/29, Kavita Mehta [EMAIL PROTECTED]: Hi Angelo, thanks for your help . I am using the JSPTagControl in my JSP as: jsptabcontrol:tabControl name=PERSONNE_TABCONTROL width=800px height=100% jsptabcontrol:tabPage name=IDENTITY_TABPAGE title=BSSMAP Stats width=100px BSSMAP Stats ...follows... /jsptabcontrol:tabPage jsptabcontrol:tabPage name=ADRESS_TABPAGE title=Call Control Stats href=/status.do /jsptabcontrol:tabPage /jsptabcontrol:tabControl My problem is that when I click the second tab, the page corresponding to /status.do is displayed as a full page JSP and not as a part of tabbed JSP page. Please help. Regards, Kavita -- Wong Tseng 王曾
Re: How to make tabs in JSP
hi you are welcome. it's every body's right. But it seems your right to think other people are making noise of dor like an insect. 2007/6/29, Angelo zerr [EMAIL PROTECTED]: Hi thank you Wong dor your response. You have right. So in your url you must add parameter tabPageInputHiddenName into url like this : /status.do.do?tabPageInputHiddenName_PERSONNE_TABCONTROL=ADRESS_TABPAGE I have explain it at http://jsptabcontrol.sourceforge.net/user-guide.html#How%20manage%20tab%20page%20with%20runat%20server ? Regards Angelo 2007/6/29, Kavita Mehta [EMAIL PROTECTED]: But then that means that my tabbed JSP would have code for all the tabs ..How does it identify which tab code to open ?? WongTseng [EMAIL PROTECTED] 06/29/2007 05:28 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: How to make tabs in JSP The action which is mapped to the url status.do should forward to the jsp in which you have used the JSPTagControl. In this way several actions can share a single tabbed jsp. So don't put the content of the a tab in a separate jsp. 2007/6/29, Kavita Mehta [EMAIL PROTECTED]: Hi Angelo, thanks for your help . I am using the JSPTagControl in my JSP as: jsptabcontrol:tabControl name=PERSONNE_TABCONTROL width=800px height=100% jsptabcontrol:tabPage name=IDENTITY_TABPAGE title=BSSMAP Stats width=100px BSSMAP Stats ...follows... /jsptabcontrol:tabPage jsptabcontrol:tabPage name=ADRESS_TABPAGE title=Call Control Stats href=/status.do /jsptabcontrol:tabPage /jsptabcontrol:tabControl My problem is that when I click the second tab, the page corresponding to /status.do is displayed as a full page JSP and not as a part of tabbed JSP page. Please help. Regards, Kavita -- Wong Tseng 王曾 *DISCLAIMER* This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately and delete the message. -- Wong Tseng 王曾
Re: [S2] Checkbox causes error on form submission.
It's so strange. If the hidden field is generated to solve the problem of submitting checkboxs' values unchecked , the filed should look like this: input type=hidden name=payment.billerSame value=true/ By the way, where is the AsPayor come from? What's the strategy used by S2 to generate the names of thses hidden fileds? 2007/5/26, Dave Newton [EMAIL PROTECTED]: --- Skip Hollowell [EMAIL PROTECTED] wrote: I get the first input, but the second hidden one? That is obviously where the error is coming from, but why/how? I do have validate turned on, so is that how the extra field is getting generated for checkboxes? OK Dave, feel free to show me which doc page I missed this time. :) *lol* The hidden field is generated because of the way HTTP deals with checkboxes--since checkboxes aren't submitted if they're not checked, having the hidden field means that you'll get the unchecked value when submitted. (If you're familiar with S1 you'll undoubtedly remember the dreaded reset ActionForm method.) That said I'm not sure about the error (and can't check my code at the moment) at this point. d. Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. http://new.toolbar.yahoo.com/toolbar/features/mail/index.php - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Wong Tseng 王曾
Re: Ajax can't receive Chinese code from action of struts2
Maybe you should url-encode them first before sending them to client through ajax response. 2007/4/28, Dave Newton [EMAIL PROTECTED]: --- red phoenix [EMAIL PROTECTED] wrote: when ajax receive information which include Chinese code from action of Struts2,ajax will show chinese code into confusion code,but if ajax receive information which include Chinese code from jsp, ajax will show correct Chinese code.I don't know why raise this error! How to correct it? I believe that in order to compile I18N code you must do two things: make sure your source is in an I18N format and tell the compiler to use that encoding. I think with Sun's compiler you can use the -encoding option. d. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Wong Tseng 王曾
Re: sub-struts
If you want to learn more about struts2, you can read the book 'webwork in action' which covers almost 90% of the knowledge about struts2 except for different package and cofig file names. As we all know, struts2 is almost the same as webwork. 2007/4/8, Asaf Paris Mandoki [EMAIL PROTECTED]: The requirement is that the widgets should be very easy to develop. And be as independent as possible of the application. So they could even be uploaded by users. The widgets should be able to make use of other, more general systems, like user management. I was thinking of doing this by implementing an interface on the widgets action classes. Something like the SessionAware interface. I'm really new to struts so I'll try to get more familiar with it so i can post more specific questions. On 4/7/07, Piero Sartini [EMAIL PROTECTED] wrote: On Sunday 08 April 2007 02:01:24 Asaf Paris Mandoki wrote: I forgot to say that the directory structure i wrote on my first post (which was wrong [forgot the web-inf directory]), should be inside a directory of the application. So each widget should have it's own classes directory, struts.xml, etc. The directory nesting is not necessary, but the widgets will work as children to the main application will be nested so it makes more sense to me. The objective is to have struts within struts. Yes, I did understand that. Just did not understand why you would want that and tried to show other solutions that may solve your needs :-) If you really want to make several struts2 applications and compose them somehow, you could use sitemesh to do so. But I think configuring and developing several stand-alone webapps is much more work than developing everything within one s2 application. Piero - 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] -- Wong Tseng 王曾
[S2]Where is the component interceptor ?
In webwork,there is a component interceptor which injects components to your actions. But there is no such interceptor in the Struts2 beta release. I wonder whether this interceptor is replaced by something else, or it will be provided in the GA release. -- Wong Tseng 王曾
[S2]Could not find or error in struts.properties
I am a newbie to Strus2, and I have just set up a Struts2 project of blank example. When I start the web container, it throws an exception. java.lang.IllegalStateException: struts.properties missing at org.apache.struts2.config.PropertiesSettings.init( PropertiesSettings.java:49) at org.apache.struts2.config.DefaultSettings.init(DefaultSettings.java :52) the directory structure is as follow: WEB-INF |web.xml |struts.properties |applicationContext.xml |class ||struts.xml ||example.xml |example |Login-validation.xml |package.properties |package_es.properties I just don't know where these xml files should be correctly located. The struts2 is rather webwork than Struts,so don't know how to deal with it. Any help is userful to me. -- Wong Tseng 王曾
Re: [S2]Could not find or error in struts.properties
thanks s lot. 2006/12/4, Don Brown [EMAIL PROTECTED]: struts.properties goes in WEB-INF/classes In the next version, 2.0.2, it is completely optional. Don On 12/3/06, WongTseng [EMAIL PROTECTED] wrote: I am a newbie to Strus2, and I have just set up a Struts2 project of blank example. When I start the web container, it throws an exception. java.lang.IllegalStateException: struts.properties missing at org.apache.struts2.config.PropertiesSettings.init( PropertiesSettings.java:49) at org.apache.struts2.config.DefaultSettings.init( DefaultSettings.java :52) the directory structure is as follow: WEB-INF |web.xml |struts.properties |applicationContext.xml |class ||struts.xml ||example.xml |example |Login-validation.xml |package.properties |package_es.properties I just don't know where these xml files should be correctly located. The struts2 is rather webwork than Struts,so don't know how to deal with it. Any help is userful to me. -- Wong Tseng 王曾 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Wong Tseng 王曾
Re: Indexed Properties
I think it's the getResultsPage method that causes your problem. If the results is none, and the parameter index equels any value that is large than 0, an OutOfBound Exception will occur. 2006/11/18, Adam K [EMAIL PROTECTED]: public Product getResultsPage(int index) { if(this.results == null) { this.results = new ArrayList(); } while(index = this.results.size()) { this.results.add(new Product()); } return (Product) results.get(index); } -- Wong Tseng 王曾
Re: Indexed Properties
Just think If the struts dosen't set these indexed properties from the lower bound to the upper bound in a ascending order, an outofbound exception will occur. -- Wong Tseng 王曾
Re: how to selectively call struts validation from a form
hi,Paul: You say the validator is based on whatever key I supply.Is that true, as far as I know the validation is linked with the form by the form's name. 2006/11/24, Paul Benedict [EMAIL PROTECTED]: Robin, The validator is based on whatever key you supply. You can choose the key. I like to do formname(buttonname) style. So if I have a form called personForm and a button called save, my form key in my validaton files is personForm(buttonname). Paul -- Wong Tseng
Re: can not reach the jsp file
You can check your source code of the blank page to see if there is html and /html tags in it. If there are,that may be because the forward you use is missing or incorrect. 2006/11/17, Ken Hu [EMAIL PROTECTED]: No , I am using firefox. I can see no exception or warning in log file(tomcat's log). My platform is Tomcat 5.5 on Debian Linux, I develope and test my code in Netbeans IDE. Ken 於 五,2006-11-17 於 10:22 +,Lance Semmens 提到: hmm... are you using IE? You may need to turn off show friendly error messages in the options somewhere. I'm thinking you've got a server error that IE is hiding from you. Any errors in the log? -Original Message- From: Ken Hu [mailto:[EMAIL PROTECTED] Sent: 17 November 2006 01:39 To: Struts Users Mailing List Subject: RE: can not reach the jsp file well ... sorry for that , this is a wrong typing when I post this question. In my struts-config.xml , the slash is not missing. I add log4J in my app to trace my code : public class ShowDocsAct extends org.apache.struts.action.Action{ private Category _cat = Category.getInstance(this.getClass()); public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) throws Exception{ //print out this line in log file to prove the process has come into this class _cat.info(come into Action); return mapping.findForward(success); } } But I can not find the evidence that the process has come into this Action class. My struts-config.xml is as following : action-mappings action path=/Welcome forward=/welcomeStruts.jsp/ action path=/ShowDocs type=com.kenhu.cdms.servlet.ShowDocsAct forward name=success path=/showDocs.jsp / /action /action-mappings The URL that I ask my browser to browse is : http://localhost:8080/cdms/ShowDocs.do Help ! what do I go wrong ? Ken 於 四,2006-11-16 於 15:16 +,Lance Semmens 提到: I think you're missing a '/' forward name=success path=/showDocs.jsp / To keep your webapp a bit cleaner, perhaps consider forward name=success path=/WEB-INF/jsps/showDocs.jsp / -Original Message- From: Ken Hu [mailto:[EMAIL PROTECTED] Sent: 16 November 2006 09:03 To: user@struts.apache.org Subject: can not reach the jsp file Dear All: I'm doing a simple strus test, but all I can see after I try to visit ShowDocs.do is a blank page. struts-config.xml: action-mappings action path=/Welcome forward=/welcomeStruts.jsp/ action path=/ShowDocs type=com.kenhu.cdms.servlet.ShowDocsAct forward name=success path=showDocs.jsp / /action /action-mappings My Action class: public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) throws Exception{ return mapping.findForward(success); } I can not find anything wrong , could someone please tell me what's going on here ? Thanks -- 研�l部 胡重威 Ken Hu [EMAIL PROTECTED] 孟�A科技股份有限公司 http://www.mmti.com.tw 地址: 高雄市802苓雅�^中正一路120��4F-7 : 07-7279337 分�C: 120 �髡�: 07-7279377 行��: 0937083880 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Wong Tseng 王曾
Re: How to pass Java parameter to javascript
when you insert jsp scriptlet into the tag as a value of an attribute, the scriptlet should be bracketed by the quotation marks without anything else inside. 2006/11/8, Pankaj Gupta [EMAIL PROTECTED]: Hi All, I am unable to pass a java parameter to a javascript method. Can you please tell whats going wrong. Here is my code: html:submit property=submitType onclick=setFile('%= ((FileInstance)nmeFile).getFileName() %', this.form); regards, Pankaj -- Wong Tseng 王曾
Re: Issue: using logic:iterate to display rows and html:button to dis tinguish one of them
It's bacause you have more than one hidden elements with the same name,so whichever row you choose to delete, your action will recive an array of parameter values with the same parameter name. That's the reason why you always get the id of the first row. I suggest you to use a radio boxs to replace the hidden elements,and only one delete button is enough. 2006/10/26, Gallagher, Jim (RBoS ITDS Dublin) [EMAIL PROTECTED]: Hi Apologies if this is a simple issue, but it's driving me insane. In my web app (using Struts 1.1 on Java 1.4 Websphere) I have a jsp that is using logic:iterate to display a sequence of records. On each row I have a Delete button, which should cause the object that row represents to be deleted. I have a form defined and the Delete button submits the form, currently with a html:hidden tag providing the key of the row to be deleted (contactID). The full jsp code is: html:form action=scDeleteOrder logic:iterate id=outstandinglist name=outstandingList indexId=index property=arrayList type=temptest.OrderDetail bean:write name=outstandinglist property=contactID / bean:write name=outstandinglist property=contactFirstName / lt;bean:write name=outstandinglist property=contactLastName / bean:write name=outstandinglist property=organisationName / bean:write name=outstandinglist property=dateOrderSent / bean:write name=outstandinglist property=orderStatus / bean:write name=outstandinglist property=errorCode / bean:write name=outstandinglist property=serviceUserNo / bean:write name=outstandinglist property=billingSortCode / bean:write name=outstandinglist property=billingAccountNo / html:hidden name=outstandinglist property=contactID /html:submit value=Delete / /logic:iterate /html:form My problem is that the contactID returned is always the first one displayed, not the one of the row selected. I changed the hidden tag to a text one to see the value being written and it was the correct contactID, but on pressing the button the contactID retrieved in the Action is always the first row displayed. Could anybody suggest a) a solution to the above issue and/or b) a more elegant way to achieve what I'm trying to do? Thanks in advance Regards, Jim Jim Gallagher The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB Authorised and regulated by the Financial Services Authority. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Wong Tseng 王曾
Re: Forward Action to Action
Maybe it's impossible. Cos the data populated into the formbean is read from url parameters, and you can't create parameter in request by any Java API. So 'tis difficult. But you can hardcode the paramters in the path of the forward which points to your second action. 2006/10/21, Jean-Marie Pitre [EMAIL PROTECTED]: Hi, I would like to forward an Action to another one. My problem is : I want to pass a data from my first first action to my second formbean (second action). I tried to do a setattribute in my first action before calling mappingfindforward and in my second formbean to create an acessor but the formbean is never populated. Have you got and idea ? is it possible and correct to do that ? Thanks, Regards JMP. --- Email Disclaimer http://www.cofidis.be/emaildisclaimer.php - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Wong Tseng 王曾
Re: Problem with hidden String[] object
Maybe you can make your String[] Object a indexed attribute of your formbean. Then use html:hidden: something like this below: Class YourFormBean extends ActionForm{ String[] aaas = new String[5]; public String getAaa(int index){ return aaas[index]; } public void setAaa(String a,int index){ aaas[index] = a; } } then in your jsp: html:hidden property=aaas[0] / html:hidden property=aaas[1] / html:hidden property=aaas[2] / 2006/10/20, Anet [EMAIL PROTECTED]: Hi everybody; I have a String[] object. but I can't pass it via form as a hidden object. Is it wrong to pass a string[] object as html:hidden ??? Thanks. - How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates. -- Wong Tseng 王曾