RE: Validation a form
I don't understand why it does not work. It crashes only when the validate method is called and must return an error. Is sqlQuery begins with select it works fine and i got to the result page. Do i need to write a jsp page in case of error? (i already have one where i forward to when an exception is called in my Action class) -Message d'origine- De: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Date: lundi 6 août 2001 18:35 À: '[EMAIL PROTECTED]' Objet: Re: Validation a form On Mon, 6 Aug 2001, DUPRAT Alexandre wrote: hi, How can i validate a form? I tried : public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) { ActionErrors errors= new ActionErrors(); if(! getSqlQuery().startsWith(select)){ ActionError error = new ActionError(error.requete); errors.add(sqlQuery, error); } return errors; } it works when there is no error but not when i've one Is there somebody with an idea? The above code looks OK -- what about it doesn't work? Note that you *must* specify an input attribute on your Action, so that Struts knows where to send the user back to. Alexandre Duprat SOPRA. Direction France Sud. Bordeaux [EMAIL PROTECTED] Craig McClanahan ++ | Ce courrier ainsi que les fichiers joints sont confidentiels. | | Si vous avez recu ce courrier par erreur, veuillez en informer | | l'administrateur du systeme : [EMAIL PROTECTED] | | - | | Ce message confirme que le courrier a passe le controle| | antivirus du relais de messagerie Internet avec succes.| ++
Re: Validation a form
But what is the specific error ? - Original Message - From: DUPRAT Alexandre [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 07, 2001 11:31 PM Subject: RE: Validation a form I don't understand why it does not work. It crashes only when the validate method is called and must return an error. Is sqlQuery begins with select it works fine and i got to the result page. Do i need to write a jsp page in case of error? (i already have one where i forward to when an exception is called in my Action class) -Message d'origine- De: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Date: lundi 6 août 2001 18:35 À: '[EMAIL PROTECTED]' Objet: Re: Validation a form On Mon, 6 Aug 2001, DUPRAT Alexandre wrote: hi, How can i validate a form? I tried : public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) { ActionErrors errors= new ActionErrors(); if(! getSqlQuery().startsWith(select)){ ActionError error = new ActionError(error.requete); errors.add(sqlQuery, error); } return errors; } it works when there is no error but not when i've one Is there somebody with an idea? The above code looks OK -- what about it doesn't work? Note that you *must* specify an input attribute on your Action, so that Struts knows where to send the user back to. Alexandre Duprat SOPRA. Direction France Sud. Bordeaux [EMAIL PROTECTED] Craig McClanahan ++ | Ce courrier ainsi que les fichiers joints sont confidentiels. | | Si vous avez recu ce courrier par erreur, veuillez en informer | | l'administrateur du systeme : [EMAIL PROTECTED] | | - | | Ce message confirme que le courrier a passe le controle| | antivirus du relais de messagerie Internet avec succes.| ++
FW: Indexed tags problem
The way I have solved this problem currently is to create a method in the form that forwards to the object within the form. e.g. public PersonField getPersonField (int index) { return (PersonField)person.getPersonField(index); } It is a work around rather than a fix. I intend to have a look and see if I can discover a better solution. cheers Andy -Original Message- From: Marcel Maré [mailto:[EMAIL PROTECTED]] Sent: 8. august 2001 09:10 To: '[EMAIL PROTECTED]' Subject: RE: Indexed tags problem Please post the solution, since I'm having similar problems... TIA Marcel -Oorspronkelijk bericht- Van: Andrew Paul Swift [mailto:[EMAIL PROTECTED]] Verzonden: dinsdag 7 augustus 2001 16:04 Aan: '[EMAIL PROTECTED]' Onderwerp: RE: Indexed tags problem I have finally solved the problem, and it was due to the nested property. So ignore my last posting or take note of the word probably ! Is there currently a way to access nested properties stored in forms when using indexed tags?? e.g. for automatic updates form.getDetail(index).setProperty() cheers Andy -Original Message- From: Andrew Paul Swift [mailto:[EMAIL PROTECTED]] Sent: 7. august 2001 11:28 To: '[EMAIL PROTECTED]' Subject: RE: Indexed tags problem I moved the getPersonFields() method into the personForm object and I still get the problem! So it is probably not because of the nested property! i.e. logic:iterate id=personField name=personForm property=personFields any thoughts, (I have read through otherpostings, regarding session etc.. ) cheers Andy -Original Message- From: Andrew Paul Swift[mailto:[EMAIL PROTECTED]] Sent: 6. august 2001 17:32 To: '[EMAIL PROTECTED]' Subject: Indexed tags problem I am using the indexed tags (cheers, made my life a lot easier!)but I am having a problem. When submitting a form the data inthe form is not updated. I have got updates working elsewhere, but Ican't get this working. Is it because I use a nested property inthe iterate tag i.e. getPerson().getPersonFields(); Cheersin advanceAndy === JSP logic:iterateid=personField name=personFormproperty=personpersonFields td html:text name=personField property=valueindexed=true/ /td /logic:iterat! e === HTML produced td input type=text name=personField[0].value value=1000831 /td === struts-config.xml form-bean name=personFormtype=forms.PersonForm/ !-- Action that retrieves details about aperson -- action path=/person type=actions.PersonAction name=personForm scope=session input=/customerSearch.jsp forwardname=success path=/personDetail.jsp//action !-- Action that stores details about a person -- action path=/storePerson type=actions.StorePersonActionname=personForm scope=sessioninput=/personDetail.jsp forward name=cancel path=/customerSearch.jsp/ forward name=delete path=/customerSearch.jsp/ forward name=save path=/personDetail.jsp/ /action Log action: Processing a POST for /storePerson action: Looking for ActionF! orm bean under attribute 'personForm' action: Recycling existing ActionForm bean instance of class 'forms.PersonForm' action: Populating bean properties from this request action: Validating input form properties action: No errors detected, accepting input action: Looking for Action instance for class actions.StorePersonAction action: Double checking for Action instance already there action: Creating new Action instance action: Saving customer -- --- To send us encrypted mail, please refer to: http://www.millionhandshakes.com/emailpolicy/pgp.html Million Handshakes -- ---To send us encrypted mail, please refer to:http://www.millionhandshakes.com/emailpolicy/pgp.html Million Handshakes - To send us encrypted mail, please refer to: http://www.millionhandshakes.com/emailpolicy/pgp.html Million Handshakes - To send us encrypted mail, please refer to: http://www.millionhandshakes.com/emailpolicy/pgp.html Million Handshakes
Get request and the Action servlet
I would like to use Struts with an action that is initiated by following a link, rather the form-based approach that I can see in the documentation. I would also like the ActionServlet to parse the URI and instantiate my bean with the information from the URI. Is this possible? Sorry if this is a FAQ - I've had a trawl thru the docs, honest. Cheers, Roger
Re: Get request and the Action servlet
[EMAIL PROTECTED] wrote: I would like to use Struts with an action that is initiated by following a link, rather the form-based approach that I can see in the documentation. I would also like the ActionServlet to parse the URI and instantiate my bean with the information from the URI. Is this possible? Sorry if this is a FAQ - I've had a trawl thru the docs, honest. Cheers, Roger A link is for the server the same thing as a form with GET method. It works with struts without problems. (Of course, you cannot submit as much data as with POST. But this is a limitation of HTTP) -- gR
Re: Get request and the Action servlet
Excellent, thanks. The information I want to submit is minimal anyway. I'll have a look at the source. At 08/08/2001 10:21:08, Gregor Rayman [EMAIL PROTECTED] wrote: # [EMAIL PROTECTED] wrote: # # I would like to use Struts with an action that is initiated by following a # link, # rather the form-based approach that I can see in the documentation. I would # also # like the ActionServlet to parse the URI and instantiate my bean with the # information from the URI. Is this possible? # # Sorry if this is a FAQ - I've had a trawl thru the docs, honest. # # Cheers, # # Roger # # # A link is for the server the same thing as a form with GET method. # It works with struts without problems. (Of course, you cannot submit # as much data as with POST. But this is a limitation of HTTP) # # -- # gR # Roger
struts-config.xml
Title: struts-config.xml In struts-config_1_0.dtd there is a note in the data-source section that the use of url, autocommit and so on as attributes is deprecated, you should use set-property instead. How can I use set-property in struts-config.xml? I have following datasource: data-source autoCommit=false description=My Data Source Configuration driverClass=oracle.jdbc.driver.OracleDriver maxCount=8 minCount=2 password=secrer url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(HOST=myhost)(PROTOCOL=tcp)(PORT=1))(CONNECT_DATA=(SID=mysid))) user=myuser/ How can I rewrite this description so that it uses set-property as it is stated in the DTD? Thank you, Gernot
RE: struts-config.xml
Now you should write something like that : data-sources data-source set-property property=autoCommit value=false/ set-property property=description value=My Data Source Configuration/ set-property property=driverClass value=oracle.jdbc.driver.OracleDriver/ set-property property=maxCount value=8/ set-property property=minCount value=2/ set-property property=user value=myuser/ set-property property=password value=secrer/ set-property property=url value=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(HOST=myhost)(PROTOCOL=tc p)(PORT=1))(CONNECT_DATA=(SID=mysid)))/ !-- requete utilisee pour faire un ping sur la base. Celle-ci doit etre tres rapide -- set-property property=pingQuery value=SELECT * FROM STOCK.VIDE/ /data-source /data-sources Arnaud -Message d'origine- De: Pfingstl Gernot [SMTP:[EMAIL PROTECTED]] Date: mercredi 8 aout 2001 11:35 A: '[EMAIL PROTECTED]' Objet: struts-config.xml In struts-config_1_0.dtd there is a note in the data-source section that the use of url, autocommit and so on as attributes is deprecated, you should use set-property instead. How can I use set-property in struts-config.xml? I have following datasource: data-source autoCommit=false description=My Data Source Configuration driverClass=oracle.jdbc.driver.OracleDriver maxCount=8 minCount=2 password=secrer url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(HOST=myhost)(PROTOCOL=tcp) (POR T=1))(CONNECT_DATA=(SID=mysid))) user=myuser/ How can I rewrite this description so that it uses set-property as it is stated in the DTD? Thank you, Gernot Fichier: ATT00010.htm
internal servlet error
I started using struts config I just imported all packages into my directory and started tomcat and tried to run an example jsp the following errors are seen in the browser I am unable to fix it out please help me Error: 500 Location: /sunanda/header.jsp Internal Servlet Error: javax.servlet.ServletException java.lang.Throwable(java.lang.String) java.lang.Exception(java.lang.String) javax.servlet.ServletException(java.lang.Throwable) void org.apache.jasper.runtime.PageContextImpl.handlePageException(java.lang.Exception) void _0002fheader_0002ejspheader_jsp_0._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) void org.apache.jasper.runtime.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) void org.apache.jasper.runtime.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.tomcat.core.ServletWrapper.handleRequest(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(org.apache.tomcat.service.TcpConnection, java.lang.Object []) void org.apache.tomcat.service.TcpConnectionThread.run() void java.lang.Thread.run() Root cause: java.util.EmptyStackException java.lang.Throwable() java.lang.Exception() java.lang.RuntimeException() java.util.EmptyStackException() java.lang.Object java.util.Stack.peek() org.apache.struts.taglib.template.util.ContentMap org.apache.struts.taglib.template.util.ContentMapStack.peek(javax.servlet.jsp.PageContext) int org.apache.struts.taglib.template.GetTag.doStartTag() void _0002fheader_0002ejspheader_jsp_0._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) void org.apache.jasper.runtime.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) void org.apache.jasper.runtime.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.tomcat.core.ServletWrapper.handleRequest(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(org.apache.tomcat.service.TcpConnection, java.lang.Object []) void org.apache.tomcat.service.TcpConnectionThread.run() void java.lang.Thread.run() ** 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. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.Kindlesystems.com **
dynamically setting the html:select property
Hi there, inside an iterate tag I'm creating multiple textboxes and selects. to unqiuely identify each item I am appending the index from the iteration (idx) to the name; e.g. input type=text name=rate#bean:write name=idx/ maxlength=10 value=bean:write name=limitBean property=rate / I also need to do this for drop down selections. However I'm having some problems with naming the selects dynamically. html:select property=lookup#%= idx % didn't work, the result was select name=lookup#%= idx % I also tried setting an attribute on my form jsp:setProperty name=coverDetailsForm property=lookupIdx value=%= idx % / html:select property=coverDetailsForm.lookupIdx value= %= limitBean.getLimit().getLookupDataId().toString() % html:options name=limitBean property=values labelName=limitBean labelProperty=labels/ /html:select the result was select name=coverDetailsForm.lookupIdx I've had to resort to scriptlets, please help.. thanks James
HTML Base Tag using SSL
We have a problem using the html:base tag when displaying a Struts JSP Page under SSL. SSL is configured on our web server (BEA WebLogic) to listen on the default port (443). When the JSP page is displayed in the browser the source HTML code shows the base tag with port 80 instead of port 443 (or blank). If we change the web server configuration so that SSL is listening on a different port (eg. 7002) then the base tag is correctly rendered with :7002. The problem may be arising because when we try to set the URL with :443 in the address the browser automatically removes the :443 and it looks like the html:base tag assumes SSL is on port 80 when it resolves it. Cheers, Chico -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS
Re. : RE: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from r equest scope
Thanks Mark. Where can I find the struts.jar file with the modification special WAS? MIKAEL Mark Wilson [EMAIL PROTECTED] le 07/08/2001 17:48:13 Veuillez répondre à [EMAIL PROTECTED] Pour :'[EMAIL PROTECTED]' [EMAIL PROTECTED] cc : Objet : RE: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from r equest scope WAS 4.0 so far is no different, you will get the same error. The problem was fixed, by changing the code in org.apache.struts.taglib.html.FormTag per this solution posted a while ago: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg10964.html There is another FormTag class, org.apache.struts.taglib.FormTag. Make sure you got the right one, and rebuilt correctly? This solution has worked successfully repeatedly. The problem lies with the IBM implementation of the org.apache.jasper package. It behaves differently than the tomcat reference implementation, in that it will always throw an exception when specifically removing attributes from request scope. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 10:18 AM To: [EMAIL PROTECTED] Subject: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from request scope Hello, I write an application using struts. I have a first JSP page with a link to a second JSP page which contains a form. The link looks like: html:link href=epologin.do?cmd=Createbean:message key =index.login//html:link I get the first page with the link. But, when I click on it, I get the following message: ...cant remove Attributes from request scope... I've seen a lot of mails in the struts-user list about the doEndTag method; so I tried to change the code of the FormTag class (in /taglib/html). It changes nothing. So, if anyone has a solution... A few questions: Where does the problem come from (Struts, Websphere)? Is there any improvement with Websphere 4.0? Thanks for your help. MIKAEL CONFIDENTIALITE : Ce message et les éventuelles pièces attachées sont confidentiels. Si vous n'êtes pas dans la liste des destinataires, veuillez informer l'expéditeur immédiatement et ne pas divulguer le contenu à une tierce personne, ne pas l'utiliser pour quelque raison que ce soit, ne pas stocker ou copier l'information qu'il contient sur un quelconque support. CONFIDENTIALITY : This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium.
RE: Re. : RE: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from r equest scope
http://www.enfused.com/struts.jar :) Chris -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 3:03 AM To: [EMAIL PROTECTED] Subject: Re. : RE: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from r equest scope Thanks Mark. Where can I find the struts.jar file with the modification special WAS? MIKAEL Mark Wilson [EMAIL PROTECTED] le 07/08/2001 17:48:13 Veuillez répondre à [EMAIL PROTECTED] Pour :'[EMAIL PROTECTED]' [EMAIL PROTECTED] cc : Objet : RE: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from r equest scope WAS 4.0 so far is no different, you will get the same error. The problem was fixed, by changing the code in org.apache.struts.taglib.html.FormTag per this solution posted a while ago: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg10964.html There is another FormTag class, org.apache.struts.taglib.FormTag. Make sure you got the right one, and rebuilt correctly? This solution has worked successfully repeatedly. The problem lies with the IBM implementation of the org.apache.jasper package. It behaves differently than the tomcat reference implementation, in that it will always throw an exception when specifically removing attributes from request scope. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 10:18 AM To: [EMAIL PROTECTED] Subject: WEBSPHERE 3.5.4 and STRUTS 1.0: cant remove attributes from request scope Hello, I write an application using struts. I have a first JSP page with a link to a second JSP page which contains a form. The link looks like: html:link href=epologin.do?cmd=Createbean:message key =index.login//html:link I get the first page with the link. But, when I click on it, I get the following message: ...cant remove Attributes from request scope... I've seen a lot of mails in the struts-user list about the doEndTag method; so I tried to change the code of the FormTag class (in /taglib/html). It changes nothing. So, if anyone has a solution... A few questions: Where does the problem come from (Struts, Websphere)? Is there any improvement with Websphere 4.0? Thanks for your help. MIKAEL CONFIDENTIALITE : Ce message et les éventuelles pièces attachées sont confidentiels. Si vous n'êtes pas dans la liste des destinataires, veuillez informer l'expéditeur immédiatement et ne pas divulguer le contenu à une tierce personne, ne pas l'utiliser pour quelque raison que ce soit, ne pas stocker ou copier l'information qu'il contient sur un quelconque support. CONFIDENTIALITY : This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium.
RE: dynamically setting the html:select property
When you use a parameter of a tag, it should be a text or a regexp. if you write html:select property=lookup#%= idx % the tag interpretor will see the string lookup# and suppose that the parameter shouldn't be evaluated. To do this you should write this : html:select property=%=\lookup#+idx\% arnaud -Message d'origine- De: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] Date: mercredi 8 aout 2001 14:31 A: [EMAIL PROTECTED] Objet: dynamically setting the html:select property Hi there, inside an iterate tag I'm creating multiple textboxes and selects. to unqiuely identify each item I am appending the index from the iteration (idx) to the name; e.g. input type=text name=rate#bean:write name=idx/ maxlength=10 value=bean:write name=limitBean property=rate / I also need to do this for drop down selections. However I'm having some problems with naming the selects dynamically. html:select property=lookup#%= idx % didn't work, the result was select name=lookup#%= idx % I also tried setting an attribute on my form jsp:setProperty name=coverDetailsForm property=lookupIdx value=%= idx % / html:select property=coverDetailsForm.lookupIdx value= %= limitBean.getLimit().getLookupDataId().toString() % html:options name=limitBean property=values labelName=limitBean labelProperty=labels/ /html:select the result was select name=coverDetailsForm.lookupIdx I've had to resort to scriptlets, please help.. thanks James
Re: I think I found a bug in Struts?
When the app starts I put all the lists which are vectors into the application session. I do this by getting the servletcontext object and putting the vector into there. Alex * Date: Tue, 7 Aug 2001 12:41:11 -0700 (PDT) To: Struts [EMAIL PROTECTED] From: Craig R. McClanahan [EMAIL PROTECTED] Subject: Re: I think I found a bug in Struts? Message-ID: Pine.BSF.4.21.0108071238430.72473-10@localhost On Tue, 7 Aug 2001, Alex Colic wrote: Hi, It took a while but I think I found why the lists I put in application scope were not being refreshed. When my app starts I put a couple of lists into the servletcontext so that all my pages can access them. If the lists change I update the lists and then I expect the next time the user access the page that the lists would reflect the changes. I did a quick test and I found that my class was updating the list and putting them into the session. Where are they really? In the session or in application scope? That portion briefly is: protected ServletContext context; context.setAttribute(COMMON_PROBLEM_LIST,tbeList ); On my page I have the following: logic:present name=CommonProblemList scope=application html:select property=wrTitle bean:define id=list name=CommonProblemList scope=application property=list / html:options collection=list property=name/ /html:select /logic:present I stepped through the logic:present tag and found that while it looks for the bean it goes into the RequestUtils class. It enters the lookup method and scan through the scope value. It is finding that scope does equal application but the bean it is returning is the old one with the old data. I would step through the pageContext class but because it is abstract I am trying to find the concrete implementation of it. bean = pageContext.getAttribute(name, PageContext.APPLICATION_SCOPE); Any help in resolving this is highly appreciated. The concrete implementation of PageContext (and every other interface and abstract class in the Servlet and JSP APIs) is inside your servlet container. Alex Craig Alex Colic.vcf
I'm new, need some tutorials and maybe some advice
Hi all, I just signed up and looking for some tutorials on struts. I installed it on Linux with Apache-Tomcat config. There is a sample application in there, however it would be maybe easier to go through some tutorials first. Any suggestions ? Also, I'm in the process of doing a little web site for myself. It's basically only presentation of data for now. I have a little confusion there. As far as I understood the specifications, servlets ( controllers ) are responsible for data extraction from the database and JSPs for presentation. So what should I set up as the index page , a JSP that forwards the request to servlet and servlet responds to JSP again or to use a servlet that sends data to JSP ? Also. is it a good technique to have the JSP ( beans ) extract data from database ? In this case, how do I get to the connection parameters if I don't want to hardcode it and maybe use web.xml file to hold the connection parameters ? All responses are welcomed. Thank you. Jf
Struts Design Question
Hello all, I downloaded Struts last week and have enjoyed playing with it. I've come upon a design problem and I was hoping some folks on this list could help solve it. I've had no luck finding an answer in the mail archives. I want to maintain a list of songs. Through a web interface, I want to add a new song, edit information about an existing song (composer, artist, etc) and also delete a song. Under the covers this will do some sort of database insert, update and delete, respectively. The forms for adding a new song and editing an existing song are practically identical. They contain the same field names with the difference being edit pre-populates the fields with the existing values of a song whereas the fields are blank for add. Question #1: Can one ActionForm suffice for both add and edit form pages? My gut says yes, but I want to make sure. Actions. In the simplest scenario, I could create separate actions for all operations. I'd have AddSongAction, EditSongAction and DeleteSongAction classes each with their own logic in perform(). This would work, but there's something that bothers me about having three different classes performing operations on one entity. It seems like overkill. DispatchActions. I saw the post about using DispatchAction to have multiple methods in a single Action class. I really like this approach, as I could have insert, update and delete methods in my Action class. However, the input= attribute in the action mapping definition (in struts-config.xml) is shared for all of them. So if I have separate addsong.jsp and editsong.jsp form pages sharing the same Action, and a validation error occurs, Struts can only return to one (whatever input= is). So this won't work. Question #2: Is there a happy medium between these two approaches? One idea that I haven't worked through is using one songform.jsp page for add/edit/delete. Calling songform.jsp?method=add would produce a blank page for entering a new song. Songform.jsp?method=editid=1234 would populate the form with values from a song whose id = 1234. From here one could edit or delete the selected song. In Struts I'd use the DispatchAction to pass all add/edit/delete requests to one Action class. Because all were using the same form, the input= attribute problem above would be avoided. Question #3: Will this approach work? Can anyone offer a better solution for this problem? Thanks for the feedback. -ryan
RE: Struts Design Question
Yes you can do the add/edit all on the same form. If have a database generated code or key you can put that in a hidden field. When in the action examine the form or request obj to see if that key is there, if it is you have a modify, if not add the record. Have you page that lists the songs pass a the code/key as a parameter to the SongForm.jsp. Then you can use the jsp:useBean as follows: jsp:useBean id=SongForm class=com.mypackage.SongForm scope=request jsp:setProperty name=SongForm property=songKey param=songKey / /jsp:useBean Then to pre populate the form you can make a DataBase call in your form setSongKey() method and use the result to set the other values in the form. For a delete you can have a second form on the same page (with its own submit button) that has the songKey set into the SongDeleteForm and the submit is mapped to a DeleteAction that just uses the key to delete the record. I am new at the struts stuff myself, so these may not be the best ways to accomplish what you are trying to do, but I know it works. So anyone else please feel free to critique. Aaron -Original Message- From: Shriver, Ryan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 9:30 AM To: '[EMAIL PROTECTED]' Subject: Struts Design Question Hello all, I downloaded Struts last week and have enjoyed playing with it. I've come upon a design problem and I was hoping some folks on this list could help solve it. I've had no luck finding an answer in the mail archives. I want to maintain a list of songs. Through a web interface, I want to add a new song, edit information about an existing song (composer, artist, etc) and also delete a song. Under the covers this will do some sort of database insert, update and delete, respectively. The forms for adding a new song and editing an existing song are practically identical. They contain the same field names with the difference being edit pre-populates the fields with the existing values of a song whereas the fields are blank for add. Question #1: Can one ActionForm suffice for both add and edit form pages? My gut says yes, but I want to make sure. Actions. In the simplest scenario, I could create separate actions for all operations. I'd have AddSongAction, EditSongAction and DeleteSongAction classes each with their own logic in perform(). This would work, but there's something that bothers me about having three different classes performing operations on one entity. It seems like overkill. DispatchActions. I saw the post about using DispatchAction to have multiple methods in a single Action class. I really like this approach, as I could have insert, update and delete methods in my Action class. However, the input= attribute in the action mapping definition (in struts-config.xml) is shared for all of them. So if I have separate addsong.jsp and editsong.jsp form pages sharing the same Action, and a validation error occurs, Struts can only return to one (whatever input= is). So this won't work. Question #2: Is there a happy medium between these two approaches? One idea that I haven't worked through is using one songform.jsp page for add/edit/delete. Calling songform.jsp?method=add would produce a blank page for entering a new song. Songform.jsp?method=editid=1234 would populate the form with values from a song whose id = 1234. From here one could edit or delete the selected song. In Struts I'd use the DispatchAction to pass all add/edit/delete requests to one Action class. Because all were using the same form, the input= attribute problem above would be avoided. Question #3: Will this approach work? Can anyone offer a better solution for this problem? Thanks for the feedback. -ryan
Poolman under Tomcat 4
Has anyone using Poolman configured it properly for Tomcat 4? Since it supports both JNDI and a static call for retreiving the datasource, it works well with layered applications. I have it running under Tomcat 3 well enough. But configuring it to play nice with Tomcat 4 is eluding me. I have the requisite poolman support JARs in the Tomcat lib (jdbc2_0-stdext, jta, xerces), except for poolman.jar, which is in its own folder. The poolman.xml is in the poolman folder, and both the JAR and the folder and the JAR on the classpath. I'm using findDatasource(), but the Tomcat log reports it can't find the class. If I move the poolman.jar to the Tomcat4 lib orthe WEB-INF\lib, a Network Error: Peer reset connection error is exposed by the browser, and Tomcat suddenly quits. My guess is that TC4 is not finding the poolman.xml (whereas TC3 does). If anyone sorts this out, I'd love to hear about it. Meanwhile, if anyone else is trying Poolman under TC3, I found that it really does want Xerces for the parser, so swap out the Tomcat default. It is also really-not-kidding about having the poolman.xml on the server's classpath. Having it a lib folder isn't enough. But after that, it works just great. You can import the poolman class into your Data Access Object (which is why I have it in its own folder), and have it snag the datasource using a static method (findDataSource(String name), just like our favorite son ;-). This way your Web layer doesn't need to know where the connection is coming from (as recommended by our other favorite Sun 8-). http://www.codestudio.com/ -Ted.
Thanks Quan!: Re: how to create a submit button with my own image
eom --- Pham Thanh Quan [EMAIL PROTECTED] wrote: You may use this html:form ... input type=image src=your_image /html:form Quan - Original Message - From: Long Zhao [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 07, 2001 5:21 AM Subject: how to create a submit button with my own image for a struts form, html:form action=/html:form, how to create a submit button with my own image? I have tried to use javascript to do onclick=javascript:window.document.form.submit(), but it did not work, because the struts form do not have a name for the form. Thanks Long __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
radio buttons
using the strut tag library does any one no of a way of making two radio buttons in the same group ie click one deselects the other one thanks ** 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. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
Advice on how to implement the following:
Hi, I need a bit of advice on how to implement the following. I am creating a page that holds a list of item names along with their description. So far I created a vector that holds an array of items and then passes it to a Struts page in the request scope. The page then iterates the array and then produces the page. So far no problem. Now I need to add a text field in which the user can input prices for these items. Then I need that form submitted to my actionservlet for processing. This is where I get lost. I thought of adding a price field to my item class and then as the vector is iterated on the page I create a textfield binding it to the price field in the bean. But when the page is submitted I don't think the vector will be passed to my action servlet for parsing. Any help is appreciated Alex
Building Web Application
Hi All, I have sketched out the frame work for my web application. I have configured my Struts .xml files and put this in my Tomcate 3.2.2 and compiled this and this has worked. The question is what I am doing the correct way of building a web application and if not which is the professional way. I have created all my .html pages first and the links work, then I have converted most of my html pages to .jsp, I would like now to make a login process to my web application and that intails java files and java forms etc. Then intergrating the java files into my web application. Is this the incorrect way of approaching a web application? I would appreciate a bit of advise with that. Thanks Craig for your information on ActionServlets it has helped, I have read all the information on Struts-example.war and that was really good. But the example that I got mine out of was out of a book called Profession JSP 2nd Edition and that was called ch21. Thanks for your time and looking forward to your response. Kind Regards Rodney Smith -- Sent through GMX FreeMail - http://www.gmx.net
Re: radio buttons
give them the same name. --- Rachel Warburton [EMAIL PROTECTED] wrote: using the strut tag library does any one no of a way of making two radio buttons in the same group ie click one deselects the other one thanks ** 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. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Database.xml or other avenues
Hi All, I have seen how database.xml works with Struts-example.war and that was good, but I would like to test the same sort of database on Access .mdb If I put dummy data into the .mdb, where do I put the .mdb? do I put this in the WEB-INF section with the other .xml files? I have created a folder in the subdirectories called DATA and I have configured my build.xml to copy this .mdb to the main section of my web application. I need to state an action mapping in the struts-config.xml file and also mention that in the web.xml? and if so where? Is there any information that could help me configure that database not only to retreive information but also to add information into this. Or is it better to create two .mdb one to send information to a database and the other retreive data for logging onto the web application and have the two .mdb communicate with each other in some way to exchange data or to update? That sounds easy but is there any tips on doing this or any examples that could assist me with this? Thanks for your time and have a great day. Kind Regards Rodney Smith -- Sent through GMX FreeMail - http://www.gmx.net
how to submit a form with different parameter value
I have a form like this: html:form action=/*/doSomeThing.do .. input type=image src=button_saveAndContinue.gif input type=image src=button_saveAndGoback.gif /html:form how can I make the first button do doSomeThing.do?action=continue and the second button do doSomething.do?action=goback thanks in advance Long
RE: Poolman under Tomcat 4
Hi Ted, In my Tomcat 3 configuration, I put poolman.xml in the WEB-INF folder. Then you have to add this folder's path in the classpath, see my classpath from Tomcat.bat: set CP=%CP%;D:\Projects\MyApp\Source\webapps\regbl\WEB-INF;D:\DevTools\JTA\jta.j ar;D:\DevTools\JavaLibs\classes12.jar;D:\DevTools\JavaLibs\jdbc2_0-stdext.ja r;D:\DevTools\poolman-2.0.4\lib\poolman.jar;D:\DevTools\poolman-2.0.4\lib\xe rces.jar; I've seen no problem using xerces for Poolman and jaxp for Tomcat 3. Adriano Labate -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 4:30 PM To: [EMAIL PROTECTED] Subject: Poolman under Tomcat 4 Has anyone using Poolman configured it properly for Tomcat 4? Since it supports both JNDI and a static call for retreiving the datasource, it works well with layered applications. I have it running under Tomcat 3 well enough. But configuring it to play nice with Tomcat 4 is eluding me. I have the requisite poolman support JARs in the Tomcat lib (jdbc2_0-stdext, jta, xerces), except for poolman.jar, which is in its own folder. The poolman.xml is in the poolman folder, and both the JAR and the folder and the JAR on the classpath. I'm using findDatasource(), but the Tomcat log reports it can't find the class. If I move the poolman.jar to the Tomcat4 lib orthe WEB-INF\lib, a Network Error: Peer reset connection error is exposed by the browser, and Tomcat suddenly quits. My guess is that TC4 is not finding the poolman.xml (whereas TC3 does). If anyone sorts this out, I'd love to hear about it. Meanwhile, if anyone else is trying Poolman under TC3, I found that it really does want Xerces for the parser, so swap out the Tomcat default. It is also really-not-kidding about having the poolman.xml on the server's classpath. Having it a lib folder isn't enough. But after that, it works just great. You can import the poolman class into your Data Access Object (which is why I have it in its own folder), and have it snag the datasource using a static method (findDataSource(String name), just like our favorite son ;-). This way your Web layer doesn't need to know where the connection is coming from (as recommended by our other favorite Sun 8-). http://www.codestudio.com/ -Ted.
Why would jsessionid not appear?
My link is: html:link page=/createStakeholder.do?action=createbean:message key =index.createStakeholder//html:link it works, but the URL shows: http://localhost:8080/dne-struts/createStakeholder.do?action=create no jsessionid :( Any hints appreciated! Thanks, Brian Here's my action-mapping for that page: action path=/createStakeholder type=com.transplace.struts.action.CreateStakeholderAction name=StakeholderForm scope=session validate=true input=/CreateStakeholder.jsp forward name=success path=/index/ /action
Re: Poolman under Tomcat 4
As another data point, I use resin and tomcat3. I typically configure poolman locally for each web app. That is, I put poolman.jar into each WEB-INF/lib directory and an application specific poolman.xml into each WEB-INF/classes directory. Things also work if I configure poolman globally by putting poolman.jar into the /resin/lib or /tomcat/lib directory, and putting poolman.xml into /resin/classes or /tomcat/classes. (this poolman.xml has configuration for all web apps). Things get complicated if one tries to mix local and global configs on the same app server. Unfortunately I haven't used tomcat4 yet, so I can't actually help you out. - Original Message - From: Alan Inser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 08, 2001 11:20 AM Subject: RE: Poolman under Tomcat 4 Hi Ted, In my Tomcat 3 configuration, I put poolman.xml in the WEB-INF folder. Then you have to add this folder's path in the classpath, see my classpath from Tomcat.bat: set CP=%CP%;D:\Projects\MyApp\Source\webapps\regbl\WEB-INF;D:\DevTools\JTA\jta.j ar;D:\DevTools\JavaLibs\classes12.jar;D:\DevTools\JavaLibs\jdbc2_0-stdext.ja r;D:\DevTools\poolman-2.0.4\lib\poolman.jar;D:\DevTools\poolman-2.0.4\lib\xe rces.jar; I've seen no problem using xerces for Poolman and jaxp for Tomcat 3. Adriano Labate -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 4:30 PM To: [EMAIL PROTECTED] Subject: Poolman under Tomcat 4 Has anyone using Poolman configured it properly for Tomcat 4? Since it supports both JNDI and a static call for retreiving the datasource, it works well with layered applications. I have it running under Tomcat 3 well enough. But configuring it to play nice with Tomcat 4 is eluding me. I have the requisite poolman support JARs in the Tomcat lib (jdbc2_0-stdext, jta, xerces), except for poolman.jar, which is in its own folder. The poolman.xml is in the poolman folder, and both the JAR and the folder and the JAR on the classpath. I'm using findDatasource(), but the Tomcat log reports it can't find the class. If I move the poolman.jar to the Tomcat4 lib orthe WEB-INF\lib, a Network Error: Peer reset connection error is exposed by the browser, and Tomcat suddenly quits. My guess is that TC4 is not finding the poolman.xml (whereas TC3 does). If anyone sorts this out, I'd love to hear about it. Meanwhile, if anyone else is trying Poolman under TC3, I found that it really does want Xerces for the parser, so swap out the Tomcat default. It is also really-not-kidding about having the poolman.xml on the server's classpath. Having it a lib folder isn't enough. But after that, it works just great. You can import the poolman class into your Data Access Object (which is why I have it in its own folder), and have it snag the datasource using a static method (findDataSource(String name), just like our favorite son ;-). This way your Web layer doesn't need to know where the connection is coming from (as recommended by our other favorite Sun 8-). http://www.codestudio.com/ -Ted.
html:image tag, property attribute?
html:image src=../../images/sendandsave.gif property=guess/ results in input type=image name= src=../../images/saveasdraft.gif which is not what I'd expect from looking at the source for ImageTag: public int doEndTag() throws JspException { // Generate an HTML input type=image element HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); String tmp = null; StringBuffer results = new StringBuffer(); results.append(input type=\image\ name=\); results.append(property); results.append(\); .. Is there something else I have to do to get the name attribute set? Cheers ** 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. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
RE: radio buttons
use the same property name example: html:radio name=dtActionForm property=defaultTime value=5 nbsp;5 Minutes nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/html:radio html:radio name=dtActionForm property=defaultTime value=10 nbsp;10 Minutes nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/html:radio html:radio name=dtActionForm property=defaultTime value=15 nbsp;15 Minutes/html:radiobrbr hope that helps thanks VA -Original Message- From: Rachel Warburton [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 10:40 AM To: '[EMAIL PROTECTED]' Subject: radio buttons using the strut tag library does any one no of a way of making two radio buttons in the same group ie click one deselects the other one thanks ** 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. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
FW: ALERT From InfoWorld: New virus spreads using Acrobat files
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 11:13 AM To: [EMAIL PROTECTED] Subject: ALERT From InfoWorld: New virus spreads using Acrobat files INFOWORLD ALERT: SECURITY Wednesday, August 8, 2001 NEW VIRUS SPREADS USING ACROBAT FILES August 08, 2001 07:56 AM A VIRUS THAT infects PDF (Portable Document Format) files, used by Adobe Systems' Acrobat software, was identified Tuesday, according to two security organizations. For Full Story: http://www.infoworld.com/articles/hn/xml/01/08/08/010808hnacr.xml?0808alert - - - - - - - - - - - - - - - - - - - - - - - - - - - - UNSUBSCRIBE If you want to unsubscribe from InfoWorld's Newsletters or Alerts, go to http://www.iwsubscribe.com/newsletters/unsubscribe/ CHANGE E-MAIL If you want To change the e-mail address where you are receiving InfoWorld newsletters or Alerts, go to http://iwsubscribe.com/newsletters/adchange/ SUBSCRIBE To subscribe to any of InfoWorld's e-mail newsletters, or Alerts tell your friends and colleagues to go to: http://www.iwsubscribe.com/newsletters/ To subscribe to InfoWorld.com, or InfoWorld Print, or both, go to http://www.iwsubscribe.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - Copyright 2001 InfoWorld Media Group Inc. This message was sent to: [EMAIL PROTECTED]
Re: Why would jsessionid not appear?
To follow up my last message: jsessionid is now being passed from index.jsp to my next form: CreateStakeholder.jsp. CreateStakeholder.jsp does not seem to recognize jsessionid when it is sent, and does not re-write the link tags. _ One important note: I am using a template to build createStakeholder.do (CreateStakeholder.jsp): The links in the template sub-forms are: html:link href=createStakeholder.do bean:message key =global.create/ /html:link _ Menu.jsp and Stakeholder_Links.jsp both do not add jsession id correctly into the html:link Is it possible that the sub-pages on the template are not acquiring the jsessionid request parameter correctly? Is there something I need to do with the template to make sure the html:link tag builds correctly? Thanks, Brian p.s. CreateStakeholder.jsp looks like this: %@ page language=java % %@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' % template:insert template='/includes/dneTemplate.jsp' template:put name='title' content='Create Stakeholder' direct ='true'/ template:put name='header' content='/includes/Header.htm'/ template:put name='menu' content='/includes/Menu.jsp'/ template:put name='topLinks' content ='/includes/Stakeholder_Links.jsp'/ template:put name='content' content ='/CreateStakeholder_Body_Formatted.jsp'/ template:put name='footer' content='/includes/Footer.htm'/ /template:insert Brian.Duchouquette@tran splace.com To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] 08/08/2001 10:54 AMcc: Please respond to Subject: Why would jsessionid not appear? struts-user My link is: html:link page=/createStakeholder.do?action=createbean:message key =index.createStakeholder//html:link it works, but the URL shows: http://localhost:8080/dne-struts/createStakeholder.do?action=create no jsessionid :( Any hints appreciated! Thanks, Brian Here's my action-mapping for that page: action path=/createStakeholder type=com.transplace.struts.action.CreateStakeholderAction name=StakeholderForm scope=session validate=true input=/CreateStakeholder.jsp forward name=success path=/index/ /action
ActionServlet.addMapping() persistence
Hi all... I want to write an Action that will add mappings to the ActionServlet on the fly. Am I correct in thinking that any ActionMappings and such that I add in this way will not be persisted, and that I also have to modify struts-config.xml if I want the mappings to be available for future restarts of my servlet engine? Also, is there a way to specify multiple config paths in the ActionServlet so that i can have more then one struts-config.xml in one webapplication? So, for example, I would have a webapp test, which has test/WEB-INF/struts-config.xml. If I added something later to it, test/subtest, with its own new Actions, could I make a file test/subtest/WEB-INF/struts-config.xml and have that file ALSO be read by the ActionServlet on startup? I suppose I could update struts-config.xml and then tell the ActionServlet to reread it in the Action I talked about in the first paragraph...I'd like to be able to seperate this out, if possible, to make the seperate components of my webapplication seperate. The problem with putting this all into individual webapps is that I want the session to be passed from one part of the webapp to the next. Any thoughts? Thanks, Becky _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Re: Poolman under Tomcat 4
Ahh, the poolman.xml under classes! I was trying it in lib .. so this did help, William! And it works just as well under Tomcat 4, so I'm back to having no CLASSPATH again! -Ted. William Jaynes wrote: As another data point, I use resin and tomcat3. I typically configure poolman locally for each web app. That is, I put poolman.jar into each WEB-INF/lib directory and an application specific poolman.xml into each WEB-INF/classes directory. Things also work if I configure poolman globally by putting poolman.jar into the /resin/lib or /tomcat/lib directory, and putting poolman.xml into /resin/classes or /tomcat/classes. (this poolman.xml has configuration for all web apps). Things get complicated if one tries to mix local and global configs on the same app server. Unfortunately I haven't used tomcat4 yet, so I can't actually help you out. - Original Message - From: Alan Inser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 08, 2001 11:20 AM Subject: RE: Poolman under Tomcat 4 Hi Ted, In my Tomcat 3 configuration, I put poolman.xml in the WEB-INF folder. Then you have to add this folder's path in the classpath, see my classpath from Tomcat.bat: set CP=%CP%;D:\Projects\MyApp\Source\webapps\regbl\WEB-INF;D:\DevTools\JTA\jta.j ar;D:\DevTools\JavaLibs\classes12.jar;D:\DevTools\JavaLibs\jdbc2_0-stdext.ja r;D:\DevTools\poolman-2.0.4\lib\poolman.jar;D:\DevTools\poolman-2.0.4\lib\xe rces.jar; I've seen no problem using xerces for Poolman and jaxp for Tomcat 3. Adriano Labate -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 4:30 PM To: [EMAIL PROTECTED] Subject: Poolman under Tomcat 4 Has anyone using Poolman configured it properly for Tomcat 4? Since it supports both JNDI and a static call for retreiving the datasource, it works well with layered applications. I have it running under Tomcat 3 well enough. But configuring it to play nice with Tomcat 4 is eluding me. I have the requisite poolman support JARs in the Tomcat lib (jdbc2_0-stdext, jta, xerces), except for poolman.jar, which is in its own folder. The poolman.xml is in the poolman folder, and both the JAR and the folder and the JAR on the classpath. I'm using findDatasource(), but the Tomcat log reports it can't find the class. If I move the poolman.jar to the Tomcat4 lib orthe WEB-INF\lib, a Network Error: Peer reset connection error is exposed by the browser, and Tomcat suddenly quits. My guess is that TC4 is not finding the poolman.xml (whereas TC3 does). If anyone sorts this out, I'd love to hear about it. Meanwhile, if anyone else is trying Poolman under TC3, I found that it really does want Xerces for the parser, so swap out the Tomcat default. It is also really-not-kidding about having the poolman.xml on the server's classpath. Having it a lib folder isn't enough. But after that, it works just great. You can import the poolman class into your Data Access Object (which is why I have it in its own folder), and have it snag the datasource using a static method (findDataSource(String name), just like our favorite son ;-). This way your Web layer doesn't need to know where the connection is coming from (as recommended by our other favorite Sun 8-). http://www.codestudio.com/ -Ted.
Re: Poolman under Tomcat 4
Ted, I just installed Tomcat4 and got poolman to work for me. As I said, my typical setup is to have poolman.jar in each WEB-INF/lib and poolman.xml in each WEB-INF/classes. After setting up tomcat4 for struts (copying jaxp.jar and crimson.jar from /tomcat4/jasper to /tomcat4/lib) and for poolman (jdbc2_0-stdext, jta, xerces into /tomcat4/lib), I simply copied one of my webapps to the webapp directory, and it ran fine. Will - Original Message - From: Ted Husted [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 08, 2001 10:29 AM Subject: Poolman under Tomcat 4 Has anyone using Poolman configured it properly for Tomcat 4? Since it supports both JNDI and a static call for retreiving the datasource, it works well with layered applications. I have it running under Tomcat 3 well enough. But configuring it to play nice with Tomcat 4 is eluding me. I have the requisite poolman support JARs in the Tomcat lib (jdbc2_0-stdext, jta, xerces), except for poolman.jar, which is in its own folder. The poolman.xml is in the poolman folder, and both the JAR and the folder and the JAR on the classpath. I'm using findDatasource(), but the Tomcat log reports it can't find the class. If I move the poolman.jar to the Tomcat4 lib orthe WEB-INF\lib, a Network Error: Peer reset connection error is exposed by the browser, and Tomcat suddenly quits. My guess is that TC4 is not finding the poolman.xml (whereas TC3 does). If anyone sorts this out, I'd love to hear about it. Meanwhile, if anyone else is trying Poolman under TC3, I found that it really does want Xerces for the parser, so swap out the Tomcat default. It is also really-not-kidding about having the poolman.xml on the server's classpath. Having it a lib folder isn't enough. But after that, it works just great. You can import the poolman class into your Data Access Object (which is why I have it in its own folder), and have it snag the datasource using a static method (findDataSource(String name), just like our favorite son ;-). This way your Web layer doesn't need to know where the connection is coming from (as recommended by our other favorite Sun 8-). http://www.codestudio.com/ -Ted.
Re: I'm new, need some tutorials and maybe some advice
Ted Husted has links tutorials, example webapps, and code (custom tags, etc.). http://www.husted.com/about/struts/ A Walking Tour of Struts (at the bottom) walks you through the Struts example webapp. http://www.husted.com/about/struts/scaffolding.htm If you want to stay pure MVC, then you can have your home page go through the controller servlet. Struts has a connection pool that you can use for database connections. You configure it in the struts-config.xml file. David --- [EMAIL PROTECTED] wrote: Hi all, I just signed up and looking for some tutorials on struts. I installed it on Linux with Apache-Tomcat config. There is a sample application in there, however it would be maybe easier to go through some tutorials first. Any suggestions ? Also, I'm in the process of doing a little web site for myself. It's basically only presentation of data for now. I have a little confusion there. As far as I understood the specifications, servlets ( controllers ) are responsible for data extraction from the database and JSPs for presentation. So what should I set up as the index page , a JSP that forwards the request to servlet and servlet responds to JSP again or to use a servlet that sends data to JSP ? Also. is it a good technique to have the JSP ( beans ) extract data from database ? In this case, how do I get to the connection parameters if I don't want to hardcode it and maybe use web.xml file to hold the connection parameters ? All responses are welcomed. Thank you. Jf __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Context error when load images
Hi, I have a a JSP page, on which I have loaded a couples of images, eventhough the images loaded all the images correctly, I till get the following error messages, Can you tell me why? thank you very much Binh 2001-08-08 11:18:48 - Ctx( /templates ): IOException in: R( /templates + /images/news-over.gif + null) Connection aborte d by peer: socket write error 2001-08-08 11:18:48 - Ctx( /templates ): IOException in: R( /templates + /images/bgtop.gif + null) Connection aborted by peer: socket write error 2001-08-08 11:18:48 - Ctx( /templates ): IOException in: R( /templates + /images/bgbottom.gif + null) Connection aborted by peer: socket write error __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Scalability
Hello All, I've been working with Struts for sometime now, but now I run into another question. Has anyone had any issues with Struts not being scaleable? Have you performed any stress tests on your applications? I really like Struts, but I'm getting feedback from other developers that don't feel that Struts is a very scaleable framework. Can struts concurrently handle 1000+ users and not have a crippling affect on your app server? These are some feedback questions I'm curious about and thought I would get some concrete answers from developers of Struts. Have a good one, Steven application/ms-tnef
Re: how to submit a form with different parameter value
One way would be to have a hidden field in the form named action, and then have some JavaScript event handler on the two image buttons that set the value to be transmitted for the action property to either continue or goback appropriately. Essentially, this is the same thing you would do with static HTML. Craig On Wed, 8 Aug 2001, Long Zhao wrote: I have a form like this: html:form action=/*/doSomeThing.do .. input type=image src=button_saveAndContinue.gif input type=image src=button_saveAndGoback.gif /html:form how can I make the first button do doSomeThing.do?action=continue and the second button do doSomething.do?action=goback thanks in advance Long
Re: Open a new window after an action
Windows are a client side thing, so you deal with them in Struts the same way you do with static HTML. * You can specify a target attribute on the form, which will cause the response to be displayed in a window identified by the target value. * To open a window with no decorations, you'll need JavaScript that does a window.open() call. You should be able to find info on any of the tutorial sites about JavaScript. Craig On Wed, 8 Aug 2001, Mustapha Essalihe wrote: Hi every body, After executing my perform method i want to open a new window to show the result. I use the html:link tag with attribute target as : html:link page=/adminNews.do?action=ViewNews target=_blank paramName=nouvelle paramId=id paramProperty=id bean:message key=button.view/ /html:link this work correctly, when the action is exetcuted a new window is opened and the content is displayed. The probelm is that i want to open the window without toolbar, location, status like in javascript window.open() method. How can i do that with struts ?
Re: Why would jsessionid not appear?
The jsessionid path parameter will only be added if the servlet container does not know whether your client supports cookies. How Tomcat handles this (probably typical of others): * On the first response in a session, send the session id both ways (cookie and encoding). * If the subsequent request comes back with a cookie, turn of URL rewriting for the remainder of this session. * If the subsequent request comes back without a cookie, keep on rewriting. Craig On Wed, 8 Aug 2001 [EMAIL PROTECTED] wrote: My link is: html:link page=/createStakeholder.do?action=createbean:message key =index.createStakeholder//html:link it works, but the URL shows: http://localhost:8080/dne-struts/createStakeholder.do?action=create no jsessionid :( Any hints appreciated! Thanks, Brian Here's my action-mapping for that page: action path=/createStakeholder type=com.transplace.struts.action.CreateStakeholderAction name=StakeholderForm scope=session validate=true input=/CreateStakeholder.jsp forward name=success path=/index/ /action
Re: ActionServlet.addMapping() persistence
On Wed, 8 Aug 2001, Becky Moyer wrote: Hi all... I want to write an Action that will add mappings to the ActionServlet on the fly. It's kind of fun to do stuff like this :-), but there's a standard action already available for you -- check out the org.apache.struts.actions.AddMappingAction class. There are a few other interesting standard actions in the same package. Am I correct in thinking that any ActionMappings and such that I add in this way will not be persisted, and that I also have to modify struts-config.xml if I want the mappings to be available for future restarts of my servlet engine? That is correct. Alas, there is no portable way to tell the servlet container you want to *write* to a resource inside the web application archive. Also, is there a way to specify multiple config paths in the ActionServlet so that i can have more then one struts-config.xml in one webapplication? So, for example, I would have a webapp test, which has test/WEB-INF/struts-config.xml. If I added something later to it, test/subtest, with its own new Actions, could I make a file test/subtest/WEB-INF/struts-config.xml and have that file ALSO be read by the ActionServlet on startup? There's an XML trick that lets you do this without needing to modify Struts. Consider that you've got a struts-config.xml file divided into three parts (form-beans.xml, global-forwards.xml, and action-mappings.xml) stored in the /WEB-INF directory. They can be combined automatically by doing something like this in struts-config.xml: ?xml version=1.0? !DOCTYPE ... [ !ENTITY part1 SYSTEM form-beans.xml !ENTITY part2 SYSTEM global-forwards.xml !ENTITY part3 SYSTEM action-mappings.xml ] struts-config form-beans part1; /form-beans global-forwards part2; /global-forwards action-mappings part3; /action-mappings /struts-config Obviously, you can extend this concept to any reasonable separation of struts-config.xml into subordinate files. I suppose I could update struts-config.xml and then tell the ActionServlet to reread it in the Action I talked about in the first paragraph...I'd like to be able to seperate this out, if possible, to make the seperate components of my webapplication seperate. The problem with putting this all into individual webapps is that I want the session to be passed from one part of the webapp to the next. The other approach would be to keep the individual pieces of struts-config.xml in separate files in your source repository, and use the Unix cat tool (or the DOS copy tool using plus signs) to concatenate the pieces together as you deploy the web app. Any thoughts? Thanks, Becky Craig
Weblogic related question- javax.servlet.jsp.JspException: No getter method for property...
I am moving a Struts-based application from WebLogic 5.1 to 6.1 and I am encountering some strange errors. Has anyone else seen this behavior before, or know what might be causing it? I have a Collection of beans I am trying to iterate through using the Struts iterate tag (works fine with WL5.1) but now I am getting an error that there is no getter method. I have verified with the debugger that at runtime the Collection exists and it is populated with the expected objects. I am not really sure what is going on... The only thing I can think of is that this method does not exactly conform to the JavaBean spec- it does not set/get the same type of object. When doing a set, you pass it a TimeStamp but for the get it returns a formatted String (see below). However, the naming conventions are followed correctly. Is this a problem? WL Exception # note: the bean called theFermentation is a FermSummaryBean (see below) javax.servlet.jsp.JspException: No getter method for property requestDate of bean theFermentation at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179) at jsp_servlet._mainmenu._jspService(_mainmenu.java:385) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :302) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:190) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:190) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo ntext.java:2390) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java :1959) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) # Snipet from the JSP jsp:useBean id=RecentRequests scope=request class=java.util.ArrayList/ . . . logic:iterate id=theFermentation name=RecentRequests tr class=smallText tdbean:write name=theFermentation property=requestName//td tdbean:write name=theFermentation property=requestType//td tdbean:write name=theFermentation property=requestBy//td tdbean:write name=theFermentation property=requestDate//td tdbean:write name=theFermentation property=status//td tda href=viewFermRequest.do?fermid=bean:write name=theFermentation property=requestId/ View.../a logic:equal name=theFermentation property=editable value=true a href=fermAdmin.do?fermid=bean:write name=theFermentation property=requestId/ Edit.../a /logic:equal /td /tr /logic:iterate # Contents of Bean class # package com.bipi.plims.entity; import java.sql.Timestamp; import java.text.SimpleDateFormat; /** * Value object that contains basic summary information about a fermentation request. * @author Robert Hayden * @version 1.0 */ public class FermSummaryBean implements java.io.Serializable { public String getRequestName() { return requestName; } public void setRequestName( String requestName ) { this.requestName = requestName; } public String getRequestDate() { SimpleDateFormat df = new SimpleDateFormat( MMM d ); return df.format( requestDate ); } public void setRequestDate( Timestamp
Re: Weblogic related question- javax.servlet.jsp.JspException: No get ter method for property...
RequestUtils is using introspection on your form bean class to match the name you placed in your html:text tag with a bean method name. So, if you had: html:text property=requestDate Your form bean should have: String getRequestDate() andvoid setRequestDate(String) Brian [EMAIL PROTECTED] elheim.comTo: [EMAIL PROTECTED] cc: 08/08/2001 03:22 PM Subject: Weblogic related question- javax.servlet.jsp.JspException: Please respond to No get ter method for property... struts-user I am moving a Struts-based application from WebLogic 5.1 to 6.1 and I am encountering some strange errors. Has anyone else seen this behavior before, or know what might be causing it? I have a Collection of beans I am trying to iterate through using the Struts iterate tag (works fine with WL5.1) but now I am getting an error that there is no getter method. I have verified with the debugger that at runtime the Collection exists and it is populated with the expected objects. I am not really sure what is going on... The only thing I can think of is that this method does not exactly conform to the JavaBean spec- it does not set/get the same type of object. When doing a set, you pass it a TimeStamp but for the get it returns a formatted String (see below). However, the naming conventions are followed correctly. Is this a problem? WL Exception # note: the bean called theFermentation is a FermSummaryBean (see below) javax.servlet.jsp.JspException: No getter method for property requestDate of bean theFermentation at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179) at jsp_servlet._mainmenu._jspService(_mainmenu.java:385) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :302) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:190) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:190) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo ntext.java:2390) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java :1959) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) # Snipet from the JSP jsp:useBean id=RecentRequests scope=request class=java.util.ArrayList/ . . .
Re: session question
There is no way to approach this problem as you currently are. You should be able to achieve the same effect however, but you will need to restructure your approach. Not knowing the details of you situation I would advise you to think in terms of having an action initialize your action form and set it as a request (or session...) attribute. Good Luck, Troy On Tuesday 07 August 2001 07:16 am, you wrote: Thanks for the response but I was talking about the ActionForm not the Action - perhaps I wasn't clear in my earlier post. The reason I am asking is that I would like to prepare some data for a jsp within an ActionForms constructor and have the jsp display this data via reflection of the ActionForms elements. I would like to be able to grab a value from the session within the ActionForms constructor but can't figure out how to access it as there doesn't seem to be any means of doing so. Anyone have any thoughts? Simon. -Original Message- From: Jon Crater [mailto:[EMAIL PROTECTED]] Sent: 07 August 2001 13:47 To: [EMAIL PROTECTED] Subject: Re: session question the action form's perform method receives a HttpServletRequest object, which has a getSession() method. call it to get access to the current session. note that getAttribute(String key) returns Object, so a typecast would probably be required. public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); YourObject o = (YourObject)session.getAttribute(yourSessionKey); //do something with the object } Original Message Follows From: Prior, Simon [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: session question Date: Tue, 7 Aug 2001 13:33:31 +0100 Hi all, Does anybody know whether it is possible to access elements on the session from the action form? - outside of the methods reset and validae? Thanks, Simon. For optimum solutions that save you time, visit www.ds-s.com. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp For optimum solutions that save you time, visit www.ds-s.com.
Struts on Websphere on AIX box
Hi, We have being using struts for a while now. We got it running on VAJ 3.5.3 . Also, on Websphere 3.5.3 on NT box. But now when time for actual deployment came ( which is on AIX Box ) , struts is giving a hard time . We are getting following error : [01.08.03 16:12:21:326 EDT] 6a64e3f8 WebGroup A SRVE0091I: [Servlet LOG]: action: Initializing configuration from resource path /WEB-INF/struts-config.xml register('-//Apache Software Foundation//DTD Struts Configuration 1.0//EN', 'classloader:/disk1/test/test/struts-example/servlets/org/apache/struts/reso urces/struts-config_1_0.dtd' register('-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN', 'classloader:/disk1/test/test/struts-example/servlets/org/apache/struts/reso urces/web-app_2_2.dtd' register('-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN', 'classloader:/disk1/test/test/struts-example/servlets/org/apache/struts/reso urces/web-app_2_3.dtd' resolveEntity('-//Apache Software Foundation//DTD Struts Configuration 1.0//EN', 'http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd') Resolving to alternate DTD 'classloader:/disk1/test/test/struts-example/servlets/org/apache/struts/reso urces/struts-config_1_0.dtd' Parse Fatal Error at line 5 column -1: External entity not found: http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;. java.net.MalformedURLException: null: java.lang.NullPointerException at com.sun.xml.parser.Parser.fatal(Parser.java:2817) at com.sun.xml.parser.Parser.externalParameterEntity(Parser.java:2506) at com.sun.xml.parser.Parser.maybeDoctypeDecl(Parser.java:1137) at com.sun.xml.parser.Parser.parseInternal(Parser.java:481) at com.sun.xml.parser.Parser.parse(Parser.java:284) at javax.xml.parsers.SAXParser.parse(SAXParser.java:155) at javax.xml.parsers.SAXParser.parse(SAXParser.java:77) at org.apache.struts.digester.Digester.parse(Digester.java:755) at org.apache.struts.action.ActionServlet.initMapping(ActionServlet.java:1331) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:465) at javax.servlet.GenericServlet.init(GenericServlet.java:258) We completely followed the steps of running the struts example on the Struts apache web site. Also, tried In the DOCTYPE declaration, change the word PUBLIC to SYSTEM and completely remove the line that reads -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN from web.xml and remove -//Apache Software Foundation//DTD Struts Configuration 1.0//EN from struts-config.xml. step as mentioned there but then it says DTD not registered. We have tried lots of work around but nothing worked till now. Have anyone tried the same got it working. Please let us know. Struts version used is 1.0 ( final release). Its urgent ! Thanks, in advance Shipra Jain
RE: Weblogic related question- javax.servlet.jsp.JspException: No get ter method for property...
The Bean class does have a matching get method for the specified property. This is why I don't understand why I am receiving this error... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 4:45 PM To: [EMAIL PROTECTED] Subject: Re: Weblogic related question- javax.servlet.jsp.JspException: No get ter method for property... RequestUtils is using introspection on your form bean class to match the name you placed in your html:text tag with a bean method name. So, if you had: html:text property=requestDate Your form bean should have: String getRequestDate() andvoid setRequestDate(String) Brian [EMAIL PROTECTED] elheim.comTo: [EMAIL PROTECTED] cc: 08/08/2001 03:22 PM Subject: Weblogic related question- javax.servlet.jsp.JspException: Please respond to No get ter method for property... struts-user I am moving a Struts-based application from WebLogic 5.1 to 6.1 and I am encountering some strange errors. Has anyone else seen this behavior before, or know what might be causing it? I have a Collection of beans I am trying to iterate through using the Struts iterate tag (works fine with WL5.1) but now I am getting an error that there is no getter method. I have verified with the debugger that at runtime the Collection exists and it is populated with the expected objects. I am not really sure what is going on... The only thing I can think of is that this method does not exactly conform to the JavaBean spec- it does not set/get the same type of object. When doing a set, you pass it a TimeStamp but for the get it returns a formatted String (see below). However, the naming conventions are followed correctly. Is this a problem? WL Exception # note: the bean called theFermentation is a FermSummaryBean (see below) javax.servlet.jsp.JspException: No getter method for property requestDate of bean theFermentation at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179) at jsp_servlet._mainmenu._jspService(_mainmenu.java:385) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :302) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:190) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:190) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo ntext.java:2390) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java :1959) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) # Snipet from the JSP jsp:useBean id=RecentRequests scope=request class=java.util.ArrayList/ . . . logic:iterate id=theFermentation name=RecentRequests tr class=smallText tdbean:write name=theFermentation property=requestName//td tdbean:write name=theFermentation property=requestType//td tdbean:write
RE: Weblogic related question- javax.servlet.jsp.JspException: No get ter method for property...
You're Bean class does not extend ActionForm.. [EMAIL PROTECTED] elheim.comTo: [EMAIL PROTECTED] cc: 08/08/2001 03:56 PM Subject: RE: Weblogic related question- Please respond to javax.servlet.jsp.JspException: No get ter method for property... struts-user The Bean class does have a matching get method for the specified property. This is why I don't understand why I am receiving this error... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 4:45 PM To: [EMAIL PROTECTED] Subject: Re: Weblogic related question- javax.servlet.jsp.JspException: No get ter method for property... RequestUtils is using introspection on your form bean class to match the name you placed in your html:text tag with a bean method name. So, if you had: html:text property=requestDate Your form bean should have: String getRequestDate() andvoid setRequestDate(String) Brian [EMAIL PROTECTED] elheim.comTo: [EMAIL PROTECTED] cc: 08/08/2001 03:22 PM Subject: Weblogic related question- javax.servlet.jsp.JspException: Please respond to No get ter method for property... struts-user I am moving a Struts-based application from WebLogic 5.1 to 6.1 and I am encountering some strange errors. Has anyone else seen this behavior before, or know what might be causing it? I have a Collection of beans I am trying to iterate through using the Struts iterate tag (works fine with WL5.1) but now I am getting an error that there is no getter method. I have verified with the debugger that at runtime the Collection exists and it is populated with the expected objects. I am not really sure what is going on... The only thing I can think of is that this method does not exactly conform to the JavaBean spec- it does not set/get the same type of object. When doing a set, you pass it a TimeStamp but for the get it returns a formatted String (see below). However, the naming conventions are followed correctly. Is this a problem? WL Exception # note: the bean called theFermentation is a FermSummaryBean (see below) javax.servlet.jsp.JspException: No getter method for property requestDate of bean theFermentation at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179) at jsp_servlet._mainmenu._jspService(_mainmenu.java:385) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :302) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:190) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :263) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:190) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at
Can't get setter method(s) for indexed property right. Pleeze help
I'm having trouble getting the setter methods of an indexed property of my formbean to work (despite some postings on this list). It's driving me nuts. So what I'm trying to do is use a String property of my formbean (actually a List of Strings) as an indexed property. === JSP === html:form action=/editCart.do TABLE border=1 borderwidth=1 cellspacing=0 logic:iterate id=cartItem name=%= Constants.KEY_CART % type=com.webtothemax.shop.common.CartItem property=cartItems TR TDbean:write name=cartItem property=product.name //TD TDbean:write name=cartItem property=product.price //TD : : TDhtml:text property=test indexed=true //TD : : - Note that the last field references the formbean (at least it should since name= is omittted). Note also that the iteration is not over the formbean (property). = Struts-config = actionpath=/addToCart type=com.webtothemax.shop.actions.AddToCartAction name=editCartForm scope=request validate=false forward name=success path=/WEB-INF/jsp/editCart.jsp / forward name=error path=/WEB-INF/jsp/showError.jsp / /action actionpath=/editCart type=com.webtothemax.shop.actions.EditCartAction name=editCartForm scope=request validate=false input= /WEB-INF/jsp/editCart.jsp forward name=success path=/WEB-INF/jsp/editCart.jsp / forward name=error path=/WEB-INF/jsp/showError.jsp / /action - AddToCartAction adds the product and prepopulates the formbean. == Form bean editCartForm == public class EditCartForm extends ActionForm { : : private ArrayList testList = new ArrayList(); public EditCartForm() {} : : : public String getTest(int index) { return (String) testList.get(index); } public void setTest(int index, String test) { testList.set(index, test); } public ArrayList getTestList() { return testList; } public void setTestList( ArrayList testList ) { this.testList = testList; } } - I got the idea for set/getTestList from this mailinglist. The result: Error: 500 Location: /WEB-INF/jsp/editCart.jsp Internal Servlet Error: javax.servlet.ServletException: No getter method for property test of bean editCartForm at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:459) at WEB_0002dINF.jsp._0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart_ jsp_7._jspService(_0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart _jsp_7.java:690) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) : : Root cause: javax.servlet.jsp.JspException: No getter method for property test of bean editCartForm at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:519) at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:190) at WEB_0002dINF.jsp._0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart_ jsp_7._jspService(_0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart _jsp_7.java:534) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) What am I doing wrong? Any help appreciated Marcel Maré WebToTheMax [EMAIL PROTECTED]
Formbean Reset() called on every pass?
Why is the Formbean Reset() method called on every pass, regardless of scope (request vs session). This makes prepopulating a form a bit awkward. TIA Marcel Maré WebToTheMax
splitting of struts config was RE: ActionServlet.addMapping() persistence
Craig, or anyone, Has anyone actually gotten the below xml inclusion mechanism to work using struts and tomcat 3.2.1? I searched other messages about this in the archives and none of the authors were successful. I always get a parse error like: che/struts/resources/web-app_2_3.dtd' Parse Fatal Error at line 5 column -1: Relative URI forms.xml; can not be reso lved without a document URI. org.xml.sax.SAXParseException: Relative URI forms.xml; can not be resolved wit hout a document URI. Our application is getting large and I would dearly like to use this idea to split up the config file thanks, dan -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 12:41 PM To: [EMAIL PROTECTED] Subject: Re: ActionServlet.addMapping() persistence There's an XML trick that lets you do this without needing to modify Struts. Consider that you've got a struts-config.xml file divided into three parts (form-beans.xml, global-forwards.xml, and action-mappings.xml) stored in the /WEB-INF directory. They can be combined automatically by doing something like this in struts-config.xml: ?xml version=1.0? !DOCTYPE ... [ !ENTITY part1 SYSTEM form-beans.xml !ENTITY part2 SYSTEM global-forwards.xml !ENTITY part3 SYSTEM action-mappings.xml ] struts-config form-beans part1; /form-beans global-forwards part2; /global-forwards action-mappings part3; /action-mappings /struts-config Obviously, you can extend this concept to any reasonable separation of struts-config.xml into subordinate files. I suppose I could update struts-config.xml and then tell the ActionServlet to reread it in the Action I talked about in the first paragraph...I'd like to be able to seperate this out, if possible, to make the seperate components of my webapplication seperate. The problem with putting this all into individual webapps is that I want the session to be passed from one part of the webapp to the next. The other approach would be to keep the individual pieces of struts-config.xml in separate files in your source repository, and use the Unix cat tool (or the DOS copy tool using plus signs) to concatenate the pieces together as you deploy the web app. Any thoughts? Thanks, Becky Craig
Formbean Reset() called on every pass?
Why is the Formbean Reset() method called on every pass, regardless of scope (request vs session). This makes prepopulating a form a bit awkward. TIA Marcel Maré WebToTheMax
Can't get setter method(s) for indexed property right. Pleeze help
I'm having trouble getting the setter methods of an indexed property of my formbean to work (despite some postings on this list). It's driving me nuts. So what I'm trying to do is use a String property of my formbean (actually a List of Strings) as an indexed property. === JSP === html:form action=/editCart.do TABLE border=1 borderwidth=1 cellspacing=0 logic:iterate id=cartItem name=%= Constants.KEY_CART % type=com.webtothemax.shop.common.CartItem property=cartItems TR TDbean:write name=cartItem property=product.name //TD TDbean:write name=cartItem property=product.price //TD : : TDhtml:text property=test indexed=true //TD : : - Note that the last field references the formbean (at least it should since name= is omittted). Note also that the iteration is not over the formbean (property). = Struts-config = actionpath=/addToCart type=com.webtothemax.shop.actions.AddToCartAction name=editCartForm scope=request validate=false forward name=success path=/WEB-INF/jsp/editCart.jsp / forward name=error path=/WEB-INF/jsp/showError.jsp / /action actionpath=/editCart type=com.webtothemax.shop.actions.EditCartAction name=editCartForm scope=request validate=false input= /WEB-INF/jsp/editCart.jsp forward name=success path=/WEB-INF/jsp/editCart.jsp / forward name=error path=/WEB-INF/jsp/showError.jsp / /action - AddToCartAction adds the product and prepopulates the formbean. == Form bean editCartForm == public class EditCartForm extends ActionForm { : : private ArrayList testList = new ArrayList(); public EditCartForm() {} : : : public String getTest(int index) { return (String) testList.get(index); } public void setTest(int index, String test) { testList.set(index, test); } public ArrayList getTestList() { return testList; } public void setTestList( ArrayList testList ) { this.testList = testList; } } - I got the idea for set/getTestList from this mailinglist. The result: Error: 500 Location: /WEB-INF/jsp/editCart.jsp Internal Servlet Error: javax.servlet.ServletException: No getter method for property test of bean editCartForm at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:459) at WEB_0002dINF.jsp._0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart_ jsp_7._jspService(_0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart _jsp_7.java:690) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) : : Root cause: javax.servlet.jsp.JspException: No getter method for property test of bean editCartForm at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:519) at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:190) at WEB_0002dINF.jsp._0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart_ jsp_7._jspService(_0002fWEB_0002dINF_0002fjsp_0002feditCart_0002ejspeditCart _jsp_7.java:534) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) What am I doing wrong? Any help appreciated Marcel Maré WebToTheMax [EMAIL PROTECTED]
Oops, sorry for the double posts
Something fishy going on here (duplicator worm? ;-) Marcel Maré WebToTheMax
Re: Can't get setter method(s) for indexed property right. Pleeze help
Marcel, I walked through code example submitted by Warwick Boote to get past issues/concepts with setters for indexed properties. The only change I made was to add a second field to the form. So, if your list is named properties, you would have second field on the form called property also. My property set method added an item to the properties vector (if it did not already exist on the vector)... I don't know if this is the best way to do it, but it worked. Brian Here's the message Warwick posted: Here is a hacked version of the code posted by David Hay previously. The code here will compile and run - a Vector is populated then displayed. After a post, the vector is retrieved from the form and then System.out is used to show its size. This should help others that are having problems with indexed tags. You'll need to point your browser to somthing that looks like http://localhost/struts/ShowParameters.do once you've copied all the files into the correct locations. There were two issues with the way i was trying to do it, firstly it seems that unless the scope of the form is set to session (or not specified) it doesn't work and secondly because i was using a different id for the name in the logic:iterate / html:text tags (when i set them to parameter it worked). logic:iterate id=parameter name=FieldsMapForm property =parameterList html:text name=parameter property=attributeCode indexed=true/ br /logic:iterate actionpath=/mapping type=com.eurobenefits.dta.presentation.FieldsMapAction scope=session name=FieldsMapForm validate=false forward name=viewmappings path=/DefineFieldMappings.jsp/ /action Waz. =) -Original Message- From: Warwick Boote [mailto:[EMAIL PROTECTED]] Sent: 24 July 2001 14:09 To: [EMAIL PROTECTED] Subject: what setters do i implement in an indexed tag ? I've created a page using indexed tags (neat stuff!). Here is what is currently working for me: o If i populate the form's vector, values from that vector are displayed in the jsp Here is what it not working: o when the form is posted back, the vector is null (in the struts perform() method) I suspect i haven't implemented some sort of setter within the form but i can't find an example as to what method should be implemented. I've tried ArrayList and using parameterList instead with no different result. Thanks, Waz. =) Here are some code snippits for help: ---jsp--- logic:iterate id=mappings name=FieldsMapForm property=fieldMappings html:text name=mappings property=attributeCode indexed=true/ br /logic:iterate ---Form--- public class FieldsMapForm extends ActionForm { private String fileColCount; private java.util.Vector fieldMappings = new java.util.Vector(); private String action; public String getFileColCount() { return fileColCount; } public void setFileColCount(String newFileColCount) { fileColCount = newFileColCount; } public void setFieldMappings(java.util.Vector newFieldMappings) { fieldMappings = newFieldMappings; } public java.util.Vector getFieldMappings() { return fieldMappings; } public FieldMapping getParameter(int index) { return (FieldMapping)fieldMappings.elementAt(index); } public void setAction(String newAction) { action = newAction; } public String getAction() { return action; } public void reset(ActionMapping mapping, HttpServletRequest request) { fileColCount = null; fieldMappings = new java.util.Vector(); action = null; } } ---The vector contains these:--- public class FieldMapping implements Serializable { private Integer fieldNumber; private String attributeCode; public void setFieldNumber(Integer newFieldNumber) { fieldNumber = newFieldNumber; } public Integer getFieldNumber() { return fieldNumber; } public void setAttributeCode(String newAttributeCode) { attributeCode = newAttributeCode; } public String getAttributeCode() { return attributeCode; } } indexed_eg_rwb.zip (See attached file: indexed_eg_rwb.zip) Marcel Maré list@webtothTo: Mailinglist Struts-User [EMAIL PROTECTED] emax.comcc: Subject: Can't get setter method(s) for indexed property right. 08/08/2001 Pleeze help 04:46 PM Please respond to
New Release
When is the new release of struts coming out (I really would like to use the logic:notEmpty tag)? What happened to PropertyUtils in the nightly builds? Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED]
Construct context-relative URL in Javascript?
I've seen Craig posted how something like html:image page=/images/a.gif/ will get translated to img src=/myapp/images/a.gif But I need to create a context-sensitive URL in Javascript. The reason for this is that there are multiple buttons on my form/page and in the action handler function for each button I need to set the form's action to the appropriate action for that button click before submitting the form. So I think I want a way to do get at info in Javascript that is the equivalent of what is returned by javax.servlet.http.HttpServletRequest req.getContextPath() So that something like this can be done in Javascript this.form.action = contextPath + /graphs/fullgraph.jsp (or .do instead of .jsp or whatever) So is there some way with a Struts tag to put the context path on the generated page using perhaps an invisible control that would be set to have the context path as its value? Then one could assign the invisible control's value for the the context path to a Javascript variable and use it in something like the code snippet above. I also need to do some other stuff in the Javacsript (eg set the target attribute of the form tag using a generated value as well). So I think I really need to use Javascript to do this. Or am I approaching the problem in a way that is totally wrong?
Re: Construct context-relative URL in Javascript?
Did you try html:base/? Randall Parker To: [EMAIL PROTECTED] [EMAIL PROTECTED] randall2@nlscc: .netSubject: Construct context-relative URL in Javascript? 08/08/2001 05:23 PM Please respond to struts-user I've seen Craig posted how something like html:image page=/images/a.gif/ will get translated to img src=/myapp/images/a.gif But I need to create a context-sensitive URL in Javascript. The reason for this is that there are multiple buttons on my form/page and in the action handler function for each button I need to set the form's action to the appropriate action for that button click before submitting the form. So I think I want a way to do get at info in Javascript that is the equivalent of what is returned by javax.servlet.http.HttpServletRequest req.getContextPath() So that something like this can be done in Javascript this.form.action = contextPath + /graphs/fullgraph.jsp (or .do instead of .jsp or whatever) So is there some way with a Struts tag to put the context path on the generated page using perhaps an invisible control that would be set to have the context path as its value? Then one could assign the invisible control's value for the the context path to a Javascript variable and use it in something like the code snippet above. I also need to do some other stuff in the Javacsript (eg set the target attribute of the form tag using a generated value as well). So I think I really need to use Javascript to do this. Or am I approaching the problem in a way that is totally wrong?
Using multiple data sources
I am new to struts and am having a bit of trouble getting multiple datasources working. I have two datasources defined in my struts-config.xml. The documentation is unclear on how to define an identifier for each datasource. The other problem is how to reference the datasource in my action class. What do I have to supply as the parameter to the servlet.findDataSource() method? I am currently using null, which returns the first datasource that I have defined. I want to be able to reference the other. Further to this, does anybody have a concrete example of using the DBTags taglib with a struts defined datasource. Again, the documentation is very sparse on this subject. Thanks Jeff Bird -- Jeffrey Bird Email: [EMAIL PROTECTED] Phone: +61 7 47814649 Computer Systems Officer Fax: +61 7 47815230 Information Technology Resources James Cook University
Re: Formbean Reset() called on every pass?
On Wed, 8 Aug 2001, Marcel Maré wrote: Why is the Formbean Reset() method called on every pass, regardless of scope (request vs session). This makes prepopulating a form a bit awkward. Because it is the only practical way I have found to deal with the funkiness of HTTP with regards to checkboxes. You shouldn't really be using reset() for prepopulation, anyway -- a better strategy is to go through a setup action for that which precreates the form bean exactly as you want it, and forwards to the JSP page for display. The example app illustrates this technique (see the /editRegistration and /editSubscription actions). TIA Marcel Maré WebToTheMax Craig
Re: splitting of struts config was RE: ActionServlet.addMapping()persistence
My ... in the second line needs to be replaced by the usual public and system identifiers -- I pushed SEND before I went back and looked them up in the docs :-( Craig On Wed, 8 Aug 2001, Daniel Toms wrote: Craig, or anyone, Has anyone actually gotten the below xml inclusion mechanism to work using struts and tomcat 3.2.1? I searched other messages about this in the archives and none of the authors were successful. I always get a parse error like: che/struts/resources/web-app_2_3.dtd' Parse Fatal Error at line 5 column -1: Relative URI forms.xml; can not be reso lved without a document URI. org.xml.sax.SAXParseException: Relative URI forms.xml; can not be resolved wit hout a document URI. Our application is getting large and I would dearly like to use this idea to split up the config file thanks, dan -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 12:41 PM To: [EMAIL PROTECTED] Subject: Re: ActionServlet.addMapping() persistence There's an XML trick that lets you do this without needing to modify Struts. Consider that you've got a struts-config.xml file divided into three parts (form-beans.xml, global-forwards.xml, and action-mappings.xml) stored in the /WEB-INF directory. They can be combined automatically by doing something like this in struts-config.xml: ?xml version=1.0? !DOCTYPE ... [ !ENTITY part1 SYSTEM form-beans.xml !ENTITY part2 SYSTEM global-forwards.xml !ENTITY part3 SYSTEM action-mappings.xml ] struts-config form-beans part1; /form-beans global-forwards part2; /global-forwards action-mappings part3; /action-mappings /struts-config Obviously, you can extend this concept to any reasonable separation of struts-config.xml into subordinate files. I suppose I could update struts-config.xml and then tell the ActionServlet to reread it in the Action I talked about in the first paragraph...I'd like to be able to seperate this out, if possible, to make the seperate components of my webapplication seperate. The problem with putting this all into individual webapps is that I want the session to be passed from one part of the webapp to the next. The other approach would be to keep the individual pieces of struts-config.xml in separate files in your source repository, and use the Unix cat tool (or the DOS copy tool using plus signs) to concatenate the pieces together as you deploy the web app. Any thoughts? Thanks, Becky Craig
Re: New Release
On Wed, 8 Aug 2001, MacKellar, Kimberly wrote: When is the new release of struts coming out (I really would like to use the logic:notEmpty tag)? If you're planning on waiting for a 1.1 release, we haven't really talked about it yet. I know there's quite a bit of stuff yet to integrate - in the mean time, you could either use a 1.1 nightly build, or back-port logic:empty and logic:notEmpty) into 1.0 (there should not be a problem doing this). What happened to PropertyUtils in the nightly builds? This class (and the digester stuff) now uses the packages from jakarta-commons for this. They have the same functionality but different package names. (The classes are in the commons-*.jar files). Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED] Craig
newbie question
Hi all - I am facing a weird problem, which I could not solve in the last couple of hours. I checked up the mail-archive but could not locate any solution to this. The application has a login screen (login.jsp), which validates a user. There is an ActionForm (LoginForm) with appropriate get and set methods. The struts-config.xml looks like : form-beans !-- Logon form bean -- form-bean name=loginForm type=com.anshin.LoginForm/ /form-beans !-- Process a user logon -- actionpath=/login type=com.anshin.LoginAction name=loginForm validate=true input=login.jsp forward name=success path=/login.jsp/ /action When I execute the application (invoke login.jsp), I get a 404 error on the page login.do. I gave debugging statements and I find that the get methods of the ActionForm gets executed, but nothing else happens. It does not even enter the LoginAction class. But from the Tomcat startup messages, I find that the mappings have been identified and loaded by Tomcat. I have struts.jar in WEB-INF/lib. I am really banging my head over this problem. The other applications like struts-example etc. are running fine .. Pls. help. Regards. - Debasish __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: beans:write bug?
This is a consequence of the JavaBeans introspection mechanism. The getter and setter must be getting and setting the same type for them to be recognized as property accessors. See the Introspection chapter of the JavaBeans spec for more details. -- Martin Cooper - Original Message - From: Bud Gibson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 18, 2001 6:13 PM Subject: beans:write bug? We have a bean with properties where the setter takes a float, and the getter returns a string. Using expressions and scriptlets, this all works fine. For instance, I can write the following for a bean contained inside another: %= HagBean.getProduct().getPrice() % and a formatted string with the price will appear. However, when we try the equivalent bean:write, bean:write name=HagBean property=product.price / struts tells us that we are mismatching types with a float and String. Is this a bean:write bug? As I understand beans, setter methods are not even required. I find it odd that bean:write seems to be assuming the type of the setter method and then becoming unhappy when it gets the type returned by the getter method. Thanks, Bud -- ___ Bud Gibson e-Lab Czar Assistant Professor University of Michigan Business School 701 Tappan Street, C2424 Ann Arbor, MI 48109-1234 ph: 734\647-9200 fax: 734\764-3240 [EMAIL PROTECTED]
Re: How to detect an ActionError in the JSP (logic:present)?
If you are just trying to determine whether or not there are outstanding errors to be displayed, you should look for the ActionErrors object, which is stored under the key Action.ERROR_KEY. -- Martin Cooper - Original Message - From: Hartmut Bernecker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 5:55 AM Subject: How to detect an ActionError in the JSP (logic:present)? Hello, In the validate method of the form class I return ActionErrors filled with some ActionError objects. In the JSP I have: logic:present name=org.apache.struts.action.GLOBAL_ERROR perror ocurred/p[ ... ] /logic:present Why is there no reaction (displaying of error ocurred ...)?? Hartmut Bernecker
Re: Staging Pages/Action form question.
The Struts answer to both of these questions is use an Action. The Action classes are where the various pieces come together. In the first case, your action will invoke methods on business-logic objects and populate the form with the results. Then it will forward to the appropriate JSP page to display those results. In the second case, the search criteria will be presented to an action as a form bean. The action will then pass this data to business-logic objects, which will perform the search and return the results. After performing any transformations necessary to make the results more easily digested by a JSP page, the action once again forwards to an appropriate JSP to display them. Take a good look at the example application that comes with Struts, and Ted Husted's Strut by Strut article at: http://www.husted.com/about/struts/strutByStrut.htm for more details on how it all works. -- Martin Cooper - Original Message - From: Prior, Simon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 06, 2001 2:02 AM Subject: Staging Pages/Action form question. Hi Guys, I have the following scenarios and to design for and wanted to know how you approached the following problems: 1. I have a page that will have dynamically generated menus populated with entries from a database. My first question is how do you stage the pages? - can you use the action form to retrieve the information to populate the menus from the database ? I was thinking of using the action forms constructor to call an ejb to ultimately retrieve the information but didn't know whether this was the best way of approaching the problem. Do you guys have any suggestions? 2. I also have a search page where the user enters the search criteria and then submits the query, at this point I was going to put the search criteria on the session and have the results page pick up the search criteria, carry out the search and then display the results. How do you guys do this? If I was to use an action form for this in a manner similar to the above scenario the constructor would retrieve the search criteria from the session and execute the query thus 'staging' the page. Can the action form access the session? If not, how do you guys do it? Any help would be most appreciated. Thanks in advance, Simon. For optimum solutions that save you time, visit www.ds-s.com.
Re: Using multiple data sources
On Thu, 9 Aug 2001, Jeffrey Bird wrote: I am new to struts and am having a bit of trouble getting multiple datasources working. I have two datasources defined in my struts-config.xml. The documentation is unclear on how to define an identifier for each datasource. The other problem is how to reference the datasource in my action class. What do I have to supply as the parameter to the servlet.findDataSource() method? I am currently using null, which returns the first datasource that I have defined. I want to be able to reference the other. Further to this, does anybody have a concrete example of using the DBTags taglib with a struts defined datasource. Again, the documentation is very sparse on this subject. The basic principle is that every data source you define is made available to your application's Actions as a servlet context attribute. The first data source receives a default name (so you can just call servlet.getDataSource() with no argument from an Action). Beyond that, you have to assign specific names to the data sources, like this: data-source ... key=myname .../ and then you can reference that particular data source from an Action: DataSource ds = servlet.getDataSource(myname); or from a JSP page as an application-scope bean named myname. The latter is how you would access it from DBTags. Thanks Jeff Bird Craig
Re: Newbee: design question
You don't have to create a form bean if you don't want or need to. In your example, the form bean would only have one property, and that property came directly from a link (minimizing the risk of invalid values, and hence the need for validation in the form bean), so you could just use request.getParameter() instead if you wanted to. Regarding unifying access to form fields and parameters, I'm not sure what you're getting at. If a form bean is used, Struts will populate it from the request parameters regardless of how the request was submitted. So long as the form bean has a property corresponding to each parameter name, the form will contain all of the request parameter values when your action class is called. -- Martin Cooper - Original Message - From: Andreas Leitner [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 25, 2001 1:13 AM Subject: Newbee: design question Hi, I am pretty new to tomcat/struts but nevertheless trying to create a simple application using the two (; I have troubles getting my design right, maybe some people on this list could give me some hints, they would be greatly appreciated. The idea is that I have a DB backend that stores a bunch of documents identified by an integer. Now the user can click on a link and view the document (that's the first step). Now the link looks like this: html:link page=/viewDocument.do?documentId=33view doc with id 33/html:link Now, what I want to happen when the user clicks this link is: Run a controller that checks if the documentId is valid, and if so, retrieve the document from the DB and store it somewhere in the request scope, then forward to the actual viewer, otherwise forward to an error page. The forwards will be done using local forward mappings in the config file, in order to seperate buisness logic from presentation code. What I don't understand is: Do I have to create a Form class for this action? The documentId comes as an Parameter in the request scope and struts won't fill out the Form anyway (cause there is not form). The example that came with struts did create a form class in this case, that's why I am confused. My thinking was that I could just simply add a custom Document class to the request scope, which the actual viewer would then read. Another issue: Can I unify access to Forms fields and Parameters? For my example it would probably not make a lot of sense, but it would be neat (from a theoretical POV) if it would not matter if the user just clicked on a link with parameters or he submitted a form. As long as the both contain the same fields/parameters, struts could always fill out a Form class. Or am I missing something? Regards, Andreas
New To Struts
Hi, I am new to struts and for past one week I am trying to find tutorials and materials regarding struts. The only thing I got is some tutorial in jspinsider.com. I understood the model of struts, but when putting it in to code, I am facing problem at very basic step. All I see in tutorials is they have explained how to use struts in tomcat server. But I am using weblogic5.1 server. I have did all the settings as per directed for tomcat. I understand there must some different way of deploying struts in weblogic server. Can anyone please guide me through as what I should do to run my basic application? What all installations do I need and where should be they placed? I am really vexed up looking for these things on net. This mailing list is my LAST REOSRT. Thanks and Regards, Nitu.
Re: New To Struts
You must not have visited the Struts home page, which should have been your *first* resort. :-) http://jakarta.apache.org/struts/ There you will find: * A link to the Struts User Guide * A 'Resources' link, which will take you to a page listing several tutorials and articles on Struts. * An 'Installation' link, which will take you to a page detailing specific installation instructions for over a dozen different containers, including WebLogic 5.1. -- Martin Cooper - Original Message - From: Nitu Singh [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 08, 2001 5:18 PM Subject: New To Struts Hi, I am new to struts and for past one week I am trying to find tutorials and materials regarding struts. The only thing I got is some tutorial in jspinsider.com. I understood the model of struts, but when putting it in to code, I am facing problem at very basic step. All I see in tutorials is they have explained how to use struts in tomcat server. But I am using weblogic5.1 server. I have did all the settings as per directed for tomcat. I understand there must some different way of deploying struts in weblogic server. Can anyone please guide me through as what I should do to run my basic application? What all installations do I need and where should be they placed? I am really vexed up looking for these things on net. This mailing list is my LAST REOSRT. Thanks and Regards, Nitu.
Re: New To Struts
The following might help you. ramakrishna. * Ted Husted has links tutorials, example webapps, and code (custom tags, etc.). http://www.husted.com/about/struts/ A Walking Tour of Struts (at the bottom) walks you through the Struts example webapp. http://www.husted.com/about/struts/scaffolding.htm If you want to stay pure MVC, then you can have your home page go through the controller servlet. Struts has a connection pool that you can use for database connections. You configure it in the struts-config.xml file. David --- [EMAIL PROTECTED] wrote: Hi all, I just signed up and looking for some tutorials on struts. I installed it on Linux with Apache-Tomcat config. There is a sample application in there, however it would be maybe easier to go through some tutorials first. Any suggestions ? Also, I'm in the process of doing a little web site for myself. It's basically only presentation of data for now. I have a little confusion there. As far as I understood the specifications, servlets ( controllers ) are responsible for data extraction from the database and JSPs for presentation. So what should I set up as the index page , a JSP that forwards the request to servlet and servlet responds to JSP again or to use a servlet that sends data to JSP ? Also. is it a good technique to have the JSP ( beans ) extract data from database ? In this case, how do I get to the connection parameters if I don't want to hardcode it and maybe use web.xml file to hold the connection parameters ? All responses are welcomed. Thank you. Jf __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ - Original Message - From: Nitu Singh [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 08, 2001 5:18 PM Subject: New To Struts Hi, I am new to struts and for past one week I am trying to find tutorials and materials regarding struts. The only thing I got is some tutorial in jspinsider.com. I understood the model of struts, but when putting it in to code, I am facing problem at very basic step. All I see in tutorials is they have explained how to use struts in tomcat server. But I am using weblogic5.1 server. I have did all the settings as per directed for tomcat. I understand there must some different way of deploying struts in weblogic server. Can anyone please guide me through as what I should do to run my basic application? What all installations do I need and where should be they placed? I am really vexed up looking for these things on net. This mailing list is my LAST REOSRT. Thanks and Regards, Nitu.
Re: New To Struts
Thanks a lot, And I did visit the home page for struts(and that's where the problem started). Let me explain u the doubts which I had going thru the page: 1) All the downloads had 2-3 versions (for example, ANT, it had binary release, source realease and some RPM), which one I have to download, do I have to download all the 3? btw, if u can explain me the difference between source release and binary release, as I see them in almost all the downloads. 2) Do I really have to download the Servlet API ?If yes, why? as weblogic supports servlets and why again to have one more servlet API? 3) In many installations it says, I need to put some *distribution files* or some *jar files* in WEB-INF directory. I don't find any such directory in weblogic5.1. So what to do? These are only few of the things. The more I read, the more I get confused? If you could clear my above queries, I can go ahead and then may be I will come up more questions? Thanks a lot, Nitu. - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 09, 2001 3:29 PM Subject: Re: New To Struts You must not have visited the Struts home page, which should have been your *first* resort. :-) http://jakarta.apache.org/struts/ There you will find: * A link to the Struts User Guide * A 'Resources' link, which will take you to a page listing several tutorials and articles on Struts. * An 'Installation' link, which will take you to a page detailing specific installation instructions for over a dozen different containers, including WebLogic 5.1. -- Martin Cooper - Original Message - From: Nitu Singh [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 08, 2001 5:18 PM Subject: New To Struts Hi, I am new to struts and for past one week I am trying to find tutorials and materials regarding struts. The only thing I got is some tutorial in jspinsider.com. I understood the model of struts, but when putting it in to code, I am facing problem at very basic step. All I see in tutorials is they have explained how to use struts in tomcat server. But I am using weblogic5.1 server. I have did all the settings as per directed for tomcat. I understand there must some different way of deploying struts in weblogic server. Can anyone please guide me through as what I should do to run my basic application? What all installations do I need and where should be they placed? I am really vexed up looking for these things on net. This mailing list is my LAST REOSRT. Thanks and Regards, Nitu.
Weblogic + Struts + VAGE 3.5
I am trying to run Struts from weblogic in VAGE 3.5 Enterprise edition but I fail to run first example. Is there anyone who could use Struts in VAGE by using Weblogic. I got first applicatin is running at weblogic but when I try to reach index.jsp, I get a SAX parser exception.. Here is the detail; am using Struts version 1.0 and trying to run from source. I imported all needed pacakages into Visual Age (Xerses, Weblogic projects, Struts version 1.0 source) I am trying to run the first Struts application which is struts-exampleI am using VAGE 3.5 Enterprise Edition. I have downloaded weblogic kit for Visual age 3.5 Enterprise and installed alse I setup the service pack 9 for Weblogic kit. It gives me an error when I attemp to start the application. I write this error to you. Also when I try to reach 'http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd' address, I fail. I get an error message which is The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh javascript:location.reload() button, or try again later. Cannot have a DTD declaration outside of a DTD. Line 26, Position 12 !ENTITY % BeanName CDATA ---^ If you help me, I will be very glad.. Thank you in advance for your help... Pzt Agu 06 14:26:31 GMT+03:00 2001:I WebAppServletContext-amberjack-struts Pre-Loading servlet action Pzt Agu 06 14:26:32 GMT+03:00 2001:I WebAppServletContext-amberjack-struts action: init Pzt Agu 06 14:26:32 GMT+03:00 2001:I WebAppServletContext-amberjack-struts action: null Pzt Agu 06 14:26:32 GMT+03:00 2001:I WebAppServletContext-amberjack-struts action: null resolveEntity('-//Apache Software Foundation//DTD Struts Configuration 1.0//EN', 'http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd') Not registered, use system identifier javax.servlet.UnavailableException java.lang.Throwable(java.lang.String) java.lang.Exception(java.lang.String) javax.servlet.ServletException(java.lang.String) javax.servlet.UnavailableException(java.lang.String) void org.apache.struts.action.ActionServlet.init() void javax.servlet.GenericServlet.init(javax.servlet.ServletConfig) javax.servlet.Servlet weblogic.servlet.internal.ServletStubImpl.createServlet() void weblogic.servlet.internal.ServletStubImpl.createInstances() void weblogic.servlet.internal.ServletStubImpl.prepareServlet(weblogic.servle t.internal.ServletRequestImpl, weblogic.servlet.internal.ServletResponseImpl) void weblogic.servlet.internal.ServletStubImpl.prepareServlet() void weblogic.servlet.internal.ServletContextImpl.preloadServlet(java.lang.St ring) void weblogic.servlet.internal.ServletContextImpl.preloadServlets() void weblogic.t3.srvr.HttpServer.initServletContexts() void weblogic.t3.srvr.HttpServer.start() void weblogic.t3.srvr.T3Srvr.start() void weblogic.t3.srvr.T3Srvr.main(java.lang.String [], java.lang.String, java.lang.String) void weblogic.Server.startServerStatically(java.lang.String [], java.lang.String, java.lang.String) void weblogic.Server.main(java.lang.String [], java.lang.String, java.lang.String) void weblogic.Server.main(java.lang.String []) void weblogic.integration.visualage.server.Server.main(java.lang.String []) Pzt Agu 06 14:27:19 GMT+03:00 2001:I HTTP Log rotation is size based Pzt Agu 06 14:27:19 GMT+03:00 2001:I ZAC ZAC ACLs initialized Pzt Agu 06 14:27:19 GMT+03:00 2001:I ZAC ZAC packages stored in local directory exports Pzt Agu 06 14:27:19 GMT+03:00 2001:I ListenThread Listening on port: 7001 Pzt Agu 06 14:27:20 GMT+03:00 2001:I WebLogicServer WebLogic Server started Regards. Baris Guzelordu [EMAIL PROTECTED] *** This e-mail 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 are not the intended recipient you are hereby notified that any dissemination, forwarding, copying or use of any of the information is prohibited. The opinions expressed in this message belong to sender alone. There is no implied endorsement by TURKCELL. This e-mail has been scanned for all known computer viruses. ***
Struts Tomcat 4.0
Hello, I have been playing with struts for the past couple of months and I have had fun playing with it. Time has come now to stop playing and get serious. I have been asked to develop a web app with Struts Tomcat. I have been using Weblogic for the past couple of years, but this is my first experience with Tomcat, so I need some help to take some decisions. (I realize that this email should really be sent to the Tomcat mailing list, but I believe there's enough expertise in this mailing list to get these questions answered!) After reading thru the Struts mailing list I have concluded the following. Can someone please tell me if I am on the right track? 1) From one of Craig's emails it sounds like I should be using Tomcat 4.0, not 3.2. Is that right? But Tomcat 4.0 is a beta release. Is it reliable? 2) Doesn't look like Tomcat 4.0 supports EJB. Does it? 3) If EJB is not available I can use JDBC - no problem - but doesn't look like I can create database connection pool in Tomcat. 4) From one of Ted's emails I think I should use Poolman to create database connection pool in Tomcat 4.0. Right? 5) What's equivalent of Weblogic Time APIs? Tomcat workers, right? 6) Can I set up Tomcat to send emails using Java Mail APIs? In Weblogic one has to make sure that mail.jar activation.jar is in Weblogic Classpath. Is there any special requirement such as this in Tomcat? 7) Does Tomcat support JMS? 8) Which one is better - Log4J or LogKit (which is part of Avalon project from Jakarta)? 9) What's the difference between 'Struts' 'Turbine' (which is another Jakarta project)? Pros Cons? I apologize for the length of this email. Thanks in advance for your time. - Ajay