Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 23 Jun 2008 08:28:49 -0000 Issue 8103

user-digest-help

2008-06-23


Author LoginPost Reply

user Digest 23 Jun 2008 08:28:49 -0000 Issue 8103

Topics (messages 187917 through 187939):

Re: [OT] What slows you down?
 187917 by: Martin
 187918 by: Dave Newton

Re: Using Struts2 Template
 187919 by: Doug Pham
 187921 by: Dave Newton

Validation
 187920 by: Doug Pham
 187922 by: Dave Newton

Anyone know what happened to ArcTechSoftware?
 187923 by: stanlick

Re: Rest plugin and binary data
 187924 by: Mike Watson

[S2] attempts to access www.opensymphony.com on Struts startup???
 187925 by: Pierre Thibaudeau
 187926 by: Chris Pratt
 187927 by: Pierre Thibaudeau
 187928 by: Wendy Smoak
 187929 by: Pierre Thibaudeau
 187931 by: Pierre Thibaudeau
 187932 by: Chris Pratt
 187933 by: Pierre Thibaudeau

Re: Struts Themes Problem - help
 187930 by: Narayana S

[S2] OGNL and enum
 187934 by: Pierre Thibaudeau
 187936 by: Jeromy Evans

my Own CSS
 187935 by: Narayana S
 187937 by: Jeromy Evans

Re: render JSP from action class
 187938 by: Jeromy Evans

Special Characters in s:text tag
 187939 by: sudipto.dey

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_187917.ezm (zipped)
Greg-

RhinoScript only works with JS files (not ftl or jsp)

Your Best option is to configure in jspc task thru ant using the compiler
option
http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html
a must have for the build engineer who will want to assure clean jsp pages
before deploying

Anyone else?
Martin
----- Original Message -----
From: "Greg Lindholm" <glindholm@(protected)>
To: <user@(protected)>
Sent: Saturday, June 21, 2008 11:01 PM
Subject: Re: [OT] What slows you down?


>
> When I read this I was being slowed down by constant stopping
> and starting of Tomcat from within Eclipse...
> - make a change in an action class
> - start tomcat
> - test it... not working
> - stop tomcat
> - make a java change
> - repeat....
>
> In this case I was working on validation logic with annotations.
> How else do you test validation logic? Can you unit test validation
> logic? Is there a better way? [1]
>
> Part of this problem was I wasn't sure if my OGNL expression was correct.
> How do you test/debug OGNL expressions when they will depend on
> the ValueStack? [2]
>
> Another part of the problem is the doc for FieldExpressionValidator
> doesn't
> bother to tell you which direction (true or false) the expression should
> return to pass or fail the validation. [3]
>
> BTW: I really really like Struts 2. Over the years I've went from Struts
> 1,
> to JSF, and now Struts 2, and S2 is by far the best and easiest and
> most enjoyable.
>
> The thing that slowed me down the most was the learning curve. I started
> with
> the online tutorials, and the "Starting Struts 2" pdf book, then I had to
> start
> working on my application. It was very rough going at first, I spent a
> lot
> of time
> in the debugger trying to figure out what the hell was going on. Then I
> read
> "Struts 2 Design and Programming" and felt better, went back and fixed
> some
> of the bad designs I started with but still was lacking much knowledge.
> Finally
> "Struts 2 in Action" was released and I got time to read it **.
> I finally feel comfortable, and figure I understand how Struts 2 really
> works.
> Now I'm going back again and fixing more early bad designs. [4]
>
> One more, un-versioned online documentation.
> Under the URL http://struts.apache.org/2.0.11.1/docs (which anyone would
> reasonably believe is documentation for Struts 2.0.11) is documentation
> that
> only applies to release 2.1.x. More then a couple of times I've had a
> problem
> searched for a solution found it in the 2.0.11.1 docs started implementing
> it
> only to discover it was only for 2.1.x. (very frustrating.) [5]
>
> [1] Unit testing validation logic
> [2] Debugging OGNL expressions
> [3] Poor or incomplete documentation, lack or real-world examples and use
> cases
> [4] Learning curve
> [5] Un-versioned docs.
>
> ** Struts 2 in Action is a really good book, highly recommend it. However,
> I
> don't think I would have got nearly as much out of it if I hadn't already
> gone
> through the other books and hand's on struggles before I read it.
>
>
> Ted Husted wrote:
>>
>> Since it's friday, let me pose a question to the group ...
>>
>> Even with rock-solid frameworks like Apache Struts, it still seems
>> like web application development takes longer than it should. Some
>> frameworks, like Ruby on Rails, speak directly to "time to market"
>> concerns and have been gathering many followers.
>>
>> But why does web application still seem so difficult or so
>> time-consuming? Are there time bandits that still suck days or weeks
>> out of your development schedule? Are there time gremlins that
>> "nickel-and-dime" you every hour of every day? Is there anything more
>> that frameworks like Apache Struts can do to help? Or are just there
>> intractable problems with web development itself?
>>
>> Thoughts? :)
>>
>> -Ted.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/-OT--What-slows-you-down--tp18027912p18050807.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)
>
>


Attachment: user_187918.ezm (zipped)
--- On Sun, 6/22/08, Martin <mgainty@(protected):
> RhinoScript only works with JS files (not ftl or jsp)

RhinoScript?

I must have gotten a truncated version of Greg's post; I didn't see anything about JavaScript at all.

Dave

>
> Your Best option is to configure in jspc task thru ant
> using the compiler
> option
> http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html
> a must have for the build engineer who will want to assure
> clean jsp pages
> before deploying
>
> Anyone else?
> Martin
> ----- Original Message -----
> From: "Greg Lindholm" <glindholm@(protected)>
> To: <user@(protected)>
> Sent: Saturday, June 21, 2008 11:01 PM
> Subject: Re: [OT] What slows you down?
>
>
> >
> > When I read this I was being slowed down by constant
> stopping
> > and starting of Tomcat from within Eclipse...
> > - make a change in an action class
> > - start tomcat
> > - test it... not working
> > - stop tomcat
> > - make a java change
> > - repeat....
> >
> > In this case I was working on validation logic with
> annotations.
> > How else do you test validation logic? Can you unit
> test validation
> > logic? Is there a better way? [1]
> >
> > Part of this problem was I wasn't sure if my OGNL
> expression was correct.
> > How do you test/debug OGNL expressions when they will
> depend on
> > the ValueStack? [2]
> >
> > Another part of the problem is the doc for
> FieldExpressionValidator
> > doesn't
> > bother to tell you which direction (true or false) the
> expression should
> > return to pass or fail the validation. [3]
> >
> > BTW: I really really like Struts 2. Over the years
> I've went from Struts
> > 1,
> > to JSF, and now Struts 2, and S2 is by far the best
> and easiest and
> > most enjoyable.
> >
> > The thing that slowed me down the most was the
> learning curve. I started
> > with
> > the online tutorials, and the "Starting Struts
> 2" pdf book, then I had to
> > start
> > working on my application. It was very rough going at
> first, I spent a
> > lot
> > of time
> > in the debugger trying to figure out what the hell was
> going on. Then I
> > read
> > "Struts 2 Design and Programming" and felt
> better, went back and fixed
> > some
> > of the bad designs I started with but still was
> lacking much knowledge.
> > Finally
> > "Struts 2 in Action" was released and I got
> time to read it **.
> > I finally feel comfortable, and figure I understand
> how Struts 2 really
> > works.
> > Now I'm going back again and fixing more early bad
> designs. [4]
> >
> > One more, un-versioned online documentation.
> > Under the URL http://struts.apache.org/2.0.11.1/docs
> (which anyone would
> > reasonably believe is documentation for Struts 2.0.11)
> is documentation
> > that
> > only applies to release 2.1.x. More then a couple of
> times I've had a
> > problem
> > searched for a solution found it in the 2.0.11.1 docs
> started implementing
> > it
> > only to discover it was only for 2.1.x. (very
> frustrating.) [5]
> >
> > [1] Unit testing validation logic
> > [2] Debugging OGNL expressions
> > [3] Poor or incomplete documentation, lack or
> real-world examples and use
> > cases
> > [4] Learning curve
> > [5] Un-versioned docs.
> >
> > ** Struts 2 in Action is a really good book, highly
> recommend it. However,
> > I
> > don't think I would have got nearly as much out of
> it if I hadn't already
> > gone
> > through the other books and hand's on struggles
> before I read it.
> >
> >
> > Ted Husted wrote:
> >>
> >> Since it's friday, let me pose a question to
> the group ...
> >>
> >> Even with rock-solid frameworks like Apache
> Struts, it still seems
> >> like web application development takes longer than
> it should. Some
> >> frameworks, like Ruby on Rails, speak directly to
> "time to market"
> >> concerns and have been gathering many followers.
> >>
> >> But why does web application still seem so
> difficult or so
> >> time-consuming? Are there time bandits that still
> suck days or weeks
> >> out of your development schedule? Are there time
> gremlins that
> >> "nickel-and-dime" you every hour of
> every day? Is there anything more
> >> that frameworks like Apache Struts can do to help?
> Or are just there
> >> intractable problems with web development itself?
> >>
> >> Thoughts? :)
> >>
> >> -Ted.
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> >> For additional commands, e-mail:
> user-help@(protected)
> >>
> >>
> >>
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/-OT--What-slows-you-down--tp18027912p18050807.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)
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

Attachment: user_187919.ezm (zipped)
Dave,
     Do you have to add anything to the web.xml file or what libraries to include.  If I am using Sitemesh, anything different I have to do?

Doug Pham

--- On Sun, 6/22/08, Dave Newton <newton.dave@(protected):
From: Dave Newton <newton.dave@(protected)>
Subject: Re: Using Struts2 Template
To: "Struts Users Mailing List" <user@(protected)>
Date: Sunday, June 22, 2008, 7:29 AM

--- On Sun, 6/22/08, Doug Pham <dougtpham@(protected):
> Do I have to include anything special to use the Freemarker templates?

"The" FreeMarker templates? Do you mean FreeMarker results? If so,
no. If not, not sure what you mean.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



Attachment: user_187921.ezm (zipped)
--- On Sun, 6/22/08, Doug Pham <dougtpham@(protected):
> Do you have to add anything to the web.xml file or
> what libraries to include.

I still don't know what templates you're talking about, so I don't know.

S2 is already dependent on FreeMarker; you don't need to do anything special other than make sure FreeMarker and its dependencies end up deployed.

If you're talking about FreeMarker results, read the FreeMarker result type docs.

http://struts.apache.org/2.0.11.1/docs/freemarker-result.html

> If I am using Sitemesh, anything different I have to do?

Yes, read the docs about the SiteMesh plugin docs and do what it says.

http://struts.apache.org/2.0.11.1/docs/sitemesh-plugin.html

Dave


Attachment: user_187920.ezm (zipped)
I have an action that have multiple methods that I mapped to.  Only one action that I need validation for, the rest I don't need.  Where can I get information to set this up or how do I set it up using the XML file?

Thanks,
Doug




Attachment: user_187922.ezm (zipped)
--- On Sun, 6/22/08, Doug Pham <dougtpham@(protected):
> I have an action that have multiple methods that I mapped
> to.  Only one action that I need validation for, the rest
> I don't need.  Where can I get information to set this
> up or how do I set it up using the XML file?

http://struts.apache.org/2.0.11.1/docs/validation.html

DAve


Attachment: user_187923.ezm (zipped)

I am trying to reach David Gorrell and can't get any response. Also, his
site is down and I am worried something might have happened to him. You may
know him as the guy who was selling the complete Struts 2 Tutorial. If
anyone has any information, I would appreciate it. I got to know him over
the past couple years and he is a great cat. I really hope everything is
alright.

Peace,
Scott
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_187924.ezm (zipped)
Hi Jeromy,

Thanks for the response, that's really helpful.

Could you possibly provide a little bit more detail though as I
haven't been able to get this working yet.

This might seem like a stupid question, but in your code snippet below
where you have: // create the stream
Where does the output go? Should I use ModelDriven and assign it to the model?

Also how do I get a handle on the StreamResult object so I can specify
attributes programmatically? All the samples I have seen do so
declaratively.

Thanks again for the tips!

Mike


2008/6/20 Jeromy Evans <jeromy.evans@(protected)>:
> Mike Watson wrote:
>>
>> Hi Folks,
>>
>> I'm trying to figure out how to return binary data from the REST plugin.
>>
>> I'd like to be able to return images that are generated on the fly by
>> a REST request but looking at ContentTypeHandlerManager, it assumes
>> that we'll only ever want to return a string and so passes a
>> StringWriter as the output for implementers of
>> ContentTypeHandler.fromObject.
>>
>>
>
> At first, don't create a custom ContentTypeHander.
> Just have your Controller declare a StreamResult. The default
> ContentTypeHandler will drop through for result processing by XWork (as per
> a ServletRedirectResult).
>
> eg. GET /namespace/image/21
>
> @Result("stream", type = StreamResult.class, value="image")
> class ImageController {
> public InputStream getImage() {}
>
> public String show() {
>   // create the stream
>   return "stream";   }
> }
>
> See StreamResult for how to set the Content-type and other properties.
>
> One that works, you could (potentially) register a ContentTypeHandler for
> each image content type you want to return (eg. register the jpg and png
> extensions). The ContentTypeHandler should do nothing except return a
> result name for XWork that is mapped to a StreamResult. The image retrieval
> would have to be performed in the Controller rather than the Handler though.
> There is probably a bit of work to do in the plugin to handle binary
> results better though.
>
> Hope that gets you started.
> Jeromy Evans
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_187925.ezm (zipped)
I would love to get to the bottom of a problem that has cropped up a number
of times on this list:

* On April 29, 2008, I reported that XmlConfigurationProvider was trying to
access the internet. (At the time, I thought the problem might be due to an
incompatibility with a specific version of Tomcat.)
* On March 26, 2008, Nuwan Chandrasoma reports a similar phenomenon to do
with loading validator.xml.

I experienced anew the problem yesterday, when I could not access the
internet. This time, Struts complains that it can't find struts.xml,
looking for it in the very exact location where it is! When I have internet
access, on the other hand, struts.xml loads without a glitch! Has anyone
got an idea how to prevent Struts from trying to look online for what's
under its nose?

struts.xml is in the following path:
D:/applications/apache-tomcat-6.0.16/webapps/myapp/WEB-INF/classes/struts.xml

Version of Struts: 2.1.2

Here's struts.xml's header:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation //DTD Struts Configuration 2.0//EN"
  "http://struts.apache.org/dtds/struts-2.0.dtd">

Relevant excerpt from web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="infloox"
  xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
  version="2.5">
...
  <filter>
    <filter-name>action2</filter-name>

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>action2</filter-name>
    <url-pattern>*.action</url-pattern>
  </filter-mapping>



And finally here is the relevant part of the error trace when I am offline:

16:32:24,199 DEBUG XmlConfigurationProvider:58 - Loading action
configurations from: struts.xml
2008-06-22 16:32:24 org.apache.catalina.core.StandardContext filterStart
GRAVE: Exception au démarrage du filtre action2
Unable to load configuration. - Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1
  at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
  at
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
  at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
  at
org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:213)
  at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
  at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
  at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
  at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
  at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
  at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
  at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
  at
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924)
  at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)
  at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
  at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
  at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
  at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
  at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
  at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
  at
org.apache.catalina.core.StandardService.start(StandardService.java:516)
  at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Unable to load
file:/D:/applications/apache-tomcat-6.0.16/webapps/myapp/WEB-INF/classes/struts.xml
- Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1
  at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:875)
  at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:161)
  at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:130)
  at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:155)
  at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
  ... 30 more
Caused by: struts.apache.org - Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1
  at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:122)
  at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:870)
  ... 34 more
Caused by: java.net.UnknownHostException: struts.apache.org
  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
  at java.net.Socket.connect(Socket.java:518)
  at java.net.Socket.connect(Socket.java:468)
  at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:389)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:516)
  at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
  at sun.net.www.http.HttpClient.New(HttpClient.java:306)
  at sun.net.www.http.HttpClient.New(HttpClient.java:318)
  at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:788)
  at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:729)
  at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:654)
  at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
  at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown
Source)
  at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
  at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown
Source)
  at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown
Source)
  at
org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown
Source)
  at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
  at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
  at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
  at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:120)
  ... 35 more

Attachment: user_187926.ezm (zipped)
When validating the XML files, the system has to load the DTD's or
XSD's that are housed at apache.org and opensymphony.org. There's
probably a way to disable the XML validation of those files, I haven't
had the need to look for it yet.
(*Chris*)

On Sun, Jun 22, 2008 at 7:36 PM, Pierre Thibaudeau
<pierre.thibaudeau@(protected):
> I would love to get to the bottom of a problem that has cropped up a number
> of times on this list:
>
> * On April 29, 2008, I reported that XmlConfigurationProvider was trying to
> access the internet. (At the time, I thought the problem might be due to an
> incompatibility with a specific version of Tomcat.)
> * On March 26, 2008, Nuwan Chandrasoma reports a similar phenomenon to do
> with loading validator.xml.
>
> I experienced anew the problem yesterday, when I could not access the
> internet. This time, Struts complains that it can't find struts.xml,
> looking for it in the very exact location where it is! When I have internet
> access, on the other hand, struts.xml loads without a glitch! Has anyone
> got an idea how to prevent Struts from trying to look online for what's
> under its nose?
>
> struts.xml is in the following path:
> D:/applications/apache-tomcat-6.0.16/webapps/myapp/WEB-INF/classes/struts.xml
>
> Version of Struts: 2.1.2
>
> Here's struts.xml's header:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE struts PUBLIC
>   "-//Apache Software Foundation //DTD Struts Configuration 2.0//EN"
>   "http://struts.apache.org/dtds/struts-2.0.dtd">
>
> Relevant excerpt from web.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="infloox"
>   xmlns="http://java.sun.com/xml/ns/j2ee"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
>   version="2.5">
> ...
>   <filter>
>     <filter-name>action2</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
>   </filter>
>   <filter-mapping>
>     <filter-name>action2</filter-name>
>     <url-pattern>*.action</url-pattern>
>   </filter-mapping>
>
>
>
> And finally here is the relevant part of the error trace when I am offline:
>
> 16:32:24,199 DEBUG XmlConfigurationProvider:58 - Loading action
> configurations from: struts.xml
> 2008-06-22 16:32:24 org.apache.catalina.core.StandardContext filterStart
> GRAVE: Exception au démarrage du filtre action2
> Unable to load configuration. - Class: java.net.PlainSocketImpl
> File: PlainSocketImpl.java
> Method: connect
> Line: 177 - java/net/PlainSocketImpl.java:177:-1
>   at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
>   at
> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
>   at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
>   at
> org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:213)
>   at
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
>   at
> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
>   at
> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
>   at
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
>   at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
>   at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
>   at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
>   at
> org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924)
>   at
> org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)
>   at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
>   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
>   at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
>   at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
>   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
>   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
>   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>   at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>   at
> org.apache.catalina.core.StandardService.start(StandardService.java:516)
>   at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Caused by: Unable to load
> file:/D:/applications/apache-tomcat-6.0.16/webapps/myapp/WEB-INF/classes/struts.xml
> - Class: java.net.PlainSocketImpl
> File: PlainSocketImpl.java
> Method: connect
> Line: 177 - java/net/PlainSocketImpl.java:177:-1
>   at
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:875)
>   at
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:161)
>   at
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:130)
>   at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:155)
>   at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
>   ... 30 more
> Caused by: struts.apache.org - Class: java.net.PlainSocketImpl
> File: PlainSocketImpl.java
> Method: connect
> Line: 177 - java/net/PlainSocketImpl.java:177:-1
>   at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:122)
>   at
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:870)
>   ... 34 more
> Caused by: java.net.UnknownHostException: struts.apache.org
>   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
>   at java.net.Socket.connect(Socket.java:518)
>   at java.net.Socket.connect(Socket.java:468)
>   at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
>   at sun.net.www.http.HttpClient.openServer(HttpClient.java:389)
>   at sun.net.www.http.HttpClient.openServer(HttpClient.java:516)
>   at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
>   at sun.net.www.http.HttpClient.New(HttpClient.java:306)
>   at sun.net.www.http.HttpClient.New(HttpClient.java:318)
>   at
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:788)
>   at
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:729)
>   at
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:654)
>   at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
>   at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown
> Source)
>   at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
>   at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown
> Source)
>   at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown
> Source)
>   at
> org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown
> Source)
>   at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
>   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>   at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>   at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>   at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
> Source)
>   at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
>   at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:120)
>   ... 35 more
>

Attachment: user_187927.ezm (zipped)
Thanks, Chris, for the info!

It doesn't make sense to me that the DTD's should be compared to the ones
stored remotely (rather than locally), but at least it explains why the
system fails to start up when the internet is unavailable! May I suggest to
the Powers That Be that this should be made very very very explicit in the
docs/guides/FAQs.

2008/6/22 Chris Pratt <thechrispratt@(protected)>:

> When validating the XML files, the system has to load the DTD's or
> XSD's that are housed at apache.org and opensymphony.org. There's
> probably a way to disable the XML validation of those files, I haven't
> had the need to look for it yet.
>

Attachment: user_187928.ezm (zipped)
On Sun, Jun 22, 2008 at 7:53 PM, Chris Pratt <thechrispratt@(protected):
> When validating the XML files, the system has to load the DTD's or
> XSD's that are housed at apache.org and opensymphony.org. There's
> probably a way to disable the XML validation of those files, I haven't
> had the need to look for it yet.

If it needs them, it should load them from the classpath using the
URI. Aren't they in one of the Struts 2 jars?

(I'm not sure how it works with schemas, but DTDs definitely don't
need to be loaded from a remote url.)

--
Wendy

Attachment: user_187929.ezm (zipped)
Hello Wendy,
As far as I know, the DTDs definitely are on the classpath. At least,
Eclipse considers they are. (It's easy to check: if I modify the header of
the DTD by (say) changing the DTD's version number, Eclipse gives a warning
that it cannot anymore find the corresponding "mock" DTD on the classpath.)

2008/6/22 Wendy Smoak <wsmoak@(protected)>:

> If it needs them, it should load them from the classpath using the
> URI. Aren't they in one of the Struts 2 jars?
>
> (I'm not sure how it works with schemas, but DTDs definitely don't
> need to be loaded from a remote url.)
>
>

Attachment: user_187931.ezm (zipped)
As a matter of fact, the DTD for struts.xml that corresponds to "
http://struts.apache.org/dtds/struts-2.0.dtd" is found inside
struts2-core-2.1.2.jar which IS on the classpath.

2008/6/22 Pierre Thibaudeau <pierre.thibaudeau@(protected)>:

> As far as I know, the DTDs definitely are on the classpath. At least,
> Eclipse considers they are. (It's easy to check: if I modify the header of
> the DTD by (say) changing the DTD's version number, Eclipse gives a warning
> that it cannot anymore find the corresponding "mock" DTD on the classpath.)
>
> 2008/6/22 Wendy Smoak <wsmoak@(protected)>:
>
>> If it needs them, it should load them from the classpath using the
>> URI. Aren't they in one of the Struts 2 jars?
>>
>> (I'm not sure how it works with schemas, but DTDs definitely don't
>> need to be loaded from a remote url.)
>>
>>
>

Attachment: user_187932.ezm (zipped)
If you look at the <!DOCTYPE of the struts.xml file it explicitly
states that the location of the DTD is
http://struts.apache.org/dtds/struts-2.0.dtd. Since there is no way
to put something like this on the CLASSPATH, the only way I know of to
stop the XML libraries from loading this DTD remotely during
validation is to turn validation off. But, of course, I could be
wrong.
(*Chris*)

On Sun, Jun 22, 2008 at 9:10 PM, Pierre Thibaudeau
<pierre.thibaudeau@(protected):
> As a matter of fact, the DTD for struts.xml that corresponds to "
> http://struts.apache.org/dtds/struts-2.0.dtd" is found inside
> struts2-core-2.1.2.jar which IS on the classpath.
>
> 2008/6/22 Pierre Thibaudeau <pierre.thibaudeau@(protected)>:
>
>> As far as I know, the DTDs definitely are on the classpath. At least,
>> Eclipse considers they are. (It's easy to check: if I modify the header of
>> the DTD by (say) changing the DTD's version number, Eclipse gives a warning
>> that it cannot anymore find the corresponding "mock" DTD on the classpath.)
>>
>> 2008/6/22 Wendy Smoak <wsmoak@(protected)>:
>>
>>> If it needs them, it should load them from the classpath using the
>>> URI. Aren't they in one of the Struts 2 jars?
>>>
>>> (I'm not sure how it works with schemas, but DTDs definitely don't
>>> need to be loaded from a remote url.)
>>>
>>>
>>
>

Attachment: user_187933.ezm (zipped)
2008/6/23 Chris Pratt <thechrispratt@(protected)>:

> If you look at the <!DOCTYPE of the struts.xml file it explicitly
> states that the location of the DTD is
> http://struts.apache.org/dtds/struts-2.0.dtd. Since there is no way
> to put something like this on the CLASSPATH, the only way I know of to
> stop the XML libraries from loading this DTD remotely during
> validation is to turn validation off. But, of course, I could be
> wrong.


Sorry, Chris, but that "location" most definitely is NOT a URL, even though
it looks like one. It's only the official (and unique) reference name for
that particular DTD. (That's not something specific to Struts, but it's
similar with any DTD.)

In this case, it refers to the DTD stored inside struts2-core-2.1.2.jar (or
the equivalent jar file, if using a different version of Struts). Let's
have a look inside that jar file. The jar file contains the file
struts-2.0.dtd which contains the following comment:
<!--
 Struts configuration DTD.
 Use the following DOCTYPE

 <!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
  "http://struts.apache.org/dtds/struts-2.0.dtd">
-->
(The rest of that file defines the DTD itself; no need to fetch from
abroad; it's all there, available locally on my classpath.)

Now, I am no specialist of DTD syntax, therefore I cannot judge if
everything is exactly as it should be inside struts-2.0.dtd, but I assume
that's the case, since no one else seems to have reported some major problem
here...

Therefore my original question remains: Why, oh why does Struts feel the
need to access the internet on startup?
(Subsidiary question: where does one get hold of the source code for
com.opensymphony.xwork2? I briefly looked on opensymphony.com and quickly
got confused!)

Attachment: user_187930.ezm (zipped)
Hi Dave,

  thanks for your reply, but when i use simple theme, my application is
not getting any values from resource bundle..

will this problem be solved by extending theme ?

can you provide any best link to extend a theme if it is the solution... ?



On Sun, Jun 22, 2008 at 8:25 PM, Dave Newton <newton.dave@(protected):

> --- On Sun, 6/22/08, Narayana S <narayanasgs1@(protected):
> > The problem is here struts 2 is applying it's own styles to
> > my page, i want to give my own styles instead of using struts
> > default styles,
>
> The easiest answer is to just supply your own CSS styles. You can also
> extend an existing, or create your own, theme.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_187934.ezm (zipped)
It is possible to refer to an enum value within OGNL:
%{@com.myapp.Planets@(protected)}

But how can I refer to the collection of all the values of an enum? In
Java, that would be: com.myapp.Planets.values()
With OGNL, I tried the following without success:
%{@com.myapp.Planets@(protected)()}
%{@com.myapp.Planets@(protected)}
%{@(protected)()}

One option that would work:
%{{@com.myapp.Planets@(protected),
@com.myapp.Planets@(protected).}}

but that defeats the point, doesn't it?

Attachment: user_187936.ezm (zipped)
Pierre Thibaudeau wrote:
> It is possible to refer to an enum value within OGNL:
> %{@com.myapp.Planets@(protected)}
>
> But how can I refer to the collection of all the values of an enum? In
> Java, that would be: com.myapp.Planets.values()
> With OGNL, I tried the following without success:
> %{@com.myapp.Planets@(protected)()}
> %{@com.myapp.Planets@(protected)}
> %{@(protected)()}
>  
You'll need to enable OGNL's access to static methods.

struts.ognl.allowStaticMethodAccess=true

Otherwise your approach is fine.

I try not to use this myself. Instead I expose a property that
provides the values so it can sort, lookup I81N text, and minimize
dependencies on OGNL-specific syntax.


Attachment: user_187935.ezm (zipped)
Hi,

   i used struts 2 default theme to develop the pages. but recently i got
the CSS from the designer now i need to apply those styles to my project.
the problem is when i change theme to simple, it is not letting me to read
values from properties file(Resource bundle). how can i apply my own css
styles, and work properly with internationalization also...?


thanks in advance.
Help me plz.
~Narayana

Attachment: user_187937.ezm (zipped)
Narayana S wrote:
> Hi,
>
>     i used struts 2 default theme to develop the pages. but recently i got
> the CSS from the designer now i need to apply those styles to my project.
> the problem is when i change theme to simple, it is not letting me to read
> values from properties file(Resource bundle). how can i apply my own css
> styles, and work properly with internationalization also...?
>
>
> thanks in advance.
> Help me plz.
> ~Narayana
>
>  
As you've noticed, the simple theme doesn't include labels.

You have two options:
- use css_xhtml and override the CSS supplied by struts with the
styles supplied by your design. This will probably suck as there's
likely to be selector mismatches; or
- create a new theme, extending simple but duplicated from css_xhtml.
This should use the CSS and structure provided by your designer while
retaining the useful bits from css_xhtml (such as the labels loaded from
resource bundles). I always work like this. It's much easier than it
first seems.


Hope that helps,
Jeromy Evans

Attachment: user_187938.ezm (zipped)
Esteve Camps Chust wrote:
> hi all,
>
> this is my first email at struts list. I am a new user to struts2. I'm
> trying to get working the next scenario: having a mailer class, I want the
> message text be a rendered JSP. The action class calls a mailer class; this
> composes the mail from the rendering result of a jsp element (it would be
> fantastic that this rendering process uses some action class
> attributes/values). Finally, the action class informs the user about the
> mailing result.
>
> Is there any way to get this working? I think I did it once on struts 1.3 :(
>
> Thanks in advance.
>
> Sincerely,
>
> Esteve
>
>  

Yes it can be done, but my suggestion is to NOT use a JSP as the source
of the message text. Instead use a template engine like FreeMarker or
Velocity and write the source of the message in HTML+templateLanguage.  
That'll allow you to build and test the mailer outside the J2EE
environment which is much more productive (and in the case of FTL, superior)

With this approach, your action class will simply be responsible for
creating a context for the template (eg. a Map), invoking the emailer
and then returning a happy result (JSP) for the user.


Attachment: user_187939.ezm (zipped)

Hi,

I am using the struts s:text tag to print a number of values from the stack.
It was working fine untill I got the '[' and ']' characters in the stack and
had to show these values. When we are trying to display the string it does
not show the page.

Please provide me some pointers so that I can find the solution.

Thanks,
Sudipto
--
Sent from the Struts - User mailing list archive at Nabble.com.

©2008 gg3721.com - Jax Systems, LLC, U.S.A.