Author Login
Post Reply
user Digest 1 Apr 2008 07:50:29 -0000 Issue 7952
Topics (messages 184834 through 184863):
Mapped Properties Woes
184834 by: Tom Holmes Jr.
184843 by: Laurie Harper
184844 by: Tom Holmes Jr.
Re: Compile error in JSP after upgrading from servlet specification 2.3 to 2.4
184835 by: Ashish Kulkarni
184854 by: Antonio Petrelli
184855 by: Antonio Petrelli
Re: ajax layout - how to place 2 submit buttons one after the other?
184836 by: Dave Newton
Re: testing file uploads
184837 by: Adam Hardy
184839 by: Adam Hardy
184840 by: Dave Newton
184846 by: Adam Hardy
184847 by: Dave Newton
184848 by: Adam Hardy
[S2] Logging Issues
184838 by: Kelly.Graus
Re: Ant based Struts2 application
184841 by: Frans Thamura
Re: Initializing Actions from Spring
184842 by: Laurie Harper
S2 with JSON RPC
184845 by: Frans Thamura
using javascript with struts2 tags.
184849 by: Varun Deep
184860 by: Dave Newton
Help on <data-source>
184850 by: Chen Chunwei
184851 by: Vinny
184852 by: Chen Chunwei
184853 by: Antonio Petrelli
184856 by: Chen Chunwei
184857 by: Antonio Petrelli
184859 by: Chen Chunwei
184861 by: Antonio Petrelli
184863 by: Chen Chunwei
xwork 2.1.1-SNAPSHOT
184858 by: Ian Meikle
184862 by: Dave Newton
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_184834.ezm (zipped)based on my previous message I want to have multiple-selects named off
of a hashmap.
I have found and read all the documentation of "Mapped Properties" I
could find under Google.
I know my form bean is 100% correct based on the documentation, so that
is a not a worry there.
I have a:
HashMap mapValues = null;
setMapValues(HashMap mapValues); returns HashMap with getMapValues()
setMapValue(String key, Object value) and finally
getMapValue(String key)
I created the HashMap in my preActionClass:
HashMap testMap = new HashMap();
testMap.put("a","value of a");
testMap.put("b","value of b");
testMap.put("c","value of c");
I tested this out in the jsp by using: <bean:write name="myFormBean"
property="getMapValue(b)" />
This does return "value of b" correctly.
I can even use a logic:iterate to loop through these three items and get
their key and values correctly!!!
Ultimately, I want three selects:
<select name="mapValues(a)"></select>
<select name="mapValues(b)"></select>
<select name="mapValues(b)"></select>
So ... now I created manually three selects on my jsp page.
<html:select name="myFormBean" property="mapValue(a)" value="not sure
yet"></html:select>
<html:select name="myFormBean" property="mapValue(b)" value="not sure
yet"></html:select>
<html:select name="myFormBean" property="mapValue(c)" value="not sure
yet"></html:select>
I just wanted to see if I could get my HashMap back to the post Action
and it constantly comes back null.
Can anyone help me deal with mapped properties, I am just not having any
luck and I've spent way too much time on this already.
Thanks!
Tom

Attachment:
user_184843.ezm (zipped)Tom Holmes Jr. wrote:
> based on my previous message I want to have multiple-selects named off
> of a hashmap.
> I have found and read all the documentation of "Mapped Properties" I
> could find under Google.
> I know my form bean is 100% correct based on the documentation, so that
> is a not a worry there.
> I have a: HashMap mapValues = null; setMapValues(HashMap
> mapValues); returns HashMap with getMapValues()
> setMapValue(String key, Object value) and finally
> getMapValue(String key)
>
> I created the HashMap in my preActionClass:
> HashMap testMap = new HashMap();
> testMap.put("a","value of a");
> testMap.put("b","value of b");
> testMap.put("c","value of c");
>
> I tested this out in the jsp by using: <bean:write name="myFormBean"
> property="getMapValue(b)" />
> This does return "value of b" correctly.
> I can even use a logic:iterate to loop through these three items and get
> their key and values correctly!!!
>
> Ultimately, I want three selects:
> <select name="mapValues(a)"></select>
> <select name="mapValues(b)"></select>
> <select name="mapValues(b)"></select>
>
> So ... now I created manually three selects on my jsp page.
> <html:select name="myFormBean" property="mapValue(a)" value="not sure
> yet"></html:select>
> <html:select name="myFormBean" property="mapValue(b)" value="not sure
> yet"></html:select>
> <html:select name="myFormBean" property="mapValue(c)" value="not sure
> yet"></html:select>
>
> I just wanted to see if I could get my HashMap back to the post Action
> and it constantly comes back null.
>
> Can anyone help me deal with mapped properties, I am just not having any
> luck and I've spent way too much time on this already.
I don't think Struts 1 will create the HashMap for you; you need to
instantiate it yourself (in your form bean's constructor or reset
method, for example). Assuming the map has already been instantiated,
Struts should be able to store form inputs into it OK.
L.

Attachment:
user_184844.ezm (zipped)Laurie Harper wrote:
> Tom Holmes Jr. wrote:
>> based on my previous message I want to have multiple-selects named
>> off of a hashmap.
>> I have found and read all the documentation of "Mapped Properties" I
>> could find under Google.
>> I know my form bean is 100% correct based on the documentation, so
>> that is a not a worry there.
>> I have a: HashMap mapValues = null; setMapValues(HashMap
>> mapValues); returns HashMap with getMapValues()
>> setMapValue(String key, Object value) and finally
>> getMapValue(String key)
>>
>> I created the HashMap in my preActionClass:
>> HashMap testMap = new HashMap();
>> testMap.put("a","value of a");
>> testMap.put("b","value of b");
>> testMap.put("c","value of c");
>>
>> I tested this out in the jsp by using: <bean:write name="myFormBean"
>> property="getMapValue(b)" />
>> This does return "value of b" correctly.
>> I can even use a logic:iterate to loop through these three items and
>> get their key and values correctly!!!
>>
>> Ultimately, I want three selects:
>> <select name="mapValues(a)"></select>
>> <select name="mapValues(b)"></select>
>> <select name="mapValues(b)"></select>
>>
>> So ... now I created manually three selects on my jsp page.
>> <html:select name="myFormBean" property="mapValue(a)" value="not sure
>> yet"></html:select>
>> <html:select name="myFormBean" property="mapValue(b)" value="not sure
>> yet"></html:select>
>> <html:select name="myFormBean" property="mapValue(c)" value="not sure
>> yet"></html:select>
>>
>> I just wanted to see if I could get my HashMap back to the post
>> Action and it constantly comes back null.
>>
>> Can anyone help me deal with mapped properties, I am just not having
>> any luck and I've spent way too much time on this already.
>
> I don't think Struts 1 will create the HashMap for you; you need to
> instantiate it yourself (in your form bean's constructor or reset
> method, for example). Assuming the map has already been instantiated,
> Struts should be able to store form inputs into it OK.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
What I was doing was instantiating the HashMap in the preAction class so
the logic:iterate worked on the JSP page.
But the information wasn't passing to the post Action class.
Thanks for the information again. That kind of information I couldn't
find anywhere. I will try it out ....
BTW ... I'm still trying to create:
<html:select name="myFormBean" property="mapValue(a)" value="not sure
yet"></html:select>
<html:select name="myFormBean" property="mapValue(b)" value="not sure
yet"></html:select>
<html:select name="myFormBean" property="mapValue(c)" value="not sure
yet"></html:select>
When I loop through the HashMap ... for some reason anything in the
property quotes is taken for a literal.
I can't seem to make it work with some form of variable.
Thanks again.

Attachment:
user_184835.ezm (zipped)
Attachment:
user_184854.ezm (zipped)2008/3/31, Ashish Kulkarni <ashish.kulkarni13@(protected)>:
>
>
org.apache.jasper.JasperException: /pages/index.jsp(125,15) According to
> TLD
> or attribute directive in tag file, attribute test does not accept any
> expressions
You have to import the "c_rt.tld" file, not the "c.tld".
Antonio

Attachment:
user_184855.ezm (zipped)2008/3/31, Ashish Kulkarni <ashish.kulkarni13@(protected)>:
>
>
org.apache.jasper.JasperException: /pages/index.jsp(125,15) According to
> TLD
> or attribute directive in tag file, attribute test does not accept any
> expressions
You have to import the "c_rt.tld" file, not the "c.tld".
Antonio

Attachment:
user_184836.ezm (zipped)--- Roger Varley <roger.varley@(protected):
> > There are at least three choices:
> >
> > (1) Do something via CSS (inline or something)
> > (2) Modify the existing Ajax theme
> > (3) Create a new theme
>
> I know I'm probably going to be shot down in flames for this, but why do
> the Struts 2 tags attempt to control any sort of layout? Why is there not a
> theme that simply renders the tags and relies on a seperate CSS to do the
> layout.
No shooting down, just a reminder that this is what the "css_xhtml" theme
attempts to do, sometimes successfully.
Dave

Attachment:
user_184837.ezm (zipped)Dave Newton on 31/03/08 18:42, wrote:
> --- Adam Hardy <ahardy.struts@(protected):
>> I need to test an action that is getting uploaded files and piping them
>> straight into Strings. I don't want to save actual files on server, so I'll
>
>> get the multipart request wrapper directly.
>
> What, specifically, are you trying to test?
>
> I ask because I've never had any particular reason to test file uploads
> inside the container, because the container itself should have already tested
> that and verified its operations. Everything else I've ever done with files
> has been testable outside the container.
The action has to get strings out of the request, work out which file they are
from and call the appropriate managers, with the corresponding string as a
request. There's logic in the action that basically has nothing to do with how
the container handles it (I hope).

Attachment:
user_184839.ezm (zipped)Didn't see that. I might use it. But I don't actually know quite what the
MultipartRequestHandler does, so I'm not sure how to mock it :)
I figured the ServletUnit framework would teach me.
Martin Gainty on 31/03/08 20:55, wrote:
> Have you looked at using Mock classes of MockHttpServletRequest(),
> MockHttpServletResponse(), MockServletContext()
> from
> org.apache.struts2.ServletActionContextTest.java
>
> ?
> ----- Original Message -----
> From: "Adam Hardy" <ahardy.struts@(protected)>
> To: "Struts Users Mailing List" <user@(protected)>
> Sent: Monday, March 31, 2008 12:04 PM
> Subject: testing file uploads
>
>
>> I need to test an action that is getting uploaded files and piping them
> straight
>> into Strings. I don't want to save actual files on server, so I'll get the
>> multipart request wrapper directly.
>>
>> MultiPartRequestWrapper multiWrapper =
>> (MultiPartRequestWrapper) ServletActionContext.getRequest()
>>
>> I'm thinking of using HttpUnit and ServletUnit to set this stuff up. Has
> anyone
>> set up Struts2 with ServletUnit?
>>
>> By the way, has anyone used Mockito yet, the new mocking framework?
>> http://code.google.com/p/mockito/

Attachment:
user_184840.ezm (zipped)--- Adam Hardy <ahardy.struts@(protected):
> Dave Newton on 31/03/08 18:42, wrote:
> > What, specifically, are you trying to test?
>
> The action has to get strings out of the request, work out which file they
> are from and call the appropriate managers, with the corresponding string
> as a request. There's logic in the action that basically has nothing to do
> with how the container handles it (I hope).
You're saying it's reading the file and deciding what to do based on file
contents?
Well, either way, I'd still test that completely separately from any
container/request stuff, but without your understanding of how it's working
I'm mostly just babbling ;)
Dave

Attachment:
user_184846.ezm (zipped)Dave Newton on 31/03/08 22:00, wrote:
> --- Adam Hardy <ahardy.struts@(protected):
>> Dave Newton on 31/03/08 18:42, wrote:
>>> What, specifically, are you trying to test?
>> The action has to get strings out of the request, work out which file they
>> are from and call the appropriate managers, with the corresponding string
>> as a request. There's logic in the action that basically has nothing to do
>> with how the container handles it (I hope).
>
> You're saying it's reading the file and deciding what to do based on file
> contents?
>
> Well, either way, I'd still test that completely separately from any
> container/request stuff, but without your understanding of how it's working
> I'm mostly just babbling ;)
I see the multipart http request as a weak point in the servlet spec. Or the
http spec. But I want to test it for my own piece of mind, and when I have the
test finished, I guess I can work out if it's really necessary.

Attachment:
user_184847.ezm (zipped)--- Adam Hardy <ahardy.struts@(protected):
> I see the multipart http request as a weak point in the servlet spec. Or
> the http spec. But I want to test it for my own piece of mind, and when
> I have the test finished, I guess I can work out if it's really necessary.
You want to test multipart HTTP requests? Well, okay; enjoy!
Dave

Attachment:
user_184848.ezm (zipped)Just remembered struts2 isn't a servlet. I just wanted a quick and easy way of
giving my action a real multipart request wrapper to run against. So tomorrow I
guess I'll have to check out the MockMultipartRequestWrapper.
Thanks
Adam
Martin Gainty on 31/03/08 20:55, wrote:
> Have you looked at using Mock classes of MockHttpServletRequest(),
> MockHttpServletResponse(), MockServletContext()
> from
> org.apache.struts2.ServletActionContextTest.java
>
> ?
> Martin
> ----- Original Message -----
> From: "Adam Hardy" <ahardy.struts@(protected)>
> To: "Struts Users Mailing List" <user@(protected)>
> Sent: Monday, March 31, 2008 12:04 PM
> Subject: testing file uploads
>
>
>> I need to test an action that is getting uploaded files and piping them
> straight
>> into Strings. I don't want to save actual files on server, so I'll get the
>> multipart request wrapper directly.
>>
>> MultiPartRequestWrapper multiWrapper =
>> (MultiPartRequestWrapper) ServletActionContext.getRequest()
>>
>> I'm thinking of using HttpUnit and ServletUnit to set this stuff up. Has
> anyone
>> set up Struts2 with ServletUnit?
>>
>> By the way, has anyone used Mockito yet, the new mocking framework?
>> http://code.google.com/p/mockito/

Attachment:
user_184838.ezm (zipped)Hello,
I am writing an application using Struts (2.0.11), Spring (2.5.1), and
Hibernate (3.2.6), running on Tomcat (6.0.13). We have a legacy webapp
running on Tomcat that outputs some important information to the default
Tomcat logs. We aren't really in a position to change that application, so
we're trying to update our new webapp to put all messages in a different log
file. I'm trying to do this using log4j (1.2.15).
So far, I can add messages to the new log in my java code. I am also
getting freemarker.cache debug messages in the new log. However, all other
messages are still being put in the default Tomcat logs. For example, if
the database I'm trying to access closes its connection and I don't catch
the exception that is thrown, it gets printed to the screen, and put in the
catalina log. I would like that exception to go in the new log file instead
(and yes, eventually I will catch the exception and have struts display a
nicer error message for the user).
Below are the relevant parts of my web.xml, and my log4j.properties file.
Any help would be greatly appreciated!
Thanks!
Kelly
[web.xml]
[snip]
<context-param>
<description>This context parameter specifies the name and location
of the log4j properties file.</description>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>
<filter>
<filter-name>struts2-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>
com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
[snip]
[log4j.properties]
log4j.rootLogger=DEBUG, rollingFileAppender
# Rolling file Appender
log4j.appender.rollingFileAppender=
org.apache.log4j.RollingFileAppenderlog4j.appender.rollingFileAppender.File=${catalina.home}/logs/lessonDownloader.log
log4j.appender.rollingFileAppender.MaxFileSize=1024KB
log4j.appender.rollingFileAppender.MaxBackupIndex=10
log4j.appender.rollingFileAppender.layout=
org.apache.log4j.PatternLayoutlog4j.appender.rollingFileAppender.layout.ConversionPattern=%d %p [%c] -
%m%n*
# Control logging for other packages
log4j.logger.org.apache.commons=WARN
log4j.logger.org.apache.struts2=WARN
log4j.logger.org.springframework=WARN
log4j.logger.org.hibernate=WARN
log4j.logger.org.apache.jasper=WARN
log4j.logger.org.apache.catalina=WARN
log4j.logger.com.opensymphony.xwork2=WARN
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184841.ezm (zipped)we here, use ant..
please try it
www.sf.net/projects/cimande
we use S2, Spring and Hibernte as the core framework.
F
On Mon, Mar 31, 2008 at 9:37 PM, HHB <hubaghdadi@(protected):
>
> Hi.
> Struts2 prefers Maven as the building tool, do know any on line sample
> Struts2 application that uses Ant instead of Maven?
> I can write one by hand but I'm looking for Ant script that is production
> aware.
> Thanks.
> --
> View this message in context:
> http://www.nabble.com/Ant-based-Struts2-application-tp16396285p16396285.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
--
Frans Thamura
Director
Meruvian
Redefining Civilization
Indonesia
Education, Consulting, Networking, Profesional Marketplace, OpenSource
Development and Implementation
Mobile: +62 855 7888 699
Skype: fthamura
YM: fthamura@(protected)
GoogleTalk: frans@(protected)
MSN: fthamura@(protected)
Sun Java Champion
Oracle Ace Director
JEDI Indonesia / JENI Team
JUG Indonesia Founder
jTechnopreneur Community Founder
Blogs:
http://www.jroller.com/fthamura (English)
http://www.nagasakti.or.id/roller/page/fthamura (Indonesia : Motivation Blog
Linkedin: http://www.linkedin.com/in/fthamura

Attachment:
user_184842.ezm (zipped)
Attachment:
user_184845.ezm (zipped)hi there
anyone have an example that work based on JSON RPC
i am looking a response mechanism that run well here
for POJO to JSON, i did it, using json plugins.
F

Attachment:
user_184849.ezm (zipped)Hi.
I am using Struts2. In this I am facing the problem in using the
"JavaScript" with the Struts2 tags. If some has the solution for that
please help me.
Looking forward for help
Varun

Attachment:
user_184860.ezm (zipped)--- Varun Deep <vdeep@(protected):
> I am using Struts2. In this I am facing the problem in using the
> "JavaScript" with the Struts2 tags. If some has the solution for that
> please help me.
That's somewhat nebulous.
It would be more helpful if you could describe what specific issues you're
having or what you're trying to accomplish.
Dave

Attachment:
user_184850.ezm (zipped)Hi all,
I've configured a data source at struts-config.xml. This data source use oracle thin jdbc driver. And I've already included the ojdbc.jar. Also, the oracle database I'm trying to connect is OK. But I just can't make the data source get the connection. It always throws a SQLException: Timeout awaiting connection. Can anyone give some help? Following is my <data-source>.
----------------------------------------------------------------------------------------------
<data-source key="org.apache.struts.action.DATA_SOURCE">
<set-property property="password" value="passw0rd" />
<set-property property="minCount" value="" />
<set-property property="maxCount" value="" />
<set-property property="user" value="planuser" />
<set-property property="driverClass"
value="oracle.jdbc.driver.OracleDriver" />
<set-property property="description"
value="Oracle 9i Database - Struts Test" />
<set-property property="url"
value="jdbc:oracle:thin:@(protected)" />
<set-property property="readOnly" value="false" />
<set-property property="autoCommit" value="false" />
<set-property property="loginTimeout" value="30" />
</data-source>
----------------------------------------------------------------------------------------------
Thanks
Talos

Attachment:
user_184851.ezm (zipped)What version of struts?
Data-source got deprecated at some point. I forget the version.
On 4/1/08, Chen Chunwei <out-chenchunwei@(protected):
> Hi all,
>
> I've configured a data source at struts-config.xml. This data source use
> oracle thin jdbc driver. And I've already included the ojdbc.jar. Also, the
> oracle database I'm trying to connect is OK. But I just can't make the data
> source get the connection. It always throws a SQLException: Timeout awaiting
> connection. Can anyone give some help? Following is my <data-source>.
> ----------------------------------------------------------------------------------------------
> <data-source key="org.apache.struts.action.DATA_SOURCE">
> <set-property property="password" value="passw0rd" />
> <set-property property="minCount" value="" />
> <set-property property="maxCount" value="" />
> <set-property property="user" value="planuser" />
> <set-property property="driverClass"
> value="oracle.jdbc.driver.OracleDriver" />
> <set-property property="description"
> value="Oracle 9i Database - Struts Test" />
> <set-property property="url"
> value="jdbc:oracle:thin:@(protected)" />
> <set-property property="readOnly" value="false" />
> <set-property property="autoCommit" value="false" />
> <set-property property="loginTimeout" value="30" />
> </data-source>
> ----------------------------------------------------------------------------------------------
>
> Thanks
>
> Talos
--
Sent from Gmail for mobile | mobile.google.com
The future is here. It's just not widely distributed yet.
-William Gibson

Attachment:
user_184852.ezm (zipped)I'm using struts 1.1
----- Original Message -----
From: "Vinny" <xaymaca@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Tuesday, April 01, 2008 2:52 PM
Subject: Re: Help on <data-source>
What version of struts?
Data-source got deprecated at some point. I forget the version.
On 4/1/08, Chen Chunwei <out-chenchunwei@(protected):
> Hi all,
>
> I've configured a data source at struts-config.xml. This data source use
> oracle thin jdbc driver. And I've already included the ojdbc.jar. Also, the
> oracle database I'm trying to connect is OK. But I just can't make the data
> source get the connection. It always throws a SQLException: Timeout awaiting
> connection. Can anyone give some help? Following is my <data-source>.
> ----------------------------------------------------------------------------------------------
> <data-source key="org.apache.struts.action.DATA_SOURCE">
> <set-property property="password" value="passw0rd" />
> <set-property property="minCount" value="" />
> <set-property property="maxCount" value="" />
> <set-property property="user" value="planuser" />
> <set-property property="driverClass"
> value="oracle.jdbc.driver.OracleDriver" />
> <set-property property="description"
> value="Oracle 9i Database - Struts Test" />
> <set-property property="url"
> value="jdbc:oracle:thin:@(protected)" />
> <set-property property="readOnly" value="false" />
> <set-property property="autoCommit" value="false" />
> <set-property property="loginTimeout" value="30" />
> </data-source>
> ----------------------------------------------------------------------------------------------
>
> Thanks
>
> Talos
--
Sent from Gmail for mobile | mobile.google.com
The future is here. It's just not widely distributed yet.
-William Gibson
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_184853.ezm (zipped)Please Chen, the next time you post a question, say that you are using
Struts 1.1 *always*.
See the answers below.
2008/4/1, Chen Chunwei <out-chenchunwei@(protected)>:
> <set-property property="minCount" value="" />
> <set-property property="maxCount" value="" />
I think this is the problem: specify a value for "minCount" and "maxCount".
And remember to close the connection once you used it!
Notice that, for default, a commons-dbcp datasource will be used,
while I suggest to use the Oracle datasource.
And, BTW, as Vinny said, the datasource support in Struts is
deprecated, I suggest you to use JNDI and configure the datasource in
your container.
Antonio

Attachment:
user_184856.ezm (zipped)Thanks.
I've tried to specify minCount=2 and maxCount=4. But I've encountered a new exception: The Network Adapter could not establish the connection. Is that mean something wrong with my network connection?
I'm using Struts 1.1
Talos
----- Original Message -----
From: "Antonio Petrelli" <antonio.petrelli@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Tuesday, April 01, 2008 2:58 PM
Subject: Re: Help on <data-source>
Please Chen, the next time you post a question, say that you are using
Struts 1.1 *always*.
See the answers below.
2008/4/1, Chen Chunwei <out-chenchunwei@(protected)>:
> <set-property property="minCount" value="" />
> <set-property property="maxCount" value="" />
I think this is the problem: specify a value for "minCount" and "maxCount".
And remember to close the connection once you used it!
Notice that, for default, a commons-dbcp datasource will be used,
while I suggest to use the Oracle datasource.
And, BTW, as Vinny said, the datasource support in Struts is
deprecated, I suggest you to use JNDI and configure the datasource in
your container.
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_184857.ezm (zipped)2008/4/1, Chen Chunwei <out-chenchunwei@(protected)>:
>
> Thanks.
>
> I've tried to specify minCount=2 and maxCount=4. But I've encountered a
> new exception: The Network Adapter could not establish the connection. Is
> that mean something wrong with my network connection?
Can I see the complete stacktrace?
Antonio

Attachment:
user_184859.ezm (zipped)Here's the whole stacktrace. Note: the language version of my Tomcat 5.5 is Chinese. So I replaced some non-English text with translated English.
Talos
--------------------------------begin----------------------------------------------------------------
2008-4-1 15:07:22
org.apache.catalina.startup.HostConfig checkResources
Infomation: Reloading context [/Week 3 DbAccess]
2008-4-1 15:07:22
org.apache.struts.util.PropertyMessageResources <init>
Infomation: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
2008-4-1 15:07:22
org.apache.struts.util.PropertyMessageResources <init>
Infomation: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
2008-4-1 15:07:23
org.apache.struts.util.PropertyMessageResources <init>
Infomation: Initializing, config='com.psh.struts.ApplicationResources', returnNull=true
2008-4-1 15:07:23 org.apache.struts.legacy.GenericDataSource createConnection
Infomation: createConnection()
2008-4-1 15:08:00
org.apache.struts.action.ActionServlet initModuleDataSources
Error: Initializing application data source org.apache.struts.action.DATA_SOURCE
java.sql.SQLException: Io Exception: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:439)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at org.apache.struts.legacy.GenericDataSource.createConnection(GenericDataSource.java:805)
at org.apache.struts.legacy.GenericDataSource.open(GenericDataSource.java:741)
at
org.apache.struts.action.ActionServlet.initModuleDataSources (
ActionServlet.java:1085)
at
org.apache.struts.action.ActionServlet.init (
ActionServlet.java:472)
at
javax.servlet.GenericServlet.init (
GenericServlet.java:212)
at
org.apache.catalina.core.StandardWrapper.loadServlet (
StandardWrapper.java:1139)
at
org.apache.catalina.core.StandardWrapper.load (
StandardWrapper.java:966)
at
org.apache.catalina.core.StandardContext.loadOnStartup (
StandardContext.java:3956)
at
org.apache.catalina.core.StandardContext.start (
StandardContext.java:4230)
at
org.apache.catalina.startup.HostConfig.checkResources (
HostConfig.java:1116)
at
org.apache.catalina.startup.HostConfig.check (
HostConfig.java:1214)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent (
HostConfig.java:293)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (
LifecycleSupport.java:120)
at
org.apache.catalina.core.ContainerBase.backgroundProcess (
ContainerBase.java:1306)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
at
java.lang.Thread.run(Unknown Source)
2008-4-1 15:08:00
org.apache.catalina.core.ApplicationContext log
Infomation: Marking servlet action as unavailable
2008-4-1 15:08:00
org.apache.catalina.core.StandardContext loadOnStartup
Error: Servlet /Week 3 DbAccess threw load() exception
javax.servlet.UnavailableException: Initializing application data source org.apache.struts.action.DATA_SOURCE
at
org.apache.struts.action.ActionServlet.initModuleDataSources (
ActionServlet.java:1091)
at
org.apache.struts.action.ActionServlet.init (
ActionServlet.java:472)
at
javax.servlet.GenericServlet.init (
GenericServlet.java:212)
at
org.apache.catalina.core.StandardWrapper.loadServlet (
StandardWrapper.java:1139)
at
org.apache.catalina.core.StandardWrapper.load (
StandardWrapper.java:966)
at
org.apache.catalina.core.StandardContext.loadOnStartup (
StandardContext.java:3956)
at
org.apache.catalina.core.StandardContext.start (
StandardContext.java:4230)
at
org.apache.catalina.startup.HostConfig.checkResources (
HostConfig.java:1116)
at
org.apache.catalina.startup.HostConfig.check (
HostConfig.java:1214)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent (
HostConfig.java:293)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (
LifecycleSupport.java:120)
at
org.apache.catalina.core.ContainerBase.backgroundProcess (
ContainerBase.java:1306)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
at
java.lang.Thread.run(Unknown Source)
2008-4-1 15:11:10
org.apache.struts.util.PropertyMessageResources <init>
Infomation: Initializing, config='org.apache.struts.taglib.logic.LocalStrings', returnNull=true
------------------------------------end--------------------------------------------------------------------------
----- Original Message -----
From: "Antonio Petrelli" <antonio.petrelli@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Tuesday, April 01, 2008 3:13 PM
Subject: Re: Help on <data-source>
2008/4/1, Chen Chunwei <out-chenchunwei@(protected)>:
>
> Thanks.
>
> I've tried to specify minCount=2 and maxCount=4. But I've encountered a
> new exception: The Network Adapter could not establish the connection. Is
> that mean something wrong with my network connection?
Can I see the complete stacktrace?
Antonio

Attachment:
user_184861.ezm (zipped)2008/4/1, Chen Chunwei <out-chenchunwei@(protected)>:
>
>
java.sql.SQLException: Io Exception: The Network Adapter could not
> establish the connection
It seems that you cannot reach the Oracle server... can you ping it? Are you
able to see it through a sql client?
Antonio

Attachment:
user_184863.ezm (zipped)Thanks Antonio
Now I can make it connected.
By the way, can I say that, if I use <data-source> in my struts application, then the struts servlet manages the connection? That is, when the application is deployed, the struts servlet will automaticly create connections of numbers specified by "minCount". And the application just fetch the connection created to use?
Talos
----- Original Message -----
From: "Antonio Petrelli" <antonio.petrelli@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Tuesday, April 01, 2008 3:27 PM
Subject: Re: Help on <data-source>
2008/4/1, Chen Chunwei <out-chenchunwei@(protected)>:
>
>
java.sql.SQLException: Io Exception: The Network Adapter could not
> establish the connection
It seems that you cannot reach the Oracle server... can you ping it? Are you
able to see it through a sql client?
Antonio

Attachment:
user_184858.ezm (zipped)Hi,
We are starting to use STRUTS 2 and have found that the MailReader demo
app throws an exception. To help us find the root of this problem and to
help us understand xwork better we are looking for the source code for the
release of xwork that struts 2 v2.0.11.1 is built on.
This does not seem to be included in the STRUTS source zip file.
From the project dependencies page (
http://struts.apache.org/2.x/struts2-core/dependencies.html) this seems to
be xwork 2.1.1-SNAPSHOT.
This does not apear to be available from the dowload page of xwork. Could
someone help he in getting this version of the source.
Many thanks
Ian
CSC Solutions Norge AS
Registered Office: Sandsliåsen 57, 5254 Sandsli, Norway
Registered in Norway No: 958 958 455
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Attachment:
user_184862.ezm (zipped)--- Ian Meikle <imeikle@(protected):
> To help us find the root of this problem and to help us understand
> xwork better we are looking for the source code for the release of
> xwork that struts 2 v2.0.11.1 is built on. This does not seem to be
> included in the STRUTS source zip file.
It's not Struts source, it's XWork source.
> From the project dependencies page (
> http://struts.apache.org/2.x/struts2-core/dependencies.html) this seems to
> be xwork 2.1.1-SNAPSHOT.
2.x != 2.0.11.1
http://struts.apache.org/2.0.11.1/struts2-core/dependencies.html
The appropriate version is available from either the XWork site, the XWork
repo in the /tags directory, or a source build of S2 under
/core/target/xwork-sources. (I don't recall if you have to do the build to
get this there or not.)
Dave