Re: Datasource problem again..
I tried using the datasources tags in struts-config.xml, couldnt get it work so I modified the server.xml in tomcat/conf directly. Just add a context element as follows in your server.xml This is my configuration: Context path=/wrap docBase=C:\tomcat5\webapps\wrap reloadable=true Resource name=jdbc/WrapDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/WrapDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value200/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to 0 for no limit. -- parameter namemaxIdle/name value10/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value20/value /parameter !-- dB username and password for dB connections -- parameter nameusername/name value(*place your username here) /value /parameter parameter namepassword/name value(*place your password here)/value /parameter !-- Class name for oracle JDBC driver -- parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://(***place your URL here)/value /parameter /ResourceParams /Context Hope this helps. -Asif - Original Message - From: Koon Yue Lam [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, July 19, 2004 12:46 PM Subject: Datasource problem again.. Hi ! I have try the follow to retrieve a datasource from Struts using JNDI: Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/kiss_web_news); but it doesn't work it is my struts-config,xml: data-sources data-source type=org.apache.commons.dbcp.BasicDataSource set-property property=driverClassName value=org.gjt.mm.mysql.Driver / set-property property=url value=jdbc:mysql://localhost/kiss_web_news / set-property property=username value=root / set-property property=password value=1234567 / /data-source /data-sources Do I need to modify the web.xml under $Tomcat/conf ?? It seems that Stucts doesn't registry the datasource to JNDI and I always get a null pointer of datasource. any help? Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with formatting messages from ApplicationResources.xml
I included br in one of the entries in the ApplicationResources. Im not sure if that is allowed. This is what I get in my jsp output: a.. Your payment of $750.00 has been approved! br Your Order ID is 6690. br Please print this page for your records. I tried using the filter attribute bean:write name=message filter=true /, but that didnt work either. Can someone help me with this? -Asif
Re: Is it possible to reuse the same FormBean with different actions?
Thanks! - Original Message - From: Robert Taylor [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Asif Rahman [EMAIL PROTECTED] Sent: Friday, June 25, 2004 4:21 PM Subject: RE: Is it possible to reuse the same FormBean with different actions? Use different action mappings with same form bean. Each action mapping can have a different input attribute value for validation. robert -Original Message- From: Asif Rahman [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 3:52 PM To: Struts Users Mailing List Subject: Is it possible to reuse the same FormBean with different actions? Importance: High I have a few jsp pages that use almost the same information. I am using a formbean for one of them right now for validation. Of course I'd like to re-use the this same bean with the other jsp pages too since the info is so similar. But here's the catch, theres only one input field in an action mapping, meaning it will always send the user back to the same jsp page if validation fails, rather than different ones. Is there some other element in the action mapping I can set to get around this? I can always have 2 or 3 formbeans and copy properties from one to the other, but that doesnt seem like a very good solution to me. Does anyone have any ideas? -Asif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Is it possible to reuse the same FormBean with different actions?
I have a few jsp pages that use almost the same information. I am using a formbean for one of them right now for validation. Of course I'd like to re-use the this same bean with the other jsp pages too since the info is so similar. But here's the catch, theres only one input field in an action mapping, meaning it will always send the user back to the same jsp page if validation fails, rather than different ones. Is there some other element in the action mapping I can set to get around this? I can always have 2 or 3 formbeans and copy properties from one to the other, but that doesnt seem like a very good solution to me. Does anyone have any ideas? -Asif
Problem with displaying a subset of error messages using html:messages
Hi Im have been using pretty standard code to display error messages so far, eg: logic:messagesPresent html:messages id=error libean:write name=error//li /html:messages brbr /logic:messagesPresent But now, the problem I am facing is that I want to display a subset of my error messages in one part of page, (e.g. Error messages that start with Company) and the rest of the messages (ones that start with Factory) in another section of the page. I've read the docs but really havent been able to figure this one out. Can someone plese help me? Thanks. -Asif
Re: Problem with displaying a subset of error messages using html:messages
Hi Atta, this is what I'm getting when I try that: javax.servlet.jsp.JspTagException: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute test with value ${error.key == 'company'}: Unable to find a value for key in object of class java.lang.String using operator . (null) at org.apache.taglibs.standard.tag.el.core.IfTag.condition(IfTag.java:102) Any ideas? -Asif - Original Message - From: atta-ur rehman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Asif Rahman [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:04 PM Subject: Re: Problem with displaying a subset of error messages using html:messages Hello Asif, Now I havn't checked what I'm going to write here but am pretty sure it should work. First of all while adding your ActionError to ActionErrors use 'company' as the key for the company errors and 'factory' for factory related error messages. like: ActionErrors errors = new ActionErrors(); errors.add('company', new ActionError()); errors.add('factory', new ActionError()); now in you loop wrap you bean:wrie in an if statement: logic:messagesPresent html:messages id=error c:if test=${error.key == 'company'} libean:write name=error//li /c:if /html:messages brbr /logic:messagesPresent hope this work and helps! ATTA - Original Message - From: Asif Rahman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 12:48 PM Subject: Problem with displaying a subset of error messages using html:messages Hi Im have been using pretty standard code to display error messages so far, eg: logic:messagesPresent html:messages id=error libean:write name=error//li /html:messages brbr /logic:messagesPresent But now, the problem I am facing is that I want to display a subset of my error messages in one part of page, (e.g. Error messages that start with Company) and the rest of the messages (ones that start with Factory) in another section of the page. I've read the docs but really havent been able to figure this one out. Can someone plese help me? Thanks. -Asif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[SOLVED] Re: Problem with displaying a subset of error messages using html:messages
It works! I just got it to work the same way too:http://javaboutique.internet.com/tutorials/excep_struts/index-2.html Thanks so much Atta :) -Asif - Original Message - From: atta-ur rehman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Asif Rahman [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:56 PM Subject: Re: Problem with displaying a subset of error messages using html:messages Okay, while out for lunch i thought about it and i think the right way of doing it would be to use property attribute of the html:messages tag: http://jakarta.apache.org/struts/userGuide/struts-html.html#messages henc new code: logic:messagesPresent html:messages id=error property=company libean:write name=error//li /html:messages brbr /logic:messagesPresent I wish i could have been able to check it but let's see if it works! ATTA - Original Message - From: Asif Rahman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 1:26 PM Subject: Re: Problem with displaying a subset of error messages using html:messages Hi Atta, this is what I'm getting when I try that: javax.servlet.jsp.JspTagException: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute test with value ${error.key == 'company'}: Unable to find a value for key in object of class java.lang.String using operator . (null) at org.apache.taglibs.standard.tag.el.core.IfTag.condition(IfTag.java:102) Any ideas? -Asif - Original Message - From: atta-ur rehman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Asif Rahman [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:04 PM Subject: Re: Problem with displaying a subset of error messages using html:messages Hello Asif, Now I havn't checked what I'm going to write here but am pretty sure it should work. First of all while adding your ActionError to ActionErrors use 'company' as the key for the company errors and 'factory' for factory related error messages. like: ActionErrors errors = new ActionErrors(); errors.add('company', new ActionError()); errors.add('factory', new ActionError()); now in you loop wrap you bean:wrie in an if statement: logic:messagesPresent html:messages id=error c:if test=${error.key == 'company'} libean:write name=error//li /c:if /html:messages brbr /logic:messagesPresent hope this work and helps! ATTA - Original Message - From: Asif Rahman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 12:48 PM Subject: Problem with displaying a subset of error messages using html:messages Hi Im have been using pretty standard code to display error messages so far, eg: logic:messagesPresent html:messages id=error libean:write name=error//li /html:messages brbr /logic:messagesPresent But now, the problem I am facing is that I want to display a subset of my error messages in one part of page, (e.g. Error messages that start with Company) and the rest of the messages (ones that start with Factory) in another section of the page. I've read the docs but really havent been able to figure this one out. Can someone plese help me? Thanks. -Asif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts alternative to using request.getParameterValues in an actionform?
I tried this, it should work theoretically, but my form is empty now, none of the textfields are showing up. I do have a property called sitesList in the OpporutnitySitesForm and it is already populated when I arrive at this page. Please advise. Thanks. -Asif - Original Message - From: Satish Kataria [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Asif Rahman [EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 8:35 AM Subject: RE: Struts alternative to using request.getParameterValues in an actionform? You can use nested tags to automatically retrive and populate information. A snippet of code is as follows nested:root name=OpportunitySitesForm nested:nest property=sitesList logic:iterate id=myCollectionElement name=OpportunitySitesForm property=sitesList nested:text name=myCollectionElement property=siteName/ /logic:iterate /nested:nest property=sitesList /nested:root name=OpportunitySitesForm It assumes you have a attribute named sitesList in ur action form This way you can access any type of attribute from ur action form -Original Message- From: Asif Rahman [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:31 AM To: [EMAIL PROTECTED] Subject: Struts alternative to using request.getParameterValues in an actionform? Importance: High Hi Im using logic:iterate shown below to iterate through an arraylist (sitesList) in my actionform (OpportunitySitesForm). This arraylist contains a number of Site objects which have the properties siteName, address1, and city. This is getting displayed correctly. Now when processing the form, I am wondering whether in struts there is a way to retrieve these as objects and automatically populate setSitesList(ArrayList) method, rather than manually use request.getParameterValues for siteName, address1, city, create individual Site objects, add the site objects to an arraylist with Site objects and finally pass the list into setSitesList(arraylist). logic:iterate id=myCollectionElement name=OpportunitySitesForm property=sitesList tr td colspan=2input type=text name=siteName value='bean:write name=myCollectionElement property=siteName /'/td td colspan=2input type=text name=address1 value='bean:write name=myCollectionElement property=address1 /'/td td colspan=2input type=text name=city value='bean:write name=myCollectionElement property=city /'/td tr /logic:iterate Any help would be most appreciated. Thanks! -Asif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts alternative to using request.getParameterValues in an actionform?
*blush* sorry, forgot the taglib directive. -Asif - Original Message - From: Asif Rahman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 9:50 AM Subject: Re: Struts alternative to using request.getParameterValues in an actionform? I tried this, it should work theoretically, but my form is empty now, none of the textfields are showing up. I do have a property called sitesList in the OpporutnitySitesForm and it is already populated when I arrive at this page. Please advise. Thanks. -Asif - Original Message - From: Satish Kataria [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Asif Rahman [EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 8:35 AM Subject: RE: Struts alternative to using request.getParameterValues in an actionform? You can use nested tags to automatically retrive and populate information. A snippet of code is as follows nested:root name=OpportunitySitesForm nested:nest property=sitesList logic:iterate id=myCollectionElement name=OpportunitySitesForm property=sitesList nested:text name=myCollectionElement property=siteName/ /logic:iterate /nested:nest property=sitesList /nested:root name=OpportunitySitesForm It assumes you have a attribute named sitesList in ur action form This way you can access any type of attribute from ur action form -Original Message- From: Asif Rahman [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:31 AM To: [EMAIL PROTECTED] Subject: Struts alternative to using request.getParameterValues in an actionform? Importance: High Hi Im using logic:iterate shown below to iterate through an arraylist (sitesList) in my actionform (OpportunitySitesForm). This arraylist contains a number of Site objects which have the properties siteName, address1, and city. This is getting displayed correctly. Now when processing the form, I am wondering whether in struts there is a way to retrieve these as objects and automatically populate setSitesList(ArrayList) method, rather than manually use request.getParameterValues for siteName, address1, city, create individual Site objects, add the site objects to an arraylist with Site objects and finally pass the list into setSitesList(arraylist). logic:iterate id=myCollectionElement name=OpportunitySitesForm property=sitesList tr td colspan=2input type=text name=siteName value='bean:write name=myCollectionElement property=siteName /'/td td colspan=2input type=text name=address1 value='bean:write name=myCollectionElement property=address1 /'/td td colspan=2input type=text name=city value='bean:write name=myCollectionElement property=city /'/td tr /logic:iterate Any help would be most appreciated. Thanks! -Asif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I put a JSP via a DispatchAction class into a tile?
Example: I have a DispatchAction called OpportunityCustomerAction that is forwadring to a tile: //*snippet start in struts config // action path=/OpportunityCustomerAction type=com.companyX.opportunity.CustomerAction name=OpportunityCustomerForminput=CustomerDef scope=session parameter=method forward name=success path=CustomerDef / /action //*snippet end struts config// Whether the validation fails or succeeds it will forwarded to the CustomerDef tile. //*snippet start in tiles definition // ?xml version=1.0 encoding=ISO-8859-1? component-definitions definition name=CustomerDef path=/templates/layout.jsp put name=header value=/templates/header.jsp/ put name=menu value=/templates/menu.jsp/ put name=footer value=/templates/footer.jsp/ put name=body value=/opportunity/customerBody.jsp/ /definition /component-deifnitions //*snippet end in tiles definition // - Original Message - From: bojke [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 10:50 AM Subject: How do I put a JSP via a DispatchAction class into a tile? I understand how to put a static page into a tile ... tiles:insert page=layout.jsp flush=true tiles:put name=header value=header.jsp / ... /tiles:insert ... but how do I put a dymanic page ... that is, a JSP via a DispatchAction class into a tile? When I use the action path from struts-config.xml (i.e. main.do), It does not work. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts alternative to using request.getParameterValues in an actionform?
Satish, it does not seem to work in the actionform. The properties are not getting set for the individual site objects using the nested tags. I have a setSitesList(arraylistOfSiteTransferObjects). What am I missing? Thanks. -Asif - Original Message - From: Asif Rahman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Asif Rahman [EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 10:21 AM Subject: Re: Struts alternative to using request.getParameterValues in an actionform? *blush* sorry, forgot the taglib directive. -Asif - Original Message - From: Asif Rahman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 9:50 AM Subject: Re: Struts alternative to using request.getParameterValues in an actionform? I tried this, it should work theoretically, but my form is empty now, none of the textfields are showing up. I do have a property called sitesList in the OpporutnitySitesForm and it is already populated when I arrive at this page. Please advise. Thanks. -Asif - Original Message - From: Satish Kataria [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Asif Rahman [EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 8:35 AM Subject: RE: Struts alternative to using request.getParameterValues in an actionform? You can use nested tags to automatically retrive and populate information. A snippet of code is as follows nested:root name=OpportunitySitesForm nested:nest property=sitesList logic:iterate id=myCollectionElement name=OpportunitySitesForm property=sitesList nested:text name=myCollectionElement property=siteName/ /logic:iterate /nested:nest property=sitesList /nested:root name=OpportunitySitesForm It assumes you have a attribute named sitesList in ur action form This way you can access any type of attribute from ur action form -Original Message- From: Asif Rahman [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:31 AM To: [EMAIL PROTECTED] Subject: Struts alternative to using request.getParameterValues in an actionform? Importance: High Hi Im using logic:iterate shown below to iterate through an arraylist (sitesList) in my actionform (OpportunitySitesForm). This arraylist contains a number of Site objects which have the properties siteName, address1, and city. This is getting displayed correctly. Now when processing the form, I am wondering whether in struts there is a way to retrieve these as objects and automatically populate setSitesList(ArrayList) method, rather than manually use request.getParameterValues for siteName, address1, city, create individual Site objects, add the site objects to an arraylist with Site objects and finally pass the list into setSitesList(arraylist). logic:iterate id=myCollectionElement name=OpportunitySitesForm property=sitesList tr td colspan=2input type=text name=siteName value='bean:write name=myCollectionElement property=siteName /'/td td colspan=2input type=text name=address1 value='bean:write name=myCollectionElement property=address1 /'/td td colspan=2input type=text name=city value='bean:write name=myCollectionElement property=city /'/td tr /logic:iterate Any help would be most appreciated. Thanks! -Asif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts alternative to using request.getParameterValues in an actionform?
Hi Im using logic:iterate shown below to iterate through an arraylist (sitesList) in my actionform (OpportunitySitesForm). This arraylist contains a number of Site objects which have the properties siteName, address1, and city. This is getting displayed correctly. Now when processing the form, I am wondering whether in struts there is a way to retrieve these as objects and automatically populate setSitesList(ArrayList) method, rather than manually use request.getParameterValues for siteName, address1, city, create individual Site objects, add the site objects to an arraylist with Site objects and finally pass the list into setSitesList(arraylist). logic:iterate id=myCollectionElement name=OpportunitySitesForm property=sitesList tr td colspan=2input type=text name=siteName value='bean:write name=myCollectionElement property=siteName /'/td td colspan=2input type=text name=address1 value='bean:write name=myCollectionElement property=address1 /'/td td colspan=2input type=text name=city value='bean:write name=myCollectionElement property=city /'/td tr /logic:iterate Any help would be most appreciated. Thanks! -Asif