Re[2]: Locale access from within a bean?

2000-12-12 Thread Oleg V Alexeev

Hello Ned,

Tuesday, December 12, 2000, 12:47:05 PM, you wrote:

NS Thanks, that would be great.

NS I reckon that there should be some kind of method to allow the bean property 
NS to specify it's format... somehow. I'll have a think.

This tag extends bean:write tag and adds one attribute above it -
format. If you use this tag as bean:write - without format attribute -
then locale from session will be used as base for printing of date and
number values. If format is specified then this format string will be
used as base for values printing. Format string rules you can find in
API doc for Java.

Add class from attachment to struts framework and extend
struts-bean.tld with next strings -

tag
nameformat/name
tagclassorg.apache.struts.taglib.bean.FormatTag/tagclass
bodycontentempty/bodycontent
attribute
namefilter/name
requiredfalse/required
rtexprvaluetrue/rtexprvalue
/attribute
attribute
namename/name
requiredtrue/required
rtexprvaluetrue/rtexprvalue
/attribute
attribute
nameproperty/name
requiredfalse/required
rtexprvaluetrue/rtexprvalue
/attribute
attribute
namescope/name
requiredfalse/required
rtexprvaluetrue/rtexprvalue
/attribute
attribute
nameformat/name
requiredfalse/required
rtexprvaluetrue/rtexprvalue
/attribute
/tag


-- 
Best regards,
 Olegmailto:[EMAIL PROTECTED]
 FormatTag.java


Identifying calling page

2000-12-12 Thread Phillips, George H.

Hello,

I have a couple of jsp pages (a menu and a browse) which share the same
action class and action mapping .  This works fine except for when errors
occur - I set up the error messages and return via:

return (new ActionForward(mapping.getInputForm()));

This works great when there's a one-to-one correspondance between pages and
actions, but it returns me to the page listed in the action mapping, which
in my case may or may not be the page which invoked the action class.  The
obvious solution is a separate action mapping for each page, but this
results in two mappings for every page listed on every menu page.  This
could be a fairly sizable system and I'd like to avoid that if I can.

I couldn't find any titles in the archives addressing this and my
understanding of how the classes involved relate is incomplete, so I guess
my question is - when sharing action mappings/classes is there a way to
correctly identify which page invoked the action class so that I can return
to it directly?  

George Phillips
University of Miami Information Technology
1365 Memorial Drive Rm. 202-H
Coral Gables, FL  33146
Phone: 305-284-5143
Email:  [EMAIL PROTECTED]




Where is the form:error property=xxxxx tag?

2000-12-12 Thread Johan Compagner

Hi,

I have attached 2 html files as an example;
Errors.html is the default one that i get when using: form:errors/ tag in a jsp file.
and a
Error.html is the one that i want to have.

form:errors/ has some drawbacks like:
1 The layout of the input screen suddenly changes.
2 You must link the error text and the right input field with each other.  (the user 
must, visually)
In the second approace the error text is right besides the input field.

You do store errors under it's property name:
   errors.add("fromAddress", new ActionError("error.fromAddress.required"));

so with that in mind there must be somthing to get one specifiek error very easy 
without much code.
something like this: (registration.jsp example from adress section)

tr
th align="right"
  bean:message key="prompt.fromAddress"/
/th
td align="left"
  form:text property="fromAddress" size="50"/
/td
  /tr

becomes this:

tr
th align="right"
  bean:message key="prompt.fromAddress"/
/th
td align="left"
  form:text property="fromAddress" size="50"/
font color=#ffform:error property="fromAddress"//font
/td
  /tr

The form:error property="fromAddress"/ returns the same error string that belowns
to that property or "" if none set.

Before i code this myself i thought let's ask it before i do something twice.

Johan  Compagner






Title: Register for the MailReader Demostration Application












Validation ErrorYou must correct the following error(s) before proceeding:
From Address is required
Full Name is required
Username is required







  

  Username:


  

  
  

  

  

  Password:


  

  

  

  (Repeat) Password:


  

  

  

  Full Name:


  

  

  

  From Address:


  

  

  

  Reply To Address:


  

  

  

  


  
  
  

  









Title: Register for the MailReader Demostration Application










  

  Username:


  

  
	Username is required
  

  

  

  Password:


  

  

  

  (Repeat) Password:


  

  

  

  Full Name:


  
	Full Name is required

	
  

  

  From Address:


  
	From Address is required

  

  

  Reply To Address:


  

  

  

  


  
  
  

  











Re: Where is the form:error property=xxxxx tag?

2000-12-12 Thread Jean-Baptiste Nizet



Johan Compagner wrote:

 Hi,

 I have attached 2 html files as an example;
 Errors.html is the default one that i get when using: form:errors/ tag in a jsp 
file.
 and a
 Error.html is the one that i want to have.

 form:errors/ has some drawbacks like:
 1 The layout of the input screen suddenly changes.
 2 You must link the error text and the right input field with each other.  (the 
user must, visually)
 In the second approace the error text is right besides the input field.

 You do store errors under it's property name:
errors.add("fromAddress", new ActionError("error.fromAddress.required"));

 so with that in mind there must be somthing to get one specifiek error very easy 
without much code.
 something like this: (registration.jsp example from adress section)

 tr
 th align="right"
   bean:message key="prompt.fromAddress"/
 /th
 td align="left"
   form:text property="fromAddress" size="50"/
 /td
   /tr

 becomes this:

 tr
 th align="right"
   bean:message key="prompt.fromAddress"/
 /th
 td align="left"
   form:text property="fromAddress" size="50"/
 font color=#ffform:error property="fromAddress"//font
 /td
   /tr

 The form:error property="fromAddress"/ returns the same error string that belowns
 to that property or "" if none set.

 Before i code this myself i thought let's ask it before i do something twice.


I have implemented an xxx:ifErrorExists and xxx:ifErrorMissing tag. Here's the doc 
of these tags:


ifErrorExists - tests if a specific error exists, for a specific property

Executes its body if a specific error is found. If name is not specified, the tag 
checks if one or more
errors exist for the specified property. If name is specified, then the tag checks 
that the specific
error exists for the specified property. If not specified, the property defaults to 
the "global"
property, i.e., the tag searches for global errors, not associated with any property.

Attribute  Description
 Should be omitted in most cases. Name of the request scope bean under 
which a String[]
   errorsNameobject has possibly been stored. [The value of the 
org.apache.struts.Action.ERROR_KEY
 constant string].
  name   Name of the specific error to test.
property Name of the property the error is associated with.

ifErrorMissing - tests if a specific error exists

Executes its body if a specific error is not found.If name is not specified, the tag 
checks if one or
more errors exist for the specified property. If name is specified, then the tag 
checks that the specific
error exists for the specified property. If not specified, the property defaults to 
the "global"
property, i.e., the tag searches for global errors, not associated with any property.

Attribute  Description
 Should be omitted in most cases. Name of the request scope bean under 
which a String[]
   errorsNameobject has possibly been stored. [The value of the 
org.apache.struts.Action.ERROR_KEY
 constant string].
  name   Name of the specific error to test.
property Name of the property the error is associated with.

This allows you to put an image or a text behind a form field if there is one or more 
errors associated
with this field.
I would of course be honored if these tags were put in the struts distribution.
The code of these tags is trivial, but I can mail it to you if you want.

JB.


 Johan  Compagner

   
   Name: saveRegistrationErrors.html
saveRegistrationErrors.htmlType: Hypertext Markup Language (text/html)
   Encoding: 7bit

  Name: saveRegistrationError.html
saveRegistrationError.htmlType: Hypertext Markup Language (text/html)
  Encoding: 7bit

--
Jean-Baptiste Nizet
[EMAIL PROTECTED]

RD Engineer, S1 Belgium
Kleine Kloosterstraat, 23
B-1932 Sint-Stevens Woluwe
+32 2 200 45 42





A Christmas present from The DJ Agency KlubDJ

2000-12-12 Thread KlubDJ

Hi, 

KlubDJ still have DJ's available across the country for the festive season! We even 
have a few slots left for the much requested Producers, Remixes and DJ's, LUMINA... 

Please contact us for more details preferably by email for initial enquiries 

[EMAIL PROTECTED] 


Happy Christmas and Mental New Year  


From all at KlubDJ 
w: www.klubdj.co.uk 
e: [EMAIL PROTECTED] 
t: 07092 171780 
f: 07092 171790




Re: Templating Mechanism

2000-12-12 Thread David Geary

I just committed changes to the template:put tag and the template tld. The tag
works exactly like it did before, but now you can put direct content in the body
of the put tag.

If the put tag has body content:

1. You can't have a content attribute. (the tag body is the content)
2. You can't specify direct='false'. (tag body content is printed directly)

The tag will throw an exception if either of those conditions are violated.


david


"Holloway, Kevin (DEH)" wrote:

 Hi,

 For a trial, we modified the template code so that a template:put tag with
 NO "content" attribute took its content from the tag body.  A template:put
 with a "content" attribute took its content by including the file named by
 the content attribute.  This did away with the "direct" attribute entirely.

 The only small issue was what if you had both content attribute and tag
 body.  An exception could be thrown.  We just ignore the body, making it
 clear in the documentation that this is what happens.

 We can send our code if that would help.

 Kevin Holloway
 Applications Architect
 Department for Environment and Heritage
 Government of South Australia

 -Original Message-
 From: Tan Siow Boon [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, November 28, 2000 11:59 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Templating Mechanism

 Hi,

 We found the template:ExtPut tag extension provided by Oleg V Alexeev very
 useful. Is there a plan to incorporate it into Struts 1.0 ?

 Regards, SiowBoon

 Oleg V Alexeev wrote:

  Hello Andrew,
 
  Some time ago I write tag to extend template mechanism in this way.
  Use it if you find it useful.
 
  This tag can be used like template:put tag except one feature - if
  you omit content property in it, then body of this tag will be treated
  as content. For example -
 
  template:extput name="body"
   Some content
  /template:extput
 
  Sourse you can find in attachment. This class - whole mirror of PutTag
  except some strings of code.
 
  Strings to add to the struts-template.tld
 
  tag
  nameextput/name
  tagclassorg.apache.struts.taglib.template.ExtPutTag/tagclass
  bodycontentJSP/bodycontent
  attribute
  namename/name
  requiredtrue/required
  rtexprvaluetrue/rtexprvalue
  /attribute
  attribute
  namecontent/name
  requiredfalse/required
  rtexprvaluetrue/rtexprvalue
  /attribute
  attribute
  namedirect/name
  requiredfalse/required
  rtexprvaluetrue/rtexprvalue
  /attribute
  /tag
 
  Monday, November 13, 2000, 7:45:55 PM, you wrote:
 
   The template mechanism in the article is nearly identical to the one in
   Struts. See org.apache.struts.taglib.template.
 
  AB I've been looking at the templating code, and
  AB have what I hope is a simple question.
 
  AB When using direct="true" in the template:put tag,
  AB to place literal text into the template, the text must
  AB necessarily be very limited because it's contained in
  AB the value of the content attribute.  What I'd like to be
  AB able to do is something like:
 
  AB   !-- the contents of a specific page --
 
  AB   template:insert template='/pagetemplate.jsp'
 
  AB template:put name="navigation"
  AB... page-specific navigation here 
  AB /template:put
 
  AB template:put name="pagebody"
  AB... page body here...
  AB /template:put
 
  AB   /template:insert
 
  AB which seems similar to your examples, except that the
  AB contents of the navigation and pagebody sections are
  AB stated in line, instead of loaded from external files,
  AB which I'd rather not do because of how many tiny
  AB little documents that would end up creating.
 
  AB Is this feasible?  If the tag lib doesn't already
  AB support this function (and I believe it doesn't),
  AB is it possible to implement, and is it contrary to
  AB the intent?  I'm not comfortable enough with
  AB taglib implementation to know if doing it this way
  AB would affect the evaluation of the page body in
  AB some undesirable way.
 
  AB Andy Boyko   [EMAIL PROTECTED]
 
  --
  Best regards,
   Oleg   mailto:[EMAIL PROTECTED]
 

   Name: ExtPutTag.java
 ExtPutTag.javaType:
 application/x-unknown-content-type-java_auto_file
   Encoding: base64




Why are there 2 ForwardTag classes (and someothers)?

2000-12-12 Thread Johan Compagner

logic and in taglib have both classes that are almost exactly the same.
one difference: In logic package exceptions are first added as an attribute of 
pageContext:
pageContext.setAttribute(Action.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE);

and then the exception is thrown. 
  throw new JspException(messages.getMessage("forward.forward", name, e.toString()));

in taglib only the exception is thrown.

Why is this?

Johan Compagner





Follow-Up: WebLogic 6.0 Beta and Struts

2000-12-12 Thread Craig R. McClanahan

As promised, I followed up with the WebLogic representative (Mark Spotswood,
[EMAIL PROTECTED]) regarding the topic of WebLogic's 6.0 beta requiring
serializable *servlet context* (i.e. application scope) attributes, as opposed
to serializable *session* attributes.  This requirement prevents the Struts
Example Application from running under the current beta, because it uses
non-Serializable servlet context attributes for the message resources object, as
well as for the pseudo-database used to represent the application data.

We agreed that this restriction is indeed mandated by the WebLogic container,
and *not* by the servlet API specification.  Mark ackowledged that his quoting
the servlet spec commands about *session* attributes was somewhat confusing, and
could have been mis-interpreted.

Further, Mark explained the technical reason that WebLogic imposed this
requirement (to enable automatic reloading of web applications when classes are
changed).  Depending on how you build your web application class loader, this is
not at all an unreasonable design choice.

As a workaround, Mark recommended turning off the support for automatic
reloading (which is on by default).  However, in subsequent testing he found
that following this suggestion still doesn't remove the WebLogic requirement --
so the Struts example application still won't run.  He has filed an issue with
WebLogic support to address this in some future release of the 6.0 beta.  For
the short term, however (until WebLogic issues an update or patch for this),
Struts applications will not work under the WebLogic 6.0 beta.

In summary, this particular issue has turned out to be a container-specific
item.  However, it has highlighted the fact that Struts is being contemplated
for use in large scale, distributed, application servers -- and that Struts
should make every effort to use Serializable servlet context (application scope)
attributes where possbile.  As a result of this, I'm undertaking a review of all
the objects that the core Struts framework (as opposed to the example
application) stores in servlet context attributes.  Most of them can be easily
made Serializable -- the hard one is the MessageResources class, which utilizes
Java's underlying support for resource bundles.  Unfortunately, these classes do
*not* implement Serializable, so this class needs to be re-implemented.  Work to
do this is in progress.

Craig McClanahan





Re: When locale negociation should occur?

2000-12-12 Thread Craig R. McClanahan

Pierre Métras wrote:

 Hi,

 The locale negociation to display localized messages occurs in the
 ActionServlet. So, a Struts application will not display localized messages
 before the first action.

 How can we negociate the locale desired by the user with the very first page
 displayed?

 Do we need a setLocale tag, so we can write an index.jsp page like the
 following:
 html
 head
 setLocale /
 logic:forward name="firstPage" /
 /head
 /html
 But this is not good because we have a configuration flag in web.xml and a
 tag for the first page...

 Or should each localizing tag check if the negociation has already occured,
 instead of ActionServlet?


This is certainly one approach -- and would be especially useful if people tend
to bookmark a page within your app rather than entering at the "front".

For the latter sort of people, one other strategy would be to declare a "welcome
page" for your application that actually invokes the controller servlet, so that
you get locale negotiation even the first time.

welcome-file-list
welcome-filesetup.do/welcome-file
/welcome-file-list

(I'm not sure every servlet 2.2 container supports a servlet as the welcome
page, but it's required in 2.3.)


 What do you think?

 Pierre Métras




Re: Identifying calling page

2000-12-12 Thread Craig R. McClanahan

"Phillips, George H." wrote:

 Hello,

 I have a couple of jsp pages (a menu and a browse) which share the same
 action class and action mapping .  This works fine except for when errors
 occur - I set up the error messages and return via:

 return (new ActionForward(mapping.getInputForm()));

 This works great when there's a one-to-one correspondance between pages and
 actions, but it returns me to the page listed in the action mapping, which
 in my case may or may not be the page which invoked the action class.  The
 obvious solution is a separate action mapping for each page, but this
 results in two mappings for every page listed on every menu page.  This
 could be a fairly sizable system and I'd like to avoid that if I can.

 I couldn't find any titles in the archives addressing this and my
 understanding of how the classes involved relate is incomplete, so I guess
 my question is - when sharing action mappings/classes is there a way to
 correctly identify which page invoked the action class so that I can return
 to it directly?


One approach that has been suggested in the past is to use the HTTP "Referer"
header to figure this out.  Unfortunately, if you follow the Struts
recommendation to do forwarding (rather than redirecting), this won't work -- as
far as the browser is concerned, the referer will be the URL of the previous
*action* that was executed, not the *page* that was generated in response to
that action.

The easiest way I can think of to do this would be to include the actual name of
the input page as a hidden field.  Hmm, that sounds like something a custom tag
could do for me ...


 George Phillips
 University of Miami Information Technology
 1365 Memorial Drive Rm. 202-H
 Coral Gables, FL  33146
 Phone: 305-284-5143
 Email:  [EMAIL PROTECTED]

Craig McClanahan





Re: Why are there 2 ForwardTag classes (and someothers)?

2000-12-12 Thread Craig R. McClanahan

Johan Compagner wrote:

 logic and in taglib have both classes that are almost exactly the same.
 one difference: In logic package exceptions are first added as an attribute of 
pageContext:
 pageContext.setAttribute(Action.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE);


The tags listed in "struts.tld" (and implemented in the org.apache.struts.taglib 
package) are
the Struts 0.5 version of the tags, and are only kept for backwards compatibility.  
New code
should use the separate tag libraries.


 and then the exception is thrown.
   throw new JspException(messages.getMessage("forward.forward", name, e.toString()));

 in taglib only the exception is thrown.


The new tags have many additional features -- one of them being exposing any 
exceptions that
occur as a request attribute, so that you can access them in a JSP error page.  No 
effort is
being expended to update the old versions of these tags, because they are being 
deprecated.


 Why is this?

 Johan Compagner

Craig





Re: debugging with struts/tomcat/JBuilder

2000-12-12 Thread Steven D. Wilkinson

I have done it for a nightly build (struts 1.0).
To debug within the struts classes you must include the struts src code and jar
file.  The src code is from the dist/struts/src/share directory if you download
the nightly src distribution.  I had problems if I had more than one web
application using struts, because the location of the struts.jar file needs to
be under the WEB-INF/lib directory.  There is probably a better way, but I got
it working so I was happy.

Any more questions?

Steve

Dan Cancro wrote:

 Has anyone successfully debugged a struts 0.5 application running on Tomcat
 3.2, with JBuilder 4 Foundation version?

 I'm able to start Tomcat from JBuilder in debug mode, but I don't know how
 to open a source file from my struts application and have it stop execution
 at my breakpoints.

 Thanks




Idle timeout Handling

2000-12-12 Thread Shiraz Wasim Zaidi

Hi!,

I have just started working with the struts framework and like it a lot.
I have a question about idletimeout handling. The only way i can handle it
now is to do an idle timeout check at the start of perform method of my
action classes.
I cannot rely on getSession(false) check as i wont get a null session in
case i have a
session scoped form asscoiated with the mapping. I can check for some
attribute say user
profile that i bind to the session in the Authenticating action class.

Is there someother way idle timeouts can be handled then doing it repeatedly
in almost every action class?

Appreciate any response.


Thanks,
Shiraz