Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 23 Jun 2008 15:25:32 -0000 Issue 8104

user-digest-help

2008-06-23


Author LoginPost Reply

user Digest 23 Jun 2008 15:25:32 -0000 Issue 8104

Topics (messages 187940 through 187969):

Re: [S2] Validator Framework
 187940 by: Lukasz Lenart

Re: [S2] OGNL and enum
 187941 by: Pierre Thibaudeau

s:submit name attribute problem
 187942 by: mjw_85uk
 187945 by: Lukasz Lenart

Re: [S2] attempts to access www.opensymphony.com on Struts startup???
 187943 by: Dave Newton
 187944 by: Dave Newton

minimal app server for embedded Struts1 or 2 solution
 187946 by: kindlerm.arcor.de
 187959 by: Nils-Helge Garli Hegvik
 187963 by: stanlick.gmail.com

Re: render JSP from action class
 187947 by: Esteve Camps Chust
 187948 by: Dave Newton
 187951 by: Esteve Camps Chust
 187953 by: Jeromy Evans

Closing tag for html:hidden
 187949 by: Dimitris Mouchritsas
 187952 by: Antonio Petrelli
 187958 by: Dimitris Mouchritsas
 187960 by: Antonio Petrelli
 187961 by: Dimitris Mouchritsas
 187962 by: Antonio Petrelli
 187964 by: Dimitris Mouchritsas
 187965 by: Antonio Petrelli
 187966 by: Dimitris Mouchritsas
 187969 by: Dimitris Mouchritsas

Re: [OT] What slows you down?
 187950 by: Greg Lindholm

Re: Validation
 187954 by: Struts Two

Struts 2: Providing Tiles Controller-like Functionality
 187955 by: Asleson, Ryan
 187957 by: Antonio Petrelli
 187968 by: Brad A Cupit

EJB3 dependancy injection on for WAS 6.1
 187956 by: Struts Two

[s2] error nesting custom components
 187967 by: mdiazf

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_187940.ezm (zipped)
Hi,

Struts2 use XWork Validation Framework, so you can use it
http://www.opensymphony.com/xwork/wikidocs/Validation%20Framework.html


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_187941.ezm (zipped)
> You'll need to enable OGNL's access to static methods.
>
> struts.ognl.allowStaticMethodAccess=true
>

Ah, I didn't know that!


>
> 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.
>

Thanks for the advice!

Attachment: user_187942.ezm (zipped)

hi,

i am having a problem with the name attribute of s:submit tag. I may be
using it in the wrong context as i am farily new to Struts 2. My problem is
that i want to set a property of a class with the value of the submit
button, which i assume would be "submit". The problem is that the property
is not set and has a value of null when the submit button is pressed. My
code is below:

JSP Page:

<s:submit name="action" action="Submit" method="getReport" value="Submit"/>

Class:

private String action;

Can anyone assist me in my problem?


many thanks
mark

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


Attachment: user_187945.ezm (zipped)
Hi,

> <s:submit name="action" action="Submit" method="getReport" value="Submit"/>

Just look for source of your page and you will see why. If you want to
use either method or action (not both), maybe it will be better to add
hidden field?


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_187943.ezm (zipped)
--- On Mon, 6/23/08, Pierre Thibaudeau <pierre.thibaudeau@(protected):
> (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!)

http://opensymphony.com/xwork/

See the "source repository" link.

Dave


Attachment: user_187944.ezm (zipped)
--- On Mon, 6/23/08, Dave Newton <newton.dave@(protected):
> http://opensymphony.com/xwork/
>
> See the "source repository" link.

(Having said that, of course, I'm not able to check out the source from there. I was on Saturday, IIRC.)

Dave


Attachment: user_187946.ezm (zipped)
Hi,

I am currently working on a little application which needs a user interface for administration. I think an embedded app server with a Struts based application might be a good choice. But one big obstacle is in the way, I fear: the size of such a solution.
What do you think is the minimal solution giving the comfort of a Struts based approach and not dominating the workhorse app with tons of jars only needed for the small admin part?
Jetty as an App server? Or Tomcat? Or some other, really small? Struts 1 or 2 (I would think Struts1 is the smaller solution)? Or shouldn't I attempt this approach and write a simple servlet? What do you do?
I cannot assume a Servlet container to be installed on machines my app will run on. There might be multiple instances of my app running on the same machine. The UI should work over the network although a console based approach might be possible, too.

Thanks in advance

Martin

Attachment: user_187959.ezm (zipped)
I know of several projects using Jetty to embed and distribute their
web applications. Jetty is easy to configureand embed (with xml or
programatically). Take a look at
http://docs.codehaus.org/display/JETTY/Embedding+Jetty to get started.

Nils-H

On Mon, Jun 23, 2008 at 2:08 PM, <kindlerm@(protected):
> Hi,
>
> I am currently working on a little application which needs a user interface for administration. I think an embedded app server with a Struts based application might be a good choice. But one big obstacle is in the way, I fear: the size of such a solution.
> What do you think is the minimal solution giving the comfort of a Struts based approach and not dominating the workhorse app with tons of jars only needed for the small admin part?
> Jetty as an App server? Or Tomcat? Or some other, really small? Struts 1 or 2 (I would think Struts1 is the smaller solution)? Or shouldn't I attempt this approach and write a simple servlet? What do you do?
> I cannot assume a Servlet container to be installed on machines my app will run on. There might be multiple instances of my app running on the same machine. The UI should work over the network although a console based approach might be possible, too.
>
> Thanks in advance
>
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_187963.ezm (zipped)
This sounds a little suspicious! When you say " I cannot assume a Servlet
container to be installed on machines my app will run on" what do you mean?
I would hope you are planning to host this from a server someplace, right?
Not sure about your environment, but you could always use an ISP to host
your Struts application. I use DailyRazor and have full control over the
server and none of the headaches of babysitting the machinery.

Scott

On Mon, Jun 23, 2008 at 7:08 AM, <kindlerm@(protected):

> Hi,
>
> I am currently working on a little application which needs a user interface
> for administration. I think an embedded app server with a Struts based
> application might be a good choice. But one big obstacle is in the way, I
> fear: the size of such a solution.
> What do you think is the minimal solution giving the comfort of a Struts
> based approach and not dominating the workhorse app with tons of jars only
> needed for the small admin part?
> Jetty as an App server? Or Tomcat? Or some other, really small? Struts 1 or
> 2 (I would think Struts1 is the smaller solution)? Or shouldn't I attempt
> this approach and write a simple servlet? What do you do?
> I cannot assume a Servlet container to be installed on machines my app will
> run on. There might be multiple instances of my app running on the same
> machine. The UI should work over the network although a console based
> approach might be possible, too.
>
> Thanks in advance
>
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Scott
stanlick@(protected)

Attachment: user_187947.ezm (zipped)
Thanks Martin, I have found some tricks in mailerReader, but not what I'm
looking for.

Jeromy, thanks for your suggestion. May you help me once again and guide me
on the code? I've been trying to do what you said me, but I cann't get it
run.

Thanks again.

Esteve

2008/6/23 Jeromy Evans <jeromy.evans@(protected)>:

> 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.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_187948.ezm (zipped)
--- On Mon, 6/23/08, Esteve Camps Chust <ecamps@(protected):
> May you help me once again and guide me on the code? I've been
> trying to do what you said me, but I cann't get it run.

What specifically are you having issues with? If it's FreeMarker issues you might have better luck on a more appropriate FreeMarker list/forum. It's pretty straight-forward, though.

Dave


Attachment: user_187951.ezm (zipped)
Ok. The subject: render a JSP/Freemaker/Velocity file in a Struts Action, to
send an email. I mean, the "problem" is getting the HTML email body from an
Action. The action skeleton would be:

public void sendEmail extends ActionSupport {

  private String username;

  public String execute() {
     // Validate parameters;
     ....
     // Send email
     Email mail = new Email();
     email.setFrom("foo@(protected)");
     email.setTo("*ben@(protected)*");
     email.setSubject("welcome");
     email.setBody(*this.renderJSP()*);
     Mailer.send(email);

     // Response to user.
     return ActionSupport.SUCCESS;
  }
}

The problem is "renderJSP" method, so it constructs a customized JSP with
username data. For example, "renderJSP" should return something like:

<html>
<body>
  <p>Welcome *ben@(protected)>
  <p>this is a welcome email.</p>
</body>
</html>

The object is render this email inside the user request. For me, it's not
important the template engine (JSP, FreeMaker, Velocity); the main thing is
getting it run from an Action.

Thanks again for your help and patience.

Esteve
2008/6/23 Dave Newton <newton.dave@(protected)>:

> --- On Mon, 6/23/08, Esteve Camps Chust <ecamps@(protected):
> > May you help me once again and guide me on the code? I've been
> > trying to do what you said me, but I cann't get it run.
>
> What specifically are you having issues with? If it's FreeMarker issues you
> might have better luck on a more appropriate FreeMarker list/forum. It's
> pretty straight-forward, though.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_187953.ezm (zipped)
Esteve Camps Chust wrote:
> The problem is "renderJSP" method, so it constructs a customized JSP with
> username data. For example, "renderJSP" should return something like:
>
> <html>
>  <body>
>    <p>Welcome *ben@(protected)>
>    <p>this is a welcome email.</p>
>  </body>
> </html>
>
>  
Do this:
http://freemarker.sourceforge.net/docs/pgui_quickstart_all.html
inside your action.

(where test.ftl contains the html above)

then pass the result to your emailer.


Attachment: user_187949.ezm (zipped)
Hi all,
We're using struts 1.2.4 in our project and we just noticed something;
When rendering a <html:hidden> element the html produced is:

<input name="id" value="1019" type="hidden">

Notice that it doesn't close the tag properly like /> as required by xhtml. Is there a way to
tell struts to close properly for xhtml or we have to upgrade?

Thanks
Dimitris



Attachment: user_187952.ezm (zipped)
2008/6/23 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
> Notice that it doesn't close the tag properly like /> as required by xhtml.
> Is there a way to tell struts to close properly for xhtml or we have to
> upgrade?

Use <html:xhtml> before the first <html:*> tag of every JSP page.
BTW I suggest to upgrade to Struts 1.2.9 (at least) because
<html:form> in Struts 1.2.4 does not produce XHTML-strict compliant
code (in particular it creates the "name" attribute).

Antonio

Attachment: user_187958.ezm (zipped)
Antonio Petrelli wrote:
> 2008/6/23 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
>  
>> Notice that it doesn't close the tag properly like /> as required by xhtml.
>> Is there a way to tell struts to close properly for xhtml or we have to
>> upgrade?
>>  
>
> Use <html:xhtml> before the first <html:*> tag of every JSP page.
> BTW I suggest to upgrade to Struts 1.2.9 (at least) because
> <html:form> in Struts 1.2.4 does not produce XHTML-strict compliant
> code (in particular it creates the "name" attribute).
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>  
Thanks for the info for the form tag. The problem is we use tiles, so
html:xhtml is not really an option.
A colleague will try to do a controller trick in web.xml, but from what
I feel we'll have to upgrade.
Dimitris

Attachment: user_187960.ezm (zipped)
2008/6/23 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
> Thanks for the info for the form tag. The problem is we use tiles, so
> html:xhtml is not really an option.

Why? <html:xhtml /> does not produce any markup code, only tells
Struts tags to render in XHTML.

Antonio

Attachment: user_187961.ezm (zipped)
Antonio Petrelli wrote:
> 2008/6/23 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
>  
>> Thanks for the info for the form tag. The problem is we use tiles, so
>> html:xhtml is not really an option.
>>  
>
> Why? <html:xhtml /> does not produce any markup code, only tells
> Struts tags to render in XHTML.
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>  
Ahh, ok, confused it with   <html:html xhtml="true">
which produces the <html> tag.

Anyway, I'm trying to upgrade to struts 1.3.8 but I get an exception
when trying to view the first page:

null
java.lang.NullPointerException
  at
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
  at
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
  at
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
  at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
  at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
  at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
  at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
  at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
  at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
  at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
  at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
  at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
  at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
  at
com.ed.ecomm.edcore.web.filters.SecurityFilter.doFilter(SecurityFilter.java:196)
  at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
  at
com.ed.ecomm.edcore.web.filters.MonitoringFilter.doFilter(MonitoringFilter.java:138)
  at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
  at
com.ed.ecomm.edcore.web.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92)
  at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
  at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
  at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
  at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
  at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
  at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
  at java.lang.Thread.run(Thread.java:534)
  -----

etendering > 17:15:56.265 DEBUG TilesAccessProxyAction   - forwarding
to tile definition: error.page
etendering > 17:15:56.265 DEBUG ErrorHandlerServlet     - doGet
etendering > 17:15:56.265 DEBUG ErrorHandlerServlet     - doPost()
etendering > 17:15:56.265 ERROR ErrorHandlerServlet     -
RepException id:b5c7ee5ac0a8010101a8cf03a8763d4f
etendering > 17:15:56.265 ERROR ErrorHandlerServlet     - EXCEPTION:
  -----
id b5c7ee5ac0a8010101a8cf03a8763d4f, error.generic
be.fedict.etendering.exception.EtenderingException: error.generic
  at
be.fedict.etendering.web.servlet.ErrorHandlerServlet.logErrors(ErrorHandlerServlet.java:92)
  at
be.fedict.etendering.web.servlet.ErrorHandlerServlet.doPost(ErrorHandlerServlet.java:53)
  at
be.fedict.etendering.web.servlet.ErrorHandlerServlet.doGet(ErrorHandlerServlet.java:68)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
  at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
  at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
  at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
  at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
  at
com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
  at
com.evermind.server.http.EvermindHttpServletResponse.handleException(EvermindHttpServletResponse.java:1685)
  at
com.evermind.server.http.EvermindHttpServletResponse.handleException(EvermindHttpServletResponse.java:1577)
  at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:843)
  at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
  at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
  at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
  at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NullPointerException
  at
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
  at
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
  at
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
  at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
  at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
  at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
  at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
  at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
  at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
  at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
  at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
  at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
  at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
  at
com.ed.ecomm.edcore.web.filters.SecurityFilter.doFilter(SecurityFilter.java:196)
  at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
  at
com.ed.ecomm.edcore.web.filters.MonitoringFilter.doFilter(MonitoringFilter.java:138)
  at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
  at
com.ed.ecomm.edcore.web.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92)
  at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
  at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
  at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)

Fortunately didn't have a lot of trouble with ActionError as most
dependencies were gone (remember my previous posts about correct use of
ActionMessages?),
the projects builds and deploys fine. Any idea why we get these exceptions?

Dimitris

Attachment: user_187962.ezm (zipped)
2008/6/23 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
> Caused by: java.lang.NullPointerException
>  at
> org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)

Mmm... Just a shot in the dark, did you put the commons-chain.jar in
your classpath?

Antonio

Attachment: user_187964.ezm (zipped)
Antonio Petrelli wrote:
> 2008/6/23 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
>  
>> Caused by: java.lang.NullPointerException
>>  at
>> org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
>>  
>
> Mmm... Just a shot in the dark, did you put the commons-chain.jar in
> your classpath?
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>  
Yep, right from the struts lib directory. One thing to note though is
we're using xdoclet 1.2.3 to
create struts-config.xml for us. As I understand this version of xdoclet
supports up to struts 1.2.x.
Could this be the culprit? That it doesn't produce a proper
struts-config.xml? Because from what I
saw web.xml is very similar to 1.3.8's web.xml from the blank web app
example.

Dimitris

Attachment: user_187965.ezm (zipped)
2008/6/23 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
> One thing to note though is we're
> using xdoclet 1.2.3 to
> create struts-config.xml for us. As I understand this version of xdoclet
> supports up to struts 1.2.x.
> Could this be the culprit?

Probably. According to the source file:
http://svn.apache.org/repos/asf/struts/struts1/tags/STRUTS_1_3_8/core/src/main/java/org/apache/struts/chain/commands/servlet/PerformForward.java
it seems that a request dispatcher is not found, that is *really*
strange, and, IMHO, can only happen when a webapp did not start
correctly. Do you see an error at startup?

Antonio

Attachment: user_187966.ezm (zipped)
Antonio Petrelli wrote:
> 2008/6/23 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
>  
>> One thing to note though is we're
>> using xdoclet 1.2.3 to
>> create struts-config.xml for us. As I understand this version of xdoclet
>> supports up to struts 1.2.x.
>> Could this be the culprit?
>>  
>
> Probably. According to the source file:
> http://svn.apache.org/repos/asf/struts/struts1/tags/STRUTS_1_3_8/core/src/main/java/org/apache/struts/chain/commands/servlet/PerformForward.java
> it seems that a request dispatcher is not found, that is *really*
> strange, and, IMHO, can only happen when a webapp did not start
> correctly. Do you see an error at startup?
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>  
No, everything seems to start smoothly. I'll try to create a
struts-config.xml file by hand just for the home action and see what
happens.

Dimitris

Attachment: user_187969.ezm (zipped)
Dimitris Mouchritsas wrote:
> Antonio Petrelli wrote:
>> 2008/6/23 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
>>
>>> One thing to note though is we're
>>> using xdoclet 1.2.3 to
>>> create struts-config.xml for us. As I understand this version of
>>> xdoclet
>>> supports up to struts 1.2.x.
>>> Could this be the culprit?
>>>  
>>
>> Probably. According to the source file:
>> http://svn.apache.org/repos/asf/struts/struts1/tags/STRUTS_1_3_8/core/src/main/java/org/apache/struts/chain/commands/servlet/PerformForward.java
>>
>> it seems that a request dispatcher is not found, that is *really*
>> strange, and, IMHO, can only happen when a webapp did not start
>> correctly. Do you see an error at startup?
>>
>> Antonio
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>  
> No, everything seems to start smoothly. I'll try to create a
> struts-config.xml file by hand just for the home action and see what
> happens.
>
> Dimitris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
I'm not sure it's the struts-config.xml file anymore. I'm using this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts-config PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
      "http://struts.apache.org/dtds/struts-config_1_3.dtd">

<struts-config>


<!-- ================================================ Form Bean
Definitions -->

  <form-beans>


 
  </form-beans>


<!-- ========================================= Global Exception
Definitions -->

  <global-exceptions>
   
  </global-exceptions>


<!-- =========================================== Global Forward
Definitions -->

  <global-forwards>
   
    <forward
       name="welcome"
       path="/Welcome.do"/>
  </global-forwards>


<!-- =========================================== Action Mapping
Definitions -->

  <action-mappings>
     
    <action
       path="/Welcome"
       forward="/pages/Welcome.jsp"/>

    <action
       path="/home"
       forward="home" />

  <!-- sample input and input submit actions

    <action
       path="/Input"
       type="org.apache.struts.actions.ForwardAction"
       parameter="/pages/Input.jsp"/>

    <action
       path="/InputSubmit"
       type="app.InputAction"
       name="inputForm"
       scope="request"
       validate="true"
       input="/pages/Input.jsp"/>

       <action
          path="/edit*"
          type="app.Edit{1}Action"
          name="inputForm"
          scope="request"
          validate="true"
          input="/pages/Edit{1}.jsp"/>

  end samples -->
  </action-mappings>


<!-- ======================================== Message Resources
Definitions -->

  <message-resources parameter="MessageResources" />


<!-- =============================================== Plug Ins
Configuration -->


<!-- =================================================== Validator
plugin -->

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
  <set-property
    property="pathnames"
    value="/org/apache/struts/validator/validator-rules.xml,
         /WEB-INF/validation.xml"/>
</plug-in>
<plug-in className="org.apache.struts.tiles.TilesPlugin">
  <set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
</plug-in>

</struts-config>

which is from another 1.3.8 sample app and I just added the action
definition for /home. Still I get the same exception.
Could it be that it's not finding a proper jar or something?

Dimitris






Attachment: user_187950.ezm (zipped)

Sorry, I don't understand your response. Was this about one of my questions
or of list of "slows"?


mgainty wrote:
>
> 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)
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

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


Attachment: user_187954.ezm (zipped)
Make sure your validation xml is named as  "ActionClass-alias-validation.xml", if you want to apply it only to one method in ur action class 
Naming it as "Actionclass-validation.xml" would apply your validation to all methods in your action.


   __________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com

Attachment: user_187955.ezm (zipped)

Hello,

We're moving from a Struts 1.x with Tiles development model to Struts 2
and Sitemesh.

One thing we miss with from Tiles is the ability to back a JSP with a
Controller. The Controller guaranteed that whenever a JSP was rendered,
certain behavior was executed to prepare data for the JSP. For example,
the loading of data for drop-down select boxes was often placed in the
Controller.

Now that we're not using Tiles we can no longer use Controllers, so I'm
wondering if Struts 2 has any sort of equivalent functionality. I'm
familiar with the Struts 2 Preparable interface, but I don't like this
because prepare() is always called -- even on form posts, which in my
case, is at best an unnecessary database hit (or hits), and at worst can
cause confusion with what was actually posted from the page vs. what was
retrieved from prepare().

If it helps any, we have a 1:1 mapping between an Action and a JSP,
including a naming convention: MyFavoriteAction maps to myFavorite.jsp.

Any thoughts or comments?

Thank you!!

-Ryan




This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you.

Attachment: user_187957.ezm (zipped)
2008/6/23 Asleson, Ryan <asleson@(protected)>:
> One thing we miss with from Tiles is the ability to back a JSP with a
> Controller. The Controller guaranteed that whenever a JSP was rendered,
> certain behavior was executed to prepare data for the JSP. For example,
> the loading of data for drop-down select boxes was often placed in the
> Controller.
>
> Now that we're not using Tiles we can no longer use Controllers

Well, Tiles 1 "controllers" were renamed to "view preparers" in Tiles 2. See:
http://tiles.apache.org/tutorial/advanced/preparer.html

Ciao
Antonio

Attachment: user_187968.ezm (zipped)
Asleson, Ryan wrote:
> I'm familiar with the Struts 2 Preparable interface, but I don't
> like this because prepare() is always called -- even on form posts

Do you have one Action with two public methods that are called by Struts
2? For example view() and submit() methods? If that's the case, I can
understand why you wouldn't want prepare() called when submit() is
called.

To solve that, just rename your prepare method to prepareView(), and it
will only run when view() is called.

If you are not using multiple public methods in one Action, and each
Action just implements the execute() method, I'd assume you have
separate Actions for viewing and submitting, let's call them ViewAction
and SubmitAction.

In this situation, make your ViewAction implement Preparable, but don't
have SubmitAction implement it.

Am I way off base here?

I personally like Preparable since the method gets called even when
there is a validation error. So you have a place to put code that you
want run both on initial display and on after a POST with validation
errors.

Brad Cupit
Louisiana State University - UIS


-----Original Message-----
From: Asleson, Ryan [mailto:asleson@(protected)]
Sent: Monday, June 23, 2008 8:36 AM
To: Struts Users Mailing List
Subject: Struts 2: Providing Tiles Controller-like Functionality


Hello,

We're moving from a Struts 1.x with Tiles development model to Struts 2
and Sitemesh.

One thing we miss with from Tiles is the ability to back a JSP with a
Controller. The Controller guaranteed that whenever a JSP was rendered,
certain behavior was executed to prepare data for the JSP. For example,
the loading of data for drop-down select boxes was often placed in the
Controller.

Now that we're not using Tiles we can no longer use Controllers, so I'm
wondering if Struts 2 has any sort of equivalent functionality. I'm
familiar with the Struts 2 Preparable interface, but I don't like this
because prepare() is always called -- even on form posts, which in my
case, is at best an unnecessary database hit (or hits), and at worst can
cause confusion with what was actually posted from the page vs. what was
retrieved from prepare().

If it helps any, we have a 1:1 mapping between an Action and a JSP,
including a naming convention: MyFavoriteAction maps to myFavorite.jsp.

Any thoughts or comments?

Thank you!!

-Ryan




This e-mail message is being sent solely for use by the intended
recipient(s) and may contain confidential information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please contact the sender by phone or reply by
e-mail, delete the original message and destroy all copies. Thank you.

Attachment: user_187956.ezm (zipped)
I have modified the EJB3 plugin(interceptor) to inject Local EJB3 beans into you action classes for Websphere V6.1 and it is working great. If anyone is interested in the code, let me know and I would send him/her the code. I was planning to send it to mailing list but my email is being rejected as spam.


   __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at
http://ca.toolbar.yahoo.com.

Attachment: user_187967.ezm (zipped)

I'm getting a NullPointerException when I pass a custom component as a
parameter to another custom component.

The files are:

test_fail.jsp (throws NPE):
<%@(protected)"%>
<%@(protected)"%>
<s:component template="myComponent.jsp">
<s:param name="body">
  <s:component template="myComponent_nested.jsp" />
</s:param>
</s:component>


test_work.jsp (works ok):
<%@(protected)"%>
<%@(protected)"%>
<s:component template="myComponent_nested.jsp" />


myComponent.jsp:
<%@(protected)" %>
<%@(protected)" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<body>
<s:property value="%{parameters.body}" escape="false" />
</body>
</html>


myComponent_nested.jsp:
<%@(protected)"%>
<%@(protected)"%>
<p>Some text...</p>
<s:form namespace="/" action="index" method="post">
</s:form>


As you can see I'm passing the component myComponent_nested.jsp as a
parameter to the component myComponent.jsp. That fails if any struts2 tag is
used in myComponent_nested.jsp (if I don't use any struts2 tag it works).
The component myComponent.jsp works ok if I pass a string instead of a
myComponent_nested.jsp.

The stack trace follows:

2008-06-23 16:49:24,703 [ERROR]
org.apache.struts2.components.template.JspTemplateEngine - Could not render
JSP template /template/xhtml/myComponent.jsp
2008-06-23 16:49:24,703 [ERROR] org.apache.struts2.components.UIBean - error
when rendering
java.lang.NullPointerException
 at org.apache.struts2.components.Include.include(Include.java:241)
 at
org.apache.struts2.components.template.JspTemplateEngine.renderTemplate(JspTemplateEngine.java:55)
 at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:530)
 at org.apache.struts2.components.UIBean.end(UIBean.java:484)
 at
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
 at
org.apache.jsp.paginas.test_fail_jsp._jspx_meth_s_005fcomponent_005f0(test_fail_jsp.java:118)
 at org.apache.jsp.paginas.test_fail_jsp._jspService(test_fail_jsp.java:68)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
 at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:619)



Is this a bug or I'm doing something wrong?

Many thanks
--
Sent from the Struts - User mailing list archive at Nabble.com.

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