Re: Using Variables with Messages in Struts

2008-02-19 Thread Nuwan Chandrasoma

Hi,

why dont you try the  tag with filter attribute as false.

Thanks,

Nuwan

Jeromy Evans wrote:
Oh, sorry, I assumed you were using Struts 2. That's a feature of the 
default tag library.


Sorry, I don't know the answer for Struts 1.x

Asad Habib wrote:

Hello Jeromy. What tag library are you using for this?

- Asad



On Feb 19, 2008 11:19 PM, Jeromy Evans 
<[EMAIL PROTECTED]> wrote:
 
You may be able to do it with s:property, disabling escaping of the 
html:





Asad Habib wrote:
   

Hello. How do I represent the following in a message resources file?
Representing a string literal is easy but the following string
contains a link. Can this even be done? I have used variables with the
validator before but there is no validator involved in this case.
Thank you.

Please click here to sign in.


- Asad

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





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



Re: Struts 2 Container Security problem

2008-02-19 Thread Wes Wannemacher

On Wed, 2008-02-20 at 05:15 +, Kelly Graus wrote:
> Wes Wannemacher  wantii.com> writes:
> 
> > I'm jumping in late, so if I refer to something that came up in a
> > previous post, I apologize ahead of time. I'm guessing that you're using
> > tomcat. Tomcat is picky about certain things being actual filesystem
> > resources. There are two possible solutions (if I'm right about Tomcat),
> > the first being Jeromy's suggestion. The other thing I've done that
> > seems to work is to create a blank file that matches the request. In
> > this case a 0-byte file called login.action may do the trick. It's a bit
> > of a hack, and I think when this comes up with the Tomcat peeps, they
> > point to the spec. 
> > 
> > -Wes
> > 
> Hi Wes,
> 
> Thanks for the reply!  I tried your fix, now Tomcat returns a blank page.  
> Any 
> other configuration issues I need to be aware of?
> 
> Thanks!
> 
> Kelly
> 

hmm... It worked for the welcome-file pages for me :)

Do you have the struts filter mapped so that it would have picked up the
request? 

I'm thinking you have three choices depending on the amount of time you
have to finish your task. The first would be using a newer version of
Tomcat. As was mentioned earlier, this is basically a gotcha when
dealing with the previous spec (more specifically Tomcat 5.5.x) combined
with a framework that takes over request processing. If not Tomcat,
there are plenty of good alternatives. 

Another choice would be to roll your own authentication and
authorization. There is a great tutorial here
http://www.vitarara.org/cms/struts_2_cookbook/creating_a_login_interceptor that 
gets linked to quite often on this list that will help. Rolling your own is 
much easier than it sounds and the lack of portability when configuring 
Tomcat's *Realms led me to start rolling my own whenever I have needed. 

The last choice is to forgo the framework for the login-form. IIRC, the
requirement is a j_username string and j_password string posted to
j_security_check. I'm a bit of a purist and I don't really like it, but
sometimes you have to do what works, rather than forcing a square peg in
a round hole.  




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



is session efficient way to persist the action properties

2008-02-19 Thread Prashant Khanal
Hello all,

I have two jsp pages say Page1 and Page2 backed by their corresponding
action. When the Page1 is first loaded the corresponding action's prepare()
method is used to provide the data for the page based on the parameter sent
by the page that precedes the Page1. Upon submit the user is navigated to
Page2 and upon submit on that page(Page2) the user is navigated back to
Page1. Now the parameter used to provide the data for Page1 is lost as it
was provided by another page. So Is there any way that i can persist the
action properties during this process.

Is session only efficient way to do that or is there any alternative?
I have been using session to store the properties for now.

-- 
Thanks,
Prashant Khanal


Re: [S2] IE does not refresh page

2008-02-19 Thread Jeromy Evans
Hmm...this is a guess, but there's a relevant issue in IE's innerHTML 
implementation.  Dojo uses this to insert the response into the page.  
This particular issue is that tables must be xhtml-compliant. 
Specifically, they must contain all the required tags including  
and .  Try adding those tags to your response.  IE definitely 
does not permit you to insert (most) invalid HTML into the page.


If not successful, IE is hopeless at debugging this, so simplify the 
pages (the one making the request and the result) to isolate the cause.


Good luck!

PS.
All your calls like this:



can be replaced with this:



as it's a javabean-compliant property name (what have works too but is 
not the convention)


carmi_cd wrote:

hi, yes my submit reached my action because the record is saved/updated in
the database.
yes the list is the response from the action. 


the list is refreshing in Firefox but not in IE..here is part of list.jsp


 


fieldValue="%{getUserId()}%{nextCell.label}" 
theme="simple" />




 href="%{list}" 
 targets="module"

 errorText="Unable to load list.">

,  







value="getModuleName()"/> ,







i'm using Struts 2.0.5. The theme being use is ajax. I hope I've given you
enough information, 
if not, dont hesitate to ask, i'm really new in Struts, I need help. Thanks

again.


Jeromy Evans - Blue Sky Minds wrote:
  


Setting showLoadingText="false" itself shouldn't affect this.

Is the submit reaching your action?
Is the list that's refreshed the response from the action? Or is the 
refresh via a topic? Or refresh by some other means?

Does your response contain any inline javascript? Or dojo widgets/ajax
tags?

The only other thing that frequently doesn't work is including inline 
javascript in the responses and expecting theme to execute at a 
particular time.

Which version of struts are you using btw?

regards,
 Jeromy Evans

-
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: [S2] IE does not refresh page

2008-02-19 Thread carmi_cd

hi, yes my submit reached my action because the record is saved/updated in
the database.
yes the list is the response from the action. 

the list is refreshing in Firefox but not in IE..here is part of list.jsp


 







,  







 ,





i'm using Struts 2.0.5. The theme being use is ajax. I hope I've given you
enough information, 
if not, dont hesitate to ask, i'm really new in Struts, I need help. Thanks
again.


Jeromy Evans - Blue Sky Minds wrote:
> 
> 
> 
> Setting showLoadingText="false" itself shouldn't affect this.
> 
> Is the submit reaching your action?
> Is the list that's refreshed the response from the action? Or is the 
> refresh via a topic? Or refresh by some other means?
> Does your response contain any inline javascript? Or dojo widgets/ajax
> tags?
> 
> The only other thing that frequently doesn't work is including inline 
> javascript in the responses and expecting theme to execute at a 
> particular time.
> Which version of struts are you using btw?
> 
> regards,
>  Jeromy Evans
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--IE-does-not-refresh-page-tp15560342p15582733.html
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: Struts 2 Container Security problem

2008-02-19 Thread Kelly Graus
Wes Wannemacher  wantii.com> writes:

> I'm jumping in late, so if I refer to something that came up in a
> previous post, I apologize ahead of time. I'm guessing that you're using
> tomcat. Tomcat is picky about certain things being actual filesystem
> resources. There are two possible solutions (if I'm right about Tomcat),
> the first being Jeromy's suggestion. The other thing I've done that
> seems to work is to create a blank file that matches the request. In
> this case a 0-byte file called login.action may do the trick. It's a bit
> of a hack, and I think when this comes up with the Tomcat peeps, they
> point to the spec. 
> 
> -Wes
> 
Hi Wes,

Thanks for the reply!  I tried your fix, now Tomcat returns a blank page.  Any 
other configuration issues I need to be aware of?

Thanks!

Kelly



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



Re: Using Variables with Messages in Struts

2008-02-19 Thread Jeromy Evans
Oh, sorry, I assumed you were using Struts 2. That's a feature of the 
default tag library.


Sorry, I don't know the answer for Struts 1.x

Asad Habib wrote:

Hello Jeromy. What tag library are you using for this?

- Asad



On Feb 19, 2008 11:19 PM, Jeromy Evans <[EMAIL PROTECTED]> wrote:
  

You may be able to do it with s:property, disabling escaping of the html:




Asad Habib wrote:


Hello. How do I represent the following in a message resources file?
Representing a string literal is easy but the following string
contains a link. Can this even be done? I have used variables with the
validator before but there is no validator involved in this case.
Thank you.

Please click here to sign in.


- Asad

-
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: Using Variables with Messages in Struts

2008-02-19 Thread Asad Habib
Hello Jeromy. What tag library are you using for this?

- Asad



On Feb 19, 2008 11:19 PM, Jeromy Evans <[EMAIL PROTECTED]> wrote:
> You may be able to do it with s:property, disabling escaping of the html:
>
> 
>
>
> Asad Habib wrote:
> > Hello. How do I represent the following in a message resources file?
> > Representing a string literal is easy but the following string
> > contains a link. Can this even be done? I have used variables with the
> > validator before but there is no validator involved in this case.
> > Thank you.
> >
> > Please click here to sign in.
> >
> >
> > - Asad
> >
> > -
> > 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: Using Variables with Messages in Struts

2008-02-19 Thread Jeromy Evans

You may be able to do it with s:property, disabling escaping of the html:



Asad Habib wrote:

Hello. How do I represent the following in a message resources file?
Representing a string literal is easy but the following string
contains a link. Can this even be done? I have used variables with the
validator before but there is no validator involved in this case.
Thank you.

Please click here to sign in.


- Asad

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



Using Variables with Messages in Struts

2008-02-19 Thread Asad Habib
Hello. How do I represent the following in a message resources file?
Representing a string literal is easy but the following string
contains a link. Can this even be done? I have used variables with the
validator before but there is no validator involved in this case.
Thank you.

Please click here to sign in.


- Asad

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



Re: [S2] Ajax Tags Reference - submit?

2008-02-19 Thread Jeromy Evans

hezjing wrote:

Hi

In http://struts.apache.org/2.0.11/docs/ui-tag-reference.html

Clicking on submit of the Ajax Tags will redirect to the Confluence's
login page.
Is this OK?


  

Thanks.  This one has already been corrected in the latest version.
It's also helpful to create your own account in confluence and add 
comments directly to the pages where you find problems.


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



Re: [S2] /2.x/tagreference.html not found on server?

2008-02-19 Thread Jeromy Evans

hezjing wrote:

Hi

At bottom of http://struts.apache.org/2.0.11/docs/ui-tag-reference.html,
the link to http://struts.apache.org/2.x/tagreference.html (Tag
Reference) does not exist on the server?


  

Thanks, I've changed this to tag-reference.html on the live version.

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



[S2] /2.x/tagreference.html not found on server?

2008-02-19 Thread hezjing
Hi

At bottom of http://struts.apache.org/2.0.11/docs/ui-tag-reference.html,
the link to http://struts.apache.org/2.x/tagreference.html (Tag
Reference) does not exist on the server?


-- 

Hez

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



[S2] Ajax Tags Reference - submit?

2008-02-19 Thread hezjing
Hi

In http://struts.apache.org/2.0.11/docs/ui-tag-reference.html

Clicking on submit of the Ajax Tags will redirect to the Confluence's
login page.
Is this OK?


-- 

Hez

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



Re: Struts 2 Container Security problem

2008-02-19 Thread Wes Wannemacher

On Tue, 2008-02-19 at 17:56 -0800, Dave Newton wrote:
> --- Jeromy Evans <[EMAIL PROTECTED]> wrote:
> > Wes Wannemacher wrote:
> > > In this case a 0-byte file called login.action may do the trick. It's a
> bit
> > > of a hack, and I think when this comes up with the Tomcat peeps, they
> > > point to the spec. 
> > Excellent!  I loathe using a redirect.  This probably belongs in a FAQ 
> > somewhere as it comes up a lot with respect to using an action as the 
> > welcome file.
> 
> Meh. I'd rather see a known, cross-browser technique like a redirect than
> potentially non-portable treachery. What, specifically, does the spec say
> regarding this?
> 
> (I'm quickly looking in 2.4, which isn't the latest; it seems to state only
> that it must check that a static resource or servlet is mapped to the file
> named in the welcome-file-list, so I guess the zero-byte trick is
> spec-friendly. Still makes me grumpy, but I'm old and easily irritated :)
> 

The only problem with a redirect in this case is that some context may
be lost :(. Generally, with container managed security, after logging
in, the server manages to send you happily on your way back to the
resource that required authorization. I haven't tried it, but assuming
that Tomcat "keeps it simple," I'd bet that redirecting might lose some
of the magic required to make it all work. 

I think that the last post was right though (by Laurie?) that the new
spec fixes this. So, don't be down Dave, there is hope yet! 


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



Re: Struts 2 Container Security problem

2008-02-19 Thread Dave Newton
--- Jeromy Evans <[EMAIL PROTECTED]> wrote:
> Wes Wannemacher wrote:
> > In this case a 0-byte file called login.action may do the trick. It's a
bit
> > of a hack, and I think when this comes up with the Tomcat peeps, they
> > point to the spec. 
> Excellent!  I loathe using a redirect.  This probably belongs in a FAQ 
> somewhere as it comes up a lot with respect to using an action as the 
> welcome file.

Meh. I'd rather see a known, cross-browser technique like a redirect than
potentially non-portable treachery. What, specifically, does the spec say
regarding this?

(I'm quickly looking in 2.4, which isn't the latest; it seems to state only
that it must check that a static resource or servlet is mapped to the file
named in the welcome-file-list, so I guess the zero-byte trick is
spec-friendly. Still makes me grumpy, but I'm old and easily irritated :)

Dave


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



Re: Struts 2 Container Security problem

2008-02-19 Thread Laurie Harper

Wes Wannemacher wrote:

On Wed, 2008-02-20 at 00:43 +, Kelly Graus wrote:

Jeromy Evans  blueskyminds.com.au> writes:

[snip]


I would add a login action to the public namespace which prepares a 
login page.  Unfortunately I don't think the container will allow you to 
specify "/login.action" as the login page though, but you can make 
login.jsp redirect to it.
According to Practical Apache Struts 2, this should be able to be an action.  
However, I'm having difficulty getting this to work.  I keep getting a 404 
requested resource not found for the logon action.  I'll keep working on it, 
if any one has any ideas it would be great.


I'm jumping in late, so if I refer to something that came up in a
previous post, I apologize ahead of time. I'm guessing that you're using
tomcat. Tomcat is picky about certain things being actual filesystem
resources. There are two possible solutions (if I'm right about Tomcat),
the first being Jeromy's suggestion. The other thing I've done that
seems to work is to create a blank file that matches the request. In
this case a 0-byte file called login.action may do the trick. It's a bit
of a hack, and I think when this comes up with the Tomcat peeps, they
point to the spec. 


I thought the Servlet 2.5 spec clarified this, and specified that any 
resource should be allowable -- or was that just for welcome files?


L.


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



Re: Struts 2 Container Security problem

2008-02-19 Thread Jeromy Evans

Wes Wannemacher wrote:


I'm jumping in late, so if I refer to something that came up in a
previous post, I apologize ahead of time. I'm guessing that you're using
tomcat. Tomcat is picky about certain things being actual filesystem
resources. There are two possible solutions (if I'm right about Tomcat),
the first being Jeromy's suggestion. The other thing I've done that
seems to work is to create a blank file that matches the request. In
this case a 0-byte file called login.action may do the trick. It's a bit
of a hack, and I think when this comes up with the Tomcat peeps, they
point to the spec. 


-Wes

  
Excellent!  I loathe using a redirect.  This probably belongs in a FAQ 
somewhere as it comes up a lot with respect to using an action as the 
welcome file.


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-19 Thread Jeromy Evans

No, it seems fine now.

Turn on debugging:


thanks you for the reply. I added the code:



on top, plus



but I get the same result - it goes to an empty page with the result and not
to the DIV?
:-(

any idea?





xianwinwin wrote:
  

Hi all,
I'm trying to return a result to DIV in a form (in the example id='two')

this is my form:

initial content








when the user clicks the GO2 --> the action, AjaxRemoteForm,  is
'activated' (showing the 'data' the user has input)

public String AjaxRemoteForm()
{
System.out.println("active ajax test 1 with data: "+data);
return "test.ajax.2";
}

and routed to AjaxResult3.jsp:

 
test_1
/pages/welcome/AjaxResult3.jsp





The result comes in a NEW page with the 'data' value the user has input



"AjaxResult3.jsp" 
-

<%@ taglib prefix="s" uri="/struts-tags" %>

<%
request.setAttribute("decorator", "none");
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy
server
%>

The value you entered was: 




Q: How can I incorporate the 'data' value in the DIV and not in a new
page?




  


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



Re: Struts 2 Container Security problem

2008-02-19 Thread Wes Wannemacher

On Wed, 2008-02-20 at 00:43 +, Kelly Graus wrote:
> Jeromy Evans  blueskyminds.com.au> writes:
[snip]
> 
> 
> > I would add a login action to the public namespace which prepares a 
> > login page.  Unfortunately I don't think the container will allow you to 
> > specify "/login.action" as the login page though, but you can make 
> > login.jsp redirect to it.
> 
> According to Practical Apache Struts 2, this should be able to be an action.  
> However, I'm having difficulty getting this to work.  I keep getting a 404 
> requested resource not found for the logon action.  I'll keep working on it, 
> if any one has any ideas it would be great.

I'm jumping in late, so if I refer to something that came up in a
previous post, I apologize ahead of time. I'm guessing that you're using
tomcat. Tomcat is picky about certain things being actual filesystem
resources. There are two possible solutions (if I'm right about Tomcat),
the first being Jeromy's suggestion. The other thing I've done that
seems to work is to create a blank file that matches the request. In
this case a 0-byte file called login.action may do the trick. It's a bit
of a hack, and I think when this comes up with the Tomcat peeps, they
point to the spec. 

-Wes


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



Re: Type conversion questions

2008-02-19 Thread Jeromy Evans



Hi Jeromy
I'm not clear what the performance problem you mention could be. This 
is what I'm doing myself and while my app's performance is OK, I would 
love to improve it. What do you mean by (e.g. select n+1 due to 
iteration)?



All the best
Adam

---
Actually, I've assumed you're using ORM like JPA/Hibernate/TopLink  If 
not it's not as relevant, but still could be.


The select n+1 problem is well described over at Hibernate:  
http://www.hibernate.org/118.html


Basically, the problem occurs when you use lazy fetching and iterate 
through a collection.  Instead of retrieving the entire collection from 
the database in one efficient query, the implementation performs a query 
for the parent object and then one query for each item in the collection 
in each pass of the iteration (hence n+1 selects).  It's one of the 
risks of lazy fetching and using the session-in-view pattern.  
Developers often don't realise it until they analyse the queries because 
it seems slow. Caching can avoid it and also complicates it.


As you're accessing objects and hiding the fact they're loaded from a 
database, it's very easy to accidentally trigger this problem.  If your 
converter is performing the query itself or through a service you can 
easily avoid it.


Hope that make sense.

regards,
Jeromy Evans

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



Re: Struts 2 Container Security problem

2008-02-19 Thread Kelly Graus
Jeromy Evans  blueskyminds.com.au> writes:

> 
> 
> >> I would add a login action to the public namespace which prepares a 
> >> login page.  Unfortunately I don't think the container will allow you to 
> >> specify "/login.action" as the login page though, but you can make 
> >> login.jsp redirect to it.
> >> 
> >
> > According to Practical Apache Struts 2, this should be able to be an 
action.  
> > However, I'm having difficulty getting this to work.  I keep getting a 404 
> > requested resource not found for the logon action.  I'll keep working on 
it, 
> > if any one has any ideas it would be great.
> >
> >   
> I fairly sure it depends on which container implementation you're using 
> and (possibly) whether you're using the 2.4 or 2.5 servlet specification 
> (specified in web.xml)
> I think it's not supported in Tomcat 5.5.
> 
You're correct, I didn't even think about that.  I'm using version 2.5 of the 
servlet specification, and Tomcat 6.0.  I will try with the redirect.

Thanks again!

Kelly


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



Re: Type conversion questions

2008-02-19 Thread Adam Hardy

Jeromy Evans on 19/02/08 22:23, wrote:

Daniel Baldes wrote:

Hello,

I have a web form where you can, generally speaking, assign objects to 
groups. This is done via a multiple select box which displays an 
object's name and uses its ID property as value.


So, usually, my action would get back a String array containing the 
IDs of the selected objects. I want the framework to load the 
corresponding objects from the database and pass them as a Collection 
to my action's setObjects(Collection objects) method, so that 
my action doesn't have to deal with loading objects.


So I wrote a type converter. The "convertFromString" method takes the 
String array with the IDs, determines the target element type using 
ObjectTypeDeterminer, loads the objects and returns them in a 
collection. In this direction - form to action - it works quite well.




Great.  I've never tried this myself.  I suppose you run the risk of 
some performance penalties doing it here (eg. select n+1 due to 
iteration) and the conversion error exception is probably not ideal, but 
otherwise I'm impressed.


Hi Jeromy
I'm not clear what the performance problem you mention could be. This is what 
I'm doing myself and while my app's performance is OK, I would love to improve 
it. What do you mean by (e.g. select n+1 due to iteration)?



All the best
Adam

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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-19 Thread xianwinwin

thanks you for the reply. I added the code:



on top, plus



but I get the same result - it goes to an empty page with the result and not
to the DIV?
:-(

any idea?





xianwinwin wrote:
> 
> Hi all,
> I'm trying to return a result to DIV in a form (in the example id='two')
> 
> this is my form:
> 
> initial content
>  id='theForm2'
> cssStyle="border: 1px solid green;"
> action='testing_AjaxRemoteForm'
> method='post'
> theme="ajax">
> 
> 
> 
> 
> 
> 
> 
> when the user clicks the GO2 --> the action, AjaxRemoteForm,  is
> 'activated' (showing the 'data' the user has input)
> 
>   public String AjaxRemoteForm()
>   {
>   System.out.println("active ajax test 1 with data: "+data);
>   return "test.ajax.2";
>   }
> 
> and routed to AjaxResult3.jsp:
> 
>  class="com.struts.user.account.TestingAction">
>type="tiles">test_1
>name="test.ajax.2">/pages/welcome/AjaxResult3.jsp
> 
> 
> 
> 
> 
> The result comes in a NEW page with the 'data' value the user has input
> 
> 
> 
> "AjaxResult3.jsp" 
> -
> <%@ taglib prefix="s" uri="/struts-tags" %>
> 
> <%
> request.setAttribute("decorator", "none");
> response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
> response.setHeader("Pragma","no-cache"); //HTTP 1.0
> response.setDateHeader ("Expires", 0); //prevents caching at the proxy
> server
> %>
> 
> The value you entered was: 
> 
> 
> 
> 
> Q: How can I incorporate the 'data' value in the DIV and not in a new
> page?
> 

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15579982.html
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: Struts 2 Container Security problem

2008-02-19 Thread Jeromy Evans


I would add a login action to the public namespace which prepares a 
login page.  Unfortunately I don't think the container will allow you to 
specify "/login.action" as the login page though, but you can make 
login.jsp redirect to it.



According to Practical Apache Struts 2, this should be able to be an action.  
However, I'm having difficulty getting this to work.  I keep getting a 404 
requested resource not found for the logon action.  I'll keep working on it, 
if any one has any ideas it would be great.


  
I fairly sure it depends on which container implementation you're using 
and (possibly) whether you're using the 2.4 or 2.5 servlet specification 
(specified in web.xml)

I think it's not supported in Tomcat 5.5.

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



Re: Struts 2 Container Security problem

2008-02-19 Thread Dave Newton
--- Kelly Graus <[EMAIL PROTECTED]> wrote:
> > I would add a login action to the public namespace which prepares a 
> > login page.  Unfortunately I don't think the container will allow you to 
> > specify "/login.action" as the login page though, but you can make 
> > login.jsp redirect to it.
> 
> According to Practical Apache Struts 2, this should be able to be an
> action.  

What should be, the container login page? I thought you said you and the book
were using different containers--AFAIK that's probably container-specific.
Did you try the redirect?

Dave


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



Re: Struts 2 Container Security problem

2008-02-19 Thread Kelly Graus
Jeromy Evans  blueskyminds.com.au> writes:

> 
> Hi Kelly,
> 
> In struts.xml, the namespace given to your package needs be in 
> /protected as well.
> eg. 
> Otherwise, as you've seen, it's available in the root of the 
> application's context path.
> 
> I usually split my struts2 application into at least two packages:
>  ...
> 
> 
> Which then allows you to apply your container-managed security where 
> necessary.

Thank you very much.  This worked perfectly!


> I would add a login action to the public namespace which prepares a 
> login page.  Unfortunately I don't think the container will allow you to 
> specify "/login.action" as the login page though, but you can make 
> login.jsp redirect to it.

According to Practical Apache Struts 2, this should be able to be an action.  
However, I'm having difficulty getting this to work.  I keep getting a 404 
requested resource not found for the logon action.  I'll keep working on it, 
if any one has any ideas it would be great.

> Hope that helps,
> regards,
>  Jeromy Evans

Thanks again!

Kelly




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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-19 Thread Jeromy Evans
Your code looks valid, but have you included the  
tag in your head section?
It looks like the default event is executing (submit form for new page) 
rather than Dojo using ajax to post it.


Also, as your target is theForm2, add showLoadingText="false" to your 
submit button.
Without that setting, unfortunately, IE writes the loading text over the 
target (your form) before it's even posted.


xianwinwin wrote:

Hi all,
I'm trying to return a result to DIV in a form (in the example id='two')

this is my form:

initial content








when the user clicks the GO2 --> the action, AjaxRemoteForm,  is 'activated'
(showing the 'data' the user has input)

public String AjaxRemoteForm()
{
System.out.println("active ajax test 1 with data: "+data);
return "test.ajax.2";
}

and routed to AjaxResult3.jsp:

 
test_1
/pages/welcome/AjaxResult3.jsp





The result comes in a NEW page with the 'data' value the user has input



"AjaxResult3.jsp" 
-

<%@ taglib prefix="s" uri="/struts-tags" %>

<%
request.setAttribute("decorator", "none");
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy
server
%>

The value you entered was: 




Q: How can I incorporate the 'data' value in the DIV and not in a new page?
  


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



Re: Type conversion questions

2008-02-19 Thread Martin Gainty
package org.apache.struts2.showcase.conversion
public class EnumTypeConverter extends StrutsTypeConverter 
{
//old methods..

//new method to convert map contents to Strings..
 @Override
public String[] convertToStrings(Map context, Object o) 
   {
   int j=0;
   Strings[] s;
List l = (List) o;
String result ="<";
for (Iterator i = l.iterator(); i.hasNext(); ) 
   {
  s[j++]=i.next();
}
return s;
}
//...other methods..
}

FWIW
Martin--
- Original Message - 
From: "Jeromy Evans" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Tuesday, February 19, 2008 5:23 PM
Subject: Re: Type conversion questions


> Daniel Baldes wrote:
> > Hello,
> >
> > I have a web form where you can, generally speaking, assign objects to 
> > groups. This is done via a multiple select box which displays an 
> > object's name and uses its ID property as value.
> >
> > So, usually, my action would get back a String array containing the 
> > IDs of the selected objects. I want the framework to load the 
> > corresponding objects from the database and pass them as a Collection 
> > to my action's setObjects(Collection objects) method, so that 
> > my action doesn't have to deal with loading objects.
> >
> > So I wrote a type converter. The "convertFromString" method takes the 
> > String array with the IDs, determines the target element type using 
> > ObjectTypeDeterminer, loads the objects and returns them in a 
> > collection. In this direction - form to action - it works quite well.
> >
> 
> Great.  I've never tried this myself.  I suppose you run the risk of 
> some performance penalties doing it here (eg. select n+1 due to 
> iteration) and the conversion error exception is probably not ideal, but 
> otherwise I'm impressed.
> > Now my questions:
> >
> > 1. extending StrutsTypeConverter forces me to implement String 
> > convertToString(Map context, Object o). I think there is no common 
> > sense way of converting a collection back to a String in this context. 
> > It would, maybe, make sense to convert it to a String[]. But what I 
> > actually want is to have access to the unconverted collection in the 
> > JSP. This might seem strange from some point of view, and I could live 
> > without it, but is there a way to do this? Example:
> >
> > > name="myObjects"
> > list="myObjects" listKey="id" listValue="name" />
> >
> > This way I could use getMyObjects() for displaying my objects and 
> > setMyObjects() for setting them (using only their IDs).
> >
> 
> It does really follow the intended contract of the interface, but I 
> don't see why convertFromString can't return a different view of the 
> object than convertToString.  Have you tried it?  This effectively gives 
> you the "databinding" feature of ASP.net (which I personally cringe at, 
> but can't argue with how productive it is to work with)
> >
> > 2. Is there a way to define a type converter application wide, like 
> > "always use this type converter for setting types which are subclasses 
> > of X" and "for setting types which are Collection"? 
> > This way I could define the type converter once for all 
> > persistence-capable classes.
> >
> classpath:xwork-converters.properties allows you to define global 
> converters by class name.  You may be able to the the element_ feature 
> for collections.
> Otherwise visitor validation will have to do
> 
> -
> 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: Struts 2 Container Security problem

2008-02-19 Thread Jeromy Evans

Hi Kelly,

In struts.xml, the namespace given to your package needs be in 
/protected as well.

eg. 
Otherwise, as you've seen, it's available in the root of the 
application's context path.


I usually split my struts2 application into at least two packages:
 ...


Which then allows you to apply your container-managed security where 
necessary.


I would add a login action to the public namespace which prepares a 
login page.  Unfortunately I don't think the container will allow you to 
specify "/login.action" as the login page though, but you can make 
login.jsp redirect to it.


Hope that helps,
regards,
Jeromy Evans

Kelly Graus wrote:

Hi Everyone,

I'm attempting to secure my first Struts 2 web app using container 
security with a DataSourceRealm.  I'm using Tomcat 6 as my container. 
Here is how my project is setup:


LicensingAdministration/
   META-INF/
  context.xml
   WEB-INF/
  web.xml
  classes/
 struts.xml
   protected/
  *JSP pages*
   login.jsp
   error.jsp

Without using struts, this works perfectly.  Any attempt to access 
anything under the protected area results in a redirect to the login 
page, and from there all of the database stuff works fine.  However, 
when I added in struts, I am now able to bypass the security by 
specifying an action directly.


For example, navigating to 
http://localhost:8080/LicensingAdministration/CreateProduct.action 
will bypass the login page and go directly to the CreateProduct 
action.  However, navigating to 
http://localhost:8080/LicensingAdministration/protected/CreateProduct.action 
will perform a redirect to the login (as expected).


Any suggestions on how to secure the actions so that the login cannot 
be bypassed would be greatly appreciated!  Below are the relevant 
parts of my web.xml and context.xml files (I can post the full files 
if necessary, but they contain a lot of resource definitions that 
aren't related to the problem).


Also, in an slightly unrelated question, is is possible to use struts 
tags in the login page?  I was trying to use an s:url tag to specify 
the location of the css.  When redirected to the login page, the 
server threw an exception and I got an error message stating the the 
Struts dispatcher cannot be found.


Thanks!

Kelly

[web.xml]

 struts2
 
org.apache.struts2.dispatcher.FilterDispatcher 


 

 
   struts2
   /*
 

[snip]


   jdbc/UsersDS
   javax.sql.DataSource
 

 
 
   name
   
 Protected Area
 /protected/*
   
   
 licensing-admin
   
 
 
   FORM
   Licensing Administration
   
 /login.jsp
 /error.jsp
   
 
 
   licensing-admin
 

 
 protected/administer.jsp
 
[/web.xml]

[context.xml]

   
   userTable="users" userNameCol="user_name" 
userCredCol="user_pass"

  userRoleTable="user_roles" roleNameCol="role_name"/>
[/context.xml]


-
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: Struts 2 Container Security problem

2008-02-19 Thread Kelly Graus
Martin Gainty  hotmail.com> writes:

> 
> start here
> http://www.acegisecurity.org/guide/springsecurity.html
> 
> M-

Thank you for the response. I looked at Acegi, but it seemed overly
complex for my requirements. This application is just a simple in
house administration tool (and learning exercise for me) that doesn't
need much in the way of authentication. Basically, once a user logs
in, they are authorized to access the entire app.


>From my research, it seems like using container security should work,
however I have been unable to find any examples using Struts 2 as of
yet (I even bought Practical Apache Struts 2, but the author doesn't
use Tomcat so his container security example didn't help much with my
problem).


Thanks again for you response!

Kelly


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



Re: Struts2 field validation and conversion

2008-02-19 Thread Jeromy Evans

Filipe David Manana wrote:

So my question, is the RequiredFieldValidator is applied after conversion?
If conversion fails, the RequiredFieldValidator catches a blank value for
the field?

  
Yes, validation is performed on your action instance, after the 
parameters have all been set, which means after all conversion.  It 
should be seeing a null value.
You could setup the first case by setting the Long value to -1 within 
you converter in the case of a conversion error.


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



Re: Type conversion questions

2008-02-19 Thread Jeromy Evans

Daniel Baldes wrote:

Hello,

I have a web form where you can, generally speaking, assign objects to 
groups. This is done via a multiple select box which displays an 
object's name and uses its ID property as value.


So, usually, my action would get back a String array containing the 
IDs of the selected objects. I want the framework to load the 
corresponding objects from the database and pass them as a Collection 
to my action's setObjects(Collection objects) method, so that 
my action doesn't have to deal with loading objects.


So I wrote a type converter. The "convertFromString" method takes the 
String array with the IDs, determines the target element type using 
ObjectTypeDeterminer, loads the objects and returns them in a 
collection. In this direction - form to action - it works quite well.




Great.  I've never tried this myself.  I suppose you run the risk of 
some performance penalties doing it here (eg. select n+1 due to 
iteration) and the conversion error exception is probably not ideal, but 
otherwise I'm impressed.

Now my questions:

1. extending StrutsTypeConverter forces me to implement String 
convertToString(Map context, Object o). I think there is no common 
sense way of converting a collection back to a String in this context. 
It would, maybe, make sense to convert it to a String[]. But what I 
actually want is to have access to the unconverted collection in the 
JSP. This might seem strange from some point of view, and I could live 
without it, but is there a way to do this? Example:


   

This way I could use getMyObjects() for displaying my objects and 
setMyObjects() for setting them (using only their IDs).




It does really follow the intended contract of the interface, but I 
don't see why convertFromString can't return a different view of the 
object than convertToString.  Have you tried it?  This effectively gives 
you the "databinding" feature of ASP.net (which I personally cringe at, 
but can't argue with how productive it is to work with)


2. Is there a way to define a type converter application wide, like 
"always use this type converter for setting types which are subclasses 
of X" and "for setting types which are Collection"? 
This way I could define the type converter once for all 
persistence-capable classes.


classpath:xwork-converters.properties allows you to define global 
converters by class name.  You may be able to the the element_ feature 
for collections.

Otherwise visitor validation will have to do

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



Re: Map instead of List in action

2008-02-19 Thread Sessizlik

Hi Musachy,

Thank you for your response,

I am sorry but I can understand how to change getter and setter.

How should be signatures of getter and setter? Just changing return type
should not be enough ?

Best Regards
Sessizlik




Musachy Barroso wrote:
> 
> Change the setter and getter and access the map like:
> 
> 
> 
> musachy
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Map-instead-of-List-in-action-tp15561406p15572476.html
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: populating ActionFormBean-s

2008-02-19 Thread Laurie Harper
Your Department class doesn't initialize its 'program' member when the 
no-arg constructor is called so when BeanUtils tries to fill in the data 
from the request, program will be null. I suspect that is your problem. 
Two things to try:


1) turn logging up to DEBUG for BeanUtils; that should show you if this 
is indeed the problem (and if not, what is)


2) try changing the field definition to

private StudyProgram program = new StudyProgram();

That may not be how you want to init that member, but you can worry 
about that afterwards if it works.


L.

auz wrote:

yep both ActionFormBeans are java bean compliant here's the code

note i didn't copy any irelevevant method (dont have reset() method for any
bean)
=
bean1
==
package beans.studyProgram;


public class StudyProgram extends
org.apache.struts.validator.ValidatorActionForm {
  
  private static final long serialVersionUID = -3131205735075358925L;
  
  private Integer id;

  private String name;
  private Integer duration;
  private Integer ects;
  private Boolean active;
  private String description;
  
  public StudyProgram() {

super();
  }
  
  public StudyProgram (Integer id) {

this.id = id;
  }

  public StudyProgram(Integer id, String name, Integer duration, Integer
ects, Boolean active, String description) {
super();
this.id = id;
this.name = name;
this.duration = duration;
this.ects = ects;
this.active = active;
this.description = description;
  }
  
  public StudyProgram (StudyProgram clone) { 
super ();

this.id  = clone.id;
this.name= clone.name;
this.duration= clone.duration;
this.ects= clone.ects;
this.active  = clone.active;
this.description = clone.description;
  }
  
  public StudyProgram clone (StudyProgram clone) {

return new StudyProgram (clone);
  } 


 public Integer getId() {
return id;
  }
  
  public String getID () { 
return id.toString();

  }
  
  public String getName() {

return name;
  }

  public Integer getDuration() {
return duration;
  }

  public Integer getEcts() {
return ects;
  }

  public Boolean getActive() {
return active;
  }

  public String getDescription() {
return description;
  }

  public void setId(Integer id) {
this.id = id;
  }

  public void setName(String name) {
this.name = name;
  }

  public void setDuration(Integer duration) {
this.duration = duration;
  }

  public void setEcts(Integer ects) {
this.ects = ects;
  }

  public void setActive(Boolean active) {
this.active = active;
  }

  public void setDescription(String description) {
this.description = description;
  }
}


bean2 (has bean1 as a property)


package beans.department;

import beans.studyProgram.StudyProgram;

public class Department extends
org.apache.struts.validator.ValidatorActionForm {
  
  private static final long serialVersionUID = 4766571497570970495L;
  
  private Integer id;

  private String name;
  private Boolean active;
  private String description;
  private StudyProgram program;
  
  public Department() {

super();
  }

  public Department (Integer id) {
this.id = id;
  }
  public Department(Integer id, String name, Boolean active, String
description, StudyProgram program) {
super();
this.id  = id;
this.name= name;
this.active  = active;
this.description = description;
this.program = program;
  }
  
  public Department (Department clone) {

super ();
this.id  = clone.id;
this.name= clone.name;
this.active  = clone.active;
this.description = clone.description;
if(clone.hasProgram())
  this.program   = clone.program;
  }
  
  public Department clone (Department clone) {

return new Department (clone);
  }


  public boolean hasProgram () {

return program!=null;
  }

  public Integer getId() {
return id;
  }
  
  public String getID() {

return id.toString();
  }

  public String getName() {
return name;
  }

  public Boolean getActive() {
return active;
  }

  public String getDescription() {
return description;
  }

  public StudyProgram getProgram() {
return program;
  }
  
  public void setId(Integer id) {

this.id = id;
  }

  public void setName(String name) {
this.name = name;
  }

  public void setActive(Boolean active) {
this.active = active;
  }

  public void setDescription(String description) {
this.description = description;
  }
  
  public void setProgram (StudyProgram program) {

this.program = program;
  }
}

==
struts config file
==


  />

  
  />

...
scope="request" type="actions.department.SaveDAction">



 
=

jsp page (just on

Re: i18N jsp application on linux and windows

2008-02-19 Thread Laurie Harper

Raghuveer wrote:

Hello Lauri,

This is with reference..

http://www.mail-archive.com/user@struts.apache.org/msg72782.html

[...]

response.getCharacterEncoding()is returning ISO-8859-1.

I have set it to charset - ISO-8859-2 in JSP pages but it is returning
“charset - ISO-8859-1”.


Then you have something missing somewhere; from my first reply which you 
didn't answer:


> I have set ISO8859_2 in JSP page for charset.
>
> <%@ page contentType="text/html;charset=ISO8859_2"  %>

This tells the JSP engine what character encoding to use. Do you also 
have an HTML meta http-equiv tag in the head of your page to tell the 
browser what encoding it should use to process the page?


When the browser submits a form, it should use the character encoding of 
the page that the form is in. If that's not working, start by fixing that.



Same thing is happening in windows and Linux.

It is working in windows with this conversion(convertTo_IS08559_2) but
failing in Linux..


As I said, the conversion code you have is semantically incorrect and 
shouldn't be necessary anyway. Remove it and fix the issue above and see 
where you are then.


L.


Regards,
Raghu

 

 

  _  

From: Laurie Harper [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 19, 2008 4:24 AM

To: [EMAIL PROTECTED]
Subject: Re: i18N jsp application on linux and windows

 


Uh, yeah, I got that; that's why I've replied to you twice, on the list; see
also: 

 


http://www.mail-archive.com/user@struts.apache.org/msg72782.html

 


Please follow up on-list if you need further help, to keep the discussion
where everyone can see it.

 


L.

 


On 18-Feb-08, at 8:50 AM, Raghuveer wrote:





I need an help related to i18n (internationalization),…

 
http://www.mail-archive.com/user@struts.apache.org/msg72581.html

 

 


I am developing an application an struts application to be used in poland
for English,polish language on tomcat.

 


There is scenario to extract SAP messages and show to the user in browser in
JSP page.

 


I have written following method to read SAP message and Convert to
charsetThis is working for me on XP and Windows 2000 in Hyderabad.

IS0-559-2And in JSP pages

<%@ page contentType="text/html;charset=iso-8859-2"  %>

 

 


But messages are corrupted some times and getting Question marks when
deployed and tested application in Poland on Linux.

Linux-

Nr potwierdzenia 8018340248 nie został znaleziony (proszę sprawdzić wpis)

 Windows

 


Nr potwierdzenia 22 nie zosta³ znaleziony (proszê sprawdziæ wpis)

 


-

 


String convertTo_IS08559_2(HttpServletResponse response, StringstrMessage)
throws UnsupportedEncodingException{

String charset = response.getCharacterEncoding();

   


Log.info(CLASS_NAME +" - " +METHOD_NAME+" - charset -
"+charset);

   


  try {

  } catch (UnsupportedEncodingException e) {

//e.printStackTrace();

throw e;

}

return strFormatedMessage;






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



Re: S2 NESTED iterators & FLAT HashMaps:

2008-02-19 Thread Randy Burgess
One is JSTL, the other is using OGNL and they are not the same.

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: ravi_eze <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List 
> Date: Tue, 19 Feb 2008 08:44:06 -0800 (PST)
> To: 
> Subject: Re: S2 NESTED iterators & FLAT HashMaps:
> 
> 
> hi,
> 
> The answers were a real help. I could get the things to things working...
> 
> now when i use: fruits Val :${fruitsId.value} this displays: fruits Val
> :[apple, banana, orange]
> 
> but when i use: ${fruitsId.value.size()} its giving compile time
> errors:tAttributes.jsp(98,16) The function size must be used with a prefix
> when a default namespace is not specified. I need to get 3 so how should i
> form the expression?
> 
> if i use:  then its displaying
> 3. The tag is written as follows:
> 
>  id="fruitsId"
> status="fruitsStat"
> value="fruitColourInfo">
>
>  ...
> 
> i basically need to use this in < td colspan="{...}" > ... is there any
> alternative ways of handling this? any ideas pl: help
> 
> ravi
> 
> 
> 
> Laurie Harper wrote:
>> 
>>> fruits KEY 
>> 
>> Gets the key from the map entry and displays it; OK here.
>> 
>>> fruits Val 
>> 
>> Gets the 'value' property of the iterator status object and uses that as
>> a lookup key in the application's message resources. Umm... First, I'm
>> not sure if the iterator status object has a value property, but
>> wouldn't you want the value from the map entry? And second, do you have
>> the message properties set up?
>> 
>> That should probably be
>> 
>>  fruits Val 
>> 
>> and, for sanity checing (in case your message resources aren't set up
>> correctly) you should start with just
>> 
>>  fruits Val 
>> 
>> L.
>> 
>> Ravichandra C wrote:
>>> Hi,
>>> 
>>> I am trying this way:
>>> 
>>> 
>>> >> value="fruitscolourandInfo" >
>>> fruits KEY 
>>> 
>>> fruits Val 
>>> 
>>> >> value="fruitsId.value" >
>>> colour  
>>> 
>>> 
>>> 
>>> The issue is that:
>>> Fruits key: is being displayed fine
>>> Fruits Val: nothing is being dislayed; infact when I tried similarly
>>> with fruits KEY even that is not being displayed. Any ideas how to get
>>> this working.. (in fact I need to get the results in textboxes next) 
>>> 
>>> Any help?
>>> Ravi 
>>> 
>>> -Original Message-
>>> From: Musachy Barroso [mailto:[EMAIL PROTECTED]
>>> Sent: Monday, February 18, 2008 10:09 PM
>>> To: Struts Users Mailing List
>>> Subject: Re: S2 NESTED iterators & FLAT HashMaps:
>>> 
>>> When you use the "iterator" tag, the value of the "id" tag becomes the
>>> reference to the current object on that iteration(same as "top" on
>>> this case). When iterating over a map, the object is a Map.Entry, so
>>> you need to access the "key" and "value" properties, like
>>> 
>>> 
>>> Key:  same as >> value="key" />
>>> Value: same as
>>> 
>>> 
>>> 
>>> is not a direct answer to your question, but I think your problem is
>>> around that.
>>> //you can always do %{superMap[top.key]} to access the value, it is
>>> just harder to read
>>> 
>>> regards
>>> musachy
>>> 
>>> On Feb 18, 2008 11:21 AM, ravi_eze <[EMAIL PROTECTED]> wrote:
 hi,
 
 i have 4 hashmaps as follows:
 (1). HashMap> treesFruitsMap = new HashMap();
 (2). HashMap> fruitsColourMap = new HashMap();
 (3). HashMap colourVitaminMap = new HashMap();
 
 i.e.
 (1) has the mapping btw tree names and the fruits it bears (as a set
>>> of
 strings)
 (2) has the mapping btw fruit name and the possible colours it can
>>> come out
 in
 (3) mapping btw fruit and the vitamins it has in it.
 
 I need to display the output as follows:
 Fruit1 - Colour1 - Vitamin1
 Fruit1 - Colour1 - Vitamin2
 Fruit1 - Colour2 - < corresponding vitamins >
 ...
 
 any idea how to go with this? I tried as follows but its not working..
 
 >> value="frColourMap.keySet()" >
 
 FE  
 BR  
 
 
 
 this is giving only the fruits names but not the colours...
 
 pl: help.
 
 --
 View this message in context:
>>> http://www.nabble.com/S2-NESTED-iterators---FLAT-HashMaps%3A-tp15546918p
>>> 15546918.html
 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]
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/S2-NESTED-iterators---FLAT-HashMaps%3A-tp15546918p155615
> 58.html
> Sent from the Struts - User mailing list archive at 

Re: Struts 2 Container Security problem

2008-02-19 Thread Martin Gainty
start here
http://www.acegisecurity.org/guide/springsecurity.html

M-
- Original Message -
From: "Kelly Graus" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, February 19, 2008 12:12 PM
Subject: Struts 2 Container Security problem


> Hi Everyone,
>
> I'm attempting to secure my first Struts 2 web app using container
> security with a DataSourceRealm.  I'm using Tomcat 6 as my container.
> Here is how my project is setup:
>
> LicensingAdministration/
> META-INF/
>context.xml
> WEB-INF/
>web.xml
>classes/
>   struts.xml
> protected/
>*JSP pages*
> login.jsp
> error.jsp
>
> Without using struts, this works perfectly.  Any attempt to access
> anything under the protected area results in a redirect to the login
> page, and from there all of the database stuff works fine.  However,
> when I added in struts, I am now able to bypass the security by
> specifying an action directly.
>
> For example, navigating to
> http://localhost:8080/LicensingAdministration/CreateProduct.action will
> bypass the login page and go directly to the CreateProduct action.
> However, navigating to
>
http://localhost:8080/LicensingAdministration/protected/CreateProduct.action
> will perform a redirect to the login (as expected).
>
> Any suggestions on how to secure the actions so that the login cannot be
> bypassed would be greatly appreciated!  Below are the relevant parts of
> my web.xml and context.xml files (I can post the full files if
> necessary, but they contain a lot of resource definitions that aren't
> related to the problem).
>
> Also, in an slightly unrelated question, is is possible to use struts
> tags in the login page?  I was trying to use an s:url tag to specify the
> location of the css.  When redirected to the login page, the server
> threw an exception and I got an error message stating the the Struts
> dispatcher cannot be found.
>
> Thanks!
>
> Kelly
>
> [web.xml]
> 
>   struts2
>
>
org.apache.struts2.dispatcher.FilterDispatcher
>   
>
>   
> struts2
> /*
>   
>
> [snip]
>
> 
> jdbc/UsersDS
> javax.sql.DataSource
>   
>
>   
>   
> name
> 
>   Protected Area
>   /protected/*
> 
> 
>   licensing-admin
> 
>   
>   
> FORM
> Licensing Administration
> 
>   /login.jsp
>   /error.jsp
> 
>   
>   
> licensing-admin
>   
>
>   
>   protected/administer.jsp
>   
> [/web.xml]
>
> [context.xml]
>type="javax.sql.DataSource"
>   username="username"
>   password="password"
>   driverClassName="com.mysql.jdbc.Driver"
>   url="jdbc:mysql://localhost:3306/users"/>
>
> 
>   dataSourceName="jdbc/UsersDS" localDataSource="true"
>userTable="users" userNameCol="user_name"
userCredCol="user_pass"
>userRoleTable="user_roles" roleNameCol="role_name"/>
> [/context.xml]
>
>
> -
> 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]



struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-19 Thread xianwinwin

Hi all,
I'm trying to return a result to DIV in a form (in the example id='two')

this is my form:

initial content








when the user clicks the GO2 --> the action, AjaxRemoteForm,  is 'activated'
(showing the 'data' the user has input)

public String AjaxRemoteForm()
{
System.out.println("active ajax test 1 with data: "+data);
return "test.ajax.2";
}

and routed to AjaxResult3.jsp:

  
test_1
/pages/welcome/AjaxResult3.jsp





The result comes in a NEW page with the 'data' value the user has input



"AjaxResult3.jsp" 
-
<%@ taglib prefix="s" uri="/struts-tags" %>

<%
request.setAttribute("decorator", "none");
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy
server
%>

The value you entered was: 




Q: How can I incorporate the 'data' value in the DIV and not in a new page?
-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15562626.html
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 NESTED iterators & FLAT HashMaps:

2008-02-19 Thread Dave Newton
--- ravi_eze <[EMAIL PROTECTED]> wrote:
> The answers were a real help. I could get the things to things working... 
> 
> now when i use: fruits Val :${fruitsId.value} this displays: fruits Val
> :[apple, banana, orange] 
> 
> but when i use: ${fruitsId.value.size()} its giving compile time
> errors:tAttributes.jsp(98,16) The function size must be used with a prefix
> when a default namespace is not specified. I need to get 3 so how should i
> form the expression?
> 
> if i use:  then its displaying
> 3. The tag is written as follows:
> 
>  id="fruitsId"
>   status="fruitsStat"
>   value="fruitColourInfo"> 
> 
>  ...
> 
> i basically need to use this in < td colspan="{...}" > ... is there any
> alternative ways of handling this? any ideas pl: help

">

Dave


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



Struts 2 Container Security problem

2008-02-19 Thread Kelly Graus

Hi Everyone,

I'm attempting to secure my first Struts 2 web app using container 
security with a DataSourceRealm.  I'm using Tomcat 6 as my container. 
Here is how my project is setup:


LicensingAdministration/
   META-INF/
  context.xml
   WEB-INF/
  web.xml
  classes/
 struts.xml
   protected/
  *JSP pages*
   login.jsp
   error.jsp

Without using struts, this works perfectly.  Any attempt to access 
anything under the protected area results in a redirect to the login 
page, and from there all of the database stuff works fine.  However, 
when I added in struts, I am now able to bypass the security by 
specifying an action directly.


For example, navigating to 
http://localhost:8080/LicensingAdministration/CreateProduct.action will 
bypass the login page and go directly to the CreateProduct action.  
However, navigating to 
http://localhost:8080/LicensingAdministration/protected/CreateProduct.action 
will perform a redirect to the login (as expected).


Any suggestions on how to secure the actions so that the login cannot be 
bypassed would be greatly appreciated!  Below are the relevant parts of 
my web.xml and context.xml files (I can post the full files if 
necessary, but they contain a lot of resource definitions that aren't 
related to the problem).


Also, in an slightly unrelated question, is is possible to use struts 
tags in the login page?  I was trying to use an s:url tag to specify the 
location of the css.  When redirected to the login page, the server 
threw an exception and I got an error message stating the the Struts 
dispatcher cannot be found.


Thanks!

Kelly

[web.xml]

 struts2
 
org.apache.struts2.dispatcher.FilterDispatcher

 

 
   struts2
   /*
 

[snip]


   jdbc/UsersDS
   javax.sql.DataSource
 

 
 
   name
   
 Protected Area
 /protected/*
   
   
 licensing-admin
   
 
 
   FORM
   Licensing Administration
   
 /login.jsp
 /error.jsp
   
 
 
   licensing-admin
 

 
 protected/administer.jsp
 
[/web.xml]

[context.xml]


   

 
[/context.xml]


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



Re: Map instead of List in action

2008-02-19 Thread Musachy Barroso
Change the setter and getter and access the map like:



musachy

On Feb 19, 2008 10:12 AM, Sessizlik <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I am completely new to Struts. I am studying about show-case examples. I
> noticed that such a example:
>
>
> The goal is updating multiple records at one time. For that,
>
> in EditPersonAction.java
>
> List persons = new ArrayList();
>
>
> 
>
> And in EditPerson.java
>
>
> 
> 
> 
> 
> 
> 
>  name="persons(%{id}).name" value="%{name}" theme="simple" />
> 
> 
>  name="persons(%{id}).lastName" value="%{lastName}" theme="simple"/>
> 
> 
> 
>
>
> 
>
>
>
> There is a confusing thing for me which is name="persons(%{id}).name" . This
> sets user in persons list in EditPersonAction.java . So the keypoint is here
> that the index of person is up to "id". In this case, if the user id is a
> big number, the index of person in personList is also directly proportional
> its id. So it could be 100th entry in a list and the other values are
> null.
>
> My question is how can I implement this scenario with a MAP.
>
> That is to say,
>
> in EditPersonAction.java
>
> Map persons = new HashMap();
>
>
> 
>
> What Should I do to implement that? Do Getter and setter of this property
> should be changed? And in JSP side what should I do to provide that?
>
>
> Thanks
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/Map-instead-of-List-in-action-tp15561406p15561406.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> 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

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



Re: S2 NESTED iterators & FLAT HashMaps:

2008-02-19 Thread ravi_eze

hi,

The answers were a real help. I could get the things to things working... 

now when i use: fruits Val :${fruitsId.value} this displays: fruits Val
:[apple, banana, orange] 

but when i use: ${fruitsId.value.size()} its giving compile time
errors:tAttributes.jsp(98,16) The function size must be used with a prefix
when a default namespace is not specified. I need to get 3 so how should i
form the expression?

i basically need to use this in < td colspan="{...}" > ... is there any
alternative ways of handling this? any ideas pl: help

ravi



Laurie Harper wrote:
> 
>  > fruits KEY 
> 
> Gets the key from the map entry and displays it; OK here.
> 
>  > fruits Val 
> 
> Gets the 'value' property of the iterator status object and uses that as 
> a lookup key in the application's message resources. Umm... First, I'm 
> not sure if the iterator status object has a value property, but 
> wouldn't you want the value from the map entry? And second, do you have 
> the message properties set up?
> 
> That should probably be
> 
>  fruits Val 
> 
> and, for sanity checing (in case your message resources aren't set up 
> correctly) you should start with just
> 
>  fruits Val 
> 
> L.
> 
> Ravichandra C wrote:
>> Hi,
>> 
>> I am trying this way:
>> 
>> 
>>  > value="fruitscolourandInfo" >
>>  fruits KEY 
>> 
>>  fruits Val 
>> 
>>  > value="fruitsId.value" >
>>  colour  
>>  
>>  
>> 
>> The issue is that:
>> Fruits key: is being displayed fine
>> Fruits Val: nothing is being dislayed; infact when I tried similarly
>> with fruits KEY even that is not being displayed. Any ideas how to get
>> this working.. (in fact I need to get the results in textboxes next) 
>> 
>> Any help?
>> Ravi 
>> 
>> -Original Message-
>> From: Musachy Barroso [mailto:[EMAIL PROTECTED] 
>> Sent: Monday, February 18, 2008 10:09 PM
>> To: Struts Users Mailing List
>> Subject: Re: S2 NESTED iterators & FLAT HashMaps:
>> 
>> When you use the "iterator" tag, the value of the "id" tag becomes the
>> reference to the current object on that iteration(same as "top" on
>> this case). When iterating over a map, the object is a Map.Entry, so
>> you need to access the "key" and "value" properties, like
>> 
>> 
>> Key:  same as > value="key" />
>> Value: same as
>> 
>> 
>> 
>> is not a direct answer to your question, but I think your problem is
>> around that.
>> //you can always do %{superMap[top.key]} to access the value, it is
>> just harder to read
>> 
>> regards
>> musachy
>> 
>> On Feb 18, 2008 11:21 AM, ravi_eze <[EMAIL PROTECTED]> wrote:
>>> hi,
>>>
>>> i have 4 hashmaps as follows:
>>> (1). HashMap> treesFruitsMap = new HashMap();
>>> (2). HashMap> fruitsColourMap = new HashMap();
>>> (3). HashMap colourVitaminMap = new HashMap();
>>>
>>> i.e.
>>> (1) has the mapping btw tree names and the fruits it bears (as a set
>> of
>>> strings)
>>> (2) has the mapping btw fruit name and the possible colours it can
>> come out
>>> in
>>> (3) mapping btw fruit and the vitamins it has in it.
>>>
>>> I need to display the output as follows:
>>> Fruit1 - Colour1 - Vitamin1
>>> Fruit1 - Colour1 - Vitamin2
>>> Fruit1 - Colour2 - < corresponding vitamins >
>>> ...
>>>
>>> any idea how to go with this? I tried as follows but its not working..
>>>
>>> > value="frColourMap.keySet()" >
>>> 
>>> FE  
>>> BR  
>>> 
>>> 
>>>
>>> this is giving only the fruits names but not the colours...
>>>
>>> pl: help.
>>>
>>> --
>>> View this message in context:
>> http://www.nabble.com/S2-NESTED-iterators---FLAT-HashMaps%3A-tp15546918p
>> 15546918.html
>>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/S2-NESTED-iterators---FLAT-HashMaps%3A-tp15546918p15561558.html
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 s:if and displaytag question

2008-02-19 Thread Randy Burgess
It's because you have the property set on that column. Remove that attribute
and if your condition is found then it will display that text.

I don't think that if statement is correct either. This should look like:

  
...

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: red phoenix <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List 
> Date: Wed, 20 Feb 2008 00:09:43 +0800
> To: Struts Users Mailing List 
> Subject: struts2 s:if and displaytag question
> 
> I use Struts2 and displaytag, In testList,there is a abc attribute,it
> contains data like "english","france",when abc="english",I want to show
> En,else show Eu,my code is follows:
> 
> 
>   
> 
> En
>
>
>Eu
>
> 
> 
> when I execute code,I find it only shows english or france,I don't know why
> it don't show En or Eu.Where wrong with my code?
> 
> Any idea will be appreciated!
> Thanks



This email and any attachments ("Message") may contain legally privileged 
and/or confidential information.  If you are not the addressee, or if this 
Message has been addressed to you in error, you are not authorized to read, 
copy, or distribute it, and we ask that you please delete it (including all 
copies) and notify the sender by return email.  Delivery of this Message to any 
person other than the intended recipient(s) shall not be deemed a waiver of 
confidentiality and/or a privilege.

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



Re: struts2 s:if and displaytag question

2008-02-19 Thread Dave Newton
The "#element" is syntax meaning there's a named element "element" on the
value stack; do the display tags interact with the S2 value stack?

I'd be more likely to try "${element.abc}" as I would have assumed that the
display tags did things with normal JEE contexts.

Just an idea.

Dave

--- red phoenix <[EMAIL PROTECTED]> wrote:

> I use Struts2 and displaytag, In testList,there is a abc attribute,it
> contains data like "english","france",when abc="english",I want to show
> En,else show Eu,my code is follows:
> 
> 
>   
> 
> En
>
>
>Eu
>
> 
> 
> when I execute code,I find it only shows english or france,I don't know why
> it don't show En or Eu.Where wrong with my code?
> 
> Any idea will be appreciated!
> Thanks
> 


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



struts2 s:if and displaytag question

2008-02-19 Thread red phoenix
I use Struts2 and displaytag, In testList,there is a abc attribute,it
contains data like "english","france",when abc="english",I want to show
En,else show Eu,my code is follows:


  

En
   
   
   Eu
   


when I execute code,I find it only shows english or france,I don't know why
it don't show En or Eu.Where wrong with my code?

Any idea will be appreciated!
Thanks


Map instead of List in action

2008-02-19 Thread Sessizlik

Hi all,

I am completely new to Struts. I am studying about show-case examples. I
noticed that such a example:


The goal is updating multiple records at one time. For that, 

in EditPersonAction.java  

List persons = new ArrayList(); 




And in EditPerson.java












   








There is a confusing thing for me which is name="persons(%{id}).name" . This
sets user in persons list in EditPersonAction.java . So the keypoint is here
that the index of person is up to "id". In this case, if the user id is a
big number, the index of person in personList is also directly proportional
its id. So it could be 100th entry in a list and the other values are
null.

My question is how can I implement this scenario with a MAP.

That is to say,

in EditPersonAction.java  

Map persons = new HashMap(); 




What Should I do to implement that? Do Getter and setter of this property
should be changed? And in JSP side what should I do to provide that?


Thanks



-- 
View this message in context: 
http://www.nabble.com/Map-instead-of-List-in-action-tp15561406p15561406.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Type conversion questions

2008-02-19 Thread Daniel Baldes

Hello,

I have a web form where you can, generally speaking, assign objects to 
groups. This is done via a multiple select box which displays an 
object's name and uses its ID property as value.


So, usually, my action would get back a String array containing the IDs 
of the selected objects. I want the framework to load the corresponding 
objects from the database and pass them as a Collection to my action's 
setObjects(Collection objects) method, so that my action doesn't 
have to deal with loading objects.


So I wrote a type converter. The "convertFromString" method takes the 
String array with the IDs, determines the target element type using 
ObjectTypeDeterminer, loads the objects and returns them in a 
collection. In this direction - form to action - it works quite well.


Now my questions:

1. extending StrutsTypeConverter forces me to implement String 
convertToString(Map context, Object o). I think there is no common sense 
way of converting a collection back to a String in this context. It 
would, maybe, make sense to convert it to a String[]. But what I 
actually want is to have access to the unconverted collection in the 
JSP. This might seem strange from some point of view, and I could live 
without it, but is there a way to do this? Example:


   

This way I could use getMyObjects() for displaying my objects and 
setMyObjects() for setting them (using only their IDs).



2. Is there a way to define a type converter application wide, like 
"always use this type converter for setting types which are subclasses 
of X" and "for setting types which are Collection"? This 
way I could define the type converter once for all persistence-capable 
classes.


Thanks in advance,

Daniel



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



Re: Unable to make Type Conversion work in Struts2

2008-02-19 Thread Jeromy Evans

Hi Maxx,

Yeah, I've had no success with Enum's either for the same reason, 
however that's definitely fixed in Struts 2.1.1 (XWork 2.1)
In theory, EnumMap should work in 2.1 as well, although I'm not sure 
what can be done about the constructor.


regards,
Jeromy Evans

Maxx wrote:

Thanks for your answer.

I partially fixed this, noticing the square brackets notation is the
same for Lists and Maps, which is not so clear on the related doc page
(I posted a comment about this, having had a conversion with Dave
Newton about this in a more recent thread on the mailing-list), as
well as fixed the getter method which had a bad copy/paste issue.

But I found another problem that might need some better formulation
from me, and eventually a Jira: it seems Struts2 isn't able to fully
support the java.lang.EnumMap object (e.g. using a EnumMap), given that it's a particular Map (i.e. all keys are known,
and they are NOT Strings) without any no-arg constructor - thus
resulting in some cases in an InstanciationException.

I tried some work-around with the introduction of an
"EnumTypeConverter" (extending StrutsTypeConverter), which seemed to
work fine at first sight, but unfortunately there's a buggy side
effect: Struts2 then tried to convert the input value (which has to be
the "value" of the map of type java.lang.String, if referring to the
above example) ... in the corresponding Enum type of the key!!!
Even if its declared in the -conversion.properties with:
Element_xxx=java.lang.String

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



Differentiate Redirection of page if validator fails and action property setter fails.

2008-02-19 Thread neha bhatt

Hi All,
I have made the page where userList is displayed page wise. There is the
link 'createUser' on that page.

I kept validation.xml file for CreateUser fields. If validation fails then
it redirects to same 'UserDetail' page with validation Messages.

Now..There is an integer variable 'page' in my UserAction file. I use- form
'Get' method for page selection.
now if user change 

from http://localhost:8080/Isp/User?page=1 to
http://localhost:8080/Isp/User?page=anyNonNumeric 
it redirects to 'UserDetail' page. as it setPage() fails.

I want to devide these both case page redirection. For validation it should
redirect to same page. 
and For Page=nonNumeric to different exception page.

How can I do so? Any idea?

My Struts.xml is




  








  
/ISP_View/UserDetailView.jsp
/ISP_View/UserDetail.jsp
/ISP_View/UserDetail.jsp
/ISP_View/UserDetail.jsp
/ISP_View/UserList.jsp

http://www.nabble.com/Differentiate-Redirection-of-page-if-validator-fails-and-action-property-setter-fails.-tp15560564p15560564.html
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: Unable to make Type Conversion work in Struts2

2008-02-19 Thread Maxx
Thanks for your answer.

I partially fixed this, noticing the square brackets notation is the
same for Lists and Maps, which is not so clear on the related doc page
(I posted a comment about this, having had a conversion with Dave
Newton about this in a more recent thread on the mailing-list), as
well as fixed the getter method which had a bad copy/paste issue.

But I found another problem that might need some better formulation
from me, and eventually a Jira: it seems Struts2 isn't able to fully
support the java.lang.EnumMap object (e.g. using a EnumMap), given that it's a particular Map (i.e. all keys are known,
and they are NOT Strings) without any no-arg constructor - thus
resulting in some cases in an InstanciationException.

I tried some work-around with the introduction of an
"EnumTypeConverter" (extending StrutsTypeConverter), which seemed to
work fine at first sight, but unfortunately there's a buggy side
effect: Struts2 then tried to convert the input value (which has to be
the "value" of the map of type java.lang.String, if referring to the
above example) ... in the corresponding Enum type of the key!!!
Even if its declared in the -conversion.properties with:
Element_xxx=java.lang.String

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



Re: Tabbed panel problem

2008-02-19 Thread Jeromy Evans

Ok, that makes sense.

This is a little hard to explain, but here goes...
What I have done in the past is NOT use the href attribute on the tab 
itself.
Instead include another ANOTHER div inside the tab and make this div the 
ajax target.


ie.

 
 theme="simple">

   ...

Now, the inner div rather than your tab needs to be the target of your 
form.  This way your tab still works but the content of the tab is 
refreshed by your ajax form.
If you don't do that, the tab's special markup is overwritten by the 
result and no longer works.


Does that help?

regards,
Jeromy Evans

Paranoid_Fabio wrote:

Yes. What I want to is to have the results of the action I call from inside
the div shown inside the div again.


Jeromy Evans - Blue Sky Minds wrote:
  

I don't quite understand what you're asking for, but I suspect:
  - you're doing the right thing using a remote tab/remote div to load 
html fragments into your tabs asynchronously, but;
  - you also want to use the notifyTopics and listenTopics features of 
these tags to trigger refreshing/reloads


See the topics section of 
:http://struts.apache.org/2.0.11/docs/ajax-tags.html


Paranoid_Fabio wrote:


Hello. I try to explain the problem as cleary as possible:
I want to manage a jsp with two views: mainPage.jsp is a jsp with a
tabbed
panel. In the tabbed panel I've two tabs. In each tab calls an action and
shows the resulting jsp correctly. Here's the code of mainPage.jsp tabbed
panel:











where the second tab is not implemented. The first tab shows the jsp
resulting from the call to the action "showManual", the jsp is
"ManualContentUpload.jsp"
When I post the form in this page, I get the ManualContentUpload action
invoked:

 
/pages/UploadSuccess.jsp
/pages/ManualContentUpload.jsp
/pages/ManualContentUpload.jsp
type="redirect">/pages/UploadDenied.jsp   
 


What I want is that all the resulting jsp's still be shown in the tab of
the
panel. How I can do this? 


Thank you for help!





  
  

-
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: Struts2 actions' extension

2008-02-19 Thread Filipe David Manana
And, set it in the struts.properties file as the ActionMapper:

struts.mapper.class=org.apache.struts2.dispatcher.mapper.LsfwebMapper


On Feb 19, 2008 10:09 AM, Filipe David Manana <[EMAIL PROTECTED]> wrote:

> I managed to find a solution to be able to use extensionless actions.
> Just subclass the DefaultActionMapper like this:
>
> package org.apache.struts2.dispatcher.mapper;
> >
> > import java.util.*;
> >
> > public class LsfwebMapper extends DefaultActionMapper
> > {
> >private static List ignoredExtensions = new
> > ArrayList();
> >
> >static
> >{
> >   ignoredExtensions.add(".jsp");
> >   ignoredExtensions.add(".css");
> >   ignoredExtensions.add(".js");
> >   ignoredExtensions.add(".gif");
> >   ignoredExtensions.add(".png");
> >   ignoredExtensions.add(".html");
> >}
> >
> >
> >String dropExtension(String name)
> >{
> >   Iterator it = ignoredExtensions.iterator();
> >
> >   while ( it.hasNext() )
> >   {
> >  if ( name.endsWith(it.next()) )
> > return null;
> >   }
> >
> >   return super.dropExtension(name);
> >}
> > }
> >
> >
> Don't forget to place this class in a directory named
> org/apache/struts2/dispatcher/mapper/  within your source directory,
> src/main/java/ (if using maven).
>
>
>
> On Sat, Jan 12, 2008 at 6:28 PM, Filipe David Manana <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
> >
> > I have set the property struts.action.extension to the empty string. I
> > can now invoke my actions with the default ".action" suffix, although I have
> > a problem:
> >
> > css files (ending in .css) and javascript (.js) are no longer accessible
> > to the client.
> >
> > How can I fix this?
> >
> > cheers
> >
> > --
> > Filipe David Manana,
> > [EMAIL PROTECTED]
> >
> > Obvious facts are like secrets to those not trained to see them.
>
>
>
>
> --
> Filipe David Manana,
> [EMAIL PROTECTED]
>
> Obvious facts are like secrets to those not trained to see them.
>



-- 
Filipe David Manana,
[EMAIL PROTECTED]

Obvious facts are like secrets to those not trained to see them.


Re: Struts2 actions' extension

2008-02-19 Thread Filipe David Manana
I managed to find a solution to be able to use extensionless actions.
Just subclass the DefaultActionMapper like this:

package org.apache.struts2.dispatcher.mapper;
>
> import java.util.*;
>
> public class LsfwebMapper extends DefaultActionMapper
> {
>private static List ignoredExtensions = new
> ArrayList();
>
>static
>{
>   ignoredExtensions.add(".jsp");
>   ignoredExtensions.add(".css");
>   ignoredExtensions.add(".js");
>   ignoredExtensions.add(".gif");
>   ignoredExtensions.add(".png");
>   ignoredExtensions.add(".html");
>}
>
>
>String dropExtension(String name)
>{
>   Iterator it = ignoredExtensions.iterator();
>
>   while ( it.hasNext() )
>   {
>  if ( name.endsWith(it.next()) )
> return null;
>   }
>
>   return super.dropExtension(name);
>}
> }
>
>
Don't forget to place this class in a directory named
org/apache/struts2/dispatcher/mapper/  within your source directory,
src/main/java/ (if using maven).


On Sat, Jan 12, 2008 at 6:28 PM, Filipe David Manana <[EMAIL PROTECTED]>
wrote:

> Hi,
>
> I have set the property struts.action.extension to the empty string. I can
> now invoke my actions with the default ".action" suffix, although I have a
> problem:
>
> css files (ending in .css) and javascript (.js) are no longer accessible
> to the client.
>
> How can I fix this?
>
> cheers
>
> --
> Filipe David Manana,
> [EMAIL PROTECTED]
>
> Obvious facts are like secrets to those not trained to see them.




-- 
Filipe David Manana,
[EMAIL PROTECTED]

Obvious facts are like secrets to those not trained to see them.


Re: How to come back to previous action?

2008-02-19 Thread Eduardo Yáñez Parareda
>
>
> You might want to include a Marker interface so that you don't collect all
> the data from every request.  If you have a BackAware interface (or
> BackTarget, or something else meaningful).


That's a good idea, but our app. saves the state depending on where you come
from,
not depending on where you go to. I mean, if user dblclick from screen 1 to
go to scr2, then
state will be saved to allow user to go back, but if you go to scr2 from the
menu, the state won't be saved.


Struts2 field validation and conversion

2008-02-19 Thread Filipe David Manana
Hi,

I am using struts 2.0.11 and I am wondering about the following:

I have an action with a Long property that is using both validation and
conversion (a custom converter).
I have a RequiredFieldValidator and a ConversionErrorFieldValidator set for
that property, as follows:

@Conversion
@Validation
public class RequestAction extends ActionSupport
{
   private Long share;

  // etc...
  @RequiredFieldValidator(message = "Share value is required", shortCircuit
= true)
  @TypeConversion(converter = "
actions.converters.PositiveLongNotNullConverter")
  @ConversionErrorFieldValidator(message = "Share value must be greater than
or equal to zero", shortCircuit = true)
   public void setShare(Long share)
   {
  this.share = share;
   }
}


They are working, but in the JSP where the user fills in a form, if he
leaves the field empty, he gets the correct error message "Share value is
required". If however he places an invalid value in the field like "abc" for
example, he gets also the same error message, instead of "Share value must
be greater than or equal to zero". If I change the order of the annotations,
the opposite happens. With the shortCircuit, however the user always gets
the 2 errors messages, as expected.
So my question, is the RequiredFieldValidator is applied after conversion?
If conversion fails, the RequiredFieldValidator catches a blank value for
the field?

cheers


-- 
Filipe David Manana,
[EMAIL PROTECTED]

Obvious facts are like secrets to those not trained to see them.


Re: Tabbed panel problem

2008-02-19 Thread Paranoid_Fabio

Yes. What I want to is to have the results of the action I call from inside
the div shown inside the div again.


Jeromy Evans - Blue Sky Minds wrote:
> 
> I don't quite understand what you're asking for, but I suspect:
>   - you're doing the right thing using a remote tab/remote div to load 
> html fragments into your tabs asynchronously, but;
>   - you also want to use the notifyTopics and listenTopics features of 
> these tags to trigger refreshing/reloads
> 
> See the topics section of 
> :http://struts.apache.org/2.0.11/docs/ajax-tags.html
> 
> Paranoid_Fabio wrote:
>> Hello. I try to explain the problem as cleary as possible:
>> I want to manage a jsp with two views: mainPage.jsp is a jsp with a
>> tabbed
>> panel. In the tabbed panel I've two tabs. In each tab calls an action and
>> shows the resulting jsp correctly. Here's the code of mainPage.jsp tabbed
>> panel:
>>
>> 
>>  
>>  > key="ContentUploadMain.Option.1"
>> theme="ajax" href="%{mu}">
>>  
>>  
>>  > key="ContentUploadMain.Option.2"
>> theme="ajax">
>>  
>>  
>>  
>>
>> where the second tab is not implemented. The first tab shows the jsp
>> resulting from the call to the action "showManual", the jsp is
>> "ManualContentUpload.jsp"
>> When I post the form in this page, I get the ManualContentUpload action
>> invoked:
>>
>>  > class="actions.contents.upload.ManualUpload">
>> /pages/UploadSuccess.jsp
>> /pages/ManualContentUpload.jsp
>> /pages/ManualContentUpload.jsp
>> > type="redirect">/pages/UploadDenied.jsp   
>>  
>>
>> What I want is that all the resulting jsp's still be shown in the tab of
>> the
>> panel. How I can do this? 
>>
>> Thank you for help!
>>
>>
>>
>>
>>
>>   
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Tabbed-panel-problem-tp15547053p15560368.html
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] IE does not refresh page

2008-02-19 Thread Jeromy Evans

carmi_cd wrote:

Hi i have program that when the user input data in the form and clicked the
save button, it should display list of records that reflects changes made in
the record edited thru the form. In Firefox it works perfectly but in IE the
list does not reflect the changes made. It was refreshing the list before
but when I put the ShowLoadingText="false" in my save button, It does not
refresh the list anymore. 
I really need to put the ShowLoadingText="false" property in my save button
to solve the issue in IE which is not retrieving the values from the form.  

Please help me. how should I solve this. thanks again in advance. 
  


Setting showLoadingText="false" itself shouldn't affect this.

Is the submit reaching your action?
Is the list that's refreshed the response from the action? Or is the 
refresh via a topic? Or refresh by some other means?

Does your response contain any inline javascript? Or dojo widgets/ajax tags?

The only other thing that frequently doesn't work is including inline 
javascript in the responses and expecting theme to execute at a 
particular time.

Which version of struts are you using btw?

regards,
Jeromy Evans

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