RE: Question on the ActionForm design for dynamic data?
Title: Question on the ActionForm design for dynamic data? I have been struggling with this problem for a while. I used the way Jeff recommended and made the application working, however, because I am not using the struts taglib displaying the collection data, there is no sense to put that collection in the form. So I do validation and populating the session data in the action. I don't like that. I am pretty much sure there should be a way to use nested form in struts. So that I can use something like following to display the contributors: "/> I tried couple of ways. No one works so far. One of the approaches I tried is to have the a PlanForm and a ContributorForm. And one of the properties/fields in PlanForm is ContributorForm[]. I think it is a way to do it. But I don't know how. Can someone point me to some solution. I really appreciate. Joyce -Original Message-From: Joyce Tang [mailto:[EMAIL PROTECTED]]Sent: Wednesday, May 23, 2001 12:05 AMTo: [EMAIL PROTECTED]Subject: RE: Question on the ActionForm design for dynamic data? Why should not the reset() be used? Isn't it called automatically, anyways? Such as when the validation of the form fails? -Original Message-From: Jeff Trent [mailto:[EMAIL PROTECTED]]Sent: Sunday, May 20, 2001 6:12 AMTo: [EMAIL PROTECTED]Subject: Re: Question on the ActionForm design for dynamic data? (1) Have a Vector / Collection of contributors (ie. getContributors()) belonging to your form. Inside that function, check to see if you need more rows by using code similar to the following: public Vector getCustomerContacts() { CustomerContact lastCustomerContact = (CustomerContact)this.customerContacts.lastElement(); if (!lastCustomerContact.isEmpty()) // is this slot being used? this.customerContacts.addElement(new CustomerContact()); // always have one available slot at the end of the matrix return this.customerContacts; } (2) Do not use the reset() method. (3) On your JSP, use code like this: <% int i = 0; %> <% i++; %> (4) Have a button on the form "Add more rows" in which case the form posts to itself and will cause a new row to be added at the bottom of the grid. Hope this help, Jeff - Original Message - From: Joyce Tang To: [EMAIL PROTECTED] Sent: Saturday, May 19, 2001 11:28 PM Subject: Question on the ActionForm design for dynamic data? Here is the situation. I am developing a system to maintain a contribution plan. I need to input the plan information first and add unlimited number of contributors, specifying each share of the plan. So there will be a page with contribution plan information and a list of all the contributors. The information you can edit on this page is the percentage of share of each contributor. Validation rules are: share need to add up to 100 and share figure is an integer between 0 and 100. Since the number of contributors is unknown in advance, how should I design the ActionForm? Thanks a lot, Joyce
Radio Buttons With Generated Values
HI! I am pretty new to struts and I'm working my way through the different types of controls (select, multiboxes, etc). I am having rouble generating a list of radio buttons. I have a Map (actual a Properties object but its returned as a Map) which contains two entries: "DEBIT", "Debit my credit card" "INVOICE", "Send me an invoice". The Map object is available in my JSP page as the bean paymentTypeData: It is also accessable via another bean paymentData using the getter method getPaymentType(): I am trying to generate the following HTML: Debit my credit card Send me an invoice The closest I can get is (some spacing removed) INVOICE Debit my credit card DEBIT Send me an invoice by using the following JSP: I've had to put the 'value="fred"' in there, as value is required. Removing it gives "required attribute `value' missing from `html:radio' " Any suggestions about how I set dynamic values for "value"? Fiona _ Fiona Thorne Trading Post Australia Pty Limited phone 02 9954 8200 L5, 100 Mount St, North Sydney fax 02 9954 8250 NSW Australia 2065 Australia +61 http://www.tradingpost.com.au[EMAIL PROTECTED] _ When life hands you scraps, make quilts. _
RE: Access to form data.
Title: RE: Access to form data. Martin, I have a similar problem too. May I ask two general questions? 1.When should I use the formBean attribute on the tag? 2. What is the relationship among ActionForm, actionformbean and actionformbeans. I tried to find the answer myself, but couldn't. Thanks a lot, and sorry for the dummy questions. Joyce -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 26, 2001 6:49 PM To: [EMAIL PROTECTED] Subject: e: Access to form data. When you use the formBean attribute on the tag, you are defining a bean which corresponds to the ActionFormBean instance for your form bean definition (i.e. the entry) in struts-config.xml. You are not defining a bean corresponding to your ActionForm bean itself. If your form bean exists in some scope already (i.e. either Struts put it there when processing a request or you put it there when processing an action), then all you need is: where "yourFormBeanName" is the name of the attribute used to store the bean. If Struts created the form bean for you, the attribute name is the name you specified in the entry in your struts-config.xml file. Hope this helps. -- Martin Cooper - Original Message - From: "Christophe Saudubois" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 23, 2001 6:56 AM Subject: Access to form data. > Hello, > > I am in a jsp preceded by an action and I want to display the form of > the action but not within form html tags. > > For instance : > My Form : > > public class SearchForm extends ActionForm { > public SearchForm() {} > private String mKeyword = ""; > public String getKeyword() { return mKeyword;} > public void setKeyword(String pKeyword) { mKeyword = pKeyword;} > } > > My Jsp : > > <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> > > You searched : > > I've got this exception : > javax.servlet.jsp.JspException: No getter method for property keyword of > bean form > at javax.servlet.jsp.JspException.(JspException.java:73) > at > org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:132) > at > root.store._0002froot_0002fstore_0002findexsearch_0002ejspindexsearch_jsp_0. _jspService(_0002froot_0002fstore_0002findexsearch_0002ejspindexsearch_jsp_0 .java:371) > at > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > ... > > The object form is really a SearchForm (getType method of the form that > is working). > thanks, > Christophe Sauldubois.
unsubcribe
Please unsubscribe me ([EMAIL PROTECTED]) from the list
Re: About Japanized web page of Struts
As long as all the copyright notices are kept in place, and you are contributing this work to the Apache Software Foundation, then this would be fine Toshi. We appreciate your help! -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/struts/ > Hello, Dear everyone. > > I'm Toshi Tabata who is a system engineer of > Japanese company called Sun Japan. > Nice to see you. > > I would like to have a permission from you > about publishing Japanized web page of Struts. > > Since this April, I have started translating your web page, > Struts project to Japanese. > It's finished excepting some pages. > (e.g. Tag library Guide, Old document...) > > Using that translation, I would like to introduce Struts > for Japanese how its use has great effort for > making applications. > > I'm planning that I would like to leave the un-translated > part as in English, which keep links to original. > > If you will accept this proposal, I will publish Japanized > Struts web page as soon as possible, and announce to you where > I published. > > If there is any trouble about this plan, or any questions, > Please let me know. > > I'm looking forward hearing from you. > > Thank you. > > Best Regards, > > Toshi Tabata > > -- > > > Toshi Tabata ([EMAIL PROTECTED]) > >
SV: SV: Production uses of Jakarta STRUTS 1.0
Thank for the info... Luckily our system wont have that many visitors B2B extranet...but I will be pretty hyped up in our customers local community and country... Mikkel -Oprindelig meddelelse- Fra: Ted Husted [mailto:[EMAIL PROTECTED]] Sendt: 28 May 2001 18:43 Til: [EMAIL PROTECTED] Emne: Re: SV: Production uses of Jakarta STRUTS 1.0 Resin standalone performed very well for us. We had the main site running on Red Hat. We were also doing live television broadcasts (talk about nervous;-), so I setup a second application server in the studio on W2K. Didn't really need it though. The main site never went above .5 load. (Had cranked it up to 5.0 in testing and retained fair performance). We pulled the images off another Red Hat server running Apache, which made a big difference, since most pages included a heavy image (being an auction site). The DBMS (MySQL) was also running over here. Mikkel Bruun wrote: > > Ted, > > Can you give some info regarding what webserver, app server you are running > this on??? > > Im a little nervous...In two weeks we are going to launch a struts based > website, running on win2k and IIS 5.0, and we haven't had time to load test > thoroughly...
Re: SV: Production uses of Jakarta STRUTS 1.0
Resin standalone performed very well for us. We had the main site running on Red Hat. We were also doing live television broadcasts (talk about nervous;-), so I setup a second application server in the studio on W2K. Didn't really need it though. The main site never went above .5 load. (Had cranked it up to 5.0 in testing and retained fair performance). We pulled the images off another Red Hat server running Apache, which made a big difference, since most pages included a heavy image (being an auction site). The DBMS (MySQL) was also running over here. Mikkel Bruun wrote: > > Ted, > > Can you give some info regarding what webserver, app server you are running > this on??? > > Im a little nervous...In two weeks we are going to launch a struts based > website, running on win2k and IIS 5.0, and we haven't had time to load test > thoroughly...
unsubcribe
Please unsubscribe me([EMAIL PROTECTED]) from this list. T,Peri _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: Stuck Newbie
> When the action forwards to a JSP the collection that > was obtained and set on the form seems to have been lost. If you are forwarding the set as part of the ActionForm, Struts may have recycled it and called reset(). You might need to do something like, request.setAttribute("searchResult",searchForm); before returning, and then check for searchResult in your JSP. Jim Downing wrote: > > Hi, > I'm trying to write a little struts app that simply lists all the records in > a database table by calling a findAll method on an Entity EJB. I'm pretty > sure I'm getting something wrong in my Action mapping - the Action performs > the findAll successfully, and sets a collection of remote interfaces on the > relevant action form. When the action forwards to a JSP the collection that > was obtained and set on the form seems to have been lost. > > If I map the success value of PersonSearchAction to /personSearch.do, it > goes into a loop and I end up with a stack overflow. > > Any help would be gratefully received - I've been going round in circles. > Why isn't the PersonSearchForm carrying the findAll results passed to the > JSP? > > TIA, > jim > > Relevant bit of struts-config.xml: - > === > > type="com.paribus.hemlatta.clients.people.PersonSearchForm"/> > > > > type="com.paribus.hemlatta.clients.people.PersonSearchAction" > name="personSearchForm" > scope="session" > input="/findPeople.jsp" > unknown="false" > validate="false" > > > > > > findPeople.jsp : - > > <%@ page language="java" %> > <%@ taglib uri="/WEB-INF/app.tld" prefix="app" %> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> > > > > class="com.paribus.hemlatta.clients.people.PersonSearchForm"/> > > > > > > > > property="searchStr"/> >key="personSearch.label.submit"/> > > Got <%= bean.getResults().size() %> people from this search > > > > > > > > > > > PersonSearchAction : - > > /* All the imports required... */ > public final class PersonSearchAction extends Action > { > public ActionForward perform( ActionMapping mapping, > ActionForm form, > HttpServletRequest req, > HttpServletResponse res) >throws IOException, ServletException > { > Locale locale = getLocale(req); > MessageResources messages = getResources(); > HttpSession session = req.getSession(); > String action = req.getParameter("action"); > > if(action == null) > action = "init"; > if(servlet.getDebug() >= 1) > servlet.log("PersonSearchAction: "+ action); > > if("init".equals(action)) > { >... > } > else if ("exec".equals(action)) > { > if(servlet.getDebug() >= 1) > servlet.log("Got exec successfully"); > if(form==null) > { > servlet.log("PersonSearchAction: ERROR! action \"exec\" cannot > operate on " >+" a null form"); > return mapping.findForward("error"); > } > else > { > PersonSearchForm searchForm = (PersonSearchForm) form; > // Blank search string implies "find all" > servlet.log("searchForm.getSearchStr().length(): "+ > String.valueOf(searchForm.getSearchStr().length()) ); > if(searchForm.getSearchStr() == null || > searchForm.getSearchStr().length() < 1) > { > try > { > Context ic = new InitialContext(); > Object objref = ic.lookup("PersonEJB"); > PersonHome home = > (PersonHome) PortableRemoteObject.narrow(objref, > PersonHome.class); > Collection all = home.findAll(); > if(servlet.getDebug() >= 1) > servlet.log("Found "+ all.size() +" people"); > searchForm.setResults(all); > } > catch(NamingException e) > { > e.printStackTrace(); > } > catch(FinderException e) > { > e.printStackTrace(); > } > } > return mapping.findForward("success"); > } > } > > return mapping.findForward("success"); > } > } -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/struts/
RE: enctype. and RE: struts-upload.war
Hi, in another post Soeren mentioned that Resin set's a default tmp_dir value for every application of WEB-INF/tmp. I created the directory and the original error has been replaced with another: [2001/05/28 11:51:19] argument type mismatch java.lang.IllegalArgumentException: argument type mismatch at java.lang.reflect.Method.invoke(Native Method) at org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:825) at org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:756) at org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:782) at org.apache.struts.util.BeanUtils.populate(BeanUtils.java:541) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:484) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:1910) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:83) at com.caucho.server.http.Invocation.service(Invocation.java:291) at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:121) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:238) at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:157) at com.caucho.server.TcpConnection.run(TcpConnection.java:140) at java.lang.Thread.run(Thread.java:479) thanks, Andy. At 06:47 PM 5/25/01, you wrote: >Andy and Ken, > >I've never seen this problem before, but I'll try to get it fixed asap. > >-Original Message- >From: Andy Wicks [mailto:[EMAIL PROTECTED]] >Sent: Thursday, May 24, 2001 1:47 PM >To: [EMAIL PROTECTED] >Subject: enctype. > > >Hi, > >I'm using jakarta-struts-1.0-b1 with a Resin 1.2.5 container running on >hpux11. When I post a form with a form struts tag including > >method="POST" enctype="multipart/form-data" > > >The servlet throws an exception like this: java.io.IOException: No such >file or directory at java.io.UnixFileSystem.createFileExclusively(Native >Method) at java.io.File.checkAndCreate(File.java:1161) at >java.io.File.createTempFile(File.java:1246) at >org.apache.struts.upload.MultipartIterator.createLocalFile(MultipartIterator >.java:465) >at >org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator. >java:201) >at >org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMulti >partRequestHandler.java:70) >at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:447) at >org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:19 >10) >at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521) >at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) > >Struts seems to be parsing the input and failing to create a temporary >file. The system temporary area is /var/tmp which is world writable. > >I've seen a lot of similar posts on this topic, they seemed more >compicated. I'm hoping this is simply a configuration problem. If anyone >has any ideas they would be appreciated. thanks, > >Andy.
Resin's XSL tranformations not possible?
I was trying to use Resin's XTP capability (JSP pages initially tranformed with XSL stylesheets) with Struts. I started with converting struts-example web-app's registration.jsp. I simply added the following declarations at the top of the file: and slightly reformatted the file to make it well-formed xml. I also changed file's extension to .xtp (making appropriate changes to struts-config.xml) so the file is mapped to Resin's XtpServlet instead of JspServlet. When I try to browse the file, I get the following exception: /struts-example/registration.xtp:175: expected at com.caucho.jsp.JspParseException: /struts-example/registration.xtp:175: expected at at com.caucho.jsp.JspParser.error(JspParser.java:1063) at com.caucho.jsp.JspParser.parseCloseTag(JspParser.java:929) at com.caucho.jsp.JspParser.parseNode(JspParser.java:324) at com.caucho.jsp.JspParser.parseJsp(JspParser.java:286) at com.caucho.jsp.JspParser.parse(JspParser.java:185) at com.caucho.jsp.JspParser.parse(JspParser.java:159) at com.caucho.jsp.XtpPage.getJspPage(XtpPage.java:532) at com.caucho.jsp.XtpPage.compileJspPage(XtpPage.java:375) at com.caucho.jsp.XtpPage.subservice(XtpPage.java:220) at com.caucho.jsp.Page.service(Page.java:407) at com.caucho.server.http.Invocation.service(Invocation.java:285) at com.caucho.server.http.QRequestDispatcher.forward(QRequestDisp atcher.java:157) at com.caucho.server.http.QRequestDispatcher.forward(QRequestDisp atcher.java:76) at org.apache.struts.action.ActionServlet.processActionForward(Actio nServlet.java:1747) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1 584) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:490 ) at javax.servlet.http.HttpServlet.service(HttpServlet.java:102) at javax.servlet.http.HttpServlet.service(HttpServlet.java:83) at com.caucho.server.http.Invocation.service(Invocation.java:291) at com.caucho.server.http.RunnerRequest.handleRequest(RunnerReq uest.java:333) at com.caucho.server.http.RunnerRequest.handleConnection(RunnerR equest.java:266) at com.caucho.server.TcpConnection.run(TcpConnection.java:140) at java.lang.Thread.run(Thread.java:479) Has anyone used Struts with Resin's XTP? -- úukasz Kowalczyk
additional parameter in web.xml
hello, is it possible to add some additional parameter (param-name, param-value) to the web.xml in order to enriche the org.apache.struts.action.ActionServlet with more custom information? How can it be done? Hartmut Bernecker http://www.dhw.de/
enctype.
Hi, I'm using jakarta-struts-1.0-b1 with a Resin 1.2.5 container running on hpux11. When I post a form with a form struts tag including method="POST" enctype="multipart/form-data" The servlet throws an exception like this: java.io.IOException: No such file or directory at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.checkAndCreate(File.java:1161) at java.io.File.createTempFile(File.java:1246) at org.apache.struts.upload.MultipartIterator.createLocalFile(MultipartIterator.java:465) at org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator.java:201) at org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMultipartRequestHandler.java:70) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:447) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:1910) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) Struts seems to be parsing the input and failing to create a temporary file. The system temporary area is /var/tmp which is world writable. I've seen a lot of similar posts on this topic, they seemed more compicated. I'm hoping this is simply a configuration problem. If anyone has any ideas they would be appreciated. thanks, Andy. --- TMC // +41 22 365 4712 // Mailto:[EMAIL PROTECTED]