Re: S2: Design Input suggestion

2007-04-06 Thread Harring Figueiredo

Joey,

Thank you so much for you input. I will take a look again at the showcase
application code and see the detail of it. I was not aware that we could
setup interceptors like that -- Your input on this is greatly appreciated.

Regards,

Harring Figueiredo

On 4/5/07, joey [EMAIL PROTECTED] wrote:


I don't think you should turn on validation in edit mode or create
mode.
Validation is only needed in save mode.
edit mode or create mode is just to show field data,no submit.
You can set validation only work for save mode like this:
Addinterceptor-ref name=crudStack
param name=validation.excludeMethods
edit,create/param
/interceptor-ref
in edit or create mode configuration file.
Btw.edit and create could be done in one method.It's more compact.
You can refer to the crud example in the showcase app.

On 4/6/07, Harring Figueiredo [EMAIL PROTECTED] wrote:

 Folks:


 I have a form that is rendered by calling an action from a get or a put.

 In  edit mode, the fields are pre-populated from the POJO (param to
get
 the POJO is passed on the URL GET).
 In create mode, the fields are, of course, empty.

 The design issue I am having has to do with the Validation.
 If I turn on validation, then when the Action is called for the create
 mode,
 the the validators intercept an reders the form with
 the errors (i.e. Missing Field Blah)

 What is the best way you guys handle this situation?

 Thanks in advance.

 hff






--
Sincerely,

Harring Figueiredo
Sr. Software Engineer
Email: [EMAIL PROTECTED]
Telephone: 941-256-0600

We never become truly spiritual by sitting down and wishing to become so.
You must undertake something so great that you cannot accomplish it
unaided.


Appending url to every jsp

2007-04-06 Thread kapils

I am using struts

My Jsp has action like

form action=/LoginAction.do

and also it contains certain

href =/SomeAction.do

I want to append the URL e.g When we click submit it should appear as

http://host.com/en/Loginaction.do
instead of
http://host.com/Loginaction.do

Same way in href also


Or simply I want to say that I would like to append

en to every URL

Like

http://localhost/Loginaction.do

should change to

http://localhost/en/Loginaction.do


-- 
View this message in context: 
http://www.nabble.com/Appending-url-to-every-jsp-tf3535617.html#a9868978
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[S2] redirect-action to different namespace

2007-04-06 Thread Manu Mahajan
1. How can I redirect a result from an action to an action in another 
namespace?

I have separate configuration files for each namespace.

2. What is the significance of packages? Should the package name always 
be the same as the namespace?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Memory leak when using DB connection ??

2007-04-06 Thread Balazs Michnay
Dear Struts users,

Finally I managed to get DB-handling working, but I'm experiencing problems.
When I query the database for about the 10th time, I get the following error 
message:

java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
... ...

In previous posts I read that I can somehow check the memory usage and see if I 
ran out of memory.
Where can I check this? Any suggestions on fixing this? I hope there is a way 
to fix this, because
I found very few resources online on how to set up database handling in Struts.


Here's how I set it up (if it helps...)

1) I added mysql driver's jar file to my projec's lib directory and I copied 
taglibs-dbtags.tld to WEB-INF

2) These lines were added to web.xml:

resource-ref
descriptionDB Connection/description
res-ref-namejdbc/SZTGKR/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref

taglib
taglib-uri/WEB-INF/dbtags.tld/taglib-uri
taglib-location/WEB-INF/taglibs-dbtags.tld/taglib-location
/taglib


3) And I used the connection in a jsp:

%@ taglib uri=http://jakarta.apache.org/taglibs/dbtags; prefix=sql %

sql:connection id=conn1
sql:userIduserakarmi/sql:userId
sql:passwordkod/sql:password
sql:urljdbc:mysql://localhost:3306/proba/sql:url
sql:drivercom.mysql.jdbc.Driver/sql:driver
/sql:connection

sql:statement ...
--

If there is no way to fix this, any guides to any working configurations?
I'm really looking forward to getting some replies, because I'm stuck here.
Thanks a lot for your help!!

Regards,

Michnay



 

Need Mail bonding?
Go to the Yahoo! Mail QA for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=listsid=396546091

Re: [S2] redirect-action to different namespace

2007-04-06 Thread Manu Mahajan

Manu Mahajan wrote:
1. How can I redirect a result from an action to an action in another 
namespace?

I have separate configuration files for each namespace.

2. What is the significance of packages? Should the package name 
always be the same as the namespace?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





Ok. I just found out the answer to the first question in the docs...

Did something like this...
result name=success type=redirect-action
   param name=actionNamemenu/param
   param name=namespace/project/param
/result

But I'm still not sure how package and namespace are related. Please help.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] redirect-action to different namespace

2007-04-06 Thread joey

Package 's name is the key to for other packages to reference like extend.
Namespace could be different  to name.

On 4/6/07, Manu Mahajan  [EMAIL PROTECTED] wrote:


Manu Mahajan wrote:
 1. How can I redirect a result from an action to an action in another
 namespace?
 I have separate configuration files for each namespace.

 2. What is the significance of packages? Should the package name
 always be the same as the namespace?


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Ok. I just found out the answer to the first question in the docs...

Did something like this...
result name=success type=redirect-action
param name=actionNamemenu/param
param name=namespace/project/param
/result

But I'm still not sure how package and namespace are related. Please help.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




eclipse + struts2?

2007-04-06 Thread אלחנן מעין

hi..

how do i setup and eclipse project (dynamic web project) for struts2 ?

_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] redirect-action to different namespace

2007-04-06 Thread Manu Mahajan
Ok. So what happens when I extend a package? Do i inherit its 
namespaces, interceptors and actionmappings in the sub package?



joey wrote:
Package 's name is the key to for other packages to reference like 
extend.

Namespace could be different  to name.

On 4/6/07, Manu Mahajan  [EMAIL PROTECTED] wrote:


Manu Mahajan wrote:
 1. How can I redirect a result from an action to an action in another
 namespace?
 I have separate configuration files for each namespace.

 2. What is the significance of packages? Should the package name
 always be the same as the namespace?


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Ok. I just found out the answer to the first question in the docs...

Did something like this...
result name=success type=redirect-action
param name=actionNamemenu/param
param name=namespace/project/param
/result

But I'm still not sure how package and namespace are related. Please 
help.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.26/748 - Release Date: 4/5/2007 3:33 
PM
  




Struts2 and Tiles, still not clear for me :(

2007-04-06 Thread Pedro-1

Hi, I'm new in Struts, and bought the complete reference (second edition) to
start with it.
I discovered that Struts2 is different, and begin to understand how to
develop some struts2 on Eclipse.
Now, my problem is that I am completly lost with Tiles, and
http://struts.apache.org/2.x/docs/tiles-plugin.html does not help me.
It seem's that in the previous version of struts, it was mandatory to
declare struts as a plug-in ... within struts-config.xml, and now as a
listener within web.xml. But within the doc of
org.apache.struts2.views.tiles.TilesResult they say that it must be declared
as a servlet I am lost :(
Could some one give me a pointer to a simple example (without other things
like freemaker)  showing all the configuration files, and where to put them?
Thanks in advance for your help




-- 
View this message in context: 
http://www.nabble.com/Struts2-and-Tiles%2C-still-not-clear-for-me-%3A%28-tf3535994.html#a9869976
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] redirect-action to different namespace

2007-04-06 Thread joey

only interceptors,results will be inherited from parent package.


On 4/6/07, Manu Mahajan [EMAIL PROTECTED] wrote:


Ok. So what happens when I extend a package? Do i inherit its
namespaces, interceptors and actionmappings in the sub package?


joey wrote:
 Package 's name is the key to for other packages to reference like
 extend.
 Namespace could be different  to name.

 On 4/6/07, Manu Mahajan  [EMAIL PROTECTED] wrote:

 Manu Mahajan wrote:
  1. How can I redirect a result from an action to an action in another
  namespace?
  I have separate configuration files for each namespace.
 
  2. What is the significance of packages? Should the package name
  always be the same as the namespace?
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 Ok. I just found out the answer to the first question in the docs...

 Did something like this...
 result name=success type=redirect-action
 param name=actionNamemenu/param
 param name=namespace/project/param
 /result

 But I'm still not sure how package and namespace are related. Please
 help.



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 

 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.5.446 / Virus Database: 268.18.26/748 - Release Date:
4/5/2007 3:33 PM





JMap, jsp

2007-04-06 Thread Balazs Michnay
Hi there,

Is there a way to get the process ID of a web application?
I'd like to use jmap to see the memory state of my app, but I don't know 
which pid identifies my web app. When deploying and launching my app, jps 
doesn't show my app...
How can I use jmap (or any other memory-watch tool) with a web app?

Thanks for your help,

  Balazs




 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food  Drink QA.
http://answers.yahoo.com/dir/?link=listsid=396545367

Re: resume after login feature

2007-04-06 Thread meeboo

One last question regarding this. As I beforehand don't know where to
redirect the user after the login action I will have to implement the
ServletResponseAware interface and then use the HttpServletResponse for
this. This seems like an ugly way to redirect the user, are there other ways
maybe?


Dave Newton-4 wrote:
 
 --- meeboo [EMAIL PROTECTED] wrote:
 Yeah Dave, the problem is passing the data. I have
 my Login.java action class which implements 
 ServletRequestAware but it'll of course only
 retrieve
 localhost:8080/login.action since that's the request
 URI. I need to somehow tell it which location the 
 user tried to login from so that it can redirect
 back to that specific page. 
 
 Passing information to an Action is trivial; implement
 a known or new interface and set the data inside the
 interceptor. 
 
 You don't care about the *action's* view of
 request-land, you care about the *interceptor's*
 request; that's where the original (request) is, no?
 
 d.
 
 
 
  
 
 Don't pick lemons.
 See all the new 2007 cars at Yahoo! Autos.
 http://autos.yahoo.com/new_cars.html 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/resume-after-login-feature-tf3506442.html#a9870255
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 and Tiles, still not clear for me :(

2007-04-06 Thread Dave Newton
--- Pedro-1 [EMAIL PROTECTED] wrote:
 Could some one give me a pointer to a simple example
 showing all the configuration files, and where to
put
 them?

-- web.xml fragment

!-- 
  - If you want to use tiles config files other
  - than the default /WEB-INF/tiles.xml you can
  - configure them with a context-param.
  -
  - This is optional but I think it helps a lot.
  --
context-param
  param-namedefinitions-config/param-name
  param-value
/WEB-INF/tiles.xml,
/WEB-INF/classes/com/foo/bar/bar-tiles.xml,
/WEB-INF/classes/com/foo/baz/baz-tiles.xml
  /param-value
  description
CSV list of Tiles 2.0 configuration files.
  /description
/context-param

listener
  listener-class
org.apache.struts2.tiles.StrutsTilesListener
  /listener-class
/listener

-- tiles.xml fragment

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE tiles-definitions PUBLIC
-//Apache Software Foundation//DTD Tiles
Configuration 2.0//EN
   
http://struts.apache.org/dtds/tiles-config_2_0.dtd;

tiles-definitions
  definition name=/sanityCheck.page
template=/WEB-INF/jsp/sanityCheck.jsp
put name=title value=Sanity Check/
  /definition

  definition name=layout
template=/WEB-INF/jsp/components/layout.jsp
put name=title value=!!! DEFAULT TITLE !!! /
  /definition

  definition name=/home.page extends=layout
put name=title value=Home type=string /
put name=body value=/WEB-INF/jsp/home.jsp /
  /definition

  !-- Etc. --
/tiles-definitions

-- layout.jsp (just to show insertions of attributes)

%@ taglib prefix=tiles
uri=http://struts.apache.org/tags-tiles%
html
  head
titletiles:getAsString name=title//title
  /head
  body
tiles:insertAttribute name=body /
  /body
/html

d.



 

Don't get soaked.  Take a quick peek at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: resume after login feature

2007-04-06 Thread Dave Newton
--- meeboo [EMAIL PROTECTED] wrote:
 One last question regarding this. As I beforehand
 don't know where to redirect the user after the
login
 action I will have to implement the
 ServletResponseAware interface and then use the
 HttpServletResponse for this. This seems like an
ugly
 way to redirect the user, are there other ways
maybe?

As someone else mentioned if you are using an
interface to set the original URL (like void
setOriginalUrl(String)  String getOriginalUrl()) then
you can map a redirect in your action's config, more
or less like the following:

result type=redirect${originalUrl}/result

That was a day or two ago; I don't have a reference to
it handy and I don't recall who the poster was.

d.



 

It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] redirect-action to different namespace

2007-04-06 Thread Manu Mahajan

joey wrote:

only interceptors,results will be inherited from parent package.



Ok. Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 and Tiles, still not clear for me :(

2007-04-06 Thread Pedro-1

Many thanks Dave Newton-4, 
I understand better how it works with the different configuration files :)


-- 
View this message in context: 
http://www.nabble.com/Struts2-and-Tiles%2C-still-not-clear-for-me-%3A%28-tf3535994.html#a9871359
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WildCards and Results

2007-04-06 Thread stanlick

since '!' is already a special character which specifies the method name
automatically see struts.properties configuration file for more details
about how to enable/disable dynamic method invocation

Can you explain this?  I read all I could find on this topic and their was
discussion dating back to early XWorks changes, however I could not make
sense out of it.  I do recall changing my struts.properties and it does seem
to be working as I hoped.  What is meant by already a special character?

Thanks,
Scott


Re: WildCards and Results

2007-04-06 Thread Ted Husted

There's a feature embedded in WebWork that lets the ! character
invoke a method other than execute. In WebWork, it doesn't really have
a name. During the S2 discussions, we coined the term dynamic method
invocation to describe how WW/S2 use the ! notation.

For Struts 2, we added a switch to disable Dynamic Method Invocation
for two reasons. First, it can cause security issues if POJO actions
are used. Second, it overlaps with the Wildcard feature that we
brought over from Struts 1 (and from Cocoon before that).

S2 does support  dynamic method invocation, but there are problems
with the implementation. Essentially, the code scans the action name
for a !, and finding one, tricks the framework into invoking the
other method instead of execute. The other method is invoked, but it
uses the same configuration as the execute method, including
validations.  The framework believes it is invoking the Category
action with the execute method.

The Wildcard feature is implemented differently. When a Wildcard
action is invoked, the framework acts as if the matching action had
been hardcoded. The framework believes it's executing
Category!create and knows it is executing the create method.
This permits us to add specific validations, localizations, and type
converters, for a Wildcard action, just like a conventional action.

If someone were to implement [WW-1522], then the  dynamic method
invocation approach could have its own validations too. Here, the
notion is to generate carbon actions for qualifying methods. The
invocation would no longer be dynamic, because there would be an
actual action in the configuration, but any method could be invoked.

* https://issues.apache.org/struts/browse/WW-1522

My first pass at implementing [WW-1522] didn't work out. Though, I'm
wondering if whatever we do for the codebehind plugin might work here
too. At this point, I will probably never get to it myself, but
perhaps someone will pickup the baton.

In my own applications, I tend to use the underscore (_) as a
Wildcard separator, to avoid confusion with the WebWork bang. In
practice, these are the only two special characters that work without
causing JavaScript issues.

HTH, Ted
http://www.husted.com/ted/blog/


On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

since '!' is already a special character which specifies the method name
automatically see struts.properties configuration file for more details
about how to enable/disable dynamic method invocation

Can you explain this?  I read all I could find on this topic and their was
discussion dating back to early XWorks changes, however I could not make
sense out of it.  I do recall changing my struts.properties and it does seem
to be working as I hoped.  What is meant by already a special character?

Thanks,
Scott



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[S2 Tip] Within a namespace, reuse names for common concepts

2007-04-06 Thread Ted Husted

In practice, most applications are composed of a small number of
workflows that repeat within the application. When configuration
elements in different namespaces serve the same role, use the same
identifier for each element. If each namespace includes a Menu or  a
Help action, use those same names with each namespace.

package name=receivables namespace=/receivables
   action name=Menu class=receivables.Menu 
 result/receivables/Menu.jsp/result
  /action
 !-- ... --
/package
package name=payables namespace=/payables
   action name=Menu class=payables.Menu 
  result/payables/Menu.jsp/result
   /action
 !-- ... --
/package

Since the namespace feature avoids collisions between element names,
we can increase cohesion within the application by using a consistent
naming pattern.

HTH, Ted.
http://husted.com/ted/blog/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WildCards and Results

2007-04-06 Thread Aram Mkhitaryan

! is a special character means that if you have action which name is do
and in struts.properties you have

struts.enable.DynamicMethodInvocation=true

which is the default value,
then if the request is do_namespace/do!firstMethod will invoke the
firstMethod.

If you specify action name already with containing ! I guess it will arise
additional problems
(I think action do!lolo will automatically call not execute but lolo
method).

Best,
Aram


Re: WildCards and Results

2007-04-06 Thread stanlick

Ted, you are 2 for 2! Now it's back to changing code. I read the notes
on this several times and could never glean this understanding. You
really need to finish that book my brother.

Thanks,
Scott

On 4/6/07, Ted Husted [EMAIL PROTECTED] wrote:

There's a feature embedded in WebWork that lets the ! character
invoke a method other than execute. In WebWork, it doesn't really have
a name. During the S2 discussions, we coined the term dynamic method
invocation to describe how WW/S2 use the ! notation.

For Struts 2, we added a switch to disable Dynamic Method Invocation
for two reasons. First, it can cause security issues if POJO actions
are used. Second, it overlaps with the Wildcard feature that we
brought over from Struts 1 (and from Cocoon before that).

S2 does support  dynamic method invocation, but there are problems
with the implementation. Essentially, the code scans the action name
for a !, and finding one, tricks the framework into invoking the
other method instead of execute. The other method is invoked, but it
uses the same configuration as the execute method, including
validations.  The framework believes it is invoking the Category
action with the execute method.

The Wildcard feature is implemented differently. When a Wildcard
action is invoked, the framework acts as if the matching action had
been hardcoded. The framework believes it's executing
Category!create and knows it is executing the create method.
This permits us to add specific validations, localizations, and type
converters, for a Wildcard action, just like a conventional action.

If someone were to implement [WW-1522], then the  dynamic method
invocation approach could have its own validations too. Here, the
notion is to generate carbon actions for qualifying methods. The
invocation would no longer be dynamic, because there would be an
actual action in the configuration, but any method could be invoked.

* https://issues.apache.org/struts/browse/WW-1522

My first pass at implementing [WW-1522] didn't work out. Though, I'm
wondering if whatever we do for the codebehind plugin might work here
too. At this point, I will probably never get to it myself, but
perhaps someone will pickup the baton.

In my own applications, I tend to use the underscore (_) as a
Wildcard separator, to avoid confusion with the WebWork bang. In
practice, these are the only two special characters that work without
causing JavaScript issues.

HTH, Ted
http://www.husted.com/ted/blog/


On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 since '!' is already a special character which specifies the method name
 automatically see struts.properties configuration file for more details
 about how to enable/disable dynamic method invocation

 Can you explain this?  I read all I could find on this topic and their was
 discussion dating back to early XWorks changes, however I could not make
 sense out of it.  I do recall changing my struts.properties and it does
seem
 to be working as I hoped.  What is meant by already a special character?

 Thanks,
 Scott


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Scott
[EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: autocompleter with JSON plugin

2007-04-06 Thread Musachy Barroso

The autocompleter is expecting the datasource to be an array, not a map(or
object), so in this case it should be:

{foos: [
  [1, chance],
  [10, test]
  ]
}

Although it would be convenient if it would take a map also:

https://issues.apache.org/struts/browse/WW-1872

musachy

On 4/5/07, Rohit Dewan [EMAIL PROTECTED] wrote:


I have the following in the body:

@s.url id=foos value=foosList.action /
@s.form theme=ajax action=addTest method=add
 @ s.autocompleterModel theme=ajax href=%{foos}
name=foo /
 @s.submit value=OK action=addTest method=add/
 @ s.submit value=Cancel action=addTest
method=cancel/
/@s.form

I have verified that foosList.action returns the following
{foos:{1:chance,10:test}}

However, the autocompleter is blank after load.

I am using Struts 2.0.7 and JSON Plugin 0.7

Any thoughts?

Thanks,
Rohit





--
Hey you! Would you help me to carry the stone? Pink Floyd


Re: FreeMarker evaluating result of s.url?

2007-04-06 Thread Musachy Barroso

You will have to escape it so freemarker doesn't expand it, like:

$\{test}

http://freemarker.sourceforge.net/docs/dgui_template_exp.html

regards
musachy

On 4/6/07, River Tarnell [EMAIL PROTECTED] wrote:


hello,

i have a FreeMarker template which looks like this:

@s.url id=viewurl includeParams=none action=view
title=title.text /
a href=${viewurl}View/a

as long as title.text contains simple text, this works fine: it
outputs a href=.../view.action?title=whatever.  however, if the
literal value of title.text looks like a FreeMarker expression,
FreeMarker actually evaluates the result of the s.url.  e.g. if
title.text was ${foo}, and ${foo} had the value bar, the output
would be:

  a href=.../view.action?title=bar

instead of:

  a href=.../view.action?title=${foo}

why is this happening, and how can i stop it?  (it seems to prevent
outputting any user-supplied data in a URL...)

thanks,
- river.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Hey you! Would you help me to carry the stone? Pink Floyd


Re: Struts 2 and Validation Testing

2007-04-06 Thread Rich Thornett

Tried extending XWorkTestCase in a sample test, but sgot the same error.  I'm
extending MockObjectTestCase anyway, so inheritance wouldn't be the best
solution for me.

Doesn't look like there's been any traction on this issue in Jira yet:
https://issues.apache.org/struts/browse/WW-1868


qmnonic wrote:
 
 
 I experienced the same problem in a test case (though different
 circumstances), and it was solved by extending XWorkTestCase instead of
 TestCase as noted in the example - 
 http://struts.apache.org/2.x/docs/how-do-i-unit-test-my-actions-validation-logic.html
 .  This might help...
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-and-Validation-Testing-tf3451623.html#a9872429
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: CompositeActionMapper

2007-04-06 Thread Skylark

I can propose you workaround. Simply replace
org.apache.struts2.dispatcher.FilterDispatcher.class in struts2 core library
with attached one. http://www.nabble.com/file/7722/FilterDispatcher.class
FilterDispatcher.class 

PS: struts2 2.06
-- 
View this message in context: 
http://www.nabble.com/CompositeActionMapper-tf3433990.html#a9872738
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts with Tabbed page

2007-04-06 Thread samk

Hi , 
I am using Struts frame work to develop my app, which have 5 to 6 tabs in a
page .
I am using  a Single form bean to capture all of the information which have
all together of more than 100 fields . is it a good idea to impliment or
should i go for the 1 actiionClass, 1 Action Form for each Tab.. pls give me
some example ..
Thanks in Adv 
sunny
-- 
View this message in context: 
http://www.nabble.com/Struts-with-Tabbed-page-tf3537002.html#a9872814
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



STRUTS2 Custom Properties

2007-04-06 Thread Love, Andrew
How do I access custom properties defined in struts.properties.

For instance:
### Load custom property files (does not override
struts.properties!)
struts.custom.properties=/test/myprops

Also, can the properties be referenced in a free marker template?


Thanks,
Andrew


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: MVC 2 design, how to

2007-04-06 Thread mansour77



Ted Husted wrote:

It sounds like that you might want to use the ModelDriven approach,

How many approach there is ? Where can I read about them ?


where the AccountManager is the model object.

If I move the business logic to the action class then this becomes MVC1. 

From my understanding the model should be separated.



I was surprised to find that there doesn't seem to be a page or FAQ
with regard to using ModelDriven.

Essentially, all you need to do is place a model property on a base
Action class, or at least the accessor.


The AccountManager extends  ActionSupport.


public Object getModel() ...

In the implementation of getModel, acquire an instance of Account
Manager object and return it.

On the page, you can address any JavaBean properties on the
AccountManager as if they were coded directly on the Action class.

you mean getModel should be placed in the AccountManager (ActionSupport) 
and getModel should return an object of AccountBean. All the business 
logic is encapsulated in Account.java . Am I right ?





(The framework pushes the Model object onto the ValueStack.)

Many developers use Spring to acquire something like the Account
Manager. With the addition of a setModel method, the Action Manager
can be injected automatically.

HTH, Ted
http://www.husted.com/ted/blog/

On 4/5/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hello every one:
I am trying to write a little application to familiarize myself with
struts 2. I am trying to design the application using mvc2. the
application is nothing but a small utility for invoices. It store,
retrieves and update invoices. Each invoice belongs to an Account in the
DB. from the examples I have seen so far, the Action class is populated
by values from the jsp page.
So here's my design:

newAccount.jsp
-- AccountManager.java (ActionSupport)
 Account.java
veiwAccount.jsp

Account.java is the class where all the bussiness logic goes.
AccountManager is part of the controller and based on the results it
gets from the Account.java it forwards to the appropriate view. The user
can view an existing account or create one through the jsp pages. Now
because it doesn't make scense to populate the AccountManager with
getters/setters for the same fields in Account, I will pass Account as
an attribute of the request to the view. I mean, if Account.java has
fields , accountID, accountName , ... then I need getters and setters to
access them, but the same getters and setters has to exist in
AccountManager.java so that AccountManager can communicate with the
views. However, I have read some where that because the bussiness logic
may contain other resources ( ie, db connection, ..) we  don't pass it
to the view, but we pass a minimal verion of that class as a bean. So, I
'll create another class called ActionBean.java and populate it from
within Account.java .

PLease note that AccountManager can be accessed from many places and
depending on the output it forwards to the correct view.

I need an advice or comments, as I am new to struts 2 and MVC, and I
feel that I am missing something.
Can any one please correct me or give me comments?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



caching and reload

2007-04-06 Thread Chris Pat
Hello
Is/how it possible to clear the cache on an action?  My action works perfectly, 
however when the user hits reload the previous values are repeated.  I have 
coded a reset with = and still it uses the old values.  What am I missing?  I 
will trap the null or  values in the action(I know I should do it in 
validation, but it is a case of jgid, grin).  I really need to truly reset the 
values either fed to the action class or somewhere cached by the framework for 
the action class.  tia.


[s2] [Friday] [OT] [BBQ] ant build file eclipse webtools

2007-04-06 Thread Wesley Wannemacher
Hello,

I'm feeling a bit lazy right now and was wondering if anyone here has an
example that can help me out. 

If you are using Eclipse WebTools (Callisto) and you have an ant build file
that takes your dynamic web project and creates a deployable war file (and
if it runs unit tests and deploys to tomcat as a bonus). Can you post it?  

I don't care too much about how clean or elegant, I'm planning on making the
changes/enhancements I need. I'm not a total Ant newb, but just too lazy to
build from scratch right now :)

TIA!!!

-Wes

--
Wes Wannemacher
Director of Operations
Double A Trailer Sales, Inc.
[EMAIL PROTECTED]


smime.p7s
Description: S/MIME cryptographic signature


Re: [s2] [Friday] [OT] [BBQ] ant build file eclipse webtools

2007-04-06 Thread Leon Rosenberg

https://moskito.dev.java.net/source/browse/*checkout*/moskito/moskito-demo/build.xml

not the best probably but it works.

leon


On 4/6/07, Wesley Wannemacher [EMAIL PROTECTED] wrote:

Hello,

I'm feeling a bit lazy right now and was wondering if anyone here has an
example that can help me out.

If you are using Eclipse WebTools (Callisto) and you have an ant build file
that takes your dynamic web project and creates a deployable war file (and
if it runs unit tests and deploys to tomcat as a bonus). Can you post it?

I don't care too much about how clean or elegant, I'm planning on making the
changes/enhancements I need. I'm not a total Ant newb, but just too lazy to
build from scratch right now :)

TIA!!!

-Wes

--
Wes Wannemacher
Director of Operations
Double A Trailer Sales, Inc.
[EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [s2] [Friday] [OT] [BBQ] ant build file eclipse webtools

2007-04-06 Thread Wesley Wannemacher
Awesome, this is exactly what I was hoping for... 

-Wes 

 -Original Message-
 From: Leon Rosenberg [mailto:[EMAIL PROTECTED] 
 Sent: Friday, April 06, 2007 11:08 AM
 To: Struts Users Mailing List
 Subject: Re: [s2] [Friday] [OT] [BBQ] ant build file eclipse webtools
 
 https://moskito.dev.java.net/source/browse/*checkout*/moskito/
 moskito-demo/build.xml
 
 not the best probably but it works.
 
 leon
 
 
 On 4/6/07, Wesley Wannemacher [EMAIL PROTECTED] wrote:
  Hello,
 
  I'm feeling a bit lazy right now and was wondering if 
 anyone here has an
  example that can help me out.
 
  If you are using Eclipse WebTools (Callisto) and you have 
 an ant build file
  that takes your dynamic web project and creates a 
 deployable war file (and
  if it runs unit tests and deploys to tomcat as a bonus). 
 Can you post it?
 
  I don't care too much about how clean or elegant, I'm 
 planning on making the
  changes/enhancements I need. I'm not a total Ant newb, but 
 just too lazy to
  build from scratch right now :)
 
  TIA!!!
 
  -Wes
 
  --
  Wes Wannemacher
  Director of Operations
  Double A Trailer Sales, Inc.
  [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


smime.p7s
Description: S/MIME cryptographic signature


Re: FreeMarker evaluating result of s.url?

2007-04-06 Thread River Tarnell
On Fri, 2007-04-06 at 09:29 -0400, Musachy Barroso wrote:
 You will have to escape it so freemarker doesn't expand it, like:

 $\{test}

thanks, but i'm not sure i understand... does this mean that whenever i
use s.url, i need to do something like 

@s.url id=viewurl includeParams=none action=view
title=title.freemarkerEscapedText /

... where getFreemarkerEscapedText manually replaces ${ with $\{?

- river.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [s2] [Friday] [OT] [BBQ] ant build file eclipse webtools

2007-04-06 Thread mansour77

If you are using tomcat plug-in  www.sysdeo.com/*eclipse*/*tomcat**plugin  ,
*you will have the option to deply the application to a war file.

just right click on the project in the Navigation View, --- tomcat --- 
Export to war file sets in project properties.



Wesley Wannemacher wrote:

Hello,

I'm feeling a bit lazy right now and was wondering if anyone here has an
example that can help me out. 


If you are using Eclipse WebTools (Callisto) and you have an ant build file
that takes your dynamic web project and creates a deployable war file (and
if it runs unit tests and deploys to tomcat as a bonus). Can you post it?  


I don't care too much about how clean or elegant, I'm planning on making the
changes/enhancements I need. I'm not a total Ant newb, but just too lazy to
build from scratch right now :)

TIA!!!

-Wes

--
Wes Wannemacher
Director of Operations
Double A Trailer Sales, Inc.
[EMAIL PROTECTED]
  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



populating a bean

2007-04-06 Thread mansour77

how do I populate a bean values from a jsp page ?

here's what I need to do:


s:form action=accountManager  method=post 
s:textfield name=accountBean.firstName label=First Name /
s:submit /s:submit
/s:form


this page 
http://struts.apache.org/2.0.6/docs/how-do-i-populate-a-form-bean-and-get-the-value-using-the-taglib.html 

how to read the values from the bean but not how to populate them. Or 
may be I am not getting it...







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: populating a bean

2007-04-06 Thread Hartrich, James CTR USTRANSCOM J6
So you are going from the jsp to the action, correct?
That being the case, you are doing this correctly so far. Make certain
to have an encapsulated property for accountBean in your accountManager
action. On submit the accountBean object will be constructed and
setFirstName will be called. The bean will be set on your accountManager
action. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 06, 2007 11:32 AM
To: Struts Users Mailing List
Subject: populating a bean

how do I populate a bean values from a jsp page ?

here's what I need to do:


s:form action=accountManager  method=post 
s:textfield name=accountBean.firstName label=First Name /
s:submit /s:submit
/s:form


this page 
http://struts.apache.org/2.0.6/docs/how-do-i-populate-a-form-bean-and-ge
t-the-value-using-the-taglib.html 

how to read the values from the bean but not how to populate them. Or 
may be I am not getting it...






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: populating a bean

2007-04-06 Thread mansour77

Hartrich, James CTR USTRANSCOM J6 wrote:

So you are going from the jsp to the action, correct?
That being the case, you are doing this correctly so far. Make certain
to have an encapsulated property for accountBean in your accountManager
action. On submit the accountBean object will be constructed and
setFirstName will be called. The bean will be set on your accountManager
action. 
  
that's exactly what I am doing. But it's not populating the field. The 
field still shows null.

Here's a code from my AccountManager:


public class AccountManager   extends ActionSupport{

   private Account account ;
   private AccountBean accountBean ;
  
   public String execute()

   {
   // TODO - read the coments
   //if there's account number then retrieve the correspondiing 
account and dislay

   //if there's field for the accout then create the account and dislay
   //if none then forward to the new account page
   return SUCCESS ;  //temporarily
   }

   public AccountBean getAccountBean() {
   return accountBean;
   }

   public void setAccountBean(AccountBean accountBean) {
   this.accountBean = accountBean;
   }
  
}




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 06, 2007 11:32 AM

To: Struts Users Mailing List
Subject: populating a bean

how do I populate a bean values from a jsp page ?

here's what I need to do:


s:form action=accountManager  method=post 
s:textfield name=accountBean.firstName label=First Name /
s:submit /s:submit
/s:form


this page 
http://struts.apache.org/2.0.6/docs/how-do-i-populate-a-form-bean-and-ge
t-the-value-using-the-taglib.html 

how to read the values from the bean but not how to populate them. Or 
may be I am not getting it...







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: populating a bean

2007-04-06 Thread mansour77

I found it. Never mind.
And thank you a lot for your help.


[EMAIL PROTECTED] wrote:

Hartrich, James CTR USTRANSCOM J6 wrote:

So you are going from the jsp to the action, correct?
That being the case, you are doing this correctly so far. Make certain
to have an encapsulated property for accountBean in your accountManager
action. On submit the accountBean object will be constructed and
setFirstName will be called. The bean will be set on your accountManager
action.   
that's exactly what I am doing. But it's not populating the field. The 
field still shows null.

Here's a code from my AccountManager:


public class AccountManager   extends ActionSupport{

   private Account account ;
   private AccountBean accountBean ;
 public String execute()
   {
   // TODO - read the coments
   //if there's account number then retrieve the correspondiing 
account and dislay
   //if there's field for the accout then create the account and 
dislay

   //if none then forward to the new account page
   return SUCCESS ;  //temporarily
   }

   public AccountBean getAccountBean() {
   return accountBean;
   }

   public void setAccountBean(AccountBean accountBean) {
   this.accountBean = accountBean;
   }
  }



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 
April 06, 2007 11:32 AM

To: Struts Users Mailing List
Subject: populating a bean

how do I populate a bean values from a jsp page ?

here's what I need to do:


s:form action=accountManager  method=post 
s:textfield name=accountBean.firstName label=First Name /
s:submit /s:submit
/s:form


this page 
http://struts.apache.org/2.0.6/docs/how-do-i-populate-a-form-bean-and-ge

t-the-value-using-the-taglib.html
how to read the values from the bean but not how to populate them. Or 
may be I am not getting it...







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Filtering multipart content

2007-04-06 Thread Chris Pratt

Looks like you need a MultipartFilter earlier in the Filter Chain than your
Filter.  That way both your Filter and the Action will get the results.  It
will bypass Strut's built-in Multipart support, but it should work fine.  (I
think com.oreilly.servlets has one)
 (*Chris*)

On 3/27/07, Lance [EMAIL PROTECTED] wrote:


My filter is only interested in text parameters, my struts action
processes the file parameter. If I parse the request myself (in the
filter), the file parameter does not make it through to my action. If I
do not parse the request myself, I can not see the parameters in my
filter.

Hope this clears things up a bit.

trad-ex wrote:
 Hi Lance,

 Sorry for my misunderstanding your issue.
 What I understood is:

  Your Filter class works fine except file parameter.

 Is this correct ?
 So, after I looked over your implementation, I found the line below:

 parameterMap = multipartHandler.getTextElements();

 So, parameterMap has only normal text parameters (you called), doesn't
 it ?

 Why doesn't you adopt getAllElements() ?
 But I don't have tested it yet, but if my guess above is right, it does
 work.

 Best regards,
 trad-ex


 Hi trad-ex,
 In action code, the ActionServlet has already parsed the request for
you
 so request.getParameterMap() magically works. In a filter scenario, the
 request has not yet been parsed. I have since abondened attempting to
 filter multipart requests in my filter. Luckily most of our actions
 extend a common BaseAction and I was able to plug the filtering logic
in
 there. It would have been nice to do it in a filter. I'm still
 interested if someone else has an answer.

 Cheers,
 Lance.

 trad-ex wrote:

 Hi Lance,

 Just curious, I implemented multipart request handler using Struts 1.2
,
 ActionForm and Actoin class ( not using Fileter...) .

 like:

   protected ActionForward executeAction(
 ActionMapping mapping ,
 ActionForm form ,
 HttpServletRequest request ,
 HttpServletResponse response )
   {
 ActionErrors errors = new ActionErrors() ;
 HttpSession session = request.getSession() ;

 String contentType = request.getContentType() ;
 if( contentType == null || !contentType.startsWith(
multipart/form-
 data ) )
   return null ;

 MultiFilesImportForm multiFilesImportForm =
 (MultiFilesImportForm) form ;
 Hashtable multiFormFileTable =
  multiFilesImportForm.getMultiFilesTable() ;

 ..

 ** executeAction calls execute internally.

 My ActionForm ( called MultiFilesImportForm ) is like:

 public class MultiFilesImportForm extends ActionForm
 {
   public MultiFilesImportForm()
   {
   }
   public Hashtable getAllRequestTable()
   {
 return getMultipartRequestHandler().getAllElements() ;
   }

   public Hashtable getMultiFilesTable()
   {
 Hashtable fileElements =
   getMultipartRequestHandler().getFileElements() ;
 Hashtable stringElements = getMultiStringTable() ;

 for( Enumeration enumStrKey = stringElements.keys() ; enumStrKey.
 hasMoreElements() ; )
   fileElements.remove( enumStrKey.nextElement() ) ;

 return fileElements ;
   }

   public Hashtable getMultiStringTable()
   {
 Hashtable multiStringTable = new Hashtable() ;
 Hashtable allRequestTable  = getAllRequestTable() ;

 for( Enumeration enumKey = allRequestTable.keys() ; enumKey.
 hasMoreElements() ; )
 {
   String key  = (String) enumKey.nextElement() ;
   Object elem = allRequestTable.get( key );

   if( elem instanceof String )
 multiStringTable.put( key , elem ) ;
 }

 return multiStringTable ;
   }

   public ActionErrors validate(
   ActionMapping mapping ,
   HttpServletRequest request )
   {
...

 Best Regards,
 trad-ex




 Can someone tell me the best way to deal with multipart parameters in
a
 Filter without affecting struts?

 In my filter, request.getParameterMap() returns an empty map because
the
 multipart content has not yet been parsed. I had a look in the struts
 code and saw references to a MultipartRequestWrapper and a
 CommonsMultipartRequestHandler. From what I can see, the
requestHandler
 parses the request and calls MultipartRequestWrapper.setParameter().

 So... in my filter I do the following:

 protected void doFilter(HttpServletRequest request,
HttpServletResponse
 response, FilterChain chain) throws IOException, ServletException {
boolean isMultipart = isMultipart(request);
Map parameterMap;
if (isMultipart) {
// wrap the request so that
 CommonsMultipartRequestHandler.handleRequest()
// can call set parameter. the wrapped request is then passed
 down the filter chain
request = new MultipartRequestWrapper(request);
MultipartRequestHandler multipartHandler = new
 CommonsMultipartRequestHandler();
ModuleConfig moduleConfig = (ModuleConfig)

Does struts 1.2.x or 1.3.x support the attribute autocomplete f or forms?

2007-04-06 Thread Crawford, Preston
I'm sure many of you know about this. The originally IE specific attribute
autocomplete, that when set to off would prevent the browser from saving
the data in the form for autocompletion later.
 
I'm working on a project that uses Struts 1.1.  So I have a few questions.
 
#1 - Is autocomplete supported in later version of Struts 1? 
 
#2 - If so, which version?
 
I know there are ways to do this with JavaScript. Trapping the enter
keydown, etc. and doing a submit. I'm doing that currently. The problem is
that I'm trying to avoid attaching the onkeydown event to the body, as many
examples have you do, because doing this means that even if you're not
inside the form you can just hit enter and submit the form. So you have to
attach the onkeydown event to every form field or else somehow check to see
if the event was fired by a form element. 
 
I'm just trying to support this functionality (enter key submits the form
while in the form, but doesn't save any of the fields' data) with minimal
headache. It's starting to look like going to autocomplete=off might be
better, thus my question.
 
Preston
 
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply e-mail and destroy all copies of the original
message.


Re: MVC 2 design, how to

2007-04-06 Thread Ted Husted

On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

How many approach there is ? Where can I read about them ?


Just the two. Either put the properties on the Action class, or
implement ModelDriven.

A third might be to create your own interceptor that did the same
thing as ModelDriven, but with more objects.


you mean getModel should be placed in the AccountManager (ActionSupport)
and getModel should return an object of AccountBean. All the business
logic is encapsulated in Account.java . Am I right ?


Yes, if Account is a singleton. Otherwise, you could just put the
properties on the Account object.

HTH, Ted
http://www.husted.com/ted/blog/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action Validator ans s:url...

2007-04-06 Thread Ted Husted

On 4/5/07, Dave Newton [EMAIL PROTECTED] wrote:

Having the validation files key off of method names
would be pretty handy (and avoid some extra action
defs).


I poked around, and it seems the design justification is to allow the
methods to be validated differently in different contexts.

I do see the use case for having different validation for different
methods, but I don't see a case for a context beyond the method. I
would think that the method is the context. If a method needs to be
validated, then it needs to be validated.

I'm thinking that since annotations will focus on the method name
(since they do not know the action name), then we should look at
supporting configuration by method name too, so that there is at least
one consistent path. :)

-Ted.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Does struts 1.2.x or 1.3.x support the attribute autocomplet e f or forms?

2007-04-06 Thread Crawford, Preston
Oh, and the other question is if there are issues upgrading from 1.1 to
1.2.x or 1.3.x? Any reason this would be a difficult upgrade, assuming this
is the answer to my problem.

Preston
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply e-mail and destroy all copies of the original
message.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action Validator ans s:url...

2007-04-06 Thread stanlick

Amen! I really don't know if I have this straight or not.

On 4/6/07, Ted Husted [EMAIL PROTECTED] wrote:

On 4/5/07, Dave Newton [EMAIL PROTECTED] wrote:
 Having the validation files key off of method names
 would be pretty handy (and avoid some extra action
 defs).

I poked around, and it seems the design justification is to allow the
methods to be validated differently in different contexts.

I do see the use case for having different validation for different
methods, but I don't see a case for a context beyond the method. I
would think that the method is the context. If a method needs to be
validated, then it needs to be validated.

I'm thinking that since annotations will focus on the method name
(since they do not know the action name), then we should look at
supporting configuration by method name too, so that there is at least
one consistent path. :)

-Ted.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Scott
[EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Does struts 1.2.x or 1.3.x support the attribute autocomplete f or forms?

2007-04-06 Thread Niall Pemberton

On 4/6/07, Crawford, Preston [EMAIL PROTECTED] wrote:

I'm sure many of you know about this. The originally IE specific attribute
autocomplete, that when set to off would prevent the browser from saving
the data in the form for autocompletion later.

I'm working on a project that uses Struts 1.1.  So I have a few questions.

#1 - Is autocomplete supported in later version of Struts 1?


No its not supported in any version - Struts only supports attributes
that are in the HTML 4 spec and has a policy of not adding non
standard attributes.


#2 - If so, which version?


The tags were refactored in Struts 1.2.7 to make creating custom
implementations and adding additional attributes easier. So if you are
going to upgrade then this would be your only option. If you want to
do this in the form tag then something like the following:

public MyFormTag extends FormTag {
   protected void renderOtherAttributes(StringBuffer results) {
   renderAttribute(results, autocomplete, off);
   }
}

In the other form input tags the equivalent method is prepareOtherAttributes()

For  notes on upgrading and the issues you'll face then there are
upgrade notes on the wiki:

http://wiki.apache.org/struts/StrutsUpgrade

Niall


I know there are ways to do this with JavaScript. Trapping the enter
keydown, etc. and doing a submit. I'm doing that currently. The problem is
that I'm trying to avoid attaching the onkeydown event to the body, as many
examples have you do, because doing this means that even if you're not
inside the form you can just hit enter and submit the form. So you have to
attach the onkeydown event to every form field or else somehow check to see
if the event was fired by a form element.

I'm just trying to support this functionality (enter key submits the form
while in the form, but doesn't save any of the fields' data) with minimal
headache. It's starting to look like going to autocomplete=off might be
better, thus my question.

Preston


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: populating a bean

2007-04-06 Thread Martin Gainty

Assuming you are using Struts-2?
http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/dispatcher/DefaultActionSupport.html#getSuccessResultValue()
you will need these methods
public String getSuccessResultValue()
public void setSuccessResultValue(String successResultValue)

Martin--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - 
From: [EMAIL PROTECTED]

To: Struts Users Mailing List user@struts.apache.org
Sent: Friday, April 06, 2007 12:47 PM
Subject: Re: populating a bean



Hartrich, James CTR USTRANSCOM J6 wrote:

So you are going from the jsp to the action, correct?
That being the case, you are doing this correctly so far. Make certain
to have an encapsulated property for accountBean in your accountManager
action. On submit the accountBean object will be constructed and
setFirstName will be called. The bean will be set on your accountManager
action.
that's exactly what I am doing. But it's not populating the field. The 
field still shows null.

Here's a code from my AccountManager:


public class AccountManager   extends ActionSupport{

   private Account account ;
   private AccountBean accountBean ;
  public String execute()
   {
   // TODO - read the coments
   //if there's account number then retrieve the correspondiing 
account and dislay
   //if there's field for the accout then create the account and 
dislay

   //if none then forward to the new account page
   return SUCCESS ;  //temporarily
   }

   public AccountBean getAccountBean() {
   return accountBean;
   }

   public void setAccountBean(AccountBean accountBean) {
   this.accountBean = accountBean;
   }
  }



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 
April 06, 2007 11:32 AM

To: Struts Users Mailing List
Subject: populating a bean

how do I populate a bean values from a jsp page ?

here's what I need to do:


s:form action=accountManager  method=post 
s:textfield name=accountBean.firstName label=First Name /
s:submit /s:submit
/s:form


this page 
http://struts.apache.org/2.0.6/docs/how-do-i-populate-a-form-bean-and-ge

t-the-value-using-the-taglib.html
how to read the values from the bean but not how to populate them. Or may 
be I am not getting it...







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FreeMarker evaluating result of s.url?

2007-04-06 Thread Musachy Barroso

FreeMarker will replace ${X} fot the value of X anywhere on your ftl file,
if you want to have a literal ${X} that is not expanded, you need to use
$\{X}

musachy

On 4/6/07, River Tarnell [EMAIL PROTECTED] wrote:


On Fri, 2007-04-06 at 09:29 -0400, Musachy Barroso wrote:
 You will have to escape it so freemarker doesn't expand it, like:

 $\{test}

thanks, but i'm not sure i understand... does this mean that whenever i
use s.url, i need to do something like

@s.url id=viewurl includeParams=none action=view
title=title.freemarkerEscapedText /

... where getFreemarkerEscapedText manually replaces ${ with $\{?

- river.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Hey you! Would you help me to carry the stone? Pink Floyd


RE: Does struts 1.2.x or 1.3.x support the attribute autocomplet e f or forms?

2007-04-06 Thread Crawford, Preston
Thanks for the information. I think I will stick with Struts 1.1 for now,
then. We have the opportunity at some point on a later project to perhaps do
a Struts 2 migration. I think it's probably wiser to implement the
Javascript way of handling this for now and save the Struts migration
(sometimes you only get one shot at these every X amount of years) for
giving Struts 2 a look if it fits our needs.

Preston 

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 06, 2007 11:01 AM
To: Struts Users Mailing List
Subject: Re: Does struts 1.2.x or 1.3.x support the attribute autocomplete
f or forms?

On 4/6/07, Crawford, Preston [EMAIL PROTECTED] wrote:
 I'm sure many of you know about this. The originally IE specific 
 attribute autocomplete, that when set to off would prevent the 
 browser from saving the data in the form for autocompletion later.

 I'm working on a project that uses Struts 1.1.  So I have a few questions.

 #1 - Is autocomplete supported in later version of Struts 1?

No its not supported in any version - Struts only supports attributes that
are in the HTML 4 spec and has a policy of not adding non standard
attributes.

 #2 - If so, which version?

The tags were refactored in Struts 1.2.7 to make creating custom
implementations and adding additional attributes easier. So if you are going
to upgrade then this would be your only option. If you want to do this in
the form tag then something like the following:

public MyFormTag extends FormTag {
protected void renderOtherAttributes(StringBuffer results) {
renderAttribute(results, autocomplete, off);
}
}

In the other form input tags the equivalent method is
prepareOtherAttributes()

For  notes on upgrading and the issues you'll face then there are upgrade
notes on the wiki:

http://wiki.apache.org/struts/StrutsUpgrade

Niall

 I know there are ways to do this with JavaScript. Trapping the enter 
 keydown, etc. and doing a submit. I'm doing that currently. The 
 problem is that I'm trying to avoid attaching the onkeydown event to 
 the body, as many examples have you do, because doing this means that 
 even if you're not inside the form you can just hit enter and submit 
 the form. So you have to attach the onkeydown event to every form 
 field or else somehow check to see if the event was fired by a form
element.

 I'm just trying to support this functionality (enter key submits the 
 form while in the form, but doesn't save any of the fields' data) with 
 minimal headache. It's starting to look like going to autocomplete=off 
 might be better, thus my question.

 Preston

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply e-mail and destroy all copies of the original
message.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[Struts2] How to get instance of ActionSupport class after redirect?

2007-04-06 Thread Neil Aggarwal
Hello:

I have this scenario:

I have a form in a jsp file that submits to an
ActionSupport class.

The ActionSupport class captures the submitted
data and validates the input.  If the data is valid,
it sends the user back a redirect to a servlet url
to give them the data file generated for their
input (It is a CSV file).

Right now, I am taking all of the fields from the
ActionSupport class and appending them manually to
the redirect url so I can have their values in the
servlet.

This becomes tedious if there are many fields in the
ActionSupport class.

Is there a way to grab the instance of the ActionSupport
class from the servlet?  If so, I could eliminate the
need to append the fields.

I can probably use a session variable to temporarily
hold the ActionSupport instance, but it seems there
should be a more Struts-centric way to get it.

Any suggestions?

If this is not clear, I can try to give excerpts of
my code to illustrate.

Thanks,
Neil


--
Neil Aggarwal, (214)986-3533, www.JAMMConsulting.com
FREE! Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: autocompleter with JSON plugin

2007-04-06 Thread Rohit Dewan

Hi Musachy,

That was it. It works now!

Especially given that the autocompleter is structured as a key value pair,
supporting maps would be a natural fit. Thanks for creating the enhancement
request on JIRA.

Regards,
Rohit

On 4/6/07, Musachy Barroso [EMAIL PROTECTED] wrote:


The autocompleter is expecting the datasource to be an array, not a
map(or
object), so in this case it should be:

{foos: [
   [1, chance],
   [10, test]
   ]
}

Although it would be convenient if it would take a map also:

https://issues.apache.org/struts/browse/WW-1872

musachy

On 4/5/07, Rohit Dewan [EMAIL PROTECTED] wrote:

 I have the following in the body:

 @s.url id=foos value=foosList.action /
 @s.form theme=ajax action=addTest method=add
  @ s.autocompleterModel theme=ajax href=%{foos}
 name=foo /
  @s.submit value=OK action=addTest method=add/
  @ s.submit value=Cancel action=addTest
 method=cancel/
 /@s.form

 I have verified that foosList.action returns the following
 {foos:{1:chance,10:test}}

 However, the autocompleter is blank after load.

 I am using Struts 2.0.7 and JSON Plugin 0.7

 Any thoughts?

 Thanks,
 Rohit




--
Hey you! Would you help me to carry the stone? Pink Floyd



Struts Dispatch Action

2007-04-06 Thread samk

Hi , I am new to struts , I am using a Tabbed page with  multiple buttons on
the page (submit, save, clear)
can some one let me know the process in doing it? As i have read some
article that we can do it with dispatch Action or LookUpDispatch action.
Thx in Adv
Sunny
-- 
View this message in context: 
http://www.nabble.com/Struts-Dispatch-Action-tf3538175.html#a9876477
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: S2: Better passing of fields by link

2007-04-06 Thread Scott Nesbitt

Ok, figured it out.  I did try what you mentioned but
it also required this at the top to work:

s:head theme=ajax/

It would not pass the params with just the ajax theme
in the s:a tag.

Thank you for your help.

Scott

--- Musachy Barroso [EMAIL PROTECTED] wrote:

 What problem are you having? Just do:
 
 s:a theme=ajax formId=form .. /
 
 like what you did for the autocompleter, there are a
 few examples on
 showcase also.
 
 musachy
 
 On 4/5/07, Scott Nesbitt [EMAIL PROTECTED]
 wrote:
 
 
  I have a link that calls an action and I would
 like
  the action class to have some field values from my
  page.  Currently I do this:
 
  s:url id=editUrl action=EditLineup
  includeParams=all/
  s:a href=%{editUrl}
  onclick=this.href=rewriteLink(this.href)Edit
  Lineup/s:a
 
  In rewriteLink() I manually create a list of
 parameter
  key/values.  Is there a better way?  In my
  autocompleter tag I can just do formId=dataForm
 and
  have a small form  with hidden fields that get
  automatically serialized and sent to the action
 class,
  but that does not seem to work with the a tag,
 despite
  what the documentation says about ajax.
 
  Any ideas?  Perhaps I am going about this wrong
 but do
  not see any good examples of how to do this.
 
  Thank you,
 
  Scott
 
 
 
 
 


  No need to miss a message. Get email on-the-go
  with Yahoo! Mail for Mobile. Get started.
  http://mobile.yahoo.com/mail
 
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 
 
 -- 
 Hey you! Would you help me to carry the stone?
 Pink Floyd
 



 

Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



now inscrutable

2007-04-06 Thread Chris Pat
Hello
Sorry for a second post, however I cant also fathom this.  A TC5.028 project 
was working fine several months ago.  Went back to it and it apparently still 
works however if I put in a simple queryStr=request.getQueryString(), I 
impossibly get WebappClassLoader.java cannot be found.  Further this only 
happens if I debug on the line,and everything else seems to work; however there 
are problems with new data.  How can that happen?  I reconfirm my location for 
all the TC files and nothing has changed.  Any ideas?  tia

this is the other post

Hello
Is/how it possible to clear the cache on an action?  My action works 
perfectly, however when the user hits reload the previous values are 
repeated.  I have coded a reset with = and still it uses the old values.  
What am I missing?  I will trap the null or  values in the action(I 
know I should do it in validation, but it is a case of jgid, grin).  I 
really need to truly reset the values either fed to the action class or 
somewhere cached by the framework for the action class.  tia.




Re: FreeMarker evaluating result of s.url?

2007-04-06 Thread River Tarnell
On Fri, 2007-04-06 at 14:03 -0400, Musachy Barroso wrote:
 FreeMarker will replace ${X} fot the value of X anywhere on your ftl file,

sure, but in this case the ${X} is not in the ftl file, it's returned by
@s.url - i never explictily write ${foo} anywhere, but FreeMarker
expands it to bar because the generated URL includes that string.

i find it hard to believe that having the Action wrap every string
attribute with a ${ - $\{ replacement is a reasonable way to do
this... other than being an enormous amount of effort to maintain, it
seems very easy to make a mistake and introduce various security issues
(where the user could embed arbitrary ftl code in GET attributes, or
whatever).

if this really is the case then i suppose i will go back to using JSP
instead - any advantage of having a simple template language is negated
by the amount of extra code required.

- river.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action Validator ans s:url...

2007-04-06 Thread Dave Newton
--- Ted Husted [EMAIL PROTECTED] wrote:
 but I don't see a case for a context beyond the 
 method. I would think that the method is the
context.
 If a method needs to be validated, then it needs to 
 be validated.

That was more or less my thought, perhaps not quite as
well-stated ;)

 then we should look at supporting configuration by 
 method name too, so that there is at least
 one consistent path. :)

Sounds good to me!

OT, got some interesting S2 feedback today from
someone who had used GWT on their last project--I'll
try to write it up sometime, although what I mostly
got from it was that they found it more verbose than
GWT (they also came from a Swing background, which
would make a difference). It was an interesting
conversation (big financial client) but they are
focusing on S2 right now.

d.




 

Need Mail bonding?
Go to the Yahoo! Mail QA for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=listsid=396546091

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action Validator ans s:url...

2007-04-06 Thread Musachy Barroso

Does anybody know what is the status of that JSR?

musachy

On 4/5/07, Ted Husted [EMAIL PROTECTED] wrote:


On 4/5/07, Dave Newton [EMAIL PROTECTED] wrote:
 Turns out the annotations are class-based as well
 (again, I had just been lucky so far)... If the
 validation files were based off of method names the
 annotations could be as well, which would be a nice,
 unified view of things, IMO.

The validation comes out of XWork, so we'd have to file a ticket over
there.

I've never looked at that part of the code, so I don't know what's
involved.

There's also the who JSR 303 thing, but I have no idea how that's going.

* http://jcp.org/en/jsr/detail?id=303

-Ted.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Hey you! Would you help me to carry the stone? Pink Floyd


Accesssing a bean from a jsp without struts tags

2007-04-06 Thread mansour77
I have a bean that is set in an action class. I can access it using 
struts tag, but what do I do if I need to access it from somewhere else ?


for example, if I need to access it from a list iterator.

Thanks.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Eclipse WTP/Tomcat/Struts 2 - 404 error

2007-04-06 Thread Manickam-Periaswamy . Vignesh
Hi all

This might sound off topic, but I had already posted this in Eclipse WTP 
newsgroup, but couldn't resolve it yet. So I thought someone here might 
have already faced this problem.

I configured Eclipse WTP for a struts-enabled web application. When I ran 
my application using run on server option, it gives a 404 error.

Below is my configuration:
Java - 1.4.2_13
Tomcat 5.5.23 with Java 1.4 compatible jars
Struts 2.0.6 with Java 1.4 compatible jars
Eclipse WTP 3.2.2

I created a new dynamic web project with Tomcat 5.5 as runtime, r5sis 
as context root and WebContent as Content Directory. I copied the 
struts jars to the WebContent/WEB-INF/lib folder. The jsp files are 
placed in WebContent/WEB-INF/jsp folder.

Find below my struts.xml and web.xml

?xml version=1.0 encoding=UTF-8?
struts
   !-- Include Struts 2 default (from Struts 2 JAR). --
   include file=struts-default.xml/

   !-- Configuration for the default package. --
   package name=default extends=struts-default

   !-- Default interceptor stack. --
   action name=login 
class=gov.epa.r5sis.struts.action.LoginAction 
  result name=success 
type=dispatcher/WEB-INF/jsp/welcome.jsp/result
  result name=error 
type=redirect/WEB-INF/jsp/login.jsp/result
  /action

  action name=logout2 
class=gov.epa.r5sis.struts.action.LoginAction method=logout 
  result name=success 
type=redirect/WEB-INF/jsp/login.jsp/result
  /action

  action name=logout 
class=gov.epa.r5sis.struts.action.LogoutAction 
  result name=success 
type=redirect/WEB-INF/jsp/login.jsp/result
  /action

   /package
/struts


?xml version=1.0 encoding=UTF-8?
web-app id=WebApp_ID version=2.4 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_4.xsd;
   display-namer5test/display-name
   filter
   filter-namestruts/filter-name
   
filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class
   /filter
   filter-mapping
   filter-namestruts/filter-name
   url-pattern/*/url-pattern
   /filter-mapping
   welcome-file-list
   welcome-filejsp/login.jsp/welcome-file
   welcome-fileindex.html/welcome-file
   welcome-fileindex.htm/welcome-file
   welcome-filedefault.html/welcome-file
   welcome-filedefault.htm/welcome-file
   welcome-filedefault.jsp/welcome-file
   /welcome-file-list
/web-app


When I run the application by using run on server option, the tomcat 
server starts without a problem and opens the url http://localhost
:8080/r5sis/ in the browser.

It gives a 404 error, saying The requested resource (/r5sis/) is not 
available. r5sis is my project name. Also the project is placed only in 
the eclipse workspace and not in the tomcat dir/webapps folder. Even 
localhost:8080/index.jsp gives a 404 error. 

When I tried running Tomcat from the command prompt, it runs properly and 
localhost:8080/index.jsp works fine.So the Tomcat is not working fine 
inside Eclipse WTP. Please let me know what went wrong.

A member in eclipse mailing list suggest to place the welcome file in the 
WebContent folder and try. So I just created a index.htm file with 
just Hello world!, in the WebContent folder and modified the web.xml 
as:

welcome-file-list
welcome-fileindex.htm/welcome-file
/welcome-file-list

But still it is not working, please help!

Thanks
Vignesh


Vignesh Manickam Periaswamy
Web Application Developer Intern, Information Management Section
WPTD,   EPA Region 5 312-886-0887
email: [EMAIL PROTECTED]



Re: Accesssing a bean from a jsp without struts tags

2007-04-06 Thread mansour77
OK, let me include more details, may be someone will understand what I 
am talking about.

I have a list that belongs to  a Bean that's wet in an action class.

public AccountBean getAccountBean() {
   return accountBean;
}

AccountBean has an ArrayListInvoices  calles invoices.

now im my jsp, I need to display this in a datagrid, I am doing this, 
but it's not working:




dg:dataGrid items=${accountBean.invoices} var=inv name=datagrid1 
columns
column
header value=Name /
item value=${inv.statementDate} /
/column
/dg:dataGrid


that's the error  I am getting:

According to TLD or attribute directive in tag file, attribute items does not 
accept any expressions

org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:518)

org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)


Any Idea ??




[EMAIL PROTECTED] wrote:
I have a bean that is set in an action class. I can access it using 
struts tag, but what do I do if I need to access it from somewhere else ?


for example, if I need to access it from a list iterator.

Thanks.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Memory leak when using DB connection ??

2007-04-06 Thread mansour77

This is one of the problem using connection pooling.
This page explains it and offers a solution:

http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html

I hope it helps.




Balazs Michnay wrote:

Dear Struts users,

Finally I managed to get DB-handling working, but I'm experiencing problems.
When I query the database for about the 10th time, I get the following error 
message:

java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
... ...

In previous posts I read that I can somehow check the memory usage and see if I 
ran out of memory.
Where can I check this? Any suggestions on fixing this? I hope there is a way 
to fix this, because
I found very few resources online on how to set up database handling in Struts.


Here's how I set it up (if it helps...)

1) I added mysql driver's jar file to my projec's lib directory and I copied 
taglibs-dbtags.tld to WEB-INF


2) These lines were added to web.xml:

resource-ref
descriptionDB Connection/description
res-ref-namejdbc/SZTGKR/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref

taglib
taglib-uri/WEB-INF/dbtags.tld/taglib-uri
taglib-location/WEB-INF/taglibs-dbtags.tld/taglib-location
/taglib


3) And I used the connection in a jsp:

%@ taglib uri=http://jakarta.apache.org/taglibs/dbtags; prefix=sql %

sql:connection id=conn1
sql:userIduserakarmi/sql:userId
sql:passwordkod/sql:password
sql:urljdbc:mysql://localhost:3306/proba/sql:url
sql:drivercom.mysql.jdbc.Driver/sql:driver
/sql:connection

sql:statement ...
--

If there is no way to fix this, any guides to any working configurations?
I'm really looking forward to getting some replies, because I'm stuck here.
Thanks a lot for your help!!

Regards,

Michnay



 


Need Mail bonding?
Go to the Yahoo! Mail QA for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=listsid=396546091
  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Struts2] How to get instance of ActionSupport class after redirect?

2007-04-06 Thread Laurie Harper

Neil Aggarwal wrote:

Hello:

I have this scenario:

I have a form in a jsp file that submits to an
ActionSupport class.

The ActionSupport class captures the submitted
data and validates the input.  If the data is valid,
it sends the user back a redirect to a servlet url
to give them the data file generated for their
input (It is a CSV file).

Right now, I am taking all of the fields from the
ActionSupport class and appending them manually to
the redirect url so I can have their values in the
servlet.

This becomes tedious if there are many fields in the
ActionSupport class.

Is there a way to grab the instance of the ActionSupport
class from the servlet?  If so, I could eliminate the
need to append the fields.

I can probably use a session variable to temporarily
hold the ActionSupport instance, but it seems there
should be a more Struts-centric way to get it.

Any suggestions?


My first suggestion would be to get rid of the redirect to a separate 
servlet and serve the CSV response directly from the action. Is there a 
reason you can't do that?


There's no way your servlet can get the action class instance, since 
action instances are request scoped; the instance no longer exists in 
the new request the servlet receives.


Your options in this case (or any other case where you want to use data 
from one request in a subsequent request) are pretty much limited to 
either including the data in the redirect URL's query parameters, as you 
are doing, storing them in the user's session, as you suggested, or 
persisting them somewhere else, such as a database.


L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: form filed populated wrongly

2007-04-06 Thread Laurie Harper

Guna wrote:

Hi,
I have two jsp pages with different form bean.

on first jsp page, i have field called LastName. on first jsp page if user
press cancel the request. the user is navigated to second jsp page which has
also a field called lastName.

The problem is what ever value i enter on first jsp page lastname field is
appearing on second jsp page.


Sounds like perhaps you want to use a redirect to decouple the pages. 
Either that or you need to explicitly clear state during your cancel 
processing.


If you need more help, post what Struts version you're using, and the 
relevant bits of your configuration and code.


L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] Memory leak when using DB connection ??

2007-04-06 Thread Laurie Harper
This doesn't appear to have much to do with Struts... :-/ Anyway, it 
looks like you're not closing your DB connections. I don't know anything 
about dbtags, but I would guess it provides a way to do this.


Of course ideally you wouldn't be doing database stuff in a JSP in the 
first place :-)


L.

Balazs Michnay wrote:

Dear Struts users,

Finally I managed to get DB-handling working, but I'm experiencing problems.
When I query the database for about the 10th time, I get the following error 
message:

java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
 ...

In previous posts I read that I can somehow check the memory usage and see if I 
ran out of memory.
Where can I check this? Any suggestions on fixing this? I hope there is a way 
to fix this, because
I found very few resources online on how to set up database handling in Struts.


Here's how I set it up (if it helps...)

1) I added mysql driver's jar file to my projec's lib directory and I copied 
taglibs-dbtags.tld to WEB-INF


2) These lines were added to web.xml:

resource-ref
descriptionDB Connection/description
res-ref-namejdbc/SZTGKR/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref

taglib
taglib-uri/WEB-INF/dbtags.tld/taglib-uri
taglib-location/WEB-INF/taglibs-dbtags.tld/taglib-location
/taglib


3) And I used the connection in a jsp:

%@ taglib uri=http://jakarta.apache.org/taglibs/dbtags; prefix=sql %

sql:connection id=conn1
sql:userIduserakarmi/sql:userId
sql:passwordkod/sql:password
sql:urljdbc:mysql://localhost:3306/proba/sql:url
sql:drivercom.mysql.jdbc.Driver/sql:driver
/sql:connection

sql:statement ...
--

If there is no way to fix this, any guides to any working configurations?
I'm really looking forward to getting some replies, because I'm stuck here.
Thanks a lot for your help!!

Regards,

Michnay



 


Need Mail bonding?
Go to the Yahoo! Mail QA for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=listsid=396546091



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: caching and reload

2007-04-06 Thread Laurie Harper

Chris Pat wrote:

Hello
Is/how it possible to clear the cache on an action?  

 My action works perfectly, however when the user hits reload
 the previous values are repeated.

I'm not sure what cache you're talking about, but isn't this behaviour 
as you would expect? If I refresh a page, I expect to see the same 
response as I got when I loaded it the first time.


I have coded a reset with = and still it uses the old values. 

 What am I missing?  I will trap the null or  values in the
 action(I know I should do it in validation, but it is a case of
 jgid, grin).  I really need to truly reset the values either fed
 to the action class or somewhere cached by the framework for the
 action class.  tia.

Coded a reset where? I think you need to post some code and 
configuration samples to illustrate exactly what you are doing, and 
describe in more detail how the resulting behaviour differs from what 
you expect.


L.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] JMap, jsp

2007-04-06 Thread Laurie Harper
Again, not Struts related. The answer depends on your operating system 
(Windows? Linux?). Consult the documentation for the tools you are using 
for guidance.


L.

Balazs Michnay wrote:

Hi there,

Is there a way to get the process ID of a web application?
I'd like to use jmap to see the memory state of my app, but I don't know which pid 
identifies my web app. When deploying and launching my app, jps doesn't show my app...
How can I use jmap (or any other memory-watch tool) with a web app?

Thanks for your help,

  Balazs




 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food  Drink QA.

http://answers.yahoo.com/dir/?link=listsid=396545367



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts Dispatch Action

2007-04-06 Thread Niall Pemberton

On 4/6/07, samk [EMAIL PROTECTED] wrote:


Hi , I am new to struts , I am using a Tabbed page with  multiple buttons on
the page (submit, save, clear)
can some one let me know the process in doing it? As i have read some
article that we can do it with dispatch Action or LookUpDispatch action.


There are various flavours of DispatchAction (plus ActionDispatcher) -
the struts-examples webapp has a dispatch module with examples of
all the flavours (versions 1.2.9 and 1.3.8) - which you can try out
and look at the source code to see what suits you.

Niall



Thx in Adv
Sunny


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Unable to find resource error after upgrade from S12 to S13

2007-04-06 Thread Chinenova, Tatyana
I got the following exception after upgrading the project from Struts
1.1 to 1.3:

VelocityViewServlet : Error processing a template for path
'/tile/common/shlogon.vm'
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource '/tile/common/shlogon.vm' at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(Re
sourceManagerImpl.java:458)

The exception happens when I try to go to the login page of the
application.

I followed the instructions on
http://wiki.apache.org/struts/StrutsUpgradeNotes12to13  I tried to find
any additional information of Tiles setup with 1.3, but didn't find
anything different from 1.1

I don't think I missed anything, and I have no idea why it cannot find
the file.  The upgrade document in wiki does not say anything about
TilesPlugin.  Do I need to use it, or is there another way of specifying
tile definitions?  I check the path in .war file and shlogon.vm file is
there.

I have the following in my config files:
web.xml:

servlet
servlet-nameaction/servlet-name

servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
  param-nameconfig/param-name

param-value/WEB-INF/struts-common.xml,/WEB-INF/struts-cam.xml/param-v
alue
/init-param
init-param
 param-namechainConfig/param-name

param-valueorg/apache/struts/tiles/chain-config.xml/param-value
/init-param   
.
struts-common.xml:

 plug-in className=org.apache.struts.tiles.TilesPlugin
set-property property=definitions-config 
value=/WEB-INF/tiles-common.xml,
/WEB-INF/tiles-cam.xml /
.
tiles-common.xml:

definition name=.logon extends=.common.Bundle
path=/tile/common/shlogon.vm 
 put name=header value=/tile/common/header.vm/
 put name=tabsbar value=/tile/common/tabsbar.vm/
 put name=taboptions value=/tile/common/toptions.vm/
  /definition


Any help would be appreciated.


Tatyana Chinenova 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [Struts2] How to get instance of ActionSupport class after redirect?

2007-04-06 Thread Neil Aggarwal
Laurie: 

I alyways use a redirect after a form post to avoid
the stupid page expired warning if the user hits the
reload button.

I think we will save the ActionSupport instance in the
session and get it back from there.

Thanks,
Neil


--
Neil Aggarwal, (214)986-3533, www.JAMMConsulting.com
FREE! Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
Sent: Friday, April 06, 2007 5:30 PM
To: user@struts.apache.org
Subject: Re: [Struts2] How to get instance of ActionSupport class after
redirect?

Neil Aggarwal wrote:
 Hello:
 
 I have this scenario:
 
 I have a form in a jsp file that submits to an
 ActionSupport class.
 
 The ActionSupport class captures the submitted
 data and validates the input.  If the data is valid,
 it sends the user back a redirect to a servlet url
 to give them the data file generated for their
 input (It is a CSV file).

My first suggestion would be to get rid of the redirect to a separate 
servlet and serve the CSV response directly from the action. Is there a 
reason you can't do that?

There's no way your servlet can get the action class instance, since 
action instances are request scoped; the instance no longer exists in 
the new request the servlet receives.

Your options in this case (or any other case where you want to use data 
from one request in a subsequent request) are pretty much limited to 
either including the data in the redirect URL's query parameters, as you 
are doing, storing them in the user's session, as you suggested, or 
persisting them somewhere else, such as a database.

L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Accesssing a bean from a jsp without struts tags

2007-04-06 Thread joey

add request.setAttribute(invoices,accountBean.getInvoices()) in your
action execute method.
On 4/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


OK, let me include more details, may be someone will understand what I
am talking about.
I have a list that belongs to  a Bean that's wet in an action class.

public AccountBean getAccountBean() {
return accountBean;
}

AccountBean has an ArrayListInvoices  calles invoices.

now im my jsp, I need to display this in a datagrid, I am doing this,
but it's not working:



dg:dataGrid items=${accountBean.invoices} var=inv name=datagrid1 
columns
column
header value=Name /
item value=${inv.statementDate} /
/column
/dg:dataGrid


that's the error  I am getting:

According to TLD or attribute directive in tag file, attribute items does
not accept any expressions
org.apache.struts2.dispatcher.Dispatcher.serviceAction(
Dispatcher.java:518)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(
FilterDispatcher.java:421)


Any Idea ??




[EMAIL PROTECTED] wrote:
 I have a bean that is set in an action class. I can access it using
 struts tag, but what do I do if I need to access it from somewhere else
?

 for example, if I need to access it from a list iterator.

 Thanks.



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: caching and reload

2007-04-06 Thread joey

do you have this?
meta http-equiv=Cache-Control content=no-store/
meta http-equiv=Pragma content=no-cache/
meta http-equiv=Expires content=0/

On 4/7/07, Laurie Harper [EMAIL PROTECTED] wrote:


Chris Pat wrote:
 Hello
 Is/how it possible to clear the cache on an action?
 My action works perfectly, however when the user hits reload
 the previous values are repeated.

I'm not sure what cache you're talking about, but isn't this behaviour
as you would expect? If I refresh a page, I expect to see the same
response as I got when I loaded it the first time.

 I have coded a reset with = and still it uses the old values.
 What am I missing?  I will trap the null or  values in the
 action(I know I should do it in validation, but it is a case of
 jgid, grin).  I really need to truly reset the values either fed
 to the action class or somewhere cached by the framework for the
 action class.  tia.

Coded a reset where? I think you need to post some code and
configuration samples to illustrate exactly what you are doing, and
describe in more detail how the resulting behaviour differs from what
you expect.

L.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Accesssing a bean from a jsp without struts tags

2007-04-06 Thread mansour77

joey wrote:

add request.setAttribute(invoices,accountBean.getInvoices()) in your
action execute method.
On 4/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



I thought that was set automatically by struts through the getters !



OK, let me include more details, may be someone will understand what I
am talking about.
I have a list that belongs to  a Bean that's wet in an action class.

public AccountBean getAccountBean() {
return accountBean;
}

AccountBean has an ArrayListInvoices  calles invoices.

now im my jsp, I need to display this in a datagrid, I am doing this,
but it's not working:



dg:dataGrid items=${accountBean.invoices} var=inv 
name=datagrid1 

columns
column
header value=Name /
item value=${inv.statementDate} /
/column
/dg:dataGrid


that's the error  I am getting:

According to TLD or attribute directive in tag file, attribute items 
does

not accept any expressions
org.apache.struts2.dispatcher.Dispatcher.serviceAction(
Dispatcher.java:518)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(
FilterDispatcher.java:421)


Any Idea ??




[EMAIL PROTECTED] wrote:
 I have a bean that is set in an action class. I can access it using
 struts tag, but what do I do if I need to access it from somewhere 
else

?

 for example, if I need to access it from a list iterator.

 Thanks.



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Accesssing a bean from a jsp without struts tags

2007-04-06 Thread mansour77

[EMAIL PROTECTED] wrote:

joey wrote:

add request.setAttribute(invoices,accountBean.getInvoices()) in your
action execute method.


How do I do this is struts 2. I couldn't find any way to get my hand on 
the Request object.



On 4/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



I thought that was set automatically by struts through the getters !



OK, let me include more details, may be someone will understand what I
am talking about.
I have a list that belongs to  a Bean that's wet in an action class.

public AccountBean getAccountBean() {
return accountBean;
}

AccountBean has an ArrayListInvoices  calles invoices.

now im my jsp, I need to display this in a datagrid, I am doing this,
but it's not working:



dg:dataGrid items=${accountBean.invoices} var=inv 
name=datagrid1 

columns
column
header value=Name /
item value=${inv.statementDate} /
/column
/dg:dataGrid


that's the error  I am getting:

According to TLD or attribute directive in tag file, attribute items 
does

not accept any expressions
org.apache.struts2.dispatcher.Dispatcher.serviceAction(
Dispatcher.java:518)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(
FilterDispatcher.java:421)


Any Idea ??




[EMAIL PROTECTED] wrote:
 I have a bean that is set in an action class. I can access it using
 struts tag, but what do I do if I need to access it from somewhere 
else

?

 for example, if I need to access it from a list iterator.

 Thanks.



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]