Re: Test whether an application resource is empty

2005-06-11 Thread Laurie Harper
Doh, I'm an idiot! :-( What I suggested is like trying to call getFoo() 
on the resource bundle bean, where 'Foo' is what ever 
<%=directionToUserKey.toString()%> evaluates to. Clearly not what's 
needed. The following works for me:




using Struts bean/logic


Just replace 'errors.cancel' with '<%=directionToUserKey.toString()%>' 
and you should be set.


Sorry for the confusion,

L.

Chris Loschen wrote:

Thanks again, Laurie, but for some reason it still returns false every
time, even if there is something under that key.  I'm pretty sure I
followed your directions exactly:







Although I did have to pull the key back out of the request in my second
tile -- do I have to do that here as well? I may have to give up for
now, since I have it working the other way, but I'm still curious what I
did wrong.

Chris 


-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
Sent: Friday, June 10, 2005 2:49 PM
To: user@struts.apache.org
Subject: Re: Test whether an application resource is empty

You want to use the name of the attribute the resource bundle is stored
under, not the name of the properties file. You're not specifying it in
your Struts config so you want the following:

   
 ...
   

L.

Chris Loschen wrote:


Thanks Laurie,

I tried to set it up this way, but wasn't able to make it work. My 
struts-config file defines the message-resources parameter like so:




So I tried putting that in, and also tried some variants like 
org.apache.struts.ApplicationResources and 
org.apache.struts.util.MessageResources in code like this:





		key="<%=directionToUserKey.toString()%>"/>



But it always returned false, even if there was a value for the key, 
so I apparently set up something wrong.


I did get it working using the alternate path, however -- I set up a 
new tile in the tiles-defs file which was defined as a zero-length 
file in the default case and a small JSP for those cases where I had


directions.


The calling JSP looks like this:






And the inserted tile (when I insert a non-zero-length file) looks 
like

this:

<%
String directionsKey = (String)
request.getAttribute("directionToUserKey");
%>



That is working ok, though of course I don't have the flexibility of 
having a value for some locales and no value for other locales. That's




not terribly important.

By the way, just for my own learning: I initially tried to put the 
attribute in page scope, but I kept getting a null value: is page 
scope specific to a particular JSP (I would have thought that was tile



scope...), or should it be available throughout the sub-elements of a 
given page? It works when I use request scope instead, but is that 
what is required here?


Thanks again for everyone's help!

Chris Loschen

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
Sent: Thursday, June 09, 2005 7:07 PM
To: user@struts.apache.org
Subject: Re: Test whether an application resource is empty

Try:

  ">
...
  

where 'name' is the name of the attribute your resource bundle is 
stored under.


L.

Chris Loschen wrote:




Hi Wendy,

Thank you very much for your reply.

Yes, I also thought that I could test the key, then check to see if 
the value was empty. But just how to do it is eluding me. I think part




of the problem might be this:

USAGE NOTE - If you use another tag to create the body content (e.g.
bean:write), that tag must return a non-empty String. An empty String 
equates to an empty body or a null String, and a new scripting 
variable cannot be defined as null. Your bean must return a non-empty 
String, or the define tag must be wrapped within a logic tag to test 
for an empty or null value.


(from the Struts User Guide for bean:define at 
http://struts.apache.org/userGuide/struts-bean.html#define).


I'm trying to do something like











But it's failing (I think) because the bean:message returns an empty 
String. I would wrap it in a logic tag as suggested, but if I could do



that, I'd just use the same logic for my logic:notEmpty tag instead. 
So finding a way to take that value and assign that to a variable 
which I can then test to see whether or not it's empty is what I'm


trying to do.


It was not my idea to add all of these empty i18n values: the i18n 
team did it. If I can't find a way to make this idea work, that's my 
alternate path. If that's the road I need to take, I can do it -- I 
was just hopeful I could do this a little more elegantly.


Thanks for your input. Any further ideas?

Chris

-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 09, 2005 11:52 AM
To: Struts Users Mailing List
Subject: Re: Test whether an application resource is empty

RE: My IncludeAction-where to forward

2005-06-11 Thread David G. Friedman
Tony,

I suggest checking out a tiles Controller.  It could create the menus for
you in a tile-based page WITHOUT needing to call multiple actions.  Details
on this can be found in Cedric Dumoulin's Tiles Advanced Features PDF.
Link: http://www.lifl.fr/~dumoulin/tiles/ with an instructional PDF in the
"Welcome" section listed as "Learn Tiles Advanced Features".

Struts-menu might fit but it depends on where and when you want to
instantiate your two menus.

Why do I recommend avoiding an Action calling another Action?  Because it
requires the whole request chain to be processed again - request parameters
and all.  With a tiles action, you can have it in your template or only in
select pages, depending on your requirement, i.e. a member's menu that might
only be on member pages or a generic menu for all pages.  That is left up to
you.

Again, this is just one of many opinions which might guide you on your way
to finding a solution that fits your situation and your coding style.

Regards,
David

-Original Message-
From: Tony Smith [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 11, 2005 3:07 PM
To: Struts Users Mailing List
Subject: My IncludeAction-where to forward


My webapp is standard. It has a left side menu pane
and right side content pane. Both are dynamic and
generated by struts action. I would like to have two
different Actions for menu and content. For the menu
aciton, I would like to use IncludeAction so that is
could be included in my jsps.

Thus, I derived IncludeAction and put me stuff in
execute. But the problem is after everything is done,
where should the action go?

Here is my action code:

public class MenuAction extends IncludeAction {

public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse respose)
throws Exception {

//my stuff...

return mapping.;
}
}

Here is my action defination in struts-config.xml:



Could anyone help?


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



My IncludeAction-where to forward

2005-06-11 Thread Tony Smith
My webapp is standard. It has a left side menu pane
and right side content pane. Both are dynamic and
generated by struts action. I would like to have two
different Actions for menu and content. For the menu
aciton, I would like to use IncludeAction so that is
could be included in my jsps. 

Thus, I derived IncludeAction and put me stuff in
execute. But the problem is after everything is done,
where should the action go?

Here is my action code:

public class MenuAction extends IncludeAction {

public ActionForward execute(
ActionMapping mapping, 
ActionForm form,
HttpServletRequest request,
HttpServletResponse respose)
throws Exception {

//my stuff...

return mapping.;
}
}

Here is my action defination in struts-config.xml:



Could anyone help?


--- Ray Madigan <[EMAIL PROTECTED]> wrote:

> I would advise you read the sections
> http://struts.apache.org/userGuide/introduction.html
> that explain how an
> ActionForm works and how you get/set the form
> properties.
> 
> You need an ActionForm linked to your Action and
> struts will scrape the
> properties from your page into the form and you just
> manage the form.
> 
> -Original Message-
> From: Joe Smith [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 10, 2005 11:01 PM
> To: user@struts.apache.org
> Subject: display the form values from view page
> 
> 
> register.jsp is the view page, and when the user
> click submit button,
> it will go to result.jsp based on struts-config.xml.
> The followings
> are the code fragment of each significant files.
> 
> My question is for result.jsp, I am now using
> request.getParameter("name")
> to get the name property specified in the form. It
> is working code,
> I just want to ask if this is the best appraoch in
> struts application?
> 
> 
> Please advise. thanks!!
> 
> 
> register.jsp
> =
> 
>   Name: 
>   Address:  property="address">
>   ZIP: 
>   Register Online
> 
> 
> 
> result.jsp
> ==
> Name = <%= request.getParameter("name") %>
> 
> 
> struts-config.xml
> =
>   
>scope="request"
> type="com.insights.struts.actions.RegisterAction"
> input="register.jsp">
>   
>   
>   
> 
> 
> RegisterAction.java
> ===
> 
> public ActionForward execute(...)
> {
>   //etc...
>   forward = mapping.findForward("success");
> }
> 
>
-
> 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]
> 
> 




__ 
Discover Yahoo! 
Stay in touch with email, IM, photo sharing and more. Check it out! 
http://discover.yahoo.com/stayintouch.html

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



RE: display the form values from view page

2005-06-11 Thread Ray Madigan
I would advise you read the sections
http://struts.apache.org/userGuide/introduction.html that explain how an
ActionForm works and how you get/set the form properties.

You need an ActionForm linked to your Action and struts will scrape the
properties from your page into the form and you just manage the form.

-Original Message-
From: Joe Smith [mailto:[EMAIL PROTECTED]
Sent: Friday, June 10, 2005 11:01 PM
To: user@struts.apache.org
Subject: display the form values from view page


register.jsp is the view page, and when the user click submit button,
it will go to result.jsp based on struts-config.xml. The followings
are the code fragment of each significant files.

My question is for result.jsp, I am now using request.getParameter("name")
to get the name property specified in the form. It is working code,
I just want to ask if this is the best appraoch in struts application?


Please advise. thanks!!


register.jsp
=

Name: 
Address: 
ZIP: 
Register Online



result.jsp
==
Name = <%= request.getParameter("name") %>


struts-config.xml
=







RegisterAction.java
===

public ActionForward execute(...)
{
//etc...
forward = mapping.findForward("success");
}

-
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: [Shale] How to code simple container-managed login form

2005-06-11 Thread Duong BaTien
On Fri, 2005-06-10 at 23:08 -0400, Frank W. Zammetti wrote:
> Duong BaTien wrote:
> > First, thanks for an extra help.
> 
> No problem... I hope I can help further :)
> 
> > The whole idea is to use SSL for confidential pages such as logon,
> > change username / password, edit profile with confidential data. Other
> > time some resources may just be protected by roles. The ideal situation
> > is to switch between SSL and Non-SSL using proper configuration on
> > stand-alone tomcat (not with tomcat and apache front end).
> 
> So it is within the same webapp... I think Craig raised a valid point in 
> that case... once the connection isn't secured, a would-be hacker can 
> play some games by sniffing the wire.  If security is important enough 
> to encrypt certain pages, I would wonder if they really all should be 
> encrypted.  Let's move beyond that though because if that's your 
> requirement than that's what you have to pull off :)
> 
Yes, if everything is straight then our life is simpler isn't it? Some
files are too big and ssl will kill us in the business world. We protect
them using roles.

> > The issue with standalone tomcat is that once the user is login under
> > SSL, all connections including public resources not protected by web.xml
> > after the SSL will be in SSL under the same application.
> 
> I don't know what the spec says in this regard... this could be a by 
> design mechanism, or it could be a bug in Tomcat.  It might be worth 
> researching though... you may be trying to fight something that is 
> actually working as it is supposed to.
> 
That is what a great developer community is about. Unfortunately, i am
not a hard core developer.

> > I did that but the same issue of serving public resource with SSL still
> > persist after the SSL connection. Note: I just found out that i did
> > something wrong so i still have to qualify this result(?).
> 
> When you say "public resource", what does that mean?  Do you mean an 
> unconstrained resource?
> 
Yes, unconstrained resource.

> > Because i have not been able to switch between ssl (not for the session
> > id but for Confidential data) and non-ssl connection, i work out the
> > second plan to use 2 web applications under the same tomcat host and use
> > tomcat SingleSignOn to co-ordinate user sessions under the 2 web apps: 1
> > for SSL and 1 for non SSL.
> 
> Just a shot in the dark, but what if you define a constraint on your 
> UNPROTECTED resources and define the transport guarantee as NONE?  It 
> sounds like the user will always pass through a secured page first, so 
> they would have a session established and be authenticated to a user 
> realm, so I *think* it will work... I wonder if that will force it to a 
> non-SSL state though?
> 
This is a good suggestion. I wil try this simple and easy thing first.

> > That is what i hope to get some help. The issue has nothing to do with
> > shale. I am sure that some one has done this successfully with
> > standalone tomcat. I appreciate any help. I ask this list under Shale
> > because under the scenario as explained below that i need 2 web apps, i
> > want to use shale for both.
> 
> Certainly asking this on the Tomcat list would probably get you some 
> further help... There may be some folks that that already know the ins 
> and outs of Tomcat specifically better than I do.
> 
As i said i picked up a thread called Forced Non-SSL from tomcat user
list and promised to report back the result of my investigation for the
benefit of others.

> > Yes, this is what i expect. But the reality is that the non-protected
> > resources NOT under  are served by ssl once ssl is
> > used, at least as i see it and also reported by another user in tomcat
> > user list under standalone tomcat 5.5.9.
> 
> Interesting... That *sounds* like a bug, but again, I'd be interested to 
> know what the spec says.  Might be exactly what *should* happen.  But if 
> you can, give my suggestion a try... Could be a simple fix :)
> 
Yes, this is my intention. I will report back to this list my
investigation and the result i choose since i am planning to use shale
for a production project by the end of this year.

> > Yes, i know and did that under pure html for testing. I ask for Jsf
> > because if i have to go to the route of having 2 web applications: 1 for
> > ssl connection and 1 for non-ssl connection, then i want to further
> > explore if i can use shale for both rather than ssl application for just
> > simple workaround.
> 
> Gotcha.  Let's see if we can't get it working the way you expected 
> though, and the way I would have expected it too... we might both learn 
> something here :)
> 
I hope the list won't mind for the question predominantly tomcat and
related to shale only at a higher level.

BaTien
DBGROUPS



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



RE: displayTag needs session scoped objects for sort/export ?

2005-06-11 Thread David G. Friedman
If you use Hibernate as your DAO layer, you could enable caching so
DisplayTag won't hit the database every time, assuming you have the memory
footprint to support that caching.

Regards,
David

-Original Message-
From: Lixin Chu [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 11, 2005 6:36 AM
To: user@struts.apache.org
Subject: Re: displayTag needs session scoped objects for sort/export ?


you can but have to hit the DB every time.

On 6/11/05, Lixin Chu <[EMAIL PROTECTED]> wrote:
> Hi,
> would like to clarify with those who use displayTag:
> is it a must to put list of objects into session to be able sue sort
> and export function ?
>
> thanks
> lixin
>

-
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: displayTag needs session scoped objects for sort/export ?

2005-06-11 Thread Lixin Chu
you can but have to hit the DB every time.

On 6/11/05, Lixin Chu <[EMAIL PROTECTED]> wrote:
> Hi,
> would like to clarify with those who use displayTag:
> is it a must to put list of objects into session to be able sue sort
> and export function ?
> 
> thanks
> lixin
>

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



Re: [OT] using JSTL with escapeXML="false" for preview HTML

2005-06-11 Thread Mark Benussi
Wow. I have been blown away. Been doing this job for 8 years and NEVER knew 
that! (Some of you may be thinking how the hell did he get that far).


Original Message Follows
From: Michael Jouravlev <[EMAIL PROTECTED]>
Reply-To: Michael Jouravlev <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Subject: Re: [OT] using JSTL  with escapeXML="false" for preview 
HTML

Date: Sat, 11 Jun 2005 00:36:40 -0700

  is a non-breaking space. Regular space is just &sp;

On 6/11/05, Mark Benussi <[EMAIL PROTECTED]> wrote:
>  
>
> -Original Message-
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
> Sent: 10 June 2005 20:00
> To: user@struts.apache.org
> Subject: Re: [OT] using JSTL  with escapeXML="false" for preview
> HTML
>
> What's an 'html special space char'?
>
> Lixin Chu wrote:
>
> > Hi,
> > I am trying to preview a piece of html content. but the c:out with
> > escapeXML=false can not handle space char correctly.
> >
> > is there an easy way to replace the '  ' with html special space char ?
> >
> > thanks
> > lixin
>
>
> -
> 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: [OT] using JSTL with escapeXML="false" for preview HTML

2005-06-11 Thread Michael Jouravlev
  is a non-breaking space. Regular space is just &sp;

On 6/11/05, Mark Benussi <[EMAIL PROTECTED]> wrote:
>  
> 
> -Original Message-
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
> Sent: 10 June 2005 20:00
> To: user@struts.apache.org
> Subject: Re: [OT] using JSTL  with escapeXML="false" for preview
> HTML
> 
> What's an 'html special space char'?
> 
> Lixin Chu wrote:
> 
> > Hi,
> > I am trying to preview a piece of html content. but the c:out with
> > escapeXML=false can not handle space char correctly.
> >
> > is there an easy way to replace the '  ' with html special space char ?
> >
> > thanks
> > lixin
> 
> 
> -
> 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: [OT] using JSTL with escapeXML="false" for preview HTML

2005-06-11 Thread Mark Benussi
 

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
Sent: 10 June 2005 20:00
To: user@struts.apache.org
Subject: Re: [OT] using JSTL  with escapeXML="false" for preview
HTML

What's an 'html special space char'?

Lixin Chu wrote:

> Hi,
> I am trying to preview a piece of html content. but the c:out with
> escapeXML=false can not handle space char correctly.
> 
> is there an easy way to replace the '  ' with html special space char ?
> 
> thanks
> lixin


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