Re: Bug in order of error presentment (html:error)
There's no real difference between using one property name of your own choosing, and using the Struts GLOBAL_ERROR property name. It's mostly just a matter of choice. The only point I can think of is that you might want to differentiate between things that are really global and things that are global now but might not be later. -- Martin Cooper - Original Message - From: Jeff Trent [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 9:57 PM Subject: Re: Bug in order of error presentment (html:error) Thanks for the input Martin. This is helpful. Just curious, what is the advantage in using the property name as opposed to GLOBAL_ERROR? - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 12:02 AM Subject: Re: Bug in order of error presentment (html:error) The order of errors for a given property name will be preserved. However, the error lists are stored in a HashMap with the property name as the key, so the iteration order of those is not defined. If you are just using html:errors/ (that is, you are not specifying the property attribute), then you might consider using a common property name, or just ActionErrors.GLOBAL_ERROR. That way, all of your errors will be preserved in the order in which you added them. Alternatively, you could use multiple instances of the html:errors/ tag, one for each property, like this: html:errors property=customerContactName/ html:errors property=customerContactPhone/ html:errors property=customerContactEmail/ Given your example, this isn't very practical for your situation, but it might be useful in cases where multiple errors for each of a small number of properties is typical. -- Martin Cooper - Original Message - From: Jeff Trent [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 1:46 PM Subject: Bug in order of error presentment (html:error) In Form.Validate() { ... if (getCustomerContactName().length() = 1) errors.add(customerContactName, new ActionError(error.customercontactname.required)); if (getCustomerContactPhone().length() = 1) errors.add(customerContactPhone, new ActionError(error.customercontactphone.required)); if (getCustomerContactEmail().length() = 1) errors.add(customerContactEmail, new ActionError(error.customercontactemail.required)); ... } In Properties file: error.customercontactname.required=bContact Name/b is a required fieldbr error.customercontactphone.required=bContact Phone/b is a required fieldbr error.customercontactemail.required=bContact Email/b is a required fieldbr Output from html:errors: Contact Phone is a required field Contact Name is a required field Contact Email is a required field Note the ordering. Name should have preceded Phone.
RE: Newbie Question: Servlet Exception - This is being answered by Dudley - giving something back to the user group for all the help i got - thanx all u guys
You need to make sure the html:form action=/logon tag in you jsp page, is declared in your struts config file ..here is an example of my struts confignotice the action path=/logon tag.You need one of these for every different html:form action= tag in you jsp page. ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; struts-config !-- == Form Bean Definitions === -- form-beans form-bean name=loginForm type=com.didata.itax.payment.web.actionform.LoginActionForm/ form-bean name=eFilerForm type=com.didata.itax.payment.web.actionform.EFilerActionForm/ form-bean name=taxPayerForm type=com.didata.itax.payment.web.actionform.TaxPayerActionForm/ /form-beans !-- == Global Forward Definitions == -- global-forwards forward name=logonForm path=/logon.jsp/ forward name=mainMenu path=/mainMenu.jsp/ forward name=index path=/index.jsp/ forward name=eFilerpath=/EFilerMenu.jsp/ /global-forwards !-- == Action Mapping Definitions == -- action-mappings actionpath=/logon type=com.didata.itax.payment.web.action.LoginAction name=loginForm scope=request input=/logon.jsp forward name=failure path=/index.html/ forward name=success path=/login.jsp/ /action actionpath=/eFilerAdd type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request input=/EFilerInput.jsp forward name=failure path=/EFilerInput.jsp/ forward name=success path=/EFilerDone.jsp/ /action action path=/eFilerEdit type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request forward name=failure path=/EFilerMenu.jsp/ forward name=success path=/EFilerInput.jsp/ /action action path=/eFilerUpdateState type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request forward name=failure path=/EFilerList.jsp/ forward name=success path=/EFilerDoneList.jsp/ /action action path=/eFilerDelete type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request forward name=failure path=/EFilerMenu.jsp/ forward name=success path=/EFilerList.jsp/ /action actionpath=/eFiler type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request input=/EFilerMenu.jsp forward name=failure path=/index.jsp/ forward name=success path=/EFilerList.jsp/ /action /action-mappings /struts-config -Original Message- From: Kevin Newman [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 7:07 AM To: Struts-User (E-mail) Subject: Newbie Question: Servlet Exception Hi All, I've just loaded struts and am having a little problem. I started by placing the *.war files in webapps directory. After copying xalan xerces jar files into the lib directory almost all of the example apps worked. My next step was to setup the struts-blank then modify it to get a feel for how strut works. When I try to add logon to the blank app I get the message below. What does this mean? Do I need to post more info? Platform: Windows 2000 Servlet Engine: Tomcat 4.0 b3 Struts: 1.0-b1 Thanks, Kevin Newman A Servlet Exception Has Occurred Exception Report: javax.servlet.ServletException: Cannot retrieve mapping for specified form action path /logon at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:441) at org.apache.jsp.logon_jsp._jspService(logon_jsp.java:299) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:200) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:357) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:431) Some deleted . Root Cause: javax.servlet.jsp.JspTagException: Cannot retrieve mapping for specified form action path /logon at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:487) at
Re: document.testbean.submit is not a function
Hello John From: [EMAIL PROTECTED] (John Miaso) Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: document.testbean.submit is not a function Date: Wed, 09 May 2001 08:27:24 -0600 I've modified the html-select.jsp example to include the script: SCRIPT function cbChanged() { document.testbean.cbSearch.value = Search document.testbean.submit() } /SCRIPT I'm setting a hidden property so that I can fill a select elements options in the Action peroform method based on the selection made in another select element. When I do this I get the JSP error: document.testbean.submit is not a function. Isn't that a JavaScript error? I got this error when I tried to submit a form using a link. I removed all the regular submitbuttons and then it worked. I get the same result if I try to send reset rather than submit. Is Javascript unaware of the submit button property? Is there a better way to approach this? John Miaso Grtz Bart _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Transactional Tokens in the JSP?
I would like to use the transaction token logic in the Action class. However I am not able to figure out how to place the Transactional Token in the JSP so it can be validated against when isTokenValid() is called within my Action class. I looked at the Struts source code to find: protected boolean isTokenValid(HttpServletRequest request) { // Retrieve the saved transaction token from our session HttpSession session = request.getSession(false); if (session == null) return (false); String saved = (String) session.getAttribute(TRANSACTION_TOKEN_KEY); if (saved == null) return (false); // Retrieve the transaction token included in this request String token = (String) request.getParameter(Constants.TOKEN_KEY); if (token == null) return (false); // Do the values match? return (saved.equals(token)); } The Contants class is org.apache.struts.taglib.html.Constants. Thanks for any help -allen-
RE: UnSubscribe please!!
Title: ConnectionPooling in struts me too thanks! -Original Message-From: zhongqing [mailto:[EMAIL PROTECTED]]Sent: den 10 maj 2001 03:09To: [EMAIL PROTECTED]Subject: Re: UnSubscribe please!! me too - Original Message - From: Natra, Uday To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:28 AM Subject: UnSubscribe please!! UnSubscribeme please!
relative urls
Hi, I've got an app that will be deployed to a number of different contexts /test /dev /staging / (root) The app contains a large amount of static content e.g. images which will always be referenced from /current_context/image some of the jsps are accessed directly and via the action servlet - sometimes with different depths for the action url e.g. /current_context/something/something_else/my_action.do /current_context/something/another_action.do /somepage.jsp this obviously rules out using relative urls for the static content but the changing contexts makes it difficult for basing the urls on root. Is the solution to precede the url to every image in every jsp with a variable containing the value of the context? Is this not a performance hit? What's the best way to do it? Is there a struts tag that does this for me? How do I achieve world peace? - oops wrong mail list. Thanks Nathan
Re: Struts forms and JSP components/templates
A quick check to the latest src (20010508) seem to indicate that now html:form store data in the request context. Cedric Tim Moore wrote: I'm working on a very complex webapp with hundreds of form pages. Frequently there are chunks of a form that are shared across several pages. I was hoping to use the components library to separate these common form chunks into reusable pages, but I'm not having much luck with this. The problem is that the struts html:form tag stores data in the PageContext of the enclosing page, where individual input tags that appear in the the included components are unable to access them. I don't know if there's anything I can do about this from my application's end. Does anyone have any suggestions...hopefully something other than don't do that! ;-) Would it make any sense to change html:form to use the request context rather than the page context? TIA, -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW/ 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863
Re: template flexability
Hi Cal, I don't know the reason why actual template implementation always turn 'true' the direct attribute when the body is used (David ?). Also, the getDirect() method of PutTag doesn't take into account the real value of 'direct', just its presence ! Maybe this behavior need to be changed. Meanwhile, if you want to try your solution, you can use the Components implementation in place of Templates. Components allow to use direct='true' with the tag body. There is also other mechanisms that could interest you. Cedric Components sites : http://www.lifl.fr/~dumoulin/components/ (mirror) : http://www.geocities.com/cedricdumoulin/components/ Holman, Cal wrote: Since using the template tag as follows is always direct=true how can you make the xxx in the template put=xxx variable.The reason for the substitution is to make the heading variable based on language or application- while still using the same template.Does anyone have a technique for changing the source page using the proprieties file?? welcome.jsp template:insert template='/tableTemplate.jsp' template:put name='header' direct='false' bean:message key=heading.page / /template:put template:put name='title' direct='true' bean:message key=welcome.title / /template:put /template:insert Will not work since the body on a template:put is considered direct=true welcome.jsp template:insert template='/tableTemplate.jsp' template:put name='header' content=bean:message key=heading.page / / template:put name='title' direct='true' bean:message key=welcome.title / /template:put /template:insert Will not work because the inclosing bean:message is not expanded. The in the template is the get tableTemplate.jsp td valign=toptemplate:get name='header'//td Cal
RE: Session management with Struts
Hi, I think you want to start looking at the 'tokens' functionality that comes with struts. We did something similar in my last non-struts project and it worked very well. Andy S [EMAIL PROTECTED] on 09/05/2001 22:44:26 Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: Andrew Steady/Swindon01/Domino01/Kinesis) Subject: RE: Session management with Struts But that's exactly my problem. I have forms that may span multiple pages and the ActionForm needs to be available across multiple requests. Any ideas -Original Message- From: Nanduri, Amarnath [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 1:53 PM To: '[EMAIL PROTECTED]' Subject: RE: Session management with Struts Keep the ActionForms in 'request' scope. Then each page will have its own ActionForm. The problme occurs when you want to store these forms in session scope. cheers, Amar.. -Original Message- From: TJM Todd McGregor [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 4:49 PM To: [EMAIL PROTECTED] Subject: Session management with Struts I have a requirement that my application be able to allow multiple browser windows, sharing the same HttpSession, to access two separate instances of a business process simultaneously. For example, if I have a form that allows a user to change their address information my application must allow them to have two address forms open in separate browser windows using the same HttpSession. To make a long story short, can Struts accommodate multiple instances of an ActionForm in the same session? Any general comments on how Struts does session management would also be welcome. Thanks in advance for your response, Todd McGregor The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. PricewaterhouseCoopers Kinesis Ltd
RE: How do you use indexed properties with html:input?
Turgay, Thanks for your help, I've tried something similar to your example, but I'm still having some trouble. I've probably missed something obvious as I'm new to struts JSP. In my jsp I've got the following: %@ page import=com.qspgroup.utc.TestGridForm errorPage=fcerror.jsp % %@ taglib uri=/WEB-INF/utctags/fcutc.tld prefix=fcutc % %@ taglib uri=/WEB-INF/lib/struts/struts-bean.tld prefix=struts_bean % %@ taglib uri=/WEB-INF/lib/struts/struts-html.tld prefix=struts_html % %@ taglib uri=/WEB-INF/lib/struts/struts-logic.tld prefix=struts_logic % jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / tr % int i=0; % struts_logic:iterate id=element name=testGridForm property=data td input type=text name=%= data + i % size=10 value=struts_bean:write name=element/ /td % i++; % /struts_logic:iterate /tr My action class is as follows: public ActionForward perform( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { if ( form == null ) { form = new TestGridForm(); } TestGridForm testGridForm = ( TestGridForm )form; for ( int i = 0; i testGridForm.getData().length; i++ ) { if ( request.getParameter( data + i ) != null ) { testGridForm.setData( i, request.getParameter( data + i ) ); } } return ( mapping.findForward( success )); } As you can see It doesn't do a lot. My ActionForm class creates dummy data and contains and contains get/set methods as shown below: public class TestGridForm extends ActionForm { String[] data = { Rail, Fridges, Hay, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; public String[] getData() { return data; } public String getData( int i ) { return data[i]; } public void setData( String[] data ) { this.data = data; } public void setData( int i, String d ) { data[i] = d; } My data gets displayed OK. On success I go to testgrid.jsp but this keeps displaying the original data. I've checked the tomcat log files and the new data is being sent as request parameter so I don't understand why the new data isn't saved in my bean. e.g. 2001-05-10 09:21:20 -Request Params: 2001-05-10 09:21:20 -data2 = 30 2001-05-10 09:21:20 -data1 = 20 TestGrid.jsp is as follows: %@ page import=com.qspgroup.utc.DataCaptureDemo errorPage=fcerror.jsp % jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / html head titleTest JSP/title /head body h2Test JSP Page/h2 % out.println( brdata in 1st cell is + testGridForm.getData( 0 ) ); out.println( brdata in 2st cell is + testGridForm.getData( 1 ) ); out.println( brdata in 3rd cell is + testGridForm.getData( 2 ) ); % /body /html Sorry to swamp you with info, I can't seem to figure this out, although I'm sure I've missed something obvious here. Thanks. Richard. -Original Message- From: Turgay Zengin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 1:13 PM To: [EMAIL PROTECTED] Subject: Re: How do you use indexed properties with html:input? Hi, I *guess* that the html: tags require a form bean (please correct me if this is wrong) so they won't work with dynamically created page elements like input text fields. I did the following and it works, got the idea from Scott Walter (thanks) - see http://www.mail-archive.com/struts-user@jakarta.apache.org/msg06972.html There may be a better solution to this, if there is, I would like to know. Background: dbconnection is a bean I use to keep the session's database connection, and other objects. wpLaborEntries is a vector holding objects of type WpLabor. In my jsp page I create input text fields like this: FORM METHOD=POST ACTION=UpdateWoplan.do % int i=0; % input type=submit value=Update_Fields table border=1 cellpadding=0 cellspacing=0 align=center logic:iterate name=dbconnection property=wpLaborEntries id=wpl type=com.tz.maximo.woplan.WpLabor tr tdINPUT TYPE=text NAME=%=craft+i% size=5 value=bean:write name=wpl property=craftqty//td tdINPUT TYPE=text NAME=%=lhrs+i% size=5 value=bean:write name=wpl property=laborhrs//td tdINPUT TYPE=text NAME=%=w1+i% size=5 value=bean:write name=wpl property=wpl1//td tdINPUT TYPE=text NAME=%=w2+i% size=5 value=bean:write name=wpl property=wpl2//td /tr % i++; % /logic:iterate /table /FORM So, the key point is, giving a consistent name for each input text field. And, in my action class, I get the values like this: public ActionForward perform(ActionMapping
RE: Posting Collections
Many thanks Niall, that clears things up for me. Do you know if there is a reason why this is the behaviour for checkboxes? Is this just with checkboxes or other tags as well? I don't really like the idea of modifying the struts code - the whole point of deciding to use it is for code reuse - I don't want to start hacking around with the code every time a new version comes out. Do you have an opinion on using Struts? I've been using it for a couple of weeks now and have been struggling because of basic lack of information. I get most of my training from this news group! I'm wondering whether I should just jack it in and use something else. Cheers Tony From: Niall Pemberton [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: Posting Collections Date: Wed, 9 May 2001 20:51:00 +0100 The problem is the CheckBox tag currently sets the HTML name attribute to the property, so your JSP will produced something like this: input type=checkbox name=delete So all the checkbox fields will have the same name. In order for Struts to populate your Retailer bean with the delete values you need the generated HTML to look like this: input type=checkbox name=retailer[0].delete input type=checkbox name=retailer[1].delete etc etc. Struts would then use getRetailer(0).setDelete(boolean) to set the delete attributes correctly. Unfortunately there is no easy solution - many people resort to scriptlets to generate the name properly and there are quite a few messages in the archive about this. I created my own versions of Struts tags and changed them to generate the name correctly - I like that much better - no java in the view. Niall -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: 09 May 2001 17:50 To: [EMAIL PROTECTED] Subject: Posting Collections Briefly, this is what I am trying to achieve: - Retrieve a list of items from a database - Display each item with a corresponding checkbox - Display a Delete button - which when pressed deletes all checked items. Unfortunately, although I have managed to display the items correctly and set the checkbox value using boolean values, when I do the form submit - my ActionForm properties do not get filled in. This is the code I have: My ActionForm looks like this: public class RetailerForm extends ActionForm { protected Vector retailer; /* * On construction, fill the form with all the retailers */ public RetailerForm() throws SQLException { //here i have some code to generate my vector //which is comprised of Retailer beans. } public Retailer getRetailer( int index ) { return (Retailer)retailer.elementAt( index ); } public Vector getRetailer() { return retailer; } public void setRetailer( Vector value ) { retailer = value; } } My Retailer bean has get and set elements for properties called delete and name. My struts code looks like this (obviously within html:form tags): logic:iterate id=retailer name=retailerForm property=retailer tr tdhtml:checkbox name=retailer property=delete//td tdbean:write name=retailer property=name//td /tr /logic:iterate And this all works ok for displaying the data. However, when I do the submit my delete property for each bean is not set and I have added debugging code to the set method and this is not called by struts. I don't get error messages - it just doesn't happen. I know other people have had this problem, but I am struggling to find a solution. Can anyone help me? Is there a better way of achieving what I am trying to achieve? If I am doing the correct thing, what's the reason it's not working. All help appreciated. Cheers Tony _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: Problems with STRUTS 1.0 Tomcat 4.0 - Answer + Session-Serialisation-Question
RTFM ;-) - see below :-) At 22:18 09.05.01 -0400, you wrote: I was wondering if anyone has configured STRUTS 1.0 on TOMCAT 4.0 B3, I seem to be having some errors on startup of the server. The example, blank, test, and upload applications are not deploying correctly. Below is a sample of the error being thrown in my server log file. Any help would be greatly appreciated, I've implimented STRUTS before on a porject I am working on, but I'm kind of new to configuration and setup. Thanks in advance for any help. - Root Cause - java.lang.NoClassDefFoundError: org/xml/sax/SAXException At 13:18 07.05.01 +0200, I wrote: At 21:24 06.05.01 -0500, Larry Rogers [EMAIL PROTECTED] wrote: The log file says that org.xml.sax.HandlerBase was not found, but when I look into crimson.jar in tomcat/server/lib it is indeed in there. This reminds me of the problems folks were having with putting struts.jar in more than one place. Does it matter that crimson.jar is in tomcat/jasper as well as tomcat/server/lib? I moved crimson.jar and jaxp.jar from TOMCAT_HOME/jasper/ to TOMCAT_HOME/lib/ (see also end of RELEASE-NOTES-4.0-B3.txt) and everything works fine for me except the session serialisation (see my posting from 2001-05-05). But I doubt that this has anything to with it. Here is my prob archived - I would appreciate any feedback if session serialization works for you in the Tomcat4 + struts-combination: http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg07398.html Harald
Getting hold of the session
Hi, One of my getter methods (called by struts) needs to get hold of an object in the Session so that it can populate the values of a drop down box based upon a call to the customer object which is stored in the session. Unfortunatley struts does not pass my method the request or the session object and neither does it pass either of these to the form constructor so I can't store a local reference to it in the form. This problem must have been encountered and solved by others already, does anyone have any suggestions? Regards, Andy S [EMAIL PROTECTED] on 10/05/2001 09:57:55 Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: Andrew Steady/Swindon01/Domino01/Kinesis) Subject: Re: Transactional Tokens in the JSP? Allen, You can set the transactional token in your edit Action class with saveToken(request). Then you can test the token in the submit action. I suggest you have a look at the classes EditRegistration and SaveRegistration in the example application. Jean-Noel - Original Message - From: Allen Walker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 10:37 AM Subject: Transactional Tokens in the JSP? I would like to use the transaction token logic in the Action class. However I am not able to figure out how to place the Transactional Token in the JSP so it can be validated against when isTokenValid() is called within my Action class. I looked at the Struts source code to find: protected boolean isTokenValid(HttpServletRequest request) { // Retrieve the saved transaction token from our session HttpSession session = request.getSession(false); if (session == null) return (false); String saved = (String) session.getAttribute(TRANSACTION_TOKEN_KEY); if (saved == null) return (false); // Retrieve the transaction token included in this request String token = (String) request.getParameter(Constants.TOKEN_KEY); if (token == null) return (false); // Do the values match? return (saved.equals(token)); } The Contants class is org.apache.struts.taglib.html.Constants. Thanks for any help -allen- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. PricewaterhouseCoopers Kinesis Ltd
RE: How do you use indexed properties with html:input?
Hi, I made the following changes in my Action class and got my save to work. HttpSession session = request.getSession(); TestGridForm testGridForm = (TestGridForm)session.getAttribute( testGridForm ); However, while trying to debug my problem I found I get 3 ActionForm Beans created when I only expected 1. In my jsp I have the following: jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / I have added scope=session to the logic:iterate tag e.g. struts_logic:iterate id=element name=testGridForm property=data scope=session On the page where I display the results I also have: jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / I expected all the above to refer to the session scoped bean testGridForm, so why are 3 beans created? Richard. -Original Message- From: Richard Murray [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 9:45 AM To: '[EMAIL PROTECTED]' Subject: RE: How do you use indexed properties with html:input? Turgay, Thanks for your help, I've tried something similar to your example, but I'm still having some trouble. I've probably missed something obvious as I'm new to struts JSP. In my jsp I've got the following: %@ page import=com.qspgroup.utc.TestGridForm errorPage=fcerror.jsp % %@ taglib uri=/WEB-INF/utctags/fcutc.tld prefix=fcutc % %@ taglib uri=/WEB-INF/lib/struts/struts-bean.tld prefix=struts_bean % %@ taglib uri=/WEB-INF/lib/struts/struts-html.tld prefix=struts_html % %@ taglib uri=/WEB-INF/lib/struts/struts-logic.tld prefix=struts_logic % jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / tr % int i=0; % struts_logic:iterate id=element name=testGridForm property=data td input type=text name=%= data + i % size=10 value=struts_bean:write name=element/ /td % i++; % /struts_logic:iterate /tr My action class is as follows: public ActionForward perform( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { if ( form == null ) { form = new TestGridForm(); } TestGridForm testGridForm = ( TestGridForm )form; for ( int i = 0; i testGridForm.getData().length; i++ ) { if ( request.getParameter( data + i ) != null ) { testGridForm.setData( i, request.getParameter( data + i ) ); } } return ( mapping.findForward( success )); } As you can see It doesn't do a lot. My ActionForm class creates dummy data and contains and contains get/set methods as shown below: public class TestGridForm extends ActionForm { String[] data = { Rail, Fridges, Hay, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; public String[] getData() { return data; } public String getData( int i ) { return data[i]; } public void setData( String[] data ) { this.data = data; } public void setData( int i, String d ) { data[i] = d; } My data gets displayed OK. On success I go to testgrid.jsp but this keeps displaying the original data. I've checked the tomcat log files and the new data is being sent as request parameter so I don't understand why the new data isn't saved in my bean. e.g. 2001-05-10 09:21:20 -Request Params: 2001-05-10 09:21:20 -data2 = 30 2001-05-10 09:21:20 -data1 = 20 TestGrid.jsp is as follows: %@ page import=com.qspgroup.utc.DataCaptureDemo errorPage=fcerror.jsp % jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / html head titleTest JSP/title /head body h2Test JSP Page/h2 % out.println( brdata in 1st cell is + testGridForm.getData( 0 ) ); out.println( brdata in 2st cell is + testGridForm.getData( 1 ) ); out.println( brdata in 3rd cell is + testGridForm.getData( 2 ) ); % /body /html Sorry to swamp you with info, I can't seem to figure this out, although I'm sure I've missed something obvious here. Thanks. Richard. -Original Message- From: Turgay Zengin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 1:13 PM To: [EMAIL PROTECTED] Subject: Re: How do you use indexed properties with html:input? Hi, I *guess* that the html: tags require a form bean (please correct me if this is wrong) so they won't work with dynamically created page elements like input text fields. I did the following and it works, got the idea from Scott Walter (thanks) - see http://www.mail-archive.com/struts-user@jakarta.apache.org/msg06972.html There may be a better solution to this, if there is, I would like to know. Background: dbconnection is a bean I use to keep the session's database connection, and other objects. wpLaborEntries is
Re: Getting hold of the session
I assume that you're bean extends ActionForm.can't you get the required information you need from the session during the call to the validate() method? This method receives a request object as a parameter. From: Andrew Steady[EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Getting hold of the session Date: Thu, 10 May 2001 10:39:37 +0100 Hi, One of my getter methods (called by struts) needs to get hold of an object in the Session so that it can populate the values of a drop down box based upon a call to the customer object which is stored in the session. Unfortunatley struts does not pass my method the request or the session object and neither does it pass either of these to the form constructor so I can't store a local reference to it in the form. This problem must have been encountered and solved by others already, does anyone have any suggestions? Regards, Andy S [EMAIL PROTECTED] on 10/05/2001 09:57:55 Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: Andrew Steady/Swindon01/Domino01/Kinesis) Subject: Re: Transactional Tokens in the JSP? Allen, You can set the transactional token in your edit Action class with saveToken(request). Then you can test the token in the submit action. I suggest you have a look at the classes EditRegistration and SaveRegistration in the example application. Jean-Noel - Original Message - From: Allen Walker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 10:37 AM Subject: Transactional Tokens in the JSP? I would like to use the transaction token logic in the Action class. However I am not able to figure out how to place the Transactional Token in the JSP so it can be validated against when isTokenValid() is called within my Action class. I looked at the Struts source code to find: protected boolean isTokenValid(HttpServletRequest request) { // Retrieve the saved transaction token from our session HttpSession session = request.getSession(false); if (session == null) return (false); String saved = (String) session.getAttribute(TRANSACTION_TOKEN_KEY); if (saved == null) return (false); // Retrieve the transaction token included in this request String token = (String) request.getParameter(Constants.TOKEN_KEY); if (token == null) return (false); // Do the values match? return (saved.equals(token)); } The Contants class is org.apache.struts.taglib.html.Constants. Thanks for any help -allen- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. PricewaterhouseCoopers Kinesis Ltd _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: ActionForm.reset() not called when form tag creates bean
How about not clearing the values in your reset() method (or only clear values upon some special condition). - Original Message - From: John Raley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 9:52 PM Subject: ActionForm.reset() not called when form tag creates bean When the form tag creates its form bean it doesn't invoke reset() on the form. This (or similar) behavior would be really useful to me - I'm populating the form with runtime-computed default values. Right now I'm considering hacking in a create and a call to reset() on the page (or in a special-purpose tag). Is there a better way to fill in the form with default values at creation time? Thanks.
Re: relative urls
I ran into this same issue. I accomplished this by creating a custom tag (in my case called, PageLoader). The PageLoader tag will expose a scripting variable called contextRoot, which is basically pageContext.getRequest()).getContextPath() scott. --- Nathan Coast [EMAIL PROTECTED] wrote: Hi, I've got an app that will be deployed to a number of different contexts /test /dev /staging / (root) The app contains a large amount of static content e.g. images which will always be referenced from /current_context/image some of the jsps are accessed directly and via the action servlet - sometimes with different depths for the action url e.g. /current_context/something/something_else/my_action.do /current_context/something/another_action.do /somepage.jsp this obviously rules out using relative urls for the static content but the changing contexts makes it difficult for basing the urls on root. Is the solution to precede the url to every image in every jsp with a variable containing the value of the context? Is this not a performance hit? What's the best way to do it? Is there a struts tag that does this for me? How do I achieve world peace? - oops wrong mail list. Thanks Nathan = ~~~ Scott __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: JBuilder Tags
I am using JBUilder 4, but the debugger does not let me set a breakpoint on a tag on a JSP page. I can though set a breakpoint inside the Tag code, but that is not that interesting. Have u succeeded to set a breakpoint on a tag in a JSP page? --- Mark Simms [EMAIL PROTECTED] wrote: Upgrade to Jbuilder 4 Enterprise edition - tablib debugging, JSP debugging, introspection, etc. 1) It does have it share of bugs however...hint: don't use the built-in browser.bug city. 2) Requires minimum 256mb Windows box / 128mb Linux box - 500 mhz processor or better - Original Message - From: Sean Pritchard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 2:13 PM Subject: RE: JBuilder Tags Here's a related question. I use JBuilder3 for regular development and also for JSPs. But with JSP's it is little more than a text editor. Does anyone have any suggestions for how to get introspection to work while editing a JSP page(so I get drop-down's with methods after I type .)? Thanks Sean -Original Message- From: Rajan Gupta [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 1:11 PM To: [EMAIL PROTECTED] Subject: JBuilder Tags I am able to debug standard JSP pages inside JBuilder environment, but when it comes to custom tags, it does not let me set break points on a line which has a struts tag. Has anybody debugged JSP tags with JBuilder? Thanks, Rajan __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
RE: Session management with Struts
In that case i would advise you to maintain a Hashmap/Hashtable of form objects wrapped inside an Global Action form (session scope). Every time a user opens a new browser window, i am sure that a unique id can be generated for the new window ( i have seen a posting on this list a month back where somebody has explained that using javascript we can generate a unique id for every new web browser that was opened by the user). Store this id in a hidden name=value pair. Check the mail archives as to how to do this. Over-ride your ActionServlet service() method where you initially check the id of the browser window. (btw the form objects wrapped inside the GlobalActionForm object will be mapped to these id's.) . When the corresponding form object is found, then you populate the data in that form object. If no form object is found, then create a new form object and populate the data in that form object (using reflection). Struts has libraries to do this. This is a complicated way of doing it, but the best that could pop out of my brain this time...(morning blues. I could use some caffeine). cheers, Amar.. -Original Message- From: TJM Todd McGregor [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 5:44 PM To: '[EMAIL PROTECTED]' Subject: RE: Session management with Struts But that's exactly my problem. I have forms that may span multiple pages and the ActionForm needs to be available across multiple requests. Any ideas -Original Message- From: Nanduri, Amarnath [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 1:53 PM To: '[EMAIL PROTECTED]' Subject: RE: Session management with Struts Keep the ActionForms in 'request' scope. Then each page will have its own ActionForm. The problme occurs when you want to store these forms in session scope. cheers, Amar.. -Original Message- From: TJM Todd McGregor [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 4:49 PM To: [EMAIL PROTECTED] Subject: Session management with Struts I have a requirement that my application be able to allow multiple browser windows, sharing the same HttpSession, to access two separate instances of a business process simultaneously. For example, if I have a form that allows a user to change their address information my application must allow them to have two address forms open in separate browser windows using the same HttpSession. To make a long story short, can Struts accommodate multiple instances of an ActionForm in the same session? Any general comments on how Struts does session management would also be welcome. Thanks in advance for your response, Todd McGregor
Logic iterate problems
Hello, I have a Vector Object stored in my session with the key "tabTest" this Vector contains "Client" Objetcs, Client classe have a "name" property. I use this code in my JSP : logic:iterate id="client" name="tabTest" scope="session" type="Client" bean:write name="client" property="name"//logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain
RE: Basic Design Question...
The problem with multiple servlets. 1) Security is a pain when you should check in each and every servlet. In a single servlet you have one point of entry/ on point of exit. So security can be implemented quite efficiently. 2) Ease of maintenance. For example when you are porting across multiple servlet engines then maintenance is a problem. 3) Changes in how you handle your requests can be easily applied (since you handle them at nly one servlet). I am sure that there are tons of other reasons out there. However i think the above points are valid enough for me to stick to a single servlet instead of multiple ones... I worked on projects before (when the servlet api has come out) where i used multilpe servlets. Trust me, it is not a pleasant thought for me now when i think of those times, cause i ran into all those problems i had mentioned above. cheers, Amar.. -Original Message- From: Prakash Dominic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 6:52 PM To: [EMAIL PROTECTED]; '[EMAIL PROTECTED]'@jaydemail.com; [EMAIL PROTECTED] Subject: RE: Basic Design Question... I understand MVC/Model 2. And I don't think Action layer in Struts map to Model in MVC. Actions in Struts are -Controllers- in the MVC pattern as they translate user actions to the Model and select the appropriateView. The point I was trying to make was that, instead of creating a whole new set of APIs why not leverage the existing Servlet API/spec for the -Controller- layer. And I am not still clear what the problem is with having many Servlets(still java instances under the hood). --Prakash -Original Message- From: Jason Chaffee [EMAIL PROTECTED] Date: Wed, 9 May 2001 14:03:01 -0700 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: Basic Design Question... Read up on the MVC/Model 2 design pattern. Struts is based on this design pattern. It much better to have one servlet (controller) and several actions (models), than to have serveral servlets. -Original Message- From: Prakash Dominic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 2:04 PM To: [EMAIL PROTECTED] Subject: Basic Design Question... Hello Folks, A quick design question. This might be nit picking from a design standpoint but still a valid question. Struts uses the Action.perform(...) API for action hadling/controller. I am curious to know why Servlets can't be used for the Action Handling layer. That way there is no need to introduce 2 new APIs to learn - Action and struts-config.xml. The web.xml could replace the struts-config for action mapping. And framework users simply implement Servlets instead of Action subclasses. Does this make sense or am I am missing something here ? Thanks, Prakash -- === Another FREE service from Jayde Online A HREF=http://www.jayde.com TARGET=_newFONT COLOR=BLUEhttp://www.jayde.com/FONT/A Private, Web-based email accounts at A HREF=http://www.jaydemail.com; TARGET=_newFONT COLOR=BLUEhttp://www.jaydemail.com/FONT/A Powered by Outblaze -- === Another FREE service from Jayde Online http://www.jayde.com Private, Web-based email accounts at http://www.jaydemail.com Powered by Outblaze
RE: Logic iterate problems
have u put that object into the session, before u get to the form session.setAttribute("tabTest", VectorObject); -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 2:57 PMTo: [EMAIL PROTECTED]Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key "tabTest" this Vector contains "Client" Objetcs, Client classe have a "name" property. I use this code in my JSP : logic:iterate id="client" name="tabTest" scope="session" type="Client" bean:write name="client" property="name"//logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain
RE: How do you use indexed properties with html:input?
Richard, I put my bean in session scope when I create it in an action class: OracleConnBean dbconn=null; dbconn = (OracleConnBean)session.getAttribute(dbconnection); if(dbconn == null) { dbconn = new OracleConnBean(); session.setAttribute(dbconnection, dbconn); } Then, I can access the object from my jsp pages without using jsp:useBean. I am not exactly sure because I am not very much experienced with jsp/servlets, but this may be the reason for those 3 beans created. By the way, how did you find that out? How do you debug? (This may be a more general question as what is the best way to debug jsp/servlets? I don't debug yet, but I want to. I am using Forte CE. I heard about debugging in Tomcat using IBM VAJ, do I need to get that?) When you don't use jsp:useBean, you better use the type attribute in your iterate tag, to get the correct object type: struts_logic:iterate id=element name=testGridForm property=data type=type_of_your_data_element HTH, Turgay --- From: Richard Murray Subject: RE: How do you use indexed properties with html:input? Date: Thu, 10 May 2001 02:44:02 -0700 Hi, I made the following changes in my Action class and got my save to work. HttpSession session = request.getSession(); TestGridForm testGridForm = (TestGridForm)session.getAttribute( testGridForm ); However, while trying to debug my problem I found I get 3 ActionForm Beans created when I only expected 1. In my jsp I have the following: jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / I have added scope=session to the logic:iterate tag e.g. struts_logic:iterate id=element name=testGridForm property=data scope=session On the page where I display the results I also have: jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / I expected all the above to refer to the session scoped bean testGridForm, so why are 3 beans created? Richard. _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
RE: Getting hold of the session
Use this... ActionForm.getServlet().getSession() . cheers, Amar.. -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 6:44 AM To: [EMAIL PROTECTED] Subject: Re: Getting hold of the session I assume that you're bean extends ActionForm.can't you get the required information you need from the session during the call to the validate() method? This method receives a request object as a parameter. From: Andrew Steady[EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Getting hold of the session Date: Thu, 10 May 2001 10:39:37 +0100 Hi, One of my getter methods (called by struts) needs to get hold of an object in the Session so that it can populate the values of a drop down box based upon a call to the customer object which is stored in the session. Unfortunatley struts does not pass my method the request or the session object and neither does it pass either of these to the form constructor so I can't store a local reference to it in the form. This problem must have been encountered and solved by others already, does anyone have any suggestions? Regards, Andy S [EMAIL PROTECTED] on 10/05/2001 09:57:55 Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: Andrew Steady/Swindon01/Domino01/Kinesis) Subject: Re: Transactional Tokens in the JSP? Allen, You can set the transactional token in your edit Action class with saveToken(request). Then you can test the token in the submit action. I suggest you have a look at the classes EditRegistration and SaveRegistration in the example application. Jean-Noel - Original Message - From: Allen Walker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 10:37 AM Subject: Transactional Tokens in the JSP? I would like to use the transaction token logic in the Action class. However I am not able to figure out how to place the Transactional Token in the JSP so it can be validated against when isTokenValid() is called within my Action class. I looked at the Struts source code to find: protected boolean isTokenValid(HttpServletRequest request) { // Retrieve the saved transaction token from our session HttpSession session = request.getSession(false); if (session == null) return (false); String saved = (String) session.getAttribute(TRANSACTION_TOKEN_KEY); if (saved == null) return (false); // Retrieve the transaction token included in this request String token = (String) request.getParameter(Constants.TOKEN_KEY); if (token == null) return (false); // Do the values match? return (saved.equals(token)); } The Contants class is org.apache.struts.taglib.html.Constants. Thanks for any help -allen- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. PricewaterhouseCoopers Kinesis Ltd _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
RE: Getting hold of the session
oops my mistake.. Sorry about my last mail ... I really need some caffeine before i answer any more questions here cheers, Amar.. -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 6:44 AM To: [EMAIL PROTECTED] Subject: Re: Getting hold of the session I assume that you're bean extends ActionForm.can't you get the required information you need from the session during the call to the validate() method? This method receives a request object as a parameter. From: Andrew Steady[EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Getting hold of the session Date: Thu, 10 May 2001 10:39:37 +0100 Hi, One of my getter methods (called by struts) needs to get hold of an object in the Session so that it can populate the values of a drop down box based upon a call to the customer object which is stored in the session. Unfortunatley struts does not pass my method the request or the session object and neither does it pass either of these to the form constructor so I can't store a local reference to it in the form. This problem must have been encountered and solved by others already, does anyone have any suggestions? Regards, Andy S [EMAIL PROTECTED] on 10/05/2001 09:57:55 Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: Andrew Steady/Swindon01/Domino01/Kinesis) Subject: Re: Transactional Tokens in the JSP? Allen, You can set the transactional token in your edit Action class with saveToken(request). Then you can test the token in the submit action. I suggest you have a look at the classes EditRegistration and SaveRegistration in the example application. Jean-Noel - Original Message - From: Allen Walker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 10:37 AM Subject: Transactional Tokens in the JSP? I would like to use the transaction token logic in the Action class. However I am not able to figure out how to place the Transactional Token in the JSP so it can be validated against when isTokenValid() is called within my Action class. I looked at the Struts source code to find: protected boolean isTokenValid(HttpServletRequest request) { // Retrieve the saved transaction token from our session HttpSession session = request.getSession(false); if (session == null) return (false); String saved = (String) session.getAttribute(TRANSACTION_TOKEN_KEY); if (saved == null) return (false); // Retrieve the transaction token included in this request String token = (String) request.getParameter(Constants.TOKEN_KEY); if (token == null) return (false); // Do the values match? return (saved.equals(token)); } The Contants class is org.apache.struts.taglib.html.Constants. Thanks for any help -allen- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. PricewaterhouseCoopers Kinesis Ltd _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: relative urls
cheers this is what I figured, seems like an unpleasant overhead object - instantiation and 3 method calls for every relative url in the site every time every page is accessed. Must be some hack to get the context and place it into a static final variable somewhere prior to jsp compilation. This would effectively compile the variable value into every jsp. Any ideas? Scott Walter wrote: I ran into this same issue. I accomplished this by creating a custom tag (in my case called, PageLoader). The PageLoader tag will expose a scripting variable called contextRoot, which is basically pageContext.getRequest()).getContextPath() scott. --- Nathan Coast [EMAIL PROTECTED] wrote: Hi, I've got an app that will be deployed to a number of different contexts /test /dev /staging / (root) The app contains a large amount of static content e.g. images which will always be referenced from /current_context/image some of the jsps are accessed directly and via the action servlet - sometimes with different depths for the action url e.g. /current_context/something/something_else/my_action.do /current_context/something/another_action.do /somepage.jsp this obviously rules out using relative urls for the static content but the changing contexts makes it difficult for basing the urls on root. Is the solution to precede the url to every image in every jsp with a variable containing the value of the context? Is this not a performance hit? What's the best way to do it? Is there a struts tag that does this for me? How do I achieve world peace? - oops wrong mail list. Thanks Nathan = ~~~ Scott __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: Logic iterate problems
Yes , we did ! :-( - Original Message - From: Dudley Butt@i-Commerce To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:04 PM Subject: RE: Logic iterate problems have u put that object into the session, before u get to the form session.setAttribute("tabTest", VectorObject); -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 2:57 PMTo: [EMAIL PROTECTED]Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key "tabTest" this Vector contains "Client" Objetcs, Client classe have a "name" property. I use this code in my JSP : logic:iterate id="client" name="tabTest" scope="session" type="Client" bean:write name="client" property="name"//logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain
RE: Logic iterate problems
Maybe use need to use the jsp:useBean name="tabTest" class="VectorObject" scope = "session" / in your jsp page. Give it a shot and let me know... cheers, Amar.. -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 9:13 AMTo: [EMAIL PROTECTED]Subject: Re: Logic iterate problems Yes , we did ! :-( - Original Message - From: Dudley Butt@i-Commerce To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:04 PM Subject: RE: Logic iterate problems have u put that object into the session, before u get to the form session.setAttribute("tabTest", VectorObject); -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 2:57 PMTo: [EMAIL PROTECTED]Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key "tabTest" this Vector contains "Client" Objetcs, Client classe have a "name" property. I use this code in my JSP : logic:iterate id="client" name="tabTest" scope="session" type="Client" bean:write name="client" property="name"//logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain
Re: document.testbean.submit is not a function
Bart, I did find the source of this problem. If the submit button is named the default property value of submit, Javascript assumes that the button is being referred to, not the function when the form.submit() request is processed. By using the property tag and a value other than submit, JavaScript is no longer confused. John Miaso Bart Moberts wrote: Hello John From: [EMAIL PROTECTED] (John Miaso) Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: document.testbean.submit is not a function Date: Wed, 09 May 2001 08:27:24 -0600 I've modified the html-select.jsp example to include the script: SCRIPT function cbChanged() { document.testbean.cbSearch.value = Search document.testbean.submit() } /SCRIPT I'm setting a hidden property so that I can fill a select elements options in the Action peroform method based on the selection made in another select element. When I do this I get the JSP error: document.testbean.submit is not a function. Isn't that a JavaScript error? I got this error when I tried to submit a form using a link. I removed all the regular submitbuttons and then it worked. I get the same result if I try to send reset rather than submit. Is Javascript unaware of the submit button property? Is there a better way to approach this? John Miaso Grtz Bart _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
AW: Getting hold of the session
Hi Andrew, why don?t you populate your beans before you call your jsp (where i asume your getter methods are being called). i.e. let your ActionClass gather all customer information, prepare your bean, drop it in the session and access it in your jsp. If you want to directly populate your ActionForm check the mailing list. The topic was discussed a few times. Rainer -Ursprungliche Nachricht- Von: Andrew Steady [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 10. Mai 2001 11:40 An: [EMAIL PROTECTED] Betreff: Getting hold of the session Hi, One of my getter methods (called by struts) needs to get hold of an object in the Session so that it can populate the values of a drop down box based upon a call to the customer object which is stored in the session. Unfortunatley struts does not pass my method the request or the session object and neither does it pass either of these to the form constructor so I can't store a local reference to it in the form. This problem must have been encountered and solved by others already, does anyone have any suggestions? Regards, Andy S [EMAIL PROTECTED] on 10/05/2001 09:57:55 Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: Andrew Steady/Swindon01/Domino01/Kinesis) Subject: Re: Transactional Tokens in the JSP? Allen, You can set the transactional token in your edit Action class with saveToken(request). Then you can test the token in the submit action. I suggest you have a look at the classes EditRegistration and SaveRegistration in the example application. Jean-Noel - Original Message - From: Allen Walker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 10:37 AM Subject: Transactional Tokens in the JSP? I would like to use the transaction token logic in the Action class. However I am not able to figure out how to place the Transactional Token in the JSP so it can be validated against when isTokenValid() is called within my Action class. I looked at the Struts source code to find: protected boolean isTokenValid(HttpServletRequest request) { // Retrieve the saved transaction token from our session HttpSession session = request.getSession(false); if (session == null) return (false); String saved = (String) session.getAttribute(TRANSACTION_TOKEN_KEY); if (saved == null) return (false); // Retrieve the transaction token included in this request String token = (String) request.getParameter(Constants.TOKEN_KEY); if (token == null) return (false); // Do the values match? return (saved.equals(token)); } The Contants class is org.apache.struts.taglib.html.Constants. Thanks for any help -allen- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. PricewaterhouseCoopers Kinesis Ltd
RE: Logic iterate problems
I came across a similar problem not so long ago. What I'd done wrong was try and access properties outside the html:form tags. Moving my tag calls inside the form tags fixed my problem at the time, but I don't know if this applies in your case. It's worth double checking none-the-less. Regards David -Original Message- From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]] Sent: 10 May 2001 13:57 To: [EMAIL PROTECTED] Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key tabTest this Vector contains Client Objetcs, Client classe have a name property. I use this code in my JSP : logic:iterate id=client name=tabTest scope=session type=Client bean:write name=client property=name/ /logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com ***
RE: Basic Design Question...
I think some people are missing the point you're trying to make, so I I'm going to take a stab at it. Yes, the Servlet and Action APIs are very similar, but a Servlet and an Action really have are two different entities. A Servlet's set of interfaces covers what is required of an Action and much more. You usually want to have a set of interfaces that describes succinctly what an entity is suppose to do. An Action performs a particular web action. This does not necessarily describe a servlet. You would risk bringing in a lot of confusion into the whole framework. Can an Action be setup as a standalone Servlet? To what extent should an Action adhere to the Servlet spec? What would the init() and destroy() methods do? Calvin --- Prakash Dominic [EMAIL PROTECTED] wrote: I understand MVC/Model 2. And I don't think Action layer in Struts map to Model in MVC. Actions in Struts are -Controllers- in the MVC pattern as they translate user actions to the Model and select the appropriateView. The point I was trying to make was that, instead of creating a whole new set of APIs why not leverage the existing Servlet API/spec for the -Controller- layer. And I am not still clear what the problem is with having many Servlets(still java instances under the hood). --Prakash -Original Message- From: Jason Chaffee [EMAIL PROTECTED] Date: Wed, 9 May 2001 14:03:01 -0700 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: Basic Design Question... Read up on the MVC/Model 2 design pattern. Struts is based on this design pattern. It much better to have one servlet (controller) and several actions (models), than to have serveral servlets. -Original Message- From: Prakash Dominic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 2:04 PM To: [EMAIL PROTECTED] Subject: Basic Design Question... Hello Folks, A quick design question. This might be nit picking from a design standpoint but still a valid question. Struts uses the Action.perform(...) API for action hadling/controller. I am curious to know why Servlets can't be used for the Action Handling layer. That way there is no need to introduce 2 new APIs to learn - Action and struts-config.xml. The web.xml could replace the struts-config for action mapping. And framework users simply implement Servlets instead of Action subclasses. Does this make sense or am I am missing something here ? Thanks, Prakash -- === Another FREE service from Jayde Online A HREF=http://www.jayde.com TARGET=_newFONT COLOR=BLUEhttp://www.jayde.com/FONT/A Private, Web-based email accounts at A HREF=http://www.jaydemail.com; TARGET=_newFONT COLOR=BLUEhttp://www.jaydemail.com/FONT/A Powered by Outblaze -- === Another FREE service from Jayde Online http://www.jayde.com Private, Web-based email accounts at http://www.jaydemail.com Powered by Outblaze __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
a trivial problem
Hi All, can somebody help please?? I am getting this exception: since it is demanding something in the struts.jar...Could somebody tell me where have i gone wrong..I am trying to run web application on weblogic server. Other jsp are being compiled but a couple of jsp have this problem: May 10, 2001 1:44:04 PM GMT+01:00 Error HTTP [WebAppServletContext(152793 2,amit)] Root cause of ServletException javax.servlet.jsp.JspException: Missing resources attribute org.apache.struts.ac tion.MESSAGE at org.apache.struts.taglib.MessageTag.doStartTag(MessageTag.java:360) at jsp_servlet._userManagement._registerStart._jspService(_registerStart .java:1327) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm pl.java:208) Thanks in advance Amit Legal Disclaimer:- Please be aware that messages sent over the Internet may not be secure and should not be seen as forming a legally binding contract unless otherwise stated.
Re: Logic iterate problems
I tried, here is the code in my action : tabTest= new Vector();test = new Client();test.setName("Tata DUBAR");tabTest.add(test);test = new Client();test.setName("SFA");tabTest.add(test); session.setAttribute("tabTest",tabTest); And the JSP code : jsp:useBean id="tabTest" scope="session" class="java.util.Vector" / logic:iterate id="client" name="tabTest" type="Client" bean:write name="client" property="name"//logic:iterate I still have my "cannnot find client bean " error. Thanks Sylvain ! - Original Message - From: Nanduri, Amarnath To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:17 PM Subject: RE: Logic iterate problems Maybe use need to use the jsp:useBean name="tabTest" class="VectorObject" scope = "session" / in your jsp page. Give it a shot and let me know... cheers, Amar.. -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 9:13 AMTo: [EMAIL PROTECTED]Subject: Re: Logic iterate problems Yes , we did ! :-( - Original Message - From: Dudley Butt@i-Commerce To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:04 PM Subject: RE: Logic iterate problems have u put that object into the session, before u get to the form session.setAttribute("tabTest", VectorObject); -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 2:57 PMTo: [EMAIL PROTECTED]Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key "tabTest" this Vector contains "Client" Objetcs, Client classe have a "name" property. I use this code in my JSP : logic:iterate id="client" name="tabTest" scope="session" type="Client" bean:write name="client" property="name"//logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain
Re: Logic iterate problems
I tried to encapsulate all my tags with html:form action=realAction .. /html:form But it still doesn't work ! - Original Message - From: Firmin David [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 3:22 PM Subject: RE: Logic iterate problems I came across a similar problem not so long ago. What I'd done wrong was try and access properties outside the html:form tags. Moving my tag calls inside the form tags fixed my problem at the time, but I don't know if this applies in your case. It's worth double checking none-the-less. Regards David -Original Message- From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]] Sent: 10 May 2001 13:57 To: [EMAIL PROTECTED] Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key tabTest this Vector contains Client Objetcs, Client classe have a name property. I use this code in my JSP : logic:iterate id=client name=tabTest scope=session type=Client bean:write name=client property=name/ /logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com ***
RE: Logic iterate problems
In your jsp page did you do an import on client ? %@ page import = "beans.Client" % -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 9:33 AMTo: [EMAIL PROTECTED]Subject: Re: Logic iterate problems I tried, here is the code in my action : tabTest= new Vector();test = new Client();test.setName("Tata DUBAR");tabTest.add(test);test = new Client();test.setName("SFA");tabTest.add(test); session.setAttribute("tabTest",tabTest); And the JSP code : jsp:useBean id="tabTest" scope="session" class="java.util.Vector" / logic:iterate id="client" name="tabTest" type="Client" bean:write name="client" property="name"//logic:iterate I still have my "cannnot find client bean " error. Thanks Sylvain ! - Original Message - From: Nanduri, Amarnath To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:17 PM Subject: RE: Logic iterate problems Maybe use need to use the jsp:useBean name="tabTest" class="VectorObject" scope = "session" / in your jsp page. Give it a shot and let me know... cheers, Amar.. -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 9:13 AMTo: [EMAIL PROTECTED]Subject: Re: Logic iterate problems Yes , we did ! :-( - Original Message - From: Dudley Butt@i-Commerce To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:04 PM Subject: RE: Logic iterate problems have u put that object into the session, before u get to the form session.setAttribute("tabTest", VectorObject); -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 2:57 PMTo: [EMAIL PROTECTED]Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key "tabTest" this Vector contains "Client" Objetcs, Client classe have a "name" property. I use this code in my JSP : logic:iterate id="client" name="tabTest" scope="session" type="Client" bean:write name="client" property="name"//logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain
Re: Session management with Struts
Nanduri, Amarnath wrote: i have seen a posting on this list a month back where somebody has explained that using javascript we can generate a unique id for every new web browser that was opened by the user search the archives for: The Joy of File Pete begin:vcard n:; x-mozilla-html:FALSE org:BRIMG SRC=http://www.irista.com/logo/irista.gif;BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain adr:;; version:2.1 end:vcard
Re: Logic iterate problems
In fact I use the full class name in the iterate Tag ! - Original Message - From: Nanduri, Amarnath To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:39 PM Subject: RE: Logic iterate problems In your jsp page did you do an import on client ? %@ page import = "beans.Client" %
RE: Logic iterate problems
I don't think you need the jsp:useBean. You also don't need type="Client". If you want to use type, make sure the class is fully qualified with the package it's in. -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 9:33 AMTo: [EMAIL PROTECTED]Subject: Re: Logic iterate problems I tried, here is the code in my action : tabTest= new Vector();test = new Client();test.setName("Tata DUBAR");tabTest.add(test);test = new Client();test.setName("SFA");tabTest.add(test); session.setAttribute("tabTest",tabTest); And the JSP code : jsp:useBean id="tabTest" scope="session" class="java.util.Vector" / logic:iterate id="client" name="tabTest" type="Client" bean:write name="client" property="name"//logic:iterate I still have my "cannnot find client bean " error. Thanks Sylvain ! - Original Message - From: Nanduri, Amarnath To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:17 PM Subject: RE: Logic iterate problems Maybe use need to use the jsp:useBean name="tabTest" class="VectorObject" scope = "session" / in your jsp page. Give it a shot and let me know... cheers, Amar.. -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 9:13 AMTo: [EMAIL PROTECTED]Subject: Re: Logic iterate problems Yes , we did ! :-( - Original Message - From: Dudley Butt@i-Commerce To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:04 PM Subject: RE: Logic iterate problems have u put that object into the session, before u get to the form session.setAttribute("tabTest", VectorObject); -Original Message-From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 10, 2001 2:57 PMTo: [EMAIL PROTECTED]Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key "tabTest" this Vector contains "Client" Objetcs, Client classe have a "name" property. I use this code in my JSP : logic:iterate id="client" name="tabTest" scope="session" type="Client" bean:write name="client" property="name"//logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain
RE: How do you use indexed properties with html:input?
Turgay, I've just tried that but get the following exception: javax.servlet.jsp.JspException: Cannot find bean contributorEditForm in scope session I've removed all useBean tags from my jsp and have added the following in my action class: ContributorEditForm contributorEditForm = (ContributorEditForm)session.getAttribute( contributorEditForm ); if ( contributorEditForm == null ) { contributorEditForm = new ContributorEditForm(); session.setAttribute(contributorEditForm, contributorEditForm ); } My JSP contains code like: struts_logic:iterate id=rows name=contributorEditForm property=data scope=session Have I done something wrong? As for debugging, I haven't really been able to so far, I've just been putting System.out's in my Action class. I'm about to install JBuilder Enterprise (I normally use the Foundation version ) as this supports JSP debugging, so I'll let you know if it's any good. Richard. -Original Message- From: Turgay Zengin [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 2:05 PM To: [EMAIL PROTECTED] Subject: RE: How do you use indexed properties with html:input? Richard, I put my bean in session scope when I create it in an action class: OracleConnBean dbconn=null; dbconn = (OracleConnBean)session.getAttribute(dbconnection); if(dbconn == null) { dbconn = new OracleConnBean(); session.setAttribute(dbconnection, dbconn); } Then, I can access the object from my jsp pages without using jsp:useBean. I am not exactly sure because I am not very much experienced with jsp/servlets, but this may be the reason for those 3 beans created. By the way, how did you find that out? How do you debug? (This may be a more general question as what is the best way to debug jsp/servlets? I don't debug yet, but I want to. I am using Forte CE. I heard about debugging in Tomcat using IBM VAJ, do I need to get that?) When you don't use jsp:useBean, you better use the type attribute in your iterate tag, to get the correct object type: struts_logic:iterate id=element name=testGridForm property=data type=type_of_your_data_element HTH, Turgay --- From: Richard Murray Subject: RE: How do you use indexed properties with html:input? Date: Thu, 10 May 2001 02:44:02 -0700 Hi, I made the following changes in my Action class and got my save to work. HttpSession session = request.getSession(); TestGridForm testGridForm = (TestGridForm)session.getAttribute( testGridForm ); However, while trying to debug my problem I found I get 3 ActionForm Beans created when I only expected 1. In my jsp I have the following: jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / I have added scope=session to the logic:iterate tag e.g. struts_logic:iterate id=element name=testGridForm property=data scope=session On the page where I display the results I also have: jsp:useBean id=testGridForm class=com.qspgroup.utc.TestGridForm scope=session / I expected all the above to refer to the session scoped bean testGridForm, so why are 3 beans created? Richard. _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager at [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by for the presence of computer viruses. http://www.qspgroup.com **
RE: Logic iterate problems
try this logic:iterate id=tabTest name=tabTest scope=session type=Client bean:write name=tabTest property=name/ /logic:iterate -Original Message- From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 3:37 PM To: [EMAIL PROTECTED] Subject: Re: Logic iterate problems I tried to encapsulate all my tags with html:form action=realAction .. /html:form But it still doesn't work ! - Original Message - From: Firmin David [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 3:22 PM Subject: RE: Logic iterate problems I came across a similar problem not so long ago. What I'd done wrong was try and access properties outside the html:form tags. Moving my tag calls inside the form tags fixed my problem at the time, but I don't know if this applies in your case. It's worth double checking none-the-less. Regards David -Original Message- From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]] Sent: 10 May 2001 13:57 To: [EMAIL PROTECTED] Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key tabTest this Vector contains Client Objetcs, Client classe have a name property. I use this code in my JSP : logic:iterate id=client name=tabTest scope=session type=Client bean:write name=client property=name/ /logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com ***
RE: Logic iterate problems
Humour me...I'm not entirely convinced this'll work, and I know it's not ideal anyway, but here goes... Could you try: logic:iterate collection=%=tabTest% type=your.class.name.Client id=aClient bean:write name=aClient property=name/ /logic:iterate Like I say, I'm not convinced this'll work, but no harm in trying, hey! Regards David -Original Message- From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]] Sent: 10 May 2001 14:33 To: [EMAIL PROTECTED] Subject: Re: Logic iterate problems I tried, here is the code in my action : tabTest= new Vector(); test = new Client(); test.setName(Tata DUBAR); tabTest.add(test); test = new Client(); test.setName(SFA); tabTest.add(test); session.setAttribute(tabTest,tabTest); And the JSP code : jsp:useBean id=tabTest scope=session class=java.util.Vector / logic:iterate id=client name=tabTest type=Client bean:write name=client property=name/ /logic:iterate I still have my cannnot find client bean error. Thanks Sylvain ! - Original Message - From: Nanduri, Amarnath mailto:[EMAIL PROTECTED] To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:17 PM Subject: RE: Logic iterate problems Maybe use need to use the jsp:useBean name=tabTest class=VectorObject scope = session / in your jsp page. Give it a shot and let me know... cheers, Amar.. -Original Message- From: Sylvain FAGNENT [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Thursday, May 10, 2001 9:13 AM To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Subject: Re: Logic iterate problems Yes , we did ! :-( - Original Message - From: Dudley Butt@i-Commerce mailto:[EMAIL PROTECTED] To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:04 PM Subject: RE: Logic iterate problems have u put that object into the session, before u get to the form session.setAttribute(tabTest, VectorObject); -Original Message- From: Sylvain FAGNENT [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Thursday, May 10, 2001 2:57 PM To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key tabTest this Vector contains Client Objetcs, Client classe have a name property. I use this code in my JSP : logic:iterate id=client name=tabTest scope=session type=Client bean:write name=client property=name/ /logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com ***
Re: Logic iterate problems
Doesn't work since we retrieve the following exception: javax.servlet.jsp.JspException: No getter method for property choix of bean tabTest tabTest is a Vector!! - Original Message - From: Dudley Butt@i-Commerce [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 3:45 PM Subject: RE: Logic iterate problems try this logic:iterate id=tabTest name=tabTest scope=session type=Client bean:write name=tabTest property=name/ /logic:iterate -Original Message- From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 3:37 PM To: [EMAIL PROTECTED] Subject: Re: Logic iterate problems I tried to encapsulate all my tags with html:form action=realAction .. /html:form But it still doesn't work ! - Original Message - From: Firmin David [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 3:22 PM Subject: RE: Logic iterate problems I came across a similar problem not so long ago. What I'd done wrong was try and access properties outside the html:form tags. Moving my tag calls inside the form tags fixed my problem at the time, but I don't know if this applies in your case. It's worth double checking none-the-less. Regards David -Original Message- From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]] Sent: 10 May 2001 13:57 To: [EMAIL PROTECTED] Subject: Logic iterate problems Hello, I have a Vector Object stored in my session with the key tabTest this Vector contains Client Objetcs, Client classe have a name property. I use this code in my JSP : logic:iterate id=client name=tabTest scope=session type=Client bean:write name=client property=name/ /logic:iterate This error is return : ...JSP Exception : Cannot find bean client in scope null any help...Thanks Sylvain The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com ***
RE: Logic iterate problems
i'll send u some code that u can adapt for Vectors that we used quite effectively with Arraylists, try it out... we used like a wrapper class to put our collection object in as follows: - package com.didata.itax.payment.web.data; import java.util.ArrayList; /** * Title: * Description: * Copyright:Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class EFilerList { private ArrayList list = null; private int size = 0; public int getSize(){ return list.size(); } public EFilerList() { list = new ArrayList(); } public EFilerList(ArrayList newList) { list = newList; } public void addEFiler(EFiler efiler){ list.add(efiler); } public void removeEFiler(int eFilerID){ list.remove(eFilerID); list.trimToSize(); } public EFiler[] getEfilers(){//the iterate tags property=efilers will call this method!! EFiler[] eFilers = new EFiler[list.size()]; eFilers = (EFiler[])list.toArray(eFilers); return eFilers; } public EFiler getEfiler(int eFilerID){ EFiler eFiler = new EFiler(); eFiler = (EFiler)list.get(eFilerID); return eFiler; } } in your actionform or wherever u build the vector, use the above class to wrap your Vector, then, u push this list class above as your session object. This class is juts a wrapper, so we can access the ArrayList or Vector in our jsp. Once you've built EFilerList, put all the elements in it that u need, add it to the session session.setAttribute...etc the jsp for the above example looks like this logic:iterate id=eFilerList name=eFilerList scope=session property=efilers tr td align=center bean:write name=eFilerList property=firstName filter=true/ /td td align=center bean:write name=eFilerList property=initials filter=true/ /td td align=center bean:write name=eFilerList property=lastName filter=true/ /td td align=center bean:write name=eFilerList property=idNumber/ /td td align=center bean:write name=eFilerList property=state/ /td td align=center html:link page=/eFilerEdit.do?action=Edit bean:message key=eFilerList.edit//html:link /td td align=center html:checkbox name=eFilerList property=state/ /td /tr /logic:iterate the eFiler class looks like this. package com.didata.itax.payment.web.data; import com.didata.itax.payment.web.actionform.*; /** * Title: * Description: * Copyright:Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class EFiler implements java.io.Serializable { String firstName = null; String initials = null; String lastName = null; String idNumber = null; Boolean state = new Boolean(false); public EFiler() { } public EFiler(EFilerActionForm eFilerForm) { firstName = eFilerForm.getFirstName(); initials = eFilerForm.getInitials(); lastName = eFilerForm.getLastName(); idNumber = eFilerForm.getIdNumber(); state = eFilerForm.getState(); } public Boolean getState(){ return state; } public void setState(Boolean _state){ this.state = _state; } public String getFirstName(){ return firstName; } public void setFirstName(String firstName){ this.firstName = firstName; } public String getInitials(){ return initials; } public void setInitials(String initials){ this.initials = initials; } public String getLastName(){ return lastName; } public void setLastName(String lastName){ this.lastName = lastName; } public String getIdNumber(){ return idNumber; } public void setIdNumber(String idNumber){ this.idNumber = idNumber; } } -Original Message- From: Sylvain
Design Error?
Cheers Dudley, I have a solution but I am not happy with it (and I now also have the additional problem that checkboxes only get sent back if they are set so I can't tell which checkbox has been checked! - Another one to sort out). Do you know if this is a design error. Basically, the problem is this (for those who haven't been following the thread): - I have a number of beans held in a Vector. - In my ActionForm I have a two getters for this vector - one returns the vector and one returns elements of the vector - so something like this: public RetailerBean getRetailerBean( int index ) { return (RetailerBean)retailers.elementAt( index ); } and public Vector getRetailers() { return retailers; } This works fine to populate using the following type of iterate tag: logic:iterate id=retailer name=retailerForm property=retailers tr tdhtml:checkbox name=retailer property=delete//td tdhtml:text name=retailer property=name//td /a/td-- /tr /logic:iterate However, it doesn't repopulate the beans when I do a submit. This is because the generated html is something like: input type=checkbox name=delete rather than: input type=checkbox name=retailer[0].delete input type=checkbox name=retailer[1].delete which would allow my beans to be repopulated. The outcome of this is that I have to create arrays for all properties of my beans in my ActionForm and take the values from there. This seems like bodge-heaven and not at all object-oriented. If the form can be populated directly from the beans then surely it should work the other way too. Any struts developers want to comment? Thanks for all your help. Cheers Tony -Original Message- From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 1:06 PM To: 'Tony Karas' Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING ya sorry about that the one is the actionform attribute and the other is an attribute of my TaxPayerData[] bean. -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 1:46 PM To: Dudley Butt@i-Commerce Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING OK - I see what you're doing - got a little confused with taxpayerName and taxPayerName but worked it out. I'm going to give it a go - see what happens. Will let you know -Original Message- From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:29 PM To: 'Tony Karas' Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING have a look at this multibox code i see someone also sent to u, i think that would also work..same idea..just using a Long array -Original Message- From: Deadman, Hal [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 10:30 PM To: [EMAIL PROTECTED] Subject: RE: Posting Collections I think I am doing the same thing that you want to do using the html:multibox. When the form is submitted you get an array of the ids that are checked and then you can go delete them. in the jsp form (where restaurant id is a key for the item being deleted): logic:iterate id=restaurant name=favoriterestaurants ... html:multibox property=favoriteRestaurantRemoveList bean:write property=restaurantId name=restaurant/ /html:multibox ... /logic:iterate in the form class: private Long favoriteRestaurantRemoveList[] = new Long[0]; public Long[] getFavoriteRestaurantRemoveList() { return (this.favoriteRestaurantRemoveList); } public void setFavoriteRestaurantRemoveList(Long favoriteRestaurantRemoveList[]) { this.favoriteRestaurantRemoveList = favoriteRestaurantRemoveList; } I am not sure if initializing the array to new Long[0] is necessary, probably not. -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 1:13 PM To: Dudley Butt@i-Commerce Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING Thanks very much - I'll have a look and get back to you asap. -Original Message- From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 11:49 AM To: 'Tony Karas' Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING i may have a solution for you, let me send u my one that works with a normal edit box and see if u can change it to work with your checkboxes. i think the basic idea, is that once your list is displayed, u need a String[] setter like i have. let me know...i've attached my files that actually work.. check it out and look at my comments -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]]
RE: Logic iterate problems
Have you tried this? It should work as long as whatever is in the Vector has a method defined like: public String getName(); logic:iterate id=client name=tabTest bean:write name=client property=name/ /logic:iterate Put something like this at the top of your JSP just to make sure tabTest is in there. % Object obj = session.getAttribute(tabTest); if (obj==null) { System.err.println(The action wasn't called before this jsp); } else { System.err.println(tabTest is a + obj.getClass().getName()); } % -Original Message- From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 10:36 AM To: '[EMAIL PROTECTED]' Subject: RE: Logic iterate problems i'll send u some code that u can adapt for Vectors that we used quite effectively with Arraylists, try it out... we used like a wrapper class to put our collection object in as follows: - package com.didata.itax.payment.web.data; import java.util.ArrayList; /** * Title: * Description: * Copyright:Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class EFilerList { private ArrayList list = null; private int size = 0; public int getSize(){ return list.size(); } public EFilerList() { list = new ArrayList(); } public EFilerList(ArrayList newList) { list = newList; } public void addEFiler(EFiler efiler){ list.add(efiler); } public void removeEFiler(int eFilerID){ list.remove(eFilerID); list.trimToSize(); } public EFiler[] getEfilers(){//the iterate tags property=efilers will call this method!! EFiler[] eFilers = new EFiler[list.size()]; eFilers = (EFiler[])list.toArray(eFilers); return eFilers; } public EFiler getEfiler(int eFilerID){ EFiler eFiler = new EFiler(); eFiler = (EFiler)list.get(eFilerID); return eFiler; } } in your actionform or wherever u build the vector, use the above class to wrap your Vector, then, u push this list class above as your session object. This class is juts a wrapper, so we can access the ArrayList or Vector in our jsp. Once you've built EFilerList, put all the elements in it that u need, add it to the session session.setAttribute...etc the jsp for the above example looks like this logic:iterate id=eFilerList name=eFilerList scope=session property=efilers tr td align=center bean:write name=eFilerList property=firstName filter=true/ /td td align=center bean:write name=eFilerList property=initials filter=true/ /td td align=center bean:write name=eFilerList property=lastName filter=true/ /td td align=center bean:write name=eFilerList property=idNumber/ /td td align=center bean:write name=eFilerList property=state/ /td td align=center html:link page=/eFilerEdit.do?action=Edit bean:message key=eFilerList.edit//html:link /td td align=center html:checkbox name=eFilerList property=state/ /td /tr /logic:iterate the eFiler class looks like this. package com.didata.itax.payment.web.data; import com.didata.itax.payment.web.actionform.*; /** * Title: * Description: * Copyright:Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class EFiler implements java.io.Serializable { String firstName = null; String initials = null; String lastName = null; String idNumber = null; Boolean state = new Boolean(false); public EFiler() { } public EFiler(EFilerActionForm eFilerForm) { firstName = eFilerForm.getFirstName(); initials = eFilerForm.getInitials(); lastName = eFilerForm.getLastName(); idNumber = eFilerForm.getIdNumber(); state = eFilerForm.getState(); } public Boolean getState(){ return state; } public void setState(Boolean _state){ this.state = _state; } public String getFirstName(){ return firstName;
FW: Design Error? Bean repopulation...
yes please inform us, i also want to know, i've also had to do it this way, is there a better way anyone, please help!!! desperation is setting in here! An example would help..anyone!?? -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 4:52 PM To: Dudley Butt@i-Commerce Cc: Struts User Subject: Design Error? Cheers Dudley, I have a solution but I am not happy with it (and I now also have the additional problem that checkboxes only get sent back if they are set so I can't tell which checkbox has been checked! - Another one to sort out). Do you know if this is a design error. Basically, the problem is this (for those who haven't been following the thread): - I have a number of beans held in a Vector. - In my ActionForm I have a two getters for this vector - one returns the vector and one returns elements of the vector - so something like this: public RetailerBean getRetailerBean( int index ) { return (RetailerBean)retailers.elementAt( index ); } and public Vector getRetailers() { return retailers; } This works fine to populate using the following type of iterate tag: logic:iterate id=retailer name=retailerForm property=retailers tr tdhtml:checkbox name=retailer property=delete//td tdhtml:text name=retailer property=name//td /a/td-- /tr /logic:iterate However, it doesn't repopulate the beans when I do a submit. This is because the generated html is something like: input type=checkbox name=delete rather than: input type=checkbox name=retailer[0].delete input type=checkbox name=retailer[1].delete which would allow my beans to be repopulated. The outcome of this is that I have to create arrays for all properties of my beans in my ActionForm and take the values from there. This seems like bodge-heaven and not at all object-oriented. If the form can be populated directly from the beans then surely it should work the other way too. Any struts developers want to comment? Thanks for all your help. Cheers Tony -Original Message- From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 1:06 PM To: 'Tony Karas' Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING ya sorry about that the one is the actionform attribute and the other is an attribute of my TaxPayerData[] bean. -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 1:46 PM To: Dudley Butt@i-Commerce Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING OK - I see what you're doing - got a little confused with taxpayerName and taxPayerName but worked it out. I'm going to give it a go - see what happens. Will let you know -Original Message- From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:29 PM To: 'Tony Karas' Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING have a look at this multibox code i see someone also sent to u, i think that would also work..same idea..just using a Long array -Original Message- From: Deadman, Hal [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 10:30 PM To: [EMAIL PROTECTED] Subject: RE: Posting Collections I think I am doing the same thing that you want to do using the html:multibox. When the form is submitted you get an array of the ids that are checked and then you can go delete them. in the jsp form (where restaurant id is a key for the item being deleted): logic:iterate id=restaurant name=favoriterestaurants ... html:multibox property=favoriteRestaurantRemoveList bean:write property=restaurantId name=restaurant/ /html:multibox ... /logic:iterate in the form class: private Long favoriteRestaurantRemoveList[] = new Long[0]; public Long[] getFavoriteRestaurantRemoveList() { return (this.favoriteRestaurantRemoveList); } public void setFavoriteRestaurantRemoveList(Long favoriteRestaurantRemoveList[]) { this.favoriteRestaurantRemoveList = favoriteRestaurantRemoveList; } I am not sure if initializing the array to new Long[0] is necessary, probably not. -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 1:13 PM To: Dudley Butt@i-Commerce Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING Thanks very much - I'll have a look and get back to you asap. -Original Message- From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 11:49 AM To: 'Tony Karas' Subject: RE: please help...iteration question...what i Have is...GOT IT WORKING!! LET ME kNOW IF U GOT IT WORKING i may have a solution for you, let me send u my one
Re: ActionForm.reset() not called when form tag creates bean
The problem is that my reset() method populates the form with default values (the ones I want the user to see when she first gets to the form). The workaround is to send requests like these through a no-op Action with the same form type and name. This will cause the form to be created. The Action should have validate=false in struts-config.xml. You can use the same Action class for any situation like this (since the Action itself is a no-op). I suppose I could preserve the intent of the reset() method (which I still don't fully understand) by having all of my ActionForms implement a method like populateDefaults(mapping, request) and have the action invoke this method on its form. But what I have works for now... Tharwat Abdul-Malik wrote: How about not clearing the values in your reset() method (or only clear values upon some special condition). - Original Message - From: John Raley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 9:52 PM Subject: ActionForm.reset() not called when form tag creates bean When the form tag creates its form bean it doesn't invoke reset() on the form. This (or similar) behavior would be really useful to me - I'm populating the form with runtime-computed default values. Right now I'm considering hacking in a create and a call to reset() on the page (or in a special-purpose tag). Is there a better way to fill in the form with default values at creation time? Thanks.
Re: Transactional Tokens in the JSP?
At 10:57 AM 5/10/2001 +0200, Jean-Noel Ribette wrote: Allen, You can set the transactional token in your edit Action class with saveToken(request). Then you can test the token in the submit action. I suggest you have a look at the classes EditRegistration and SaveRegistration in the example application. Yes, I checked that. But I am wondering how the token get's on the request from the jsp page itself.
Checkbox Arrays
Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony
Re: Logic iterate problems = solution
I found the error, the logic tld was not imported... the logic tag was not parsed stupid error isn't it ?? :- - Original Message - From: Sylvain FAGNENT To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 3:41 PM Subject: Re: Logic iterate problems In fact I use the full class name in the iterate Tag ! - Original Message - From: Nanduri, Amarnath To: '[EMAIL PROTECTED]' Sent: Thursday, May 10, 2001 3:39 PM Subject: RE: Logic iterate problems In your jsp page did you do an import on client ? %@ page import = "beans.Client" %
RE: Transactional Tokens in the JSP?
It is saved in a hidden field in the form so it ends up in the request when you submit. -Original Message- From: Allen Walker [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 11:40 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Transactional Tokens in the JSP? At 10:57 AM 5/10/2001 +0200, Jean-Noel Ribette wrote: Allen, You can set the transactional token in your edit Action class with saveToken(request). Then you can test the token in the submit action. I suggest you have a look at the classes EditRegistration and SaveRegistration in the example application. Yes, I checked that. But I am wondering how the token get's on the request from the jsp page itself.
Re: Checkbox Arrays
Im not sure how the ActionForm changes things, but without an actionform your could do this Each checkbox can have the same name, but a different value. When the form is submitted, the checkboxes that have been checked are in the request. You can use the request.getParameterValues(checkBoxName) to retrieve a string array of the values for the checked boxes. HTH, Pete Tony Karas wrote: Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony begin:vcard n:; x-mozilla-html:FALSE org:BRIMG SRC=http://www.irista.com/logo/irista.gif;BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain adr:;; version:2.1 end:vcard
NoInitialContextException
Hi, I'm using a Tomcat 3.3 and try to access a session-EJB from an Action-Class. When I try to get an InitialContext in my Action-Class: Hashtable env = new Hashtable(); Context ic = new InitialContext(env); EJBMMHome home = (EJBMMHome) ic.lookup(EJBMM); I get the error: class javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial. I think, the Context.INITIAL_CONTEXT_FACTORY and Context.PROVIDER_URL, have to put to the env-Hashtable. env.put(Context.INITIAL_CONTEXT_FACTORY, initCtxFactory); env.put(Context.PROVIDER_URL, providerURL); ??? but what are the values for initCtxFactory and providerURL ??? Can anybody help me? Gruß Michael -- Java - write once, run anywhere
RE: Checkbox Arrays
I posted this same response to your Posting Collections question yesterday. Here it is again. If you use the html:multibox, you can get back an array of key values instead of an array of booleans. They key values can be Longs, Strings, whatever, as long as it uniquely identifies the row that you want to know was checked. If you haven't used multibox, it generates an html checkbox. The array that will be set in your form will only contain the key values for the rows that were checked. Here is the post from yesterday: I think I am doing the same thing that you want to do using the html:multibox. When the form is submitted you get an array of the ids that are checked and then you can go delete them. in the jsp form (where restaurant id is a key for the item being deleted): logic:iterate id=restaurant name=favoriterestaurants ... html:multibox property=favoriteRestaurantRemoveList bean:write property=restaurantId name=restaurant/ /html:multibox ... /logic:iterate in the form class: private Long favoriteRestaurantRemoveList[] = new Long[0]; public Long[] getFavoriteRestaurantRemoveList() { return (this.favoriteRestaurantRemoveList); } public void setFavoriteRestaurantRemoveList(Long favoriteRestaurantRemoveList[]) { this.favoriteRestaurantRemoveList = favoriteRestaurantRemoveList; } I am not sure if initializing the array to new Long[0] is necessary, probably not. -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 11:52 AM To: Struts User Subject: Checkbox Arrays Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony
Re: JBuilder Tags
No - I don't believe it's possible to breakpoint a CUSTOM tag...it's probably a limitation of the built-in browser which maintains a table of only the JSP tags. This would be a terrific enhancement.I will pose it to the JBuilder newsgroup. - Original Message - From: Rajan Gupta [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Mark Simms [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 8:48 AM Subject: Re: JBuilder Tags I am using JBUilder 4, but the debugger does not let me set a breakpoint on a tag on a JSP page. I can though set a breakpoint inside the Tag code, but that is not that interesting. Have u succeeded to set a breakpoint on a tag in a JSP page? --- Mark Simms [EMAIL PROTECTED] wrote: Upgrade to Jbuilder 4 Enterprise edition - tablib debugging, JSP debugging, introspection, etc. 1) It does have it share of bugs however...hint: don't use the built-in browser.bug city. 2) Requires minimum 256mb Windows box / 128mb Linux box - 500 mhz processor or better - Original Message - From: Sean Pritchard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 2:13 PM Subject: RE: JBuilder Tags Here's a related question. I use JBuilder3 for regular development and also for JSPs. But with JSP's it is little more than a text editor. Does anyone have any suggestions for how to get introspection to work while editing a JSP page(so I get drop-down's with methods after I type .)? Thanks Sean -Original Message- From: Rajan Gupta [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 09, 2001 1:11 PM To: [EMAIL PROTECTED] Subject: JBuilder Tags I am able to debug standard JSP pages inside JBuilder environment, but when it comes to custom tags, it does not let me set break points on a line which has a struts tag. Has anybody debugged JSP tags with JBuilder? Thanks, Rajan __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: Checkbox Arrays
Yeah - I'm looking at that. My problem now is how to get the value for each checkbox. My bean has an id property - so I have tried this kind of thing: logic:iterate id=retailer name=retailerForm property=retailers tr tdhtml:checkbox name=retailer property=delete value=bean:write name=retailer property=id///td tdbean:write name=retailer property=id//td tdhtml:text name=retailer property=name//td /tr /logic:iterate But it doesn't like having the bean:write embedded there. Am I missing something obvious? Many thanks Tony From: Peter Alfors [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Checkbox Arrays Date: Thu, 10 May 2001 11:09:18 -0500 Im not sure how the ActionForm changes things, but without an actionform your could do this Each checkbox can have the same name, but a different value. When the form is submitted, the checkboxes that have been checked are in the request. You can use the request.getParameterValues(checkBoxName) to retrieve a string array of the values for the checked boxes. HTH, Pete Tony Karas wrote: Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony peter.alfors.vcf _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Philosophical question(s) related to STRUTS
1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
Re: Checkbox Arrays
the way we solved this was to create a hidden field for each checkbox that holds the value that would be sent if the checkbox were to be checked. I then compare the full value array sent by the hidden values with the partial array sent by the checkboxes to see which ones were checked and which weren't. Both of these, of course, are inside a logic:iterate block. HTH, - eric - Original Message - From: Tony Karas [EMAIL PROTECTED] To: Struts User [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 8:52 AM Subject: Checkbox Arrays Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony
RE: NoInitialContextException
Well the first thing that strikes me is that there would be no (ejb) initial context to obtain since Tomcat is not an EJB container. ;) I recommend downloading JBoss from http://www.jboss.org/ for doing that sort of thing. Their values for INITIAL_CONTEXT_FACTORY and PROVIDER_URL are on their docs pages. :) Chris -Original Message- From: Michael Schommer [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:45 PM To: [EMAIL PROTECTED] Subject: NoInitialContextException Hi, I'm using a Tomcat 3.3 and try to access a session-EJB from an Action-Class. When I try to get an InitialContext in my Action-Class: Hashtable env = new Hashtable(); Context ic = new InitialContext(env); EJBMMHome home = (EJBMMHome) ic.lookup(EJBMM); I get the error: class javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial. I think, the Context.INITIAL_CONTEXT_FACTORY and Context.PROVIDER_URL, have to put to the env-Hashtable. env.put(Context.INITIAL_CONTEXT_FACTORY, initCtxFactory); env.put(Context.PROVIDER_URL, providerURL); ??? but what are the values for initCtxFactory and providerURL ??? Can anybody help me? Gruß Michael -- Java - write once, run anywhere
Quick Iterate Question - DefaultTableModel
Here's a quick one - anyone use or modify iterate to support iterations through a DefaultTableModel. Since it's just a vector of vectors we tried nesting iterate tags, but to no avail. Anyone already done this or do I need to code it myself if I want it (hehe)? :) Chris
RE: Philosophical question(s) related to STRUTS
Title: RE: Philosophical question(s) related to STRUTS I believe that developers are starting to committ to Struts. This info. should be in the archive, but here it is again. Its noteworthy that the new 2nd edition Professional JSP book published by WROX (http://www.amazon.com/exec/obidos/ASIN/1861004958/smw-20) has a whole chapter dedicated to Struts. -Original Message- From: Mark Simms [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 9:44 AM To: [EMAIL PROTECTED] Subject: Philosophical question(s) related to STRUTS 1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
RE: Philosophical question(s) related to STRUTS
Just as a small aside, Wrox has devoted a chapter to Struts in their latest Professional JSP book (http://www.wrox.com/Books/Book_Details.asp?section=11_3isbn=1861004958sub ject=subject_id=) so I'd say it's definitely getting some recognition! :) Chris -Original Message- From: Mark Simms [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:44 PM To: [EMAIL PROTECTED] Subject: Philosophical question(s) related to STRUTS 1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
Re: I'm back! -- workflow
tataryn:craig What work has been done so far on this effort? Is there any documentation or source available for folks to review/use/contribute to what's being done. I have some interest in a struts based workflow mechanism, and have done a little work on my own in this area (just a proof-of-concept at this point). Thanks, james:darren/:) Craig Tataryn Craig.Tataryn@morganstTo: [EMAIL PROTECTED], [EMAIL PROTECTED] anley.com cc: Subject: I'm back! 05/09/01 12:55 PM Please respond to struts-user Hi guys, I haven't been participating lately in the mailing list because I recently moved from the US back to Canada so I haven't had too much spare time. Any how, now that I am settled in I would like to start work on the Struts Workflow TODO. I was wondering if anyone other than my self and Nic would be interested in participating? Also, my webserver was down the other day. The owner had to do some maintenance. It's back up, and actually instead of using the old us-eh address to get to my struts tutorial you can get to it via: http://www.computer-programmer.org/articles/struts/ Ted, can you update your web page to point to the new computer-programmer address? Thanks, tataryn:craig/
RE: Checkbox Arrays
Don't use the html:checkbox, use html:multibox and use bean:write in the body of the tag. An html:multibox resolves to an HTML checkbox. Hal -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:44 PM To: [EMAIL PROTECTED] Subject: Re: Checkbox Arrays Yeah - I'm looking at that. My problem now is how to get the value for each checkbox. My bean has an id property - so I have tried this kind of thing: logic:iterate id=retailer name=retailerForm property=retailers tr tdhtml:checkbox name=retailer property=delete value=bean:write name=retailer property=id///td tdbean:write name=retailer property=id//td tdhtml:text name=retailer property=name//td /tr /logic:iterate But it doesn't like having the bean:write embedded there. Am I missing something obvious? Many thanks Tony From: Peter Alfors [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Checkbox Arrays Date: Thu, 10 May 2001 11:09:18 -0500 Im not sure how the ActionForm changes things, but without an actionform your could do this Each checkbox can have the same name, but a different value. When the form is submitted, the checkboxes that have been checked are in the request. You can use the request.getParameterValues(checkBoxName) to retrieve a string array of the values for the checked boxes. HTH, Pete Tony Karas wrote: Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony peter.alfors.vcf __ ___ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Shouldn't rewrite have the same attributes as link in struts-html.tld?
Ugh... for the first time ever I had to write a pop-up using javascript :( I'd like to do: script type=text/javascript function addProductToCart() { opener.location.href = html:rewrite forward=addProductToCart paramId=productId paramName=productId/ window.close() } /script ...in place of using a form so that pop-up disappears and the parent window submits the action. However struts-html.tld does not declare paramId and paramName attributes for the rewrite tag as it does for the link tag. Seeing as the RewriteTag tag is a subclass of LinkTag, and indeed calls RequestUtils.computeParameters and RequestUtils.computeURL with all the usual LinkTag parameters (paramId, paramName, paramProperty, etc.), copying the link attributes to rewrite in struts-html.tld works exactly how I'd like it to. Is there any reason why the rewrite tag be the same as link tag? I searched bugzilla and mail-archive.com for rewrite and have not found anything on this matter. Should I file a bug?
RE: Philosophical question(s) related to STRUTS
This article touches on some of the concerns you've raised. http://www.sys-con.com/java/archives/0603/mcclanahan/index_i.html -Original Message- From: Mark Simms [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 9:44 AM To: [EMAIL PROTECTED] Subject: Philosophical question(s) related to STRUTS 1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
Re: Checkbox Arrays
Try pulling the bean value out into a script variable. Taglibs cannot be nested within another taglib as an attribute. Tony Karas wrote: Yeah - I'm looking at that. My problem now is how to get the value for each checkbox. My bean has an id property - so I have tried this kind of thing: logic:iterate id=retailer name=retailerForm property=retailers tr tdhtml:checkbox name=retailer property=delete value=bean:write name=retailer property=id///td tdbean:write name=retailer property=id//td tdhtml:text name=retailer property=name//td /tr /logic:iterate But it doesn't like having the bean:write embedded there. Am I missing something obvious? Many thanks Tony From: Peter Alfors [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Checkbox Arrays Date: Thu, 10 May 2001 11:09:18 -0500 Im not sure how the ActionForm changes things, but without an actionform your could do this Each checkbox can have the same name, but a different value. When the form is submitted, the checkboxes that have been checked are in the request. You can use the request.getParameterValues(checkBoxName) to retrieve a string array of the values for the checked boxes. HTH, Pete Tony Karas wrote: Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony peter.alfors.vcf _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. begin:vcard n:; x-mozilla-html:FALSE org:BRIMG SRC=http://www.irista.com/logo/irista.gif;BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain adr:;; version:2.1 end:vcard
RE: Philosophical question(s) related to STRUTS
Struts has a bright future, as long as JSPs have a future. I don't think Struts has any serious competition among JSP-centric MVC frameworks, but Struts' fate is somewhat tied to that of JSPs. If you decide that you don't like JSPs then there are lots of competitors to JSPs, mainly templating languages like Velocity or XML focused solutions like Cacoon/XSP or (soon) Microsoft WebForms. MS Webforms strikes me as a direct competitor of Struts since they are both geared towards Webapps. (It's probably not MVC though?) I personally like JSPs/Struts but it's good that there is competition out there. I also think the different technologies work well for different types of web-sites or even different parts of a site. I hope Struts continues to open up to other non-JSP presentation frameworks. Struts works especially well for Webapps. If you have a large brochure/informational site, it might make sense to store that in XML and convert it to HTML in batch via XSLT. There are probably other examples but I have only worked on a few web-sites (none using XML). One thing I have been wondering about recently, are we headed towards a world where servers serve up XML and XSLT is done on the client? How does JSP work in that kind of environment? Webforms: http://msdn.microsoft.com/vstudio/nextgen/technology/webforms.asp You ask for thoughts, those are mine Hal -Original Message- From: Mark Simms [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:44 PM To: [EMAIL PROTECTED] Subject: Philosophical question(s) related to STRUTS 1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
RE: Philosophical question(s) related to STRUTS
I have been doing research for my company pertaining to adopting a framework/methodology for developing all future applications. I am convinced that Struts is a very solid solution and will be pushing *heavily* for the adoption of it within our architecture. I have been monitoring this list for the last month or so and have been very impressed with the willingness of people in this community, not only to help solve issues, but to also collaborate on projects that will be beneficial to the community as a whole. Of course this is my opinion, but when you think about it, a product that is well architect, has a large support group, and .. the most important part... is free and not proprietary, will more than likely catch on. a -Original Message- From: Mark Simms [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:44 PM To: [EMAIL PROTECTED] Subject: Philosophical question(s) related to STRUTS 1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
how to forward from one action servlet to another?
Hi, how do you forward from one action servlet to another? I have a form that gets submitted to a servlet that I may depending on a value pass it off to another servlet to process. Any help is appreciated. Alex ext. 104 Fax: 1-905-777-0132
RE: Philosophical question(s) related to STRUTS
Good point Hal, WebForms are just a tiny part of what makes up .NET and I forsee the battle between MS and Sun becoming *extremely* aggressive in the near future. .NET and J2EE are two attempts at the (basically) the same end result and both do an excellent job (I'm going to say I think .NET will win the battle but not the war). If Sun is going to take Struts in for the Blueprints thing, then definitely anticipate it being heard where-ever JSP is. :) Chris -Original Message- From: Deadman, Hal [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 2:11 PM To: [EMAIL PROTECTED] Subject: RE: Philosophical question(s) related to STRUTS Struts has a bright future, as long as JSPs have a future. I don't think Struts has any serious competition among JSP-centric MVC frameworks, but Struts' fate is somewhat tied to that of JSPs. If you decide that you don't like JSPs then there are lots of competitors to JSPs, mainly templating languages like Velocity or XML focused solutions like Cacoon/XSP or (soon) Microsoft WebForms. MS Webforms strikes me as a direct competitor of Struts since they are both geared towards Webapps. (It's probably not MVC though?) I personally like JSPs/Struts but it's good that there is competition out there. I also think the different technologies work well for different types of web-sites or even different parts of a site. I hope Struts continues to open up to other non-JSP presentation frameworks. Struts works especially well for Webapps. If you have a large brochure/informational site, it might make sense to store that in XML and convert it to HTML in batch via XSLT. There are probably other examples but I have only worked on a few web-sites (none using XML). One thing I have been wondering about recently, are we headed towards a world where servers serve up XML and XSLT is done on the client? How does JSP work in that kind of environment? Webforms: http://msdn.microsoft.com/vstudio/nextgen/technology/webforms.asp You ask for thoughts, those are mine Hal -Original Message- From: Mark Simms [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:44 PM To: [EMAIL PROTECTED] Subject: Philosophical question(s) related to STRUTS 1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
Re: how to forward from one action servlet to another?
You could either define a forward for this action in struts-config.xml, or construct a new ActionForward on the fly. Alex Colic wrote: Hi, how do you forward from one action servlet to another? I have a form that gets submitted to a servlet that I may depending on a value pass it off to another servlet to process. Any help is appreciated. Alex ext. 104 Fax: 1-905-777-0132
RE: how to forward from one action servlet to another?
If you are using just Struts, then you have only one servlet, the ActionServlet. If you are using struts in conjunction with some other servlets, then in your action class do this... public class XYZAction extends Action { public ActionForward perform(mapping, form, request, response) { request.setAttribute(form, form) ; servlet.getServletConfig().getServletContext().getRequestDispacher(path to the other servlet).forward(request,response) ; } } -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 2:29 PM To: Struts Subject: how to forward from one action servlet to another? Hi, how do you forward from one action servlet to another? I have a form that gets submitted to a servlet that I may depending on a value pass it off to another servlet to process. Any help is appreciated. Alex ext. 104 Fax: 1-905-777-0132
RE: Posting Collections
This issue applies to all form field tags, not just checkboxes. Modifying struts tags is currently a pain, but I just subimitted a bugzilla enhancement to re-factor the tags so that they are more granualar and make it easier to override descrete bits such as generating the name attribute. In principle the enhacement has been accepted and I hope to submit a patch in the next few days. If it is accepted I will have a set of custom versions of these tags for this behviour very soon and you won't have to start hacking around with the code every time a new version comes out and anyone will be welcome to them. Addtionally this issue is all on the ToDo list for 1.1 and I'm sure it will be sorted then. I think struts is excellent, and I love open source because you can always look inside to see what they've done. Of course it doesn't do everything yet ;-) but I can't see it getting anything but better. We have done quite a bit of work customizing the ActionServlet and the way its been built is excellent, making it really easy to add addtional behaviour (hopefully) without having to hack around every time a new version comes out. Niall -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: 10 May 2001 10:34 To: [EMAIL PROTECTED] Subject: RE: Posting Collections Many thanks Niall, that clears things up for me. Do you know if there is a reason why this is the behaviour for checkboxes? Is this just with checkboxes or other tags as well? I don't really like the idea of modifying the struts code - the whole point of deciding to use it is for code reuse - I don't want to start hacking around with the code every time a new version comes out. Do you have an opinion on using Struts? I've been using it for a couple of weeks now and have been struggling because of basic lack of information. I get most of my training from this news group! I'm wondering whether I should just jack it in and use something else. Cheers Tony From: Niall Pemberton [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: Posting Collections Date: Wed, 9 May 2001 20:51:00 +0100 The problem is the CheckBox tag currently sets the HTML name attribute to the property, so your JSP will produced something like this: input type=checkbox name=delete So all the checkbox fields will have the same name. In order for Struts to populate your Retailer bean with the delete values you need the generated HTML to look like this: input type=checkbox name=retailer[0].delete input type=checkbox name=retailer[1].delete etc etc. Struts would then use getRetailer(0).setDelete(boolean) to set the delete attributes correctly. Unfortunately there is no easy solution - many people resort to scriptlets to generate the name properly and there are quite a few messages in the archive about this. I created my own versions of Struts tags and changed them to generate the name correctly - I like that much better - no java in the view. Niall -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: 09 May 2001 17:50 To: [EMAIL PROTECTED] Subject: Posting Collections Briefly, this is what I am trying to achieve: - Retrieve a list of items from a database - Display each item with a corresponding checkbox - Display a Delete button - which when pressed deletes all checked items. Unfortunately, although I have managed to display the items correctly and set the checkbox value using boolean values, when I do the form submit - my ActionForm properties do not get filled in. This is the code I have: My ActionForm looks like this: public class RetailerForm extends ActionForm { protected Vector retailer; /* * On construction, fill the form with all the retailers */ public RetailerForm() throws SQLException { //here i have some code to generate my vector //which is comprised of Retailer beans. } public Retailer getRetailer( int index ) { return (Retailer)retailer.elementAt( index ); } public Vector getRetailer() { return retailer; } public void setRetailer( Vector value ) { retailer = value; } } My Retailer bean has get and set elements for properties called delete and name. My struts code looks like this (obviously within html:form tags): logic:iterate id=retailer name=retailerForm property=retailer tr tdhtml:checkbox name=retailer property=delete//td tdbean:write name=retailer property=name//td /tr /logic:iterate And this all works ok for displaying the data. However, when I do the submit my delete property for each bean is not set and I have added debugging code to the set method and this is not called by
Re: how to forward from one action servlet to another?
Alex, if I understand you correctly, you can set up the forwarding in your struts-config.xml to point to the next action path: eg !-- Process Log filter -- action path=/ProcessLogFilter type=beans.ProcessLogFilterAction name=LogFilterForm input=/logFilter.jsp validate=true forward name=success path=/ShowLog.do redirect=false / /action hth, Dave Alex Colic [EMAIL PROTECTED] on 05/10/2001 02:29:28 PM Please respond to [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: how to forward from one action servlet to another? Hi, how do you forward from one action servlet to another? I have a form that gets submitted to a servlet that I may depending on a value pass it off to another servlet to process. Any help is appreciated. Alex ext. 104 Fax: 1-905-777-0132
RE: My first
there's instructions in the website. http://jakarta.apache.org/struts/installation-wls.html -Original Message- From: Kiet Nguyen [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:07 PM To: '[EMAIL PROTECTED]' Subject: My first I'm trying to setup struts to work with weblogic51. I build the source code and trying to deploy a app. I don't have any luck. Is there any app out there to help me going. I want to be able to trace through the framework. Is there any struts document out there.. thanks
RE: My first
http://jakarta.apache.org/struts http://jakarta.apache.org/struts/userGuide/index.html http://jakarta.apache.org/struts/installation.html http://jakarta.apache.org/struts/installation-wls.html Look in the struts distribution that you built: src/example/* dist/webapps/struts-example.war - example application dist/webapps/struts-documentation.war - documentation -Original Message- From: Kiet Nguyen [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 3:07 PM To: '[EMAIL PROTECTED]' Subject: My first I'm trying to setup struts to work with weblogic51. I build the source code and trying to deploy a app. I don't have any luck. Is there any app out there to help me going. I want to be able to trace through the framework. Is there any struts document out there.. thanks
RE: how to forward from one action servlet to another?
Will this not keep the thread of ActionServlet which invoked perform() method hanging? --- Nanduri, Amarnath [EMAIL PROTECTED] wrote: If you are using just Struts, then you have only one servlet, the ActionServlet. If you are using struts in conjunction with some other servlets, then in your action class do this... public class XYZAction extends Action { public ActionForward perform(mapping, form, request, response) { request.setAttribute(form, form) ; servlet.getServletConfig().getServletContext().getRequestDispacher(path to the other servlet).forward(request,response) ; } } -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 2:29 PM To: Struts Subject: how to forward from one action servlet to another? Hi, how do you forward from one action servlet to another? I have a form that gets submitted to a servlet that I may depending on a value pass it off to another servlet to process. Any help is appreciated. Alex ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: Checkbox Arrays
I don't know if this is the right thread. But I just got multibox working in my app (including preservation of checkbox entries between forwards). Let me share with you what I have to see if this helps: in Jsp: (cleanSolutionAreaTypes in an Application-scoped Vector) tr td align=left Solutions Area* /td td align=left logic:iterate id=solutionAreaType name=cleanSolutionAreaTypes html:multibox property=solutionAreaTypes bean:write name=solutionAreaType property=id/ /html:multibox bean:write name=solutionAreaType property=name/br /logic:iterate /td /tr in Form: protected String[] solutionAreaTypes = new String[0]; public String[] getSolutionAreaTypes() { return solutionAreaTypes; } public void setSolutionAreaTypes(String[] solutionAreaTypes) { this.solutionAreaTypes = solutionAreaTypes; } What was causing me some exceptions was this. I originally used another application-scoped vector called solutionAreaTypes for other purposes (like drop-down lists). That Vector contains an entry that has a null ID value (eg. name = --specify-- value=). This was causing Struts to throw a non-intuitive exception. I then created another Vector without this entry in it and everything seems to work fine now. Of course I've only gotten it to work about 15 minutes ago so I'll let you know later if it really works ;-) - jeff - Original Message - From: Peter Alfors [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 2:01 PM Subject: Re: Checkbox Arrays Try pulling the bean value out into a script variable. Taglibs cannot be nested within another taglib as an attribute. Tony Karas wrote: Yeah - I'm looking at that. My problem now is how to get the value for each checkbox. My bean has an id property - so I have tried this kind of thing: logic:iterate id=retailer name=retailerForm property=retailers tr tdhtml:checkbox name=retailer property=delete value=bean:write name=retailer property=id///td tdbean:write name=retailer property=id//td tdhtml:text name=retailer property=name//td /tr /logic:iterate But it doesn't like having the bean:write embedded there. Am I missing something obvious? Many thanks Tony From: Peter Alfors [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Checkbox Arrays Date: Thu, 10 May 2001 11:09:18 -0500 Im not sure how the ActionForm changes things, but without an actionform your could do this Each checkbox can have the same name, but a different value. When the form is submitted, the checkboxes that have been checked are in the request. You can use the request.getParameterValues(checkBoxName) to retrieve a string array of the values for the checked boxes. HTH, Pete Tony Karas wrote: Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony peter.alfors.vcf _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
RE: Philosophical question(s) related to STRUTS
Struts is the topic of a seminar at BorCon 2001 http://www.borcon.com/. There are no online links for this particular seminar, but it's outlined on their snailer mailer: Seminar 3148 - Configuring AppServer to Work with Struts I guess AppServer is (or contains) Borland's web server, but I've never worked with it. Anthony -Original Message- From: Mark Simms [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 9:44 AM To: [EMAIL PROTECTED] Subject: Philosophical question(s) related to STRUTS 1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
RE: Philosophical question(s) related to STRUTS
In response to number 2 Java serverside professional developers can choose to wait until Sun provides some kind of blessing, or they can think for themselves. This might save some people from reinventing the struts wheel all over again. Struts-like functionality must be provided one way or another. Remember, big wheels turn slow. Hope it helps. JH -Original Message- From: TJM Todd McGregor [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 2:01 PM To: '[EMAIL PROTECTED]' Subject: RE: Philosophical question(s) related to STRUTS This article touches on some of the concerns you've raised. http://www.sys-con.com/java/archives/0603/mcclanahan/index_i.html -Original Message- From: Mark Simms [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 9:44 AM To: [EMAIL PROTECTED] Subject: Philosophical question(s) related to STRUTS 1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
Re: I'm back! -- workflow
Absolutley nothing has been done! We are in design mode, basically I need to draft up a functional spec so we can start deligating chunks of it out to people intrested in contributing (sort of make a more granular TODO list). I'll put you on the struts-workflow mail list I have going, and I will send you updates as they come along... Thanks, tataryn:craig status=chilling/ ;) [EMAIL PROTECTED] wrote: tataryn:craig What work has been done so far on this effort? Is there any documentation or source available for folks to review/use/contribute to what's being done. I have some interest in a struts based workflow mechanism, and have done a little work on my own in this area (just a proof-of-concept at this point). Thanks, james:darren/:) Craig Tataryn Craig.Tataryn@morganstTo: [EMAIL PROTECTED], [EMAIL PROTECTED] anley.com cc: Subject: I'm back! 05/09/01 12:55 PM Please respond to struts-user Hi guys, I haven't been participating lately in the mailing list because I recently moved from the US back to Canada so I haven't had too much spare time. Any how, now that I am settled in I would like to start work on the Struts Workflow TODO. I was wondering if anyone other than my self and Nic would be interested in participating? Also, my webserver was down the other day. The owner had to do some maintenance. It's back up, and actually instead of using the old us-eh address to get to my struts tutorial you can get to it via: http://www.computer-programmer.org/articles/struts/ Ted, can you update your web page to point to the new computer-programmer address? Thanks, tataryn:craig/
RE: how to forward from one action servlet to another?
Nope the thread after invoking perform() will then decide what to do next. Since you are already making its decision, it won't complain and will die gracefully. An other way to do it is already pointed out by other people. In your struts-config.xml file map the forward to a different servlet One thing you might want to consider ... If you are using a web application (war file or ear file) you have to declare all your servlets in the web.xml file. cheers, Amar.. -Original Message- From: Rajan Gupta [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 3:45 PM To: [EMAIL PROTECTED] Subject: RE: how to forward from one action servlet to another? Will this not keep the thread of ActionServlet which invoked perform() method hanging? --- Nanduri, Amarnath [EMAIL PROTECTED] wrote: If you are using just Struts, then you have only one servlet, the ActionServlet. If you are using struts in conjunction with some other servlets, then in your action class do this... public class XYZAction extends Action { public ActionForward perform(mapping, form, request, response) { request.setAttribute(form, form) ; servlet.getServletConfig().getServletContext().getRequestDispacher(path to the other servlet).forward(request,response) ; } } -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 2:29 PM To: Struts Subject: how to forward from one action servlet to another? Hi, how do you forward from one action servlet to another? I have a form that gets submitted to a servlet that I may depending on a value pass it off to another servlet to process. Any help is appreciated. Alex ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Help needed extending BaseHandlerTag
I want to create my own Radio button tag that's a slightly modified version of the struts RadioTag. So, I made a new class that extends BaseHandlerTag (just like RadioTag) and copied the RadioTag code to my new class (NewRadioTag). I successfully compiled my new Tag and added it to my existing custom tld file. Now keep in mind that the code is EXACTLY the same as Struts' RadioTag except for a couple extra imports I had to make because the new package is different. I then modified the JSP file from using html:radio to test:radio. The exception I get is: javax.servlet.ServletException: runtime failure in custom tag 'form' at jsp_servlet._jsp._supplier._company._companytype._jspService(_companytype.ja va:1097) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :106) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :124) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:154) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1697) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1540) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :106) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:154) at com.zeborg.erfp.web.servlet.NavigationServlet.service(NavigationServlet.java :113) at javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :106) at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp l.java:907) at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp l.java:851) at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext Manager.java:252) at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:364) at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:252) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129) Why would this happen given that my new tag has IDENTICAL code to RadioTag, which works. My platform is Weblogic 5.1SP8.
RE: Help needed extending BaseHandlerTag
I think weblogic is masking the real error. Put a temporary try catch block inside your html:form tag on the JSP to trap the real error. If the exception is a ServletException, get the root exception Hal -Original Message- From: Ariff Sidi [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 7:01 PM To: [EMAIL PROTECTED] Subject: Help needed extending BaseHandlerTag I want to create my own Radio button tag that's a slightly modified version of the struts RadioTag. So, I made a new class that extends BaseHandlerTag (just like RadioTag) and copied the RadioTag code to my new class (NewRadioTag). I successfully compiled my new Tag and added it to my existing custom tld file. Now keep in mind that the code is EXACTLY the same as Struts' RadioTag except for a couple extra imports I had to make because the new package is different. I then modified the JSP file from using html:radio to test:radio. The exception I get is: javax.servlet.ServletException: runtime failure in custom tag 'form' at jsp_servlet._jsp._supplier._company._companytype._jspService(_ companytype.ja va:1097) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servle tStubImpl.java :106) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servle tStubImpl.java :124) at weblogic.servlet.internal.RequestDispatcherImpl.forward(Reques tDispatcherImp l.java:154) at org.apache.struts.action.ActionServlet.processActionForward(Ac tionServlet.ja va:1697) at org.apache.struts.action.ActionServlet.process(ActionServlet.j ava:1540) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servle tStubImpl.java :106) at weblogic.servlet.internal.RequestDispatcherImpl.forward(Reques tDispatcherImp l.java:154) at com.zeborg.erfp.web.servlet.NavigationServlet.service(Navigati onServlet.java :113) at javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servle tStubImpl.java :106) at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Ser vletContextImp l.java:907) at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Ser vletContextImp l.java:851) at weblogic.servlet.internal.ServletContextManager.invokeServlet( ServletContext Manager.java:252) at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketH TTP.java:364) at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:252) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129) Why would this happen given that my new tag has IDENTICAL code to RadioTag, which works. My platform is Weblogic 5.1SP8.
Re: FW: Design Error? Bean repopulation...
I had this problem, and worked out a solution that seemed workable. The main thing to remember with the html:xxx/ tags is the the name part should always be the name of the form bean, and the property be relative to that, otherwise the BeanUtils won't be able to repopulate the form. I tend to store my collections in SortedMap's and use the primary key of the database table as the index into the SortedMap (This means, each bean has a getId() which is an integer, and the Bean has the comparable interface to sort them). Then when I do the iterate, I iterate over the keys of the map and return just the Map.Entry values. Then when I do the html:xxx/ I have something like (this if from memory, based on your code, it might take a few hacks to get right, I think you'll need a useBean for the retailerForm, can remember) logic:iterate id=entry collection=%= retailerForm.getRetailers().getEntries().iterator() % html:text name=retailerForm property=%= retailerBean[\ + ((Map.Entry) entry).getKey()) + \] %/ %!-- or, if the bean identity id id, and so we use getId)( --% html:text name=retailerForm property=%= retailerBean[\ + ((RetailerBean) ((Map.Entry) entry).getValue())).getId() + \] %/ /logic:iterate I use this method all the time, it works great. Here's another message with a copy of the code I use http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg07627.html - I have a number of beans held in a Vector. - In my ActionForm I have a two getters for this vector - one returns the vector and one returns elements of the vector - so something like this: public RetailerBean getRetailerBean( int index ) { return (RetailerBean)retailers.elementAt( index ); } and public Vector getRetailers() { return retailers; } This works fine to populate using the following type of iterate tag: logic:iterate id=retailer name=retailerForm property=retailers tr tdhtml:checkbox name=retailer property=delete//td tdhtml:text name=retailer property=name//td /a/td-- /tr /logic:iterate However, it doesn't repopulate the beans when I do a submit. This is because the generated html is something like: input type=checkbox name=delete rather than: input type=checkbox name=retailer[0].delete input type=checkbox name=retailer[1].delete which would allow my beans to be repopulated. The outcome of this is that I have to create arrays for all properties of my beans in my ActionForm and take the values from there. This seems like bodge-heaven and not at all object-oriented. If the form can be populated directly from the beans then surely it should work the other way too.
Initialization of Request-Scoped Objects
When myAction.do is called, I have a chance within reset() to initialize my request-scoped objects. However, if myAction.jsp is called instead then I can't seem to find a way to get initialized. Are there any methods called in my Action class when the .jsp file is invoked instead of the .do file?
Re: Initialization of Request-Scoped Objects
No. What I do (antd I think it this is from the example app as well, maybe subscription.jsp) is to put at the beginning of the .jsp file (this is from memory, don't have the code handy) logic:notPresent name=yourFormBean logic:forward forward=editFormCode/ /logic:notPresent Where editFormCode is set up as a forward in the struct-config.xml file. This way, if the form bean has not been set up, it forwards the code through the form bean. This technique is useful for things like checking a user bean has been set in the session as well. Jeff Trent wrote: When myAction.do is called, I have a chance within reset() to initialize my request-scoped objects. However, if myAction.jsp is called instead then I can't seem to find a way to get initialized. Are there any methods called in my Action class when the .jsp file is invoked instead of the .do file?
Re: Philosophical question(s) related to STRUTS
As a profession developer I have taken to learning how to use Struts for several reasons (besides being Java, and thus way cool). It's free. It doesn't cost me anything to develop or deploy. Open Source. If the development team die in a freak accident from caffeine overdose at something like JavaOne then I can continue to apply my own patches to it. If Oracle disappeared tomorrow (or Cisco?) then who is going to apply patches, provide support and have further releases? if you end up developing your own framework, that's great but why re-invent the wheel? Does it matter if it doesn't become sanctioned? Your own framework won't become sanctioned? I developed my own framework when Turbine was being developed and discovered that amount of work it took was huge. I could have adopted Turbine an done all the development with that (I didn't because Turbine is huge and I was starting out with JavaServlets, and the best way I learn is to do it myself.) 1) Is SunMicro going to be supporting STRUTS from a financial and/or marketing standpoint ? I only saw one tiny, tiny mention of STRUTS in the JAVAONE outline of presentations I just got in the mail. That bothers me. 2) If the answer to #1 is unknown, will JSP/Java serverside professional developers take the time to learn STRUTS and employee it in their web applications ? 3) If the answer to #1 is unknown, will corporations and consulting firms decide to committ to STRUTS in lieu of their own frameworks and methodology ? I am wading thru the one-inch thick documentation and I must say I am really impressed with the work done so far. However, as a consultant, I must be concerned about spending too much time with this if it is not going to become a popular or sanctioned approach in the webdev marketplace. Thoughts / feedback anyone ?
RE: Newbie Question: Servlet Exception - This is being answered by Dudley - giving something back to the user group for all the help i got - thanx all u guys
Thanks, that was just what I needed. Now, on to the next step - connecting to a database. kln -Original Message- From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 2:41 AM To: '[EMAIL PROTECTED]' Subject: RE: Newbie Question: Servlet Exception - This is being answered by Dudley - giving something back to the user group for all the help i got - thanx all u guys You need to make sure the html:form action=/logon tag in you jsp page, is declared in your struts config file ..here is an example of my struts confignotice the action path=/logon tag.You need one of these for every different html:form action= tag in you jsp page. ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; struts-config !-- == Form Bean Definitions === -- form-beans form-bean name=loginForm type=com.didata.itax.payment.web.actionform.LoginActionForm/ form-bean name=eFilerForm type=com.didata.itax.payment.web.actionform.EFilerActionForm/ form-bean name=taxPayerForm type=com.didata.itax.payment.web.actionform.TaxPayerActionForm/ /form-beans !-- == Global Forward Definitions == -- global-forwards forward name=logonForm path=/logon.jsp/ forward name=mainMenu path=/mainMenu.jsp/ forward name=index path=/index.jsp/ forward name=eFilerpath=/EFilerMenu.jsp/ /global-forwards !-- == Action Mapping Definitions == -- action-mappings actionpath=/logon type=com.didata.itax.payment.web.action.LoginAction name=loginForm scope=request input=/logon.jsp forward name=failure path=/index.html/ forward name=success path=/login.jsp/ /action actionpath=/eFilerAdd type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request input=/EFilerInput.jsp forward name=failure path=/EFilerInput.jsp/ forward name=success path=/EFilerDone.jsp/ /action action path=/eFilerEdit type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request forward name=failure path=/EFilerMenu.jsp/ forward name=success path=/EFilerInput.jsp/ /action action path=/eFilerUpdateState type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request forward name=failure path=/EFilerList.jsp/ forward name=success path=/EFilerDoneList.jsp/ /action action path=/eFilerDelete type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request forward name=failure path=/EFilerMenu.jsp/ forward name=success path=/EFilerList.jsp/ /action actionpath=/eFiler type=com.didata.itax.payment.web.action.EFilerAction name=eFilerForm scope=request input=/EFilerMenu.jsp forward name=failure path=/index.jsp/ forward name=success path=/EFilerList.jsp/ /action /action-mappings /struts-config -Original Message- From: Kevin Newman [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 7:07 AM To: Struts-User (E-mail) Subject: Newbie Question: Servlet Exception Hi All, I've just loaded struts and am having a little problem. I started by placing the *.war files in webapps directory. After copying xalan xerces jar files into the lib directory almost all of the example apps worked. My next step was to setup the struts-blank then modify it to get a feel for how strut works. When I try to add logon to the blank app I get the message below. What does this mean? Do I need to post more info? Platform: Windows 2000 Servlet Engine: Tomcat 4.0 b3 Struts: 1.0-b1 Thanks, Kevin Newman A Servlet Exception Has Occurred Exception Report: javax.servlet.ServletException: Cannot retrieve mapping for specified form action path /logon at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:441) at org.apache.jsp.logon_jsp._jspService(logon_jsp.java:299) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:200) at
RE: How do you use indexed properties with html:input?
Richard, Make sure that your bean is put in the session scope *before* the jsp page is called. (In some earlier Action class) And, please do not take me wrong: you can of course use useBean tags, but what I understand is, you should avoid this when possible (when you can do it with Struts tags). Turgay. - I've just tried that but get the following exception: javax.servlet.jsp.JspException: Cannot find bean contributorEditForm in scope session I've removed all useBean tags from my jsp and have added the following in my action class: ContributorEditForm contributorEditForm = (ContributorEditForm)session.getAttribute( contributorEditForm ); if ( contributorEditForm == null ) { contributorEditForm = new ContributorEditForm(); session.setAttribute(contributorEditForm, contributorEditForm ); } My JSP contains code like: struts_logic:iterate id=rows name=contributorEditForm property=data scope=session Have I done something wrong? _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.