RE: html:text in logic:iterate
Hi Thanks all for the suggestion. This way works and I am going with it. input type=text value=bean:write name=mymobilephaseloadings property=percentage/ size=10 name=percentage/ Sebastian On Thu, 2004-11-04 at 16:37, Girish Kumar K. P. wrote: Hi, What I understood was like this: You have a logic:iterate tag Inside that you have the text field tag. Corresponding to the Logic:iterate you must be having a for loop inside the form population method in your action. There you will be populating the value from the said bean (in the bean you will be having list I suppose, from which you extract the corresponding entry to display in the logic:iterate) to the corresponding form field in the form bean. I also had the same problem sometime back. I did the way I suggested and it worked. That's why I suggested this way. Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:45 PM To: Struts Users Mailing List Subject: RE: html:text in logic:iterate How do I populate it in the Action if I need to iterate through the ActionForms in my JSP? I am thinking that it is just an issue of getting around the parser. In other instance I have, just adding quotes here and there to 'fool' the parser solves my problems. e.g. I can have a bean:write tag inside a hidden tag.. Sebastian On Thu, 2004-11-04 at 15:09, Girish Kumar K. P. wrote: Anyway , the value if u give the value attribute, the values populated into the form bean from the action will not be displayed. Text field will diplay bean:write name=mymobilephaseloadings property=percentage/ So, poipulate the form bean at the action . That's it Dopn't give the value attribute. It will work -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:34 PM To: Struts Users Mailing List Subject: RE: html:text in logic:iterate The user is actually editing some data that is already saved. So I need the data to be displayed in the textbox (form). sebastian On Thu, 2004-11-04 at 14:52, Girish Kumar K. P. wrote: U shouldn't give the value attribute there. The value would be read from the form Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:18 PM To: Struts Users Mailing List Subject: html:text in logic:iterate Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:text in logic:iterate
Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:text in logic:iterate
The user is actually editing some data that is already saved. So I need the data to be displayed in the textbox (form). sebastian On Thu, 2004-11-04 at 14:52, Girish Kumar K. P. wrote: U shouldn't give the value attribute there. The value would be read from the form Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:18 PM To: Struts Users Mailing List Subject: html:text in logic:iterate Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - 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]
RE: html:text in logic:iterate
How do I populate it in the Action if I need to iterate through the ActionForms in my JSP? I am thinking that it is just an issue of getting around the parser. In other instance I have, just adding quotes here and there to 'fool' the parser solves my problems. e.g. I can have a bean:write tag inside a hidden tag.. Sebastian On Thu, 2004-11-04 at 15:09, Girish Kumar K. P. wrote: Anyway , the value if u give the value attribute, the values populated into the form bean from the action will not be displayed. Text field will diplay bean:write name=mymobilephaseloadings property=percentage/ So, poipulate the form bean at the action . That's it Dopn't give the value attribute. It will work -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:34 PM To: Struts Users Mailing List Subject: RE: html:text in logic:iterate The user is actually editing some data that is already saved. So I need the data to be displayed in the textbox (form). sebastian On Thu, 2004-11-04 at 14:52, Girish Kumar K. P. wrote: U shouldn't give the value attribute there. The value would be read from the form Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:18 PM To: Struts Users Mailing List Subject: html:text in logic:iterate Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
reset method causes values not displaying
Hi Can someone point out why this do not work, or why this work? What this does, get a Actionform, set a value in it, add the ActionForm into an Vector, set the Vector into Session. Strangely the new ActionForm is not displayed in the JSP returned by ActionForward. It only appears if the ActionForm reset is not called before returning the method. How can the reset method affect my codes? and yes, the values was printed out before returning and all the values are there.. Why is that so? Thanks Sebastian Ho - public ActionForward addColumn(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(); //GET FORM LCColumnPackingMaterialForm columnPackingMaterial = (LCColumnPackingMaterialForm) form; //GET VECTOR FROM SESSION Vector columnPackingMaterials = (Vector) session.getAttribute(Constants.COLUMN_PACKING_MATERIALS_KEY); //SET INDEX IN FORM columnPackingMaterial.setIndex(String.valueOf(columnPackingMaterials.size())); //ADD FORM INTO VECTOR columnPackingMaterials.add(columnPackingMaterial); //SET VECTOR INTO SESSION session.setAttribute(Constants.COLUMN_PACKING_MATERIALS_KEY, columnPackingMaterials); //RESET FORM //form.reset(mapping, request); return mapping.findForward(addsuccess); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: reset method causes values not displaying
Now this is a Java question, if XXX newForm = (XXX) form resulted in form and newForm having the same memory space? How do I really make a duplicate copy with different memory space (beside using new, or is new the only solution)? Sebastian Ho On Wed, 2004-10-27 at 17:44, dmu2201 wrote: Sebastian Ho wrote: Hi Can someone point out why this do not work, or why this work? What this does, get a Actionform, set a value in it, add the ActionForm into an Vector, set the Vector into Session. Strangely the new ActionForm is not displayed in the JSP returned by ActionForward. It only appears if the ActionForm reset is not called before returning the method. How can the reset method affect my codes? and yes, the values was printed out before returning and all the values are there.. Why is that so? Thanks Sebastian Ho - snip //RESET FORM //form.reset(mapping, request); Since all Java calls with objects in them are call-by-reference you are actualling calling reset on the object you've just added to your Vector. I don't know how your reset method is implemented of course, but I would presume that all the values are reset to default values when you call reset. If you want to preseve the values you've would have to make a copy of the form object and then add the copy to the vector... Don't know if this is what you meant, but this is how I understand it :-) Enjoy... Claus - 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]
Re: iterate paging
Does anyone has an example using struts iterate? How does indexId works? Sebastian On Sat, 2004-10-09 at 01:05, Bill Siggelkow wrote: Or you could do it yourself with JSTL: %@ page contentType=text/html;charset=UTF-8 language=java % %@ taglib uri=http://jakarta.apache.org/struts/tags-bean; prefix=bean % %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % html head titlePaging Example/title /head body jsp:useBean id=pagedData class=com.oreilly.strutsckbk.ch04.PagedData/ bean:size id=listSize name=pagedData property=data/ c:set var=pageSize value=10/ c:set var=pageBegin value=${param.pageBegin}/ c:set var=pageEnd value=${pageBegin + pageSize - 1}/ c:if test=${(pageBegin - pageSize) ge 0} a href='c:url value=paged_data.jsp c:param name=pageBegin value=${pageBegin - pageSize}/ /c:url' Prev /a /c:if nbsp; c:if test=${(listSize gt pageSize) and (pageEnd lt listSize)} a href='c:url value=paged_data.jsp c:param name=pageBegin value=${pageBegin + pageSize}/ /c:url' Next /a /c:if table border=2 tr thFirst Name/th thLast Name/th thTerm of Office/th /tr c:forEach var=pres items=${pagedData.data} begin=${pageBegin} end=${pageEnd} tr td c:out value=${pres.firstName}/ /td td c:out value=${pres.lastName}/ /td td c:out value=${pres.term}/ /td /tr /c:forEach /table /body /html Peng Tuck Kwok wrote: Or you coud use displaytag. http://displaytag.sf.net It's pretty ok from what I can see. On Fri, 8 Oct 2004 14:32:58 +0530, Viral_Thakkar [EMAIL PROTECTED] wrote: Use ValueListHandler design pattern .. -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Friday, October 08, 2004 1:21 PM To: 'Struts Users Mailing List' Subject: iterate paging hi anyone has codes on how to display paging? i.e. display 10 rows per page with 'next' / 'back' functions. Thanks sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need advice: session scoped objects or session scoped ActionForm ?
For every calling page, use a new mapping in yr struts-config. I assume u mean setting the action as session scope in yr config? They are the same I think, the important thing is to keep it to one solution and use it thoughout the application. Else it will be confusing and hard to debug as yr application grows. Sebastian On Wed, 2004-10-13 at 08:59, lixin chu wrote: Hi, I am seeking your expert advice: I have a simple page with Done and Cancel buttons. If any of these buttons are clicked, I suppose to go back to the calling page - there are a few pages that will come to this page. It is a simple workflow type of thing. So I need to know the retutn URL, pls some other stuff. The question is, where do I keep the return URL which is passed in as request attribute ? Since the current page has some other buttons not just Done and Cancel, I use LookupDispatchAction, that means I have to keep the return URL in the session. Which one is a better solution: keeping it in the session scoped ActionForm or request.getSession().setAttribute ? It is easier to manage the return URL if put into ActionForm becuase it is isolated, no naming conflict-bur ActionForm is for UI components only; otherwise, I need to keep it in the session using a name reference something like myAction_returnURL, and also I need to handle the cleaning - it is still possible that the sting is kept in the session until the session is closed if the user does not click Done or Cancel. any best practice ? may be the best is to avoid using session scope objects but I just can not think of a way out for my use case. thanks in advance LX __ 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
iterate paging
hi anyone has codes on how to display paging? i.e. display 10 rows per page with 'next' / 'back' functions. Thanks sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Cannot create ActionForm
Hi What can go wrong when this is thrown? javax.servlet.ServletException: Exception creating bean of class sg.edu.astar.flamingo.web.proteomics.form.FileForm: {1} FileForm contains some FormFile variables and I have the correct enctype in my JSP already. Tell me if codes are needed before I posted them. Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cannot create ActionForm
) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677) at java.lang.Thread.run(Thread.java:534) On Wed, 2004-10-06 at 18:51, [EMAIL PROTECTED] wrote: Hi, Sebastian. Seems like Struts cannot create an instance of your FileForm class. Something must be wrong during (class) construction. Do your log files reveal some more information? Hiran - Hiran Chaudhuri SAG Systemhaus GmbH Elsenheimer Strae 11 80867 Mnchen Phone +49-89-54 74 21 34 Fax +49-89-54 74 21 99 -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Mittwoch, 6. Oktober 2004 11:34 To: Struts Users Mailing List Subject: Cannot create ActionForm Hi What can go wrong when this is thrown? javax.servlet.ServletException: Exception creating bean of class sg.edu.astar.flamingo.web.proteomics.form.FileForm: {1} FileForm contains some FormFile variables and I have the correct enctype in my JSP already. Tell me if codes are needed before I posted them. Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cannot create ActionForm
I traced it to a nullpointerexception. Didn't know why Struts is calling toString() which throws NullPointerException. Anyway, it uncovers the bug in my toString. Thanks Hiran! Sebastian 2004-10-06 17:47:33,268 ERROR [org.apache.struts.util.RequestUtils] Error creating form bean of class sg.edu.astar.flamingo.web.proteomics.form.FileForm java.lang.NullPointerException at sg.edu.astar.flamingo.web.proteomics.form.FileForm.toString(FileForm.java:200) at java.lang.String.valueOf(String.java:2131) at java.lang.StringBuffer.append(StringBuffer.java:370) at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:844) at org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor.java:364) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:253) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) On Wed, 2004-10-06 at 19:08, [EMAIL PROTECTED] wrote: Hi, Sebastian. It looks like the call to new FileForm() throws an exception. Have a look at your Tomcat logfiles. There might be more information about the JSP compiler failing. If that is not the case, check that the class exists (class name/package name). If it is the first instantiation in your application, it might be a class loading problem. Maybe another class FileForm relies on cannot be found. If it is a second, ... instantiation check what code runs in the default constructor. This is what I'd go for. Hiran - Hiran Chaudhuri SAG Systemhaus GmbH Elsenheimer Strae 11 80867 Mnchen Phone +49-89-54 74 21 34 Fax +49-89-54 74 21 99 -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Mittwoch, 6. Oktober 2004 11:57 To: Struts Users Mailing List Subject: RE: Cannot create ActionForm You mean struts log file? Give me some time. Mean while this is the output from my server. 18:28:33,772 ERROR [Engine] ApplicationDispatcher[/Flamingo] Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: Exception creating bean of class sg.edu.astar.flamingo.web.proteomics.form.FileForm: {1} at - 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]
Must specify type attribute if name is specified error
Hi I have the following exception : javax.servlet.ServletException: Must specify type attribute if name is specified when I insert a name parameter to my html:form as shown here. html:form action=Aliquot.do name=aliquotForm The reason for the name is for my javascript. Why is it throwing this exception? I can't even find 'type' in the struts javadoc for html:form. Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
storeException from ExceptionHandler
Hi I can't get the storeException to work in my ExceptionHandler implementation. I wish to print out ActionErrors onto the browser but the storeException only accept an ActionError parameter. How do I print multiple lines? Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: storeException from ExceptionHandler
Nobody answered my mail yet and I got the solution, so here it is for those interested. overwrite storeException and set it into Global.ERROR attribute. On Tue, 2004-09-28 at 14:17, Sebastian Ho wrote: Hi I can't get the storeException to work in my ExceptionHandler implementation. I wish to print out ActionErrors onto the browser but the storeException only accept an ActionError parameter. How do I print multiple lines? Thanks Sebastian Ho - 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]
BeanUtil Exception when File Upload
Hi Once I add in a html:file, i encountered a BeanUtil exception. I have attached all relevant information. I noticed that the validate method in ActionForm is not called. The exception occurred during the bean population. Hope someone can help. Sebastian Ho -- exception -- javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677) at java.lang.Thread.run(Thread.java:534) root cause java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method
RE: BeanUtil Exception when File Upload
Thanks David. The problem was resolved. I missed out the encoding type. Thanks On Fri, 2004-09-24 at 15:32, David G. Friedman wrote: Sebastian, I am playing around with this right now. I had to change my html:form .../ to be: html:form action=/uploadTest enctype=multipart/form-data / Between this and keeping my bean simple, it worked fine. Also, don't forget this test to see if your uploaded file(s) exceeded the max limit: Boolean b = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ( b != null ) { // You exceeded your Struts controller's // maxFileSize for uploads so let the // user know the upload was too large! } Regards, David -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Friday, September 24, 2004 3:18 AM To: Struts Users Mailing List Subject: BeanUtil Exception when File Upload Hi Once I add in a html:file, i encountered a BeanUtil exception. I have attached all relevant information. I noticed that the validate method in ActionForm is not called. The exception occurred during the bean population. Hope someone can help. Sebastian Ho -- exception -- javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR ealm.java:220) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2 46) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStat sValve.java:76) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci ationValve.java:65) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174
Re: jasper exception
I got it working although I don't know why it behaves that way.. In my JSP, I have a /html:frame somewhere in between the lines. Once I remove it, the exception went away. That tag should not be there anyway. No idea how it got there in the first place.. Thanks Kumar. Sebastian Ho On Tue, 2004-09-21 at 12:22, Jitender K Chukkavenkata wrote: I was just wondering that I couldnt find any mapping in JSP for the method nextController(). Iam sorry I was actually expecting the value of action attribute of html:form but not URL. Jitender Kumar C.V. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
bean missing after validation
hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean missing after validation
Why didnt I use html:hidden? Whenever I use that I have parsing error and exception thrown which I think is because of the bean:write within html:hidden. Using input didn't cause any problem. If html:hidden will not cause the problem and I am doing it the wrong way. Pls advise. Ok..now I understand the scope implication. I guess the only way to resolve this is to put everyting into session instead of request. Sebastian On Mon, 2004-09-20 at 15:38, Erik Weber wrote: First I would ask, why aren't you using the Struts tags (such as html:hidden)? I assume that you are using them to render your other inputs (such as those of type text). But, to answer your question, it's a matter of scope. When the page containing the form is first rendered, the hidden variable is set to some value that lives in request scope. When the form is submitted (and validation errors occur), a new request exists, the original request no longer exists, and so that value is no longer in scope when the page is rendered for the second time. See if this helps: http://www.reumann.net/struts/articles/request_lists.jsp Erik Sebastian Ho wrote: hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: bean missing after validation
I thought you can't control redirect/forwrd for validation? I can control that for mapping forward only. Sebastian On Mon, 2004-09-20 at 15:14, Sachin Bhutada wrote: hi sebastian, If you have configured action to use redirect ( which is normal case ), ur request attributes will be lost. Try putting that bean seesion scope. sachin xoriant, mumbai PS : also make sure, how does struts take us back to input page ?( using forward or redirect i guees its redirect) -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 12:59 PM To: Struts Users Mailing List Subject: bean missing after validation hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - 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]
Re: bean missing after validation
Tried changing it to session scpope. Guess wat, I hit into another problem. Because the values are in session scope, whenever there's validation errors, the values entered by user previously was reset to whats set in session! Guess have to continue reading to find a workaround.. If only struts does this for me.. Sebastian On Mon, 2004-09-20 at 16:29, Erik Weber wrote: Perhaps you would like to use the html-el tags (which also come with the Struts dist), like this: html-el:hidden property=${myBean.myField}/ But there is nothing wrong with using the standard html hidden input as far as I know (but you give up some Struts luxuries). Using Session scope is one way, but not the only way, to solve your problem. (Don't be afraid of it though). This is not an easy problem despite the simplicity of the concept of scope. Keep reading! Erik Sebastian Ho wrote: Why didnt I use html:hidden? Whenever I use that I have parsing error and exception thrown which I think is because of the bean:write within html:hidden. Using input didn't cause any problem. If html:hidden will not cause the problem and I am doing it the wrong way. Pls advise. Ok..now I understand the scope implication. I guess the only way to resolve this is to put everyting into session instead of request. Sebastian On Mon, 2004-09-20 at 15:38, Erik Weber wrote: First I would ask, why aren't you using the Struts tags (such as html:hidden)? I assume that you are using them to render your other inputs (such as those of type text). But, to answer your question, it's a matter of scope. When the page containing the form is first rendered, the hidden variable is set to some value that lives in request scope. When the form is submitted (and validation errors occur), a new request exists, the original request no longer exists, and so that value is no longer in scope when the page is rendered for the second time. See if this helps: http://www.reumann.net/struts/articles/request_lists.jsp Erik Sebastian Ho wrote: hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: bean missing after validation
Ok I resolved it and I think this is the best way at least for now. In my ActionForm, set the attribute back in request if there's error : if(errors != null) { ActionForm form = new ActionForm(); form.set form.set request.setAttribute(user, form); } Sebastian On Mon, 2004-09-20 at 16:11, Sebastian Ho wrote: I thought you can't control redirect/forwrd for validation? I can control that for mapping forward only. Sebastian On Mon, 2004-09-20 at 15:14, Sachin Bhutada wrote: hi sebastian, If you have configured action to use redirect ( which is normal case ), ur request attributes will be lost. Try putting that bean seesion scope. sachin xoriant, mumbai PS : also make sure, how does struts take us back to input page ?( using forward or redirect i guees its redirect) -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 12:59 PM To: Struts Users Mailing List Subject: bean missing after validation hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jasper exception
Hi The output doesn't even print out the nextController in the method which I inserted.. Thanks -- JSP -- html:submit value=Reset property=action/ html:submit property=action value=Next bean:message key=button.next/ /html:submit html:hidden property=page value=createproject/ --- Action --- public class CreateNewProjectAction extends DispatchLookupAction { public CreateNewProjectAction() { } protected Map getKeyMethodMap() { System.out.println(getKeyMethodMap); Map map = new HashMap(); map.put(button.next, nextController); return map; } public ActionForward nextController(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, SystemException { System.out.println(nextController); ActionForward actionForward = null; String page = (String) request.getParameter(page); System.out.println(Page in nextController : + page); if (page.equals(createproject)) { actionForward = nextFromCreateProject(mapping, form, request, response); } else if (page.equals(createexperiment)) { actionForward = nextFromCreateExperiment(mapping, form, request, response); } return actionForward; } On Tue, 2004-09-21 at 11:05, Jitender K Chukkavenkata wrote: Which part of your code generated this? Can I have a look over it? Thanks, Jitender Kumar C.V. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem forwarding with Servlet and Struts
Hi I don't know this is a struts or servlet or my problem. I am implementing servlet filter. I can access 'index.do' fine before implementing the filter. After I implemented the filter, a forward to 'index.do' gives me a blank page. This is the only statement in my doFilter() method. this.myFilterConfig.getServletContext().getRequestDispatcher(/index.do).forward(request, response); Anyone experience somethign similar? Thanks sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multiple button with same value using same Action class
Hi I have been using LookupDispatchActin for a while and everything works fine until.. I reuse the same Action class for a couple of JSPs. Some of the JSP has the button Cancel in them. Because they are in different JSP, the forwarded JSP will be different when Cancel is selected. In the getKeyMethodMap() method, I have a few keys which maps to 'Cancel' in my applicationresources.properties. And each of them will map to a different method. Problem is they are using the same 'Cancel' value with parameter 'action'. Because of the way LookupDispatchAction works, the first key that map will be used and the corresponding method called. Can I make it maps to different methods? How do I resolve this? I am using Struts 1.1. To illustrate In X.jsp : html:cancel property=action value=Cancel bean:message key=button.cancelforgotpassword/ /html:cancel In Y.jsp : html:cancel property=action value=Cancel bean:message key=button.cancelsign/ /html:cancel In properties : button.cancelforgotpassword = Cancel button.cancelsignup = Cancel In Action : protected Map getKeyMethodMap() { Map map = new HashMap(); map.put(button.cancelsignup, cancelSignup); map.put(button.cancelforgotpassword, cancelForgotPassword); return map; } Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Frame problem using Struts
When you say depending on the clicked button, are u assuming that there are 1 button. I only have one button in the frame. The behaviour is coded in actino class. If this is not what u meant, some pointers or example will be appreciated. thanks sebastian On Mon, 2004-09-13 at 15:26, Benjamin Letrou wrote: Hi, why don't you set your target dynamicaly with a javascript ? you set your form action to XX.do and change the target depending on the clicked button. Bj Sebastian Ho a crit : Hi My index.jsp has a top frame and bottom frame. I have a html:button in the bottom frame. When the button is clicked, Action will either forward to the same page or a different page. The same page target will be _self which is how struts behaves. For the other path that displays a different page, I need it to be _top because it replaces the top frame as well. I got stuck after my javascript attempt fails. I added onClick-location.parent=XX.do to my button. The action class (XX.do) is called correctly, but no matter which actionForward my action returns, the javascript overwrite that and forwards to XX.do! Any idea how to solve this? Thanks Sebastian Ho - 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]
Re: Frame problem using Struts
Sorry but I don't understand where is the 'dynamic targetting'. From the example, don't we need to hard code the setDynamicTarget(XX) in the JSP? But I won't know the taget to set at that time.. Sebastian Ho On Mon, 2004-09-13 at 16:33, Bj wrote: Here is an example of dynamic targeting :-) By default, the target will be '_self' but depending on the clicked button, you can change the target to '_top','_parent',..., a frame name or any opended window. Your Action will forward your path (succes, failure,...) to the corresponding target window. script language=JavaScript function setDynamicTarget(target) { document.forms[0].target = target; } function SubmitForm(object) { object.form.submit(); } /script ... html:frame action=XX.do target=_self ... html:button property=mybouton.name styleId=button onclick=setDynamicTarget('_top');SubmitForm(this)bean:message key=mymodule.mybuttonlabel//html:button ... /html:form Bj Sebastian Ho a crit : When you say depending on the clicked button, are u assuming that there are 1 button. I only have one button in the frame. The behaviour is coded in actino class. If this is not what u meant, some pointers or example will be appreciated. thanks sebastian On Mon, 2004-09-13 at 15:26, Benjamin Letrou wrote: Hi, why don't you set your target dynamicaly with a javascript ? you set your form action to XX.do and change the target depending on the clicked button. Bj Sebastian Ho a crit : Hi My index.jsp has a top frame and bottom frame. I have a html:button in the bottom frame. When the button is clicked, Action will either forward to the same page or a different page. The same page target will be _self which is how struts behaves. For the other path that displays a different page, I need it to be _top because it replaces the top frame as well. I got stuck after my javascript attempt fails. I added onClick-location.parent=XX.do to my button. The action class (XX.do) is called correctly, but no matter which actionForward my action returns, the javascript overwrite that and forwards to XX.do! Any idea how to solve this? Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
conversion from button to link
Hi I replaced the following struts tags for a button with one that display a link. The Action uses LookupDispatchAction. That explains the need for my message key in it. /html:form html:form action=MainMenu.do target=basefrm html:submit property=action value=Create Project bean:message key=button.createproject/ /html:submit This is my replacement codes for a link. a href=MainMenu.do?action=Create Project target=basefrmCreate Project/a I am surprised that this works! There is no need to bother about message key in the link. Can anyone explain why? (maybe i should not ask this since it works anyway..but i am curious!) Sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
request in actionform validate()
Hi A quick question.. I should be able to get request attributes from the request parameter in validate right? In my case, there is nothing in my request but in my JSP I already have the hidden fields. And what about request attributes in the same JSP, it seems like they were gone if validation fails and returns to the same JSP. Shouldn't struts keep them somewhere in case validate fails and the JSP needs to be displayed again? Any reasons what might go wrong? Thanks Sebastian Ho input type=hidden name=experimentID value=%= experiment.getExperimentID() %/ input type=hidden name=projectID value=%= experiment.getProjectID() %/ html:submit property=action value=Create Aliquot bean:message key=button.createaliquot/ /html:submit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Questions on logging
Hi I am in the stage of implementing logging in my struts application. I have been reading online but have some questions unanswered. 1. Action class should be thread-safe. Therefore no static variable, I should just use a non-static variable to hold my logger? 2. In a multi-user web application, how can I keep logs from the same class (same execution thread or same user request) stays together? I envision them to be all messy in the log file when there's multiple user requesting for the same action class. 3. About the thread safe issue with Actin class, that doesn't apply to the other classes that action execute right? Those are treated as normal java files. Thanks Sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Possible to change input path in actionForm validate?
Oh..got it. Thanks Paul. On Tue, 2004-08-31 at 16:56, Paul McCulloch wrote: What I meant is that you can use the same action class multiple times, each with a different path input: action path=/Handler1 type=com.foo.some.Action input=/file.jsp /action action path=/Handler2 type=com.foo.some.Action input=/otherfile.jsp /action Paul -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 2:18 AM To: Struts Users Mailing List Subject: RE: Possible to change input path in actionForm validate? I tried that but it is complainin about more than one identical action definition in struts-config. sebastian ho On Fri, 2004-08-27 at 20:21, Paul McCulloch wrote: One way to do this is to have multiple actions defined in struts-config.xml, each using the same Action class. Each action can have a different input JSP. Paul -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 1:05 PM To: Struts Users Mailing List Subject: Possible to change input path in actionForm validate? Hi Is it possible to change the input path that validate() displays if there are errors in the validation? I try using mapping.setInput() but it returns java.lang.IllegalStateException: Configuration is froze. Reason for this is I am using the same Action for different JSP, therefore the validation errors need to be displayed in the respective JSP, and not the input path specified in actino-mappings. Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wrong ActionMessage formatting
Hi I am having problem with the output from ActionMessage. I uses HTML tags like BR in my properties file. When bean:write prints out my messges, it displays BR in the browser. The HTML source turns out to be lt;BRgt;. I do not have this problem with ActionErrors. Am I missing anything? This is how I print it out in JSP: html:messages id=message message=true bbean:write name=message//bbr /html:messages Sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Possible to change input path in actionForm validate?
I tried that but it is complainin about more than one identical action definition in struts-config. sebastian ho On Fri, 2004-08-27 at 20:21, Paul McCulloch wrote: One way to do this is to have multiple actions defined in struts-config.xml, each using the same Action class. Each action can have a different input JSP. Paul -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 1:05 PM To: Struts Users Mailing List Subject: Possible to change input path in actionForm validate? Hi Is it possible to change the input path that validate() displays if there are errors in the validation? I try using mapping.setInput() but it returns java.lang.IllegalStateException: Configuration is froze. Reason for this is I am using the same Action for different JSP, therefore the validation errors need to be displayed in the respective JSP, and not the input path specified in actino-mappings. Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. ** - 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]
illegalargumentexception thrown
Hi I have this exception but i don't remember editing my struts-config. Where to start debugging? Sebastian java.lang.IllegalArgumentException: Path CreateProject.jsp does not start with a / character at org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:1179) at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:174) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062) at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012) at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: illegalargumentexception thrown
I resolved it although I don't know when the value changed. I added / before the 'input' in my action-mappings. Can't remember was it there all along because I didn't take note and it works for the past few days and I didn't edit the struts-config. Sebastian On Fri, 2004-08-27 at 14:48, Sebastian Ho wrote: Hi I have this exception but i don't remember editing my struts-config. Where to start debugging? Sebastian java.lang.IllegalArgumentException: Path CreateProject.jsp does not start with a / character at org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:1179) at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:174) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062) at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012) at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) - 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]
Possible to change input path in actionForm validate?
Hi Is it possible to change the input path that validate() displays if there are errors in the validation? I try using mapping.setInput() but it returns java.lang.IllegalStateException: Configuration is froze. Reason for this is I am using the same Action for different JSP, therefore the validation errors need to be displayed in the respective JSP, and not the input path specified in actino-mappings. Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Possible to change input path in actionForm validate?
My apologies. I think there was a few postings yesterday on this same problem. I will look into ValidatorForm solution suggested. Sebastian Ho On Fri, 2004-08-27 at 20:05, Sebastian Ho wrote: Hi Is it possible to change the input path that validate() displays if there are errors in the validation? I try using mapping.setInput() but it returns java.lang.IllegalStateException: Configuration is froze. Reason for this is I am using the same Action for different JSP, therefore the validation errors need to be displayed in the respective JSP, and not the input path specified in actino-mappings. Thanks Sebastian Ho - 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]
RE: how to reset form
ignore the previous email. I sent it before i finsihed typing. Sorry I am using html:text not html textfield but it still doesn't work. I call this in my action.. form.reset(mapping, request); Is this right? On Thu, 2004-08-26 at 16:54, Yves Sy wrote: You can try using html:text instead of a normal textfield and use ActionForm's reset() method to reset the values to . Regards, -Yves- -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 4:07 PM To: Struts Users Mailing List Subject: RE: how to reset form 1. I need to use session for this one. 2. The textfield in the JSP didn't load the value from the bean. It is a normal textfield. How do I reset in my case? On Thu, 2004-08-26 at 16:07, Yves Sy wrote: I mean your actionform is stored in session scope by default :) Regards, -Yves- -Original Message- From: Yves Sy [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 4:02 PM To: 'Struts Users Mailing List' Subject: RE: how to reset form This is happening because your session is stored in session scope by default. You should explicitly specify scope=request in your actionmapping. Regards, -Yves- -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 3:33 PM To: Struts Users Mailing List Subject: how to reset form hi A user submits a form and the action class forward it back to the same JSP. The values entered previously is still there. How do I clear it before action returns actionforward? Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActionForm and Transfer Object
Hi People have been telling me that ActionForm should not be dependent on your TO. Simple because actionForm is for presentation and TO for your business requirement. Sounds logical and right way to go. Now that I started developing using struts, it is actually not that simple. Say I retrieve a TO from database and convert it into a actionForm for display. In this case I have 4 fields for my actionForm but 10 in my TO. (6 are not needed for display). A user updates the 4 fields and the action convert those into TO. In this case, the other 6 fields will be reset to null(or empty) in my database! To prevent this, I actually need to use hidden fields in my JSP or some other ugly solutions in my Action class. They are still dependent on each others afterall. Is there a solution to this or I am missing something here? Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: duplication of codes in different Action class
I am already using DispatchAction. I didn't use the scope in my action-mapping. Instead I use session.setAttribute in my Action. The codes to update the actionform is in action1. But I need to update the same form in action2. One way is to duplicate the same codes in both action. Or the common update codes can be executed before a JSP is loaded. The latter will prevent duplicate codes. sebastian On Wed, 2004-08-25 at 14:26, Rick Reumann wrote: Sebastian Ho wrote: Hi Scenario : 1. User submits form in JSP1 which Action1 saves to database. 2. Action1 set Form1 into session. 3. Action1 forwards to JSP1 again, which is suppose to display newly added form with other forms previously added. How do I make JSP1 to get values from database BEFORE JSP1 displays and set them into session? I suppose I have to do this in Action1 but for the first submission of form1, Action1 is not called yet by JSP1. From my analysis, there will be situation where there will be multiple input sources into a particular JSP. That means I need to have my 'update from database and set in session' codes in all the Action classes that forwards to JSP1? In another words, how do I call the update method in Action1 from Action2 before forwarding to the JSP which display my updated data. This is duplication of codes and inefficient to me. There must be a better way to do this in Struts. My question might be confusing..I am trying my best. Tell me if its unclear. It's unclear:) Some of you terminology might just be wrong which is making it more confusing. For example in step 2 above, are you setting the form in session scope yourself? You normally don't need, or want, to manually do this. You delcare the scope of your form in your action mapping. I think what you are wondering about is How do you get your form populate for your JSP so that that user can alter it? (I could be wrong here)... anyway I like to use a DispatchAction which has several methods in it... setUp, Update, etc. So your first call when the user clicks on a link would call the setUp method and there you would make sure your form is populated with the data it needs and you forward to your JSP. As a side note, you do not need to be using Session scope for this. Do you have a particular reason why you need to be using Session scope for your form (many times you do, but I'm guessing in this case you don't and you are using the Session because you are not understanding the flow of how Struts operates). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm and Transfer Object
I don't really like the first solution. Second solution sounds promising but there's an extra call. But thats still better than the first solution or using hidden fields in JSP. I thought of putting the TO in session as well to prevent another DB call. But that will make everything very confusing and complex on the web tier.. Still looking for an ideal solution. This problem is quite common I think, someone here must have a best practices for this so I am waiting for one.. Thanks Rick. Sebastian Ho On Wed, 2004-08-25 at 14:39, Rick Reumann wrote: Sebastian Ho wrote: Say I retrieve a TO from database and convert it into a actionForm for display. In this case I have 4 fields for my actionForm but 10 in my TO. (6 are not needed for display). A user updates the 4 fields and the action convert those into TO. In this case, the other 6 fields will be reset to null(or empty) in my database! To prevent this, I actually need to use hidden fields in my JSP or some other ugly solutions in my Action class. They are still dependent on each others afterall. You can handle this several ways... For example, one solution is you create a TransferObject that refers to only the fields you care about - in this case the 4 fields you mentioned. So your call to the business layer would return that TransferObject and you could then convert that easily to your form (using BeanUtils). Then going back the other way your business layer would take as an arguemnt the same type of TransferObject. I actually don't prefer the above, though, because say later on you decide you want to add another field to your form now your backend has to worry about handling a new object with different fields. I think the best solution is to simply make another call to get back the initial TO from the db, then simply use BeanUtils to populate that TO with the form fields. It will only set the fields in which it has the same names for so your other data will be fine. So it looks like... TransferObject to = BackendEnd.getMyTransferObject(..); MyForm myForm = (MyForm)form; BeanUtils.copyProperties( to, myForm); BackEnd.doUpdate( to ); Pretty simple I think. Just make sure your ActionForm doesn't contain properties that you don't care about editing otherwise it will over-write the TO properties. If the JSP form is going to be very dyanmic, as in it will sometimes have some properties and sometimes have others, then you will have to use more complex 'tricks' such as using hidden variables.. or I'd just prefer to manually set the TO fields in the Action. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: duplication of codes in different Action class
On Wed, 2004-08-25 at 15:03, Rick Reumann wrote: Sebastian Ho wrote: I am already using DispatchAction. I didn't use the scope in my action-mapping. Instead I use session.setAttribute in my Action. More than likely you don't need to do the above (you can give your form Session scope right on the mapping for the Action in your config). The codes to update the actionform is in action1. But I need to update the same form in action2. If you are using a DispatchAction why would you be updating the form in a totally different Action? You normally keep related action tasks together in one DispatchAction. Maybe I need to refactor my codes. I grouped them into two action classes but in that particular JSP, methods from both action classes are used.. One way is to duplicate the same codes in both action. Or the common update codes can be executed before a JSP is loaded. The latter will prevent duplicate codes. Sorry, it might be a language barrier, but you have me really lost now:) I'm not sure what you are trying to in the above. Not to worry. Maybe my situation is kinda complex to explain clearly. I should be able to resolve the problem after I refactor the codes. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: updating values in a collection of beans through JSP
Hi Richard From what you describe below, we need to put it into the scope again after action class receives the actionform? I always thought if I pass a actionform to the JSP and it sets the actionform after user clicks submit, the values will be updated in the scope. Weird, my application should break in that case..I must be doing something wrong but somehow it still works.. Sebastian Ho On Wed, 2004-08-25 at 14:54, Richard Yee wrote: Muhammad, The JSP is evaluated on the server and then sent to the browser. When you change a value on the web page, you submit the form to an Action class which then takes the form properties and should update your collection and then persist it or put it in request or session scope. You can then forward to another JSP to re-display the updated collection. -Richard At 11:44 PM 8/24/2004, you wrote: Hello, I have a collection of a perticular type of bean. I am displaying the values of fields in each bean (bean values are of type strings, boolean etc.) inside a logic:iterate. The problem is when I change any value in the webpage, the bean in the collection does not get updated. Can anyone guide me how to accomplish this? Thanks for your time and effort Regards, Muhammad Momin Rashid. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.2 - ActionForm.validate(...)
I read it somewhere the best thing to do now is to use actionerror for pure error and use actionmessage for all the other purpose while we wait for next struts release. sebastian ho On Wed, 2004-08-25 at 16:10, Shinobu Kawai wrote: Hi Lic, In Struts 1.2, the ActionForm.validate return ActionErrors. However, ActionErrors will be deprecated after 1.2. If I want to valid the data in ActionForm, what I can do? Where does it say that ActionErrors will be deprecated? I know that ActionError will be deprecated... Best regards, -- Shinobu Kawai -- Shinobu Kawai [EMAIL PROTECTED], [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
strange request scope behaviour
hi I am having this strange behavior that I don't understand. I keep having 'experiments' in my request scope when I don't think I put that in. I only paste the important codes here because they are too big. --- In my action class : --- if(request.getAttribute(experiments) == null) { System.out.println(experiments is null); } return mapping.findForward(success); --- Above prints out 'experiments is null' so it is not in the scope struts-config --- action path=/CreateExperiment forward=/CreateExperiment.jsp/ action name=projectForm path=/NewProject input=CreateProject.jsp scope=request type=sg.edu.astar.flamingo.web.proteomics.action.NewProjectAction parameter=action attribute=project forward name=success path=/CreateExperiment.do redirect=true/ /action In CreateExperiment.jsp logic:present name=experiments scope=request bean:message key=error.project.title/ /logic:present logic:present name=experiments scope=session bean:message key=error.project.id/ /logic:present The JSP prints out error.project.title! when there should not be in the request scope.. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: strange request scope behaviour
I searched high and low for 'experiments' but can't find it anywhere. I am changing from request to session. Can't afford to spent too much time on it..my dateline is coming. Thanks Jim Sebastian Ho On Thu, 2004-08-26 at 00:09, Jim Barrows wrote: -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 25, 2004 5:43 AM To: Struts Users Mailing List Subject: strange request scope behaviour hi I am having this strange behavior that I don't understand. I keep having 'experiments' in my request scope when I don't think I put that in. I don't see it here, but here are the things to look for: 1) Somewhere in the action/form/jsp request.setAttribute(expirements, blah); 2) Forward forward name=blah path=/yourPath?experiments=/ 3) A link that sets experiments. It would shock me to find out that the word experiments is anywhere in the struts release code, however you could try searching the entire struts code base for it. I only paste the important codes here because they are too big. --- In my action class : --- if(request.getAttribute(experiments) == null) { System.out.println(experiments is null); } return mapping.findForward(success); --- Above prints out 'experiments is null' so it is not in the scope struts-config --- action path=/CreateExperiment forward=/CreateExperiment.jsp/ action name=projectForm path=/NewProject input=CreateProject.jsp scope=request type=sg.edu.astar.flamingo.web.proteomics.action.NewProjectAction parameter=action attribute=project forward name=success path=/CreateExperiment.do redirect=true/ /action In CreateExperiment.jsp logic:present name=experiments scope=request bean:message key=error.project.title/ /logic:present logic:present name=experiments scope=session bean:message key=error.project.id/ /logic:present The JSP prints out error.project.title! when there should not be in the request scope.. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
override actionerrors header
Hi How do I override the actionerrors headers already defined in my properties file (which is a validation message)? I am using actionerrors in my exceptionhandler and the 'validation' message is inappropriate in this case. Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Exception handler question
Hi If I plan to use global exception in struts, how do I actually throw the exception in my codes in order for the struts exception to kick in? I am little confused here how it works because if I do not catch my exceptions, it won't even compile. I am refering to non-runtime exception here. Sebastian Ho On Tue, 2004-08-10 at 10:59, Kishore Senji wrote: On Mon, 9 Aug 2004 22:06:51 -0300 (ART), Leandro Melo [EMAIL PROTECTED] wrote: Hi, i'm now starting to deal with exception in my application. So far, i haven't used Struts exception handling alternatives, so, i'm very new at that. After some reading i have a few questions (please mark True of False on my sentences , naturally comments are welcome!). * It seems to me that Struts has a very nice way to deal with Exceptions, and i actually should use that. True ! * Is it nice to have locals exceptions handlers for my Action, or i should just have a few (or one) global Exception Handler? True (If required) Having LocalException Handlers will give the functionality of handling a particular exception differently, if required. * When do i need to override ExceptionHandler? I couldn't figure it out a situation where it's needed (maybe if i want to do some special logs for every exceptions??? ). One scenario might be to handle NestedException, You might override execute(Exception ex, ExceptionConfig config, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) method of ExceptionHandler to show error messages for all the exceptiosn. * Here's an advice from jakarta: A common use of ExceptionHandlers is to configure one for java.lang.Exception so it's called for any exception and log the exception to some data store.. Is it really a nice strategy??? Well Sure, first a local ExceptionHandler is invoked if found, otherwise, the global ExceptionHandlers are searched, if not, the Exception's superclass are searched in a similar fashion. So, declaring a handler for java.lang.Exception, will always be there for you as a default handler for any type of Exception, if you haven't defined a specific handler for that particular exception. Well, i think this is it! I'd appreciate some comments. = _ Leandro Terra C. Melo Eng. de Controle e Automao - UFMG __ 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] Thanks, Kishore Senji. - 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]
Re: Exception handler question
Oh..should hit myself for not seeing this. I just throws the exception in my execute(). I was confused because I forgotten execute is called by struts and not by me. Thats y i was wondering don't I have to catch it somewhere else in order for my codes to compile. Thanks Craig Sebastian Ho On Tue, 2004-08-24 at 10:04, Craig McClanahan wrote: On 24 Aug 2004 09:56:14 +0800, Sebastian Ho [EMAIL PROTECTED] wrote: Hi If I plan to use global exception in struts, how do I actually throw the exception in my codes in order for the struts exception to kick in? I am little confused here how it works because if I do not catch my exceptions, it won't even compile. I am refering to non-runtime exception here. Sebastian Ho Which method are you using in your Action classes? If it is the perform() method from Struts 1.0, there is no throws clause there, so you will definite get compile errors if you try to throw one. Change over to the execute() method (and be sure you're using Struts 1.1, of course), and you will be able to throw any exception that you like. Craig On Tue, 2004-08-10 at 10:59, Kishore Senji wrote: On Mon, 9 Aug 2004 22:06:51 -0300 (ART), Leandro Melo [EMAIL PROTECTED] wrote: Hi, i'm now starting to deal with exception in my application. So far, i haven't used Struts exception handling alternatives, so, i'm very new at that. After some reading i have a few questions (please mark True of False on my sentences , naturally comments are welcome!). * It seems to me that Struts has a very nice way to deal with Exceptions, and i actually should use that. True ! * Is it nice to have locals exceptions handlers for my Action, or i should just have a few (or one) global Exception Handler? True (If required) Having LocalException Handlers will give the functionality of handling a particular exception differently, if required. * When do i need to override ExceptionHandler? I couldn't figure it out a situation where it's needed (maybe if i want to do some special logs for every exceptions??? ). One scenario might be to handle NestedException, You might override execute(Exception ex, ExceptionConfig config, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) method of ExceptionHandler to show error messages for all the exceptiosn. * Here's an advice from jakarta: A common use of ExceptionHandlers is to configure one for java.lang.Exception so it's called for any exception and log the exception to some data store.. Is it really a nice strategy??? Well Sure, first a local ExceptionHandler is invoked if found, otherwise, the global ExceptionHandlers are searched, if not, the Exception's superclass are searched in a similar fashion. So, declaring a handler for java.lang.Exception, will always be there for you as a default handler for any type of Exception, if you haven't defined a specific handler for that particular exception. Well, i think this is it! I'd appreciate some comments. = _ Leandro Terra C. Melo Eng. de Controle e Automao - UFMG __ 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] Thanks, Kishore Senji. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
different inputs in struts-config
hi I used the same actionform for a few JSP pages, which I guess is good practice. The problem occurs when I add in validation in my ActionForm. Because in the struts-config, only one input is specified for every Action. Therefore, whenever validation fails and struts display the error messages, struts prints it in the JSP given in input. Ideally, struts should forward and prints out the error messages in the JSP that calls the ActionForm. I tried adding in multiple action mapping in my struts-config with identical settings except input, which I hope struts will be smart enough to decide which mapping to use. Unfortuntely, it doesn't. I have read online that this strategy is quite popular. Therefore I am sure there is a solution to this problem. How do I forward the ActionError to the correct JSP instead of the one in input? Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: different inputs in struts-config
Thanks Susan. Refer to my comments below Sebastian Ho On Thu, 2004-08-19 at 21:23, Susan Bradeen wrote: Sebastian Ho [EMAIL PROTECTED] wrote on 08/19/2004 05:19:35 AM: hi I used the same actionform for a few JSP pages, which I guess is good practice. The problem occurs when I add in validation in my ActionForm. Because in the struts-config, only one input is specified for every Action. Therefore, whenever validation fails and struts display the error messages, struts prints it in the JSP given in input. Ideally, struts should forward and prints out the error messages in the JSP that calls the ActionForm. I tried adding in multiple action mapping in my struts-config with identical settings except input, which I hope struts will be smart enough to decide which mapping to use. Unfortuntely, it doesn't. Yes, you can reuse your actionform for multiple action mappings, but are your action mappings really identical except for the input? If I understand what you are trying to do, it sounds like you should have: Action1 specifies ActionForm1 and input JSP1 and forwards to JSP1. JSP1 probably then submits to Action2. Action2 specifies ActionForm1 and input JSP2 and forwards to JSP2. JSP2 probably then submits to Action3. Action3 specifies ActionForm1 and input JSP3 and forwards to JSP3. All of them ues the same action Action because I am using LookupDispatchAction. So the struts-config ideally should be (which doesn't work) : Action1 specifies ActionFrom1 and input JSP1. Action1 specifies ActionForm1 and input JSP2. Action1 specifies ActionForm1 and input JSP3. How do I achieve this effect? Is that about right? In this case, Validator should work fine. Hth, Susan Bradeen I have read online that this strategy is quite popular. Therefore I am sure there is a solution to this problem. How do I forward the ActionError to the correct JSP instead of the one in input? Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Scanned for SoftLanding Systems, Inc. by IBM Email Security Management Services powered by MessageLabs. _ _ Scanned for SoftLanding Systems, Inc. by IBM Email Security Management Services powered by MessageLabs. _ - 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]
Re: how not to use actionform and pass things around
Guess you are right in a way. But I don't know how to solve this scenario using struts.. Say I have three JSP (JSP1, JSP2 and JSP3). JSP1 populates my actionform (AF1) and in my Action, I set it into my request (not using a session) so that it is available to JSP2. In JSP2, I have yet another ActionForm to populate. Here I just want to pass AF1, which is available in the current page (JSP2) to the next JSP3. Therefore I will have two actionforms in JSP2, the new actionform and AF1 in a single form. Now, how do I pass both actionforms to the Action class of JSP2? I might be asking something stupid here, but this is what I want to achieve and I have no idea how to do it. I am new to struts. sebastian On Thu, 2004-08-19 at 09:59, Koon Yue Lam wrote: Hi ! I don't see a good reason that you are not going to use action form. Since Action form is just a Java bean, which is pretty much the same as the Object that you want to pass around and about this: use an ActionForm I have to write the entities of my ActionForm into the JSP for it to be picked up If you use plain Object to pass around JSP, u still need to declare those object in order to use it (bean: XX /). Which means u still need a Java bean in order to use it in JSP, and that's why Acton form is here to help u! lastly, can u sure that your site will only has 2 page in the future? and won't do some validation? hopes this help Regards - 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]
Disable validate in actionForm
hi I have an validate method in my actionform and everything works fine. I added a 'Back' button in my webpage, and therefore validation is not necessary if the 'Back' button is clicked. Validation should occurs only if 'Next' is selected. How do I stop struts from calling validate() is 'Back' is selected? Note : Both buttons are in the same form. Thanks Sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Disable validate in actionForm
Hi I think my situtation is kinda unique.. I have three buttons in a single form and my Action extends LookupDispatchAction. In my ExperimentForm (actionform), how do I disable validate if 'back' is clicked? struts-config.xml -- action name=experimentForm path=/NewExperiment input=CreateExperiment.jsp parameter=action scope=request type=sg.edu.astar.flamingo.web.proteomics.view.NewExperimentAction forward name=addexperiment path=/CreateExperiment.do/ forward name=next path=/CreateProjectSummary.do/ forward name=back path=/CreateProject.do/ /action CreateExperiment.jsp - html:submit property=action value=Back bean:message key=button.back/ /html:submit /html:submit html:submit property=action value=Create Experiment bean:message key=button.createexperiment/ /html:submit html:submit property=action value=Next bean:message key=button.next/ /html:submit applicationresources.properties button.createexperiment=Create Experiment button.next=Next button.back=Back NewExperimentAction.java --- public class NewExperimentAction extends LookupDispatchAction { /** * This is the main action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @return * @throws java.io.IOException * @throws javax.servlet.ServletException */ // public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException //{ // return mapping.findForward(success); // } protected Map getKeyMethodMap() { Map map = new HashMap(); map.put(button.createexperiment, createExperiment); map.put(button.next, next); map.put(button.back, back); return map; } public ActionForward next(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println(next()); return mapping.findForward(next); } public ActionForward back(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println(back()); return mapping.findForward(back); } public ActionForward createExperiment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ExperimentForm experiment = (ExperimentForm) form; HttpSession session = request.getSession(); Vector experiments = (Vector) session.getAttribute(experiments); experiments.add(experiment); return mapping.findForward(addexperiment); } } On Tue, 2004-08-17 at 15:47, Kataria, Satish wrote: Map it to a different actionMapping and set validate=fasle; ie the submit and back button should have a different actionmapping Satish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 17, 2004 1:14 PM To: Struts Users Mailing List Subject: Disable validate in actionForm hi I have an validate method in my actionform and everything works fine. I added a 'Back' button in my webpage, and therefore validation is not necessary if the 'Back' button is clicked. Validation should occurs only if 'Next' is selected. How do I stop struts from calling validate() is 'Back' is selected? Note : Both buttons are in the same form. Thanks Sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Disable validate in actionForm
Tried javascript and it works fine. The reasons I try not to use javascript : 1. since struts is used, i thought all control should be visible in the controller and not as javascripts in the JSP. 2. User might turn off javascript. sebastian ho On Tue, 2004-08-17 at 15:57, Aru wrote: Sebestian, Where does control go when u click Back button? If this has to do 'browser like' back action, just call javascript. Why do u call struts action? Any specific reason? -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 17, 2004 3:44 PM To: Struts Users Mailing List Subject: Disable validate in actionForm hi I have an validate method in my actionform and everything works fine. I added a 'Back' button in my webpage, and therefore validation is not necessary if the 'Back' button is clicked. Validation should occurs only if 'Next' is selected. How do I stop struts from calling validate() is 'Back' is selected? Note : Both buttons are in the same form. Thanks Sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Disable validate in actionForm
Thanks Richard I fixed the Back problem using javascript (using javascript history.back()). Although it is resolved, I am still very much interested in the struts solution without using javascript. sebastian On Tue, 2004-08-17 at 18:46, Richard Aukland wrote: Sebastien, I use this technique, it works but i dont know if it is 'good practice' 1. Change your 'back' button from a submit to a cancel button (thereby avoiding validation) 2. Set the action of the button to 'previous' using javascript . 3. pick up the 'previous' in a DispatchAction class and forward to appropriate place. Note that if you use LookUpDispatchAction i think you may be able to avoid the javascript. regards Richard Richard Aukland 49 Ravensmere, Beccles, Suffolk, UK. NR34 9BE Tel/Fax. +44(0)1502 470162 Cell.+44(0)7906 094578 mailto: [EMAIL PROTECTED] http://www.aukinfo.com - 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]
RE: Disable validate in actionForm
I suppose this is how I do it? html:submit property=action value=Create Experiment bean:message key=button.createexperiment/ html:hidden property=selection value=createexperiment / /html:submit And in my ActionForm : if(getSelection().equals(createexperiment)) { //validate } But getSelection returns me a null and I don't know why.. Sebastian On Tue, 2004-08-17 at 20:44, Pavel Kolesnikov wrote: On Tue, 17 Aug 2004, Sebastian Ho wrote: I fixed the Back problem using javascript (using javascript history.back()). Although it is resolved, I am still very much interested in the struts solution without using javascript. what about checking for the back property in your validate method (as i wrote few mails ago)? according to your description of CreateExperiment.jsp just change the proposed code to: 8 snip - public ActionErrors validate ( ... ) { if (! back.equals (getAction ()) ) { super.validate ( ... ); // another validations if needed } } 8 snip - i still suppose you have defined property action in your form bean. pavel - 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]
Re: [OT] Editor for Struts/J2ee apps
Try Jdeveloper. Great support for Struts. sebastian On Thu, 2004-07-15 at 13:10, Navjot Singh wrote: hi, I am starting a j2ee app(servlets,jsp.taglibs,ejb,jms,jaxp) with struts as web framework and i need to decide on the IDE that i should use. May i have your inputs on pros/cons on IDEs that you are using. Any specific inputs on IDEA/MyEclipse are most welcome. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Recommend Struts Plugins for Eclipse?
I tried JDeveloper 10g last week. It has visual view of your struts flow, JSP editing, struts-config editing, etc. Works great! sebastian BII On Sun, 2004-06-27 at 22:22, Bryce Fischer wrote: Struts Studio. The best... Struts Studio is ok. My only issue is that about a year ago, I bought it. Since then, they've had 2 paid updates. That's a lot of dough. I haven't bothered to update to 6.x yet, as I cannot see any benefits. I'm currently looking at NitroX from M7. Has some nice features that Struts Studio doesn't have, such as a visual editor for JSP, code completion and validation of form bean properties on the JSP page, etc... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
generators for struts
hi i am starting a new project which involves struts and i am completely new to it. The IDE i am familar with is Netbeans. What tool does fellow developers used for struts? I downloaded struts console but looks like it allow me to edit/manage struts configuration file in netbeans only. Is there any xdoclet like tool that make code generation easiler? If possible please provide plugin/tool for netbeans instead of eclipse. I can't find a plugin for running jboss in netbeans too. Any references? Thanks Sebastian Ho - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]