Re: datetimepicker does not work

2007-04-08 Thread David Harland
If you use the datetimepicker in date format I can preset the date value using 
an action and I can use the displayFormat to format the date. 

If I use it in type=time the time is always 12:00. I can't adjust the time or 
the time display format.





- Original Message 
From: David Harland [EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Thursday, March 29, 2007 10:21:48 PM
Subject: datetimepicker does not work

I am trying to use the datetimepicker but I am getting the following error

22:03:16,676 INFO  [STDOUT] 22:03:16,666 ERROR [[jsp]] Servlet.service() for 
servlet jsp threw exception
java.lang.NullPointerException
at 
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:50)
at 
org.apache.jsp.WEB_002dINF.decorators.layout_jsp._jspx_meth_s_url_0(layout_jsp.java:151)
at 
org.apache.jsp.WEB_002dINF.decorators.layout_jsp._jspService(layout_jsp.java:78)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at 
com.opensymphony.module.sitemesh.filter.PageFilter.applyDecorator(PageFilter.java:156)
at 
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:59)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at 
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at 
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at 
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at 
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at 
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
22:03:16,926 INFO  [STDOUT] 22:03:16,926 ERROR [[default]] Servlet.service() 
for servlet default threw exception
java.lang.NullPointerException
at 
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:50)
at 
org.apache.jsp.WEB_002dINF.decorators.layout_jsp._jspx_meth_s_url_0(layout_jsp.java:151)
at 
org.apache.jsp.WEB_002dINF.decorators.layout_jsp._jspService(layout_jsp.java:78)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at 

[OT] problem with displaytag column sorting in struts 1.2 web project

2007-04-08 Thread robin bajaj

Hi All,
In my Struts 1.2.x webapp, I am getting some Patient records from 
backend using my PatientManager businessObject (which uses Hibernate)
to send back a populated Patients List in the request scope. (Patient is 
my bean).


I am feeding this patientsList to Displaytag table,
to show the data in a table.

Here's the code snippet for my jsp containing displaytag table.
http://rafb.net/p/artIJr98.html

Now, I want to sort this table based on the PatientID
when I click on the PatientID column.

I read in the Displaytag docs

http://displaytag.homeip.net/displaytag-examples-1.1/example-sorting.jsp

where it mentions the following :

If you want to allow the user to sort the data as it is coming back, 
then you need to just do two things, make sure that the data returned 
from your property implements the Comparable interface (if it doesn't 
natively - use the decorator pattern as shown a couple of examples ago), 
and then set the attribute sortable=true on the columns that you want 
to be able to sort by.



Following the above suggestion, I changed my Patient class to implement 
Comparable interface and implemented the following compareTo method (as 
following)

http://rafb.net/p/t0CR4Q98.html

Then I re-build my app and restart it on the server, the displaytag 
table shows up fine. But when I click on the first column PtId, it 
doesn't sort the table. I just get the Http404 error page.


Am I missing something ?

Please help,
thanks in advance,
robin.

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



Re: [OT] problem with displaytag column sorting in struts 1.2 web project

2007-04-08 Thread Tim Williams

On 4/8/07, robin bajaj [EMAIL PROTECTED] wrote:

Hi All,
In my Struts 1.2.x webapp, I am getting some Patient records from
backend using my PatientManager businessObject (which uses Hibernate)
to send back a populated Patients List in the request scope. (Patient is
my bean).

I am feeding this patientsList to Displaytag table,
to show the data in a table.

Here's the code snippet for my jsp containing displaytag table.
http://rafb.net/p/artIJr98.html

Now, I want to sort this table based on the PatientID
when I click on the PatientID column.

I read in the Displaytag docs

http://displaytag.homeip.net/displaytag-examples-1.1/example-sorting.jsp

where it mentions the following :

If you want to allow the user to sort the data as it is coming back,
then you need to just do two things, make sure that the data returned
from your property implements the Comparable interface (if it doesn't
natively - use the decorator pattern as shown a couple of examples ago),
and then set the attribute sortable=true on the columns that you want
to be able to sort by.


Following the above suggestion, I changed my Patient class to implement
Comparable interface and implemented the following compareTo method (as
following)
http://rafb.net/p/t0CR4Q98.html

Then I re-build my app and restart it on the server, the displaytag
table shows up fine. But when I click on the first column PtId, it
doesn't sort the table. I just get the Http404 error page.

Am I missing something ?


Try setting the requestURI attribute of the table itself?
--tim

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



Re: resume after login feature

2007-04-08 Thread Jae K

Sigh... I tried tackling the first half of this problem today. The first
part is getting the original requested URL as a parameter to the
RedirectActionResult.

   /global-results
   result name=login type=redirect-action
   param name=actionNameLogin/param
   param name=namespace//param
   param name=origurl${ServletRequest.requestURI}/param
-- not sure about the OGNL here.
   /result
   /global-results

All of my actions extend MySupport, which implement ServletRequestAware. I
fired my debugger to see whether the request object would even be set (with
the setServletRequest method) in my action before the redirect-action is
executed. NO! I don't think I can access the ServletRequest object from the
redirect-action configuration!

My only remaining option is to create my own redirect class that taps into
the ServletRequest object via the invocation object. Rigth now S2 is looking
very very unattractive as a web framework, because the OGNL features are not
well documented (esp in relation to struts results), and because the given
Result and Interceptor classes are not suitable for my basic needs such as
resume after redirect.

- Jae

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


--- 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: resume after login feature

2007-04-08 Thread Jae K

Right after posting this I realized that my AuthenticationInterceptor was
the first interceptor to be called, and that's why the ServletRequest object
wasn't set.

AAAHhh. I've been burned by the config twice already (the first time was
when using the struts-default.xml config, ValidationInterceptor is
configured not to validate for certain methods), but I'm willing to admit
that it's my dumb oversight.

Now I need to get the OGNL syntax right.

On 4/8/07, Jae K [EMAIL PROTECTED] wrote:


Sigh... I tried tackling the first half of this problem today. The first
part is getting the original requested URL as a parameter to the
RedirectActionResult.

/global-results
result name=login type=redirect-action
param name=actionNameLogin/param
param name=namespace//param
param name=origurl${ServletRequest.requestURI}/param   
-- not sure about the OGNL here.
/result
/global-results

All of my actions extend MySupport, which implement ServletRequestAware. I
fired my debugger to see whether the request object would even be set (with
the setServletRequest method) in my action before the redirect-action is
executed. NO! I don't think I can access the ServletRequest object from the
redirect-action configuration!

My only remaining option is to create my own redirect class that taps into
the ServletRequest object via the invocation object. Rigth now S2 is looking
very very unattractive as a web framework, because the OGNL features are not
well documented (esp in relation to struts results), and because the given
Result and Interceptor classes are not suitable for my basic needs such as
resume after redirect.

 - Jae

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

 --- 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: [OT] problem with displaytag column sorting in struts 1.2 web project

2007-04-08 Thread robinbajaj

thanks for the tip.
can you please provide more specific example/code-snippet for using the 
requestURI attribute. i couldnt find enough documentation on this feature. 
thanks in advance, 
robin


Tim Williams wrote:
 
 On 4/8/07, robin bajaj [EMAIL PROTECTED] wrote:
 Hi All,
 In my Struts 1.2.x webapp, I am getting some Patient records from
 backend using my PatientManager businessObject (which uses Hibernate)
 to send back a populated Patients List in the request scope. (Patient is
 my bean).

 I am feeding this patientsList to Displaytag table,
 to show the data in a table.

 Here's the code snippet for my jsp containing displaytag table.
 http://rafb.net/p/artIJr98.html

 Now, I want to sort this table based on the PatientID
 when I click on the PatientID column.

 I read in the Displaytag docs

 http://displaytag.homeip.net/displaytag-examples-1.1/example-sorting.jsp

 where it mentions the following :

 If you want to allow the user to sort the data as it is coming back,
 then you need to just do two things, make sure that the data returned
 from your property implements the Comparable interface (if it doesn't
 natively - use the decorator pattern as shown a couple of examples ago),
 and then set the attribute sortable=true on the columns that you want
 to be able to sort by.


 Following the above suggestion, I changed my Patient class to implement
 Comparable interface and implemented the following compareTo method (as
 following)
 http://rafb.net/p/t0CR4Q98.html

 Then I re-build my app and restart it on the server, the displaytag
 table shows up fine. But when I click on the first column PtId, it
 doesn't sort the table. I just get the Http404 error page.

 Am I missing something ?
 
 Try setting the requestURI attribute of the table itself?
 --tim
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/-OT--problem-with-displaytag-column-sorting-in-struts-1.2-web-project-tf3543922.html#a9895137
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: resume after login feature

2007-04-08 Thread Dale Newfield

Jae K wrote:

Now I need to get the OGNL syntax right.


One thing that'll help is adding a parse param (set to true)

http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/dispatcher/StrutsResultSupport.html

-Dale

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



problem extending the ComposableRequestProcessor process chain

2007-04-08 Thread atitus74
Hello Everyone,

I've been working on a web application here and I've come up with a situation 
where I feel that extending the AuthorizeAction command class would be a 
quality solution to a challenge I am facing. When I complete this I would be 
willing to contribute this back for others to use.  Here is some necessary 
background on what I am trying to do. Sorry for the length on this:

The application I am working on has complex requirements for role-based 
authorization checks. When the check fails and the user is not authorized, we 
do not want to just throw an exception or report an error.  We want to direct 
the user to a page with instructions on how they can become authorized. Many of 
the actions will have different requirements, and therefore different checks 
and different pages with different instructions.  

I came up with what I thought was an elegant and cheerfully easy way to do 
this, but it has not been so easy as I thought. In the struts-config.xml file I 
define the action, including its roles, and I include a forward for where the 
instructions are located for users who fail the authorization checks. Here is 
an example of one of these actions:

action path=/orders/create
   type=mypkg.CreateOrderAction
   roles=createOrders
   forward name=unauthorized
path=/help/ordersHowTo.do
redirect=true/
/action

I then wrote a class to replace the default AuthorizeAction class which is part 
of struts. It contains the complex logic which checks to see if the user has 
the createOrders role or not. If they do, it would return false to allow the 
chain to continue. If not, it would retrieve the ForwardConfig for 
unauthorized, add it to the context, and then return  true to break what I 
was hoping was the process-action sub-chain, and then the process-view 
chain which executes next would retrieve the ForwardConfig from the context and 
then send the user there. Unfortunately this does not work the way I was 
anticipating :-(

What happens is that the chain stops completely at that point. This is where I 
get into trouble and I am hoping someone can point me in the right direction. 
Here is what the default servlet processing chain looks like for me:

chain name=servlet-standard

 !-- Establish exception handling filter --
 command className=org.apache.struts.chain.commands.ExceptionCatcher
catalogName=struts
exceptionCommand=servlet-exception/

 lookup catalogName=struts
 name=process-action
 optional=false/

 lookup catalogName=struts
 name=process-view
 optional=false/

/chain

Is there a way that I can terminate the process-action chain early but still 
have it execute the process-view chain after? I will greatly appreciate any 
help or suggestions that you can offer.

Best Regards,
Aaron Titus

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



Re: resume after login feature

2007-04-08 Thread Jae K

It turns out that ${ServletRequest.requestURI } is the correct OGNL
expression. Of course you need to have a getServletRequest method in your
action superclass, which means all of your actions for your application that
requires a login will have to implement that method or subclass from a class
that does.

Dale, the parse param is set to true by default so I didn't have to set
it.

The second part requires redirecting to the origurl location after a
successful login. This the OGNL expression I have so far, but it's not
working yet. I'll post again once i fix it.

param name=location${#ServletRequest.parameter[origurl] == null ? 
Welcome.do : #ServletRequest.parameter[origurl]}/param


On 4/8/07, Jae K [EMAIL PROTECTED] wrote:


Right after posting this I realized that my AuthenticationInterceptor was
the first interceptor to be called, and that's why the ServletRequest object
wasn't set.

AAAHhh. I've been burned by the config twice already (the first time
was when using the struts-default.xml config, ValidationInterceptor is
configured not to validate for certain methods), but I'm willing to admit
that it's my dumb oversight.

Now I need to get the OGNL syntax right.

On 4/8/07, Jae K [EMAIL PROTECTED] wrote:

 Sigh... I tried tackling the first half of this problem today. The first
 part is getting the original requested URL as a parameter to the
 RedirectActionResult.

 /global-results
 result name=login type=redirect-action
 param name=actionNameLogin/param
 param name=namespace//param
 param name=origurl${ServletRequest.requestURI}/param   
-- not sure about the OGNL here.
 /result
 /global-results

 All of my actions extend MySupport, which implement ServletRequestAware.
 I fired my debugger to see whether the request object would even be set
 (with the setServletRequest method) in my action before the redirect-action
 is executed. NO! I don't think I can access the ServletRequest object from
 the redirect-action configuration!

 My only remaining option is to create my own redirect class that taps
 into the ServletRequest object via the invocation object. Rigth now S2 is
 looking very very unattractive as a web framework, because the OGNL features
 are not well documented (esp in relation to struts results), and because the
 given Result and Interceptor classes are not suitable for my basic needs
 such as resume after redirect.

  - Jae

 On 4/6/07, Dave Newton  [EMAIL PROTECTED] wrote:
 
  --- 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: resume after login feature

2007-04-08 Thread Dale Newfield

Jae K wrote:

Dale, the parse param is set to true by default so I didn't have to set
it.


D'oh!  You're right--it says so right there in the javadoc!  When did 
that (change) happen?  (Or has it always been that way?  Online javadoc 
for WebWork 2.2.5 seems to suggest it was always that way.  Whoops.)


Hope this suggestion isn't annoying this late in your struggles, but 
ACEGI already has this resume feature (including post params and even 
(I think) including uploads)...
...in general I avoid rolling my own security code when possible 
figuring I'm more likely to introduce bugs, and since I'd be the only 
one using said code, they're less likely to be found/fixed...
(That said, I do have a LoginListener that allows me to do stuff when 
acegi tells me certain security events have happened.)


-Dale

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



Java Web Parts v1.1 Beta 1 released

2007-04-08 Thread Frank W. Zammetti
Hey everyone... just a quick weekend note to those that might be 
interested that Java Web Parts v1.1 beta 1 has been released.  This 
release includes a number of new features as well as a number of bug 
fixes and enhancements to existing functionality (see release notes for 
full list).


You can download the release, browse documentation, sample apps, etc., 
at javawebparts.sourceforge.net


Thanks and take care,
Frank


--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of Practical Ajax Projects With Java Technology
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

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



Re: resume after login feature

2007-04-08 Thread Dave Newton
--- Jae K [EMAIL PROTECTED] wrote:
 Of course in Login.jsp you need...
 s:form action=Login.do validate=true
   s:if test=${param.origurl ne null}
 s:hidden name=origurl 
   value=${param.origurl}/
   /s:if
 
 
 And finally, this has the side effect that all
 links on the login page created with s:url ... 
 will also have the origurl parameter. You can 
 override this behavior by setting 
 includeParams=none (i think), but it's not 
 strictly necessary because the s:form ... 
 action does not inherit those parameters.

I *still* believe you are making this weirder than it
needs to be and that earlier advice given would lead
to a better solution (or you could use Acegi as
suggested--I found it very irritating at first,
though!)

As a proof of concept, I did (more or less) the
following, just as a sanity check:

- IRolesAware

Actions requiring login implement this (contains
get/setRoles) and are given a roles param.../ in
their struts config. Not a perfect solution, but for
demonstration purposes it's fine.

- RolesInterceptor

If the invoked action impls IRolesAware it checks for
login, if not logged in it puts the requested URL
(with query string) into session and returns the login
page's global result.

- LoginAction

If login succeeds puts the original url from session
into a property originalUrl and returns a SUCCESS
result, which is a result for LoginAction that looks
like:

result type=redirect${originalUrl}/result

...also set loggedIn indicator and removes
originalUrl.

So there is nothing special going on; you check for a
login in the interceptor (and can check for specific
roles against the roles the action expects, but that's
not really part of the discussion). Not logged in,
save URL and go to login. (Optionally if not right
role, go to wherever you need to based on whatever
criteria you want.) Logged in and/or have the role,
process the invocation normally.

It just seems cleaner; what am I missing?

d.



 

TV dinner still cooling? 
Check out Tonight's Picks on Yahoo! TV.
http://tv.yahoo.com/

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



Re: [OT] problem with displaytag column sorting in struts 1.2 web project

2007-04-08 Thread Tim Williams

Just put requestURI=/mypage.do  (where mypage.do==the page that
displays the table).

--tim

On 4/8/07, robinbajaj [EMAIL PROTECTED] wrote:


thanks for the tip.
can you please provide more specific example/code-snippet for using the
requestURI attribute. i couldnt find enough documentation on this feature.
thanks in advance,
robin


Tim Williams wrote:

 On 4/8/07, robin bajaj [EMAIL PROTECTED] wrote:
 Hi All,
 In my Struts 1.2.x webapp, I am getting some Patient records from
 backend using my PatientManager businessObject (which uses Hibernate)
 to send back a populated Patients List in the request scope. (Patient is
 my bean).

 I am feeding this patientsList to Displaytag table,
 to show the data in a table.

 Here's the code snippet for my jsp containing displaytag table.
 http://rafb.net/p/artIJr98.html

 Now, I want to sort this table based on the PatientID
 when I click on the PatientID column.

 I read in the Displaytag docs

 http://displaytag.homeip.net/displaytag-examples-1.1/example-sorting.jsp

 where it mentions the following :

 If you want to allow the user to sort the data as it is coming back,
 then you need to just do two things, make sure that the data returned
 from your property implements the Comparable interface (if it doesn't
 natively - use the decorator pattern as shown a couple of examples ago),
 and then set the attribute sortable=true on the columns that you want
 to be able to sort by.


 Following the above suggestion, I changed my Patient class to implement
 Comparable interface and implemented the following compareTo method (as
 following)
 http://rafb.net/p/t0CR4Q98.html

 Then I re-build my app and restart it on the server, the displaytag
 table shows up fine. But when I click on the first column PtId, it
 doesn't sort the table. I just get the Http404 error page.

 Am I missing something ?

 Try setting the requestURI attribute of the table itself?
 --tim

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




--
View this message in context: 
http://www.nabble.com/-OT--problem-with-displaytag-column-sorting-in-struts-1.2-web-project-tf3543922.html#a9895137
Sent from the Struts - User mailing list archive at Nabble.com.


-
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: resume after login feature

2007-04-08 Thread Jae K

Thanks Dave for that sanity check. The only difference between your
implementation and mine is that you put the originalUrl in a session whereas
I store it away in the client. They're both the same 'cleanlinest' i think.

Dale, I was considering ACEGI / SecurityFilter, but I still had to make sure
that this feature was *possible* before deciding to use Struts. If the
framework can't handle login-resume easily, then it can't be a good
framework. Fortunately everything works fine.

- Jae

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


--- Jae K [EMAIL PROTECTED] wrote:
 Of course in Login.jsp you need...
 s:form action=Login.do validate=true
   s:if test=${param.origurl ne null}
 s:hidden name=origurl
   value=${param.origurl}/
   /s:if
 

 And finally, this has the side effect that all
 links on the login page created with s:url ...
 will also have the origurl parameter. You can
 override this behavior by setting
 includeParams=none (i think), but it's not
 strictly necessary because the s:form ...
 action does not inherit those parameters.

I *still* believe you are making this weirder than it
needs to be and that earlier advice given would lead
to a better solution (or you could use Acegi as
suggested--I found it very irritating at first,
though!)

As a proof of concept, I did (more or less) the
following, just as a sanity check:

- IRolesAware

Actions requiring login implement this (contains
get/setRoles) and are given a roles param.../ in
their struts config. Not a perfect solution, but for
demonstration purposes it's fine.

- RolesInterceptor

If the invoked action impls IRolesAware it checks for
login, if not logged in it puts the requested URL
(with query string) into session and returns the login
page's global result.

- LoginAction

If login succeeds puts the original url from session
into a property originalUrl and returns a SUCCESS
result, which is a result for LoginAction that looks
like:

result type=redirect${originalUrl}/result

...also set loggedIn indicator and removes
originalUrl.

So there is nothing special going on; you check for a
login in the interceptor (and can check for specific
roles against the roles the action expects, but that's
not really part of the discussion). Not logged in,
save URL and go to login. (Optionally if not right
role, go to wherever you need to based on whatever
criteria you want.) Logged in and/or have the role,
process the invocation normally.

It just seems cleaner; what am I missing?

d.






TV dinner still cooling?
Check out Tonight's Picks on Yahoo! TV.
http://tv.yahoo.com/

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




[S2] wiki edit

2007-04-08 Thread Jae K

Can users get access to edit the wiki? It's driving me crazy.


Re: [S2] wiki edit

2007-04-08 Thread Piero Sartini
On Monday 09 April 2007 03:30:27 Jae K wrote:
 Can users get access to edit the wiki? It's driving me crazy.

You have to sign a CLA first. More information: 
http://struts.apache.org/helping.html#documentation

Piero

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



Re: [s2] Struts Dependency Injection and EJB3 - support ? or how can i Do it?

2007-04-08 Thread Piero Sartini
I coded this today, just used the field instead of a setter method. Your 
pseudo code was very helpful, thanks :-)

Maybe the following snippet is useful for someone with the same problem.
Should I post this on the wiki as well? I am not sure if it is a good 
solution - but it works for me.

Can someone please tell me if it is ok to call this every time an action needs 
the service, or would it be better to cache the service somewhere in 
application scope? I am quite new to this whole ejb thing.

Piero


 EJBInterceptor.java 
public class EJBInterceptor extends AbstractInterceptor implements Interceptor 
{
public String intercept(ActionInvocation actionInvocation) throws 
Exception {
Object action = actionInvocation.getAction();
for (Field f : action.getClass().getDeclaredFields()) {
if (f.isAnnotationPresent(EJB.class)) {
f.setAccessible(true);
String serviceName = f.getType().getName();
Object service = null;
try {
InitialContext ic = new InitialContext();
service = ic.lookup(serviceName);
} catch (Exception ex) {
System.out.println(Error: +ex.getMessage());
}
f.set(action, f.getType().cast(service));
break;
}
}
return actionInvocation.invoke();
}
}
 code 

 EJB.java 
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface EJB {
}
- code 


On Tuesday 23 January 2007 01:05:57 Ian Roughley wrote:
 I can't provide the code - it is owned my a client.  But here is the
 pseudo code:

 class EJB3Interceptor implements Interceptor {

public String intercept(ActionInvocation actionInvocation) throws
 java.lang.Exception {
 Object action = actionInvocation.getAction();
 for all methods {
   if( this is a setter and it is annotated as expected ) {
  look up the EJB
  set the EJB on the action
   }
}
 }

 }

  From here you would need to ensure that the interceptor is applied to
 the actions that need ejb's.

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



Re: resume after login feature

2007-04-08 Thread Dave Newton
--- Jae K [EMAIL PROTECTED] wrote:
 The only difference between your implementation and 
 mine is that you put the originalUrl in a session 
 whereas I store it away in the client. They're both 
 the same 'cleanlinest' i think.

If you say so; it sure seemed like yours was a lot of
work, and frankly I'd rather role and/or login-aware
actions implemented something specific to that
functionality, for a couple of reasons.

So when I compare these chunks:

param name=location
  ${#parameters['origurl'] == null ? 
'Welcome.do' : #parameters['origurl']}
/param

s:form action=Login.do validate=true
  s:if test=${param.origurl ne null}
s:hidden name=origurl
value=${param.origurl}/
  /s:if

etc. to:

action name=login class=resume.LoginAction
  result name=input
/WEB-INF/jsp/resume/login.jsp
  /result
  result name=success type=redirect
${originalUrl}
  /result
/action

action name=page1 class=resume.Page1Action
  param name=rolesrole1, role2/param
  result/WEB-INF/jsp/resume/page1.jsp/result
/action

... and a ~50-line interceptor I can't help but like
it. If you chain the login action result it's even
easier and more encapsulated, but so far I prefer the
login url appears for login rather than holding on to
the original request URL; I'm still undecided.

 Dale, I was considering ACEGI / SecurityFilter, but
 I still had to make sure that this feature was 
 *possible* before deciding to use Struts.

I think S2 handles this trivially, but if something
else handled it better, then what would it matter?

Regarding OGNL documentation, bear in mind that OGNL
is a *completely* separate project. The basics are
mostly covered on the Wiki, if you need more
information than that then the OGNL reference
documentation would be the reasonable place to look.

d.



 

We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

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



Re: resume after login feature

2007-04-08 Thread Jae K




If you say so; it sure seemed like yours was a lot of

work, and frankly I'd rather role and/or login-aware
actions implemented something specific to that
functionality, for a couple of reasons.



Hello Dave:
in terms of work, yours and mine are about the same complexity. However, I
prefer my solution because it doesn't require sessions for guest users, and
this is a good measure for performance. To each his own. :)

I think S2 handles this trivially, but if something

else handled it better, then what would it matter?



Now I see that S3 handles it trivially, but how would a beginner to S2/OGNL
know without implementing it for himself? Whether or not somethign else
handles it better is irrelevant. The question was whether S2 is flexible
enough for the tasks that I need done.


Regarding OGNL documentation, bear in mind that OGNL

is a *completely* separate project. The basics are
mostly covered on the Wiki, if you need more
information than that then the OGNL reference
documentation would be the reasonable place to look.



I'm aware, the wiki makes it pretty clear. On the other hand, the overlap
between Struts and OGNL (i.e. what variables are available in the stack for
OGNL expressions etc) is NOT documented well, and that documentation belongs
squarely in the Struts wikis. For example, the Struts wiki does not explain
what the 'request' stack value is (I thought it was the session request
object, but it is not), and some important stack values are not listed.
(such as 'parameters'). Last but not least, it is not obvious that the OGNL
expressions need to be enclosed in ${} when used in the struts config file.
(Is this even true? I don't know since it's not documented! It certainly
isn't documented so in the OGNL documentation).

This is why I asked about wiki authorship permissions.

Anyways, are you a developer for Struts Dave? You've been very helpful,
thanks.

- Jae