Re: A trivial problem ...

2002-11-29 Thread Antoni Reus
Hi,

If the remote ejbs and ejb clients are in the same JVM some containers let you 
optimize the access enabling passing objects by reference.

There is a descriptor tag in weblogic-ejb-jar.xml called 
 that you can set to false (but I thought that it 
was tuned off by default!)


Salut!

A Divendres 29 Novembre 2002 20:29, Velmurugan M. va escriure:
> I m using Weblogic 6.1 for deploying ear
> which contains some session bean and struts code. On calling a remote
> method ( rM) in a session bean from strutsAction Class execute() method, I
> m getting a Object, say remObj. I m modifying the remObj. And on second
> call to remote method rM, I m getting the changed remObj. ( I am not using
> any LocalInterface as specified in EJB 2.0). I believe any object that is
> returned from calling a EJB Object is passed by value and  any modification
> to the returned object should have no effect on the original object in
> Session bean. When I test the EJB with a different client (Normal Java
> classes) running on different JVM, this problem does not occur.
>
> Why is the struts frame work behaves like this? Or Is there any special
> configuration to be done to run struts framework in separate JVM? If it is
> the problem with web Container or EJB server provider, can sb point me
> exact place where I need to ask this question.?
>
> regards
> velmuruganm
>
>
> *
> Disclaimer: The information in this e-mail and any attachments is
> confidential / privileged. It is intended solely for the addressee or
> addressees. If you are not the addressee indicated in this message, you may
> not copy or deliver this message to anyone. In such case, you should
> destroy this message and kindly notify the sender by reply email. Please
> advise immediately if you or your employer does not consent to Internet
> email for messages of this kind.
> *


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: i18n, resource bundles, ...

2002-11-24 Thread Antoni Reus
Hi, take a look at

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11852


A Divendres 22 Novembre 2002 21:16, Joshua McCulloch va escriure:
> That shouldn't be any different than
> 
>
> I forgot to mention the exception occuring with that
> statement. It looks like the magic happening in the
> java.text.* classes with a {0,number,currency}
> argument requires a java.lang.Number.
>
> org.apache.jasper.JasperException: Cannot format given
> Object as a Number
>   at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
>248) at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
>
>
> <...etc...>
>
> root cause
>
> java.lang.IllegalArgumentException: Cannot format
> given Object as a Number
>   at
> java.text.NumberFormat.format(NumberFormat.java:204)
>   at java.text.Format.format(Format.java:116)
>   at
> java.text.MessageFormat.format(MessageFormat.java:737)
>   at
> java.text.MessageFormat.format(MessageFormat.java:486)
>   at java.text.Format.format(Format.java:116)
>
> --- James Mitchell <[EMAIL PROTECTED]> wrote:
> > > it won't compile, its expecting a
> >
> > java.lang.String:
> >
> > try this...
> >
> >   >arg0="<%= new
> > Double("1234.56").toString() %>"/>
> >
> >
> >
> > --
> > James Mitchell
> > Software Engineer/Struts Evangelist
> > http://www.open-tools.org
> >
> > "If you were plowing a field, which would you rather
> > use? Two strong oxen or
> > 1024 chickens?"
> > - Seymour Cray (1925-1996), father of supercomputing
> >
> > > -Original Message-
> > > From: Joshua McCulloch
> >
> > [mailto:[EMAIL PROTECTED]]
> >
> > > Sent: Friday, November 22, 2002 2:43 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: i18n, resource bundles,
> >
> > ...
> >
> > > Can someone please help me understand how to use
> > > arguments for  ?
> > >
> > > I have an ApplicationResource with the following
> > > message:
> > >
> > > submit.price=It costs {0,number,currency}!
> > >
> > > How can I display that from a JSP? The following
> > > doesnt work because arg0 is a String.
> > > 
> > >
> > > I havent used JSP tags much.
> > > http://husted.com/struts/tips/004.html shows the
> > > following syntax:  > > key="ordering.authorized.range.staff" arg0='<%=
> > > config.getStaffAuthAmnt() %>'/>
> > > I tried arg0="<%= new Double("1234.56") %>" and it
> > > wont compile, its expecting a java.lang.String:
>
> C:\tomcat\work\Standalone\localhost\josh\submit_jsp.java:134:
> > > setArg0(java.lang.String) in
> > > org.apache.struts.taglib.bean.MessageTag cannot be
> > > applied to (java.lang.Double)
> > >   _jspx_th_bean_message_11.setArg0( new
> > > Double("1234.56") );
> > >
> > > What am I doing wrong?
> > >
> > > THANKS!
> > > - Josh
>
> __
> Do you Yahoo!?
> Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Question About Modules

2002-11-20 Thread Antoni Reus
Hi,

A Dimecres 20 Novembre 2002 17:26, Madel,Kurt va escriure:
> My understanding is that you have to use an extension mapping in order to
> use the Module functionality, i.e. '*.do'
>
> What are people doing if they need to serve say a '.pdf' from an action?
> That is, my pdf is dynamic and requires the use of the same DAO's that I
> use for my jsp pages.  Sure you can set the mime type, but Internet
> Explorer ignores these most of the time and counts on the extension.  If
> you map *.pdf and *.do then you won't be able to server static pdf's???
>
> Kurt Madel
> Programmer, CSMi
> (703) 823-4300 ext. 170

You can suggest a file name to the browser setting the Content-Disposition 
header  (RFC 2183)

String fileName = "theFile.pdf"
response.setContentType("application/pdf");
response.setHeader("Content-Dispostion", "inline; filename=" + fileName);



Salut!

-- Antoni Reus

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




Re: Using : Tomcat 3.2.2

2002-11-16 Thread Antoni Reus
Hi,

Can you be more specific?
Can you post an snip of your code?

Salut!

-- Antoni Reus

A Dissabte 16 Novembre 2002 17:32, vze49jqg va escriure:
> Hi I am using Tomcat 3.2.2 , struts 1.0
> I am having this problem :
>
> I have a ArrayList myArr which is populated by the Bean {A} , the
> arraylist contains object of another Bean {B}.
>
> if I say
> 
> Hello World
> 
>
> It iterates Hello world for the number of objects in myArrlst,
> but when I try to use a method call inside the logic:iterate tag it says
> getter / setter not present.
> I can do the same thing as above with Java Iterator and calling bean's
> individual getter/ setter methods.
>
>
> Any help will be greatly appreciated.
> Regards
> Gopal


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




Re: Making peace between Struts logic iterate and Ed Hill's display tag...

2002-11-09 Thread Antoni Reus
I don't understant why you can't use logic:iterate tag. 

Anyway, why don't you use a "for" instead of all those "if", something like 
this ?


<%!
// Convert a int to a 2 digit String
private String int2DString(int i) {
   String number = new Integer(i).toString();
   if ( i < 10) {
  number = "0" + number;
   }
}

private String propName(int i) {
   i++; // i was zero-based
   return "stuff" + int2DString(++i);
}

private String propTitle(int i) {
   i++; // i was zero-based
   return "Stuff " + int2DString(++i);
}
%>

<%
FooBarBean FooBarBean =
  (FooBarBean)request.getAttribute(FooBarBean.LOOKUP_KEY);
%>



   
  
   Beautiful Looking Spreadsheet in the Broswer
  Brought to you by Hideously Ugly Looking Code
  
   

   

   

   <% for (int i = 0; i < 30 ; i++) { %>

  <% if (FooBarBean.isExistingColumn(i)) { %>

  

  <% } // end If %>

<% } // End For %>






A Dissabte 09 Novembre 2002 15:59, David McLure va escriure:
> Last month a fellow by the name of Rick Ruemann [[EMAIL PROTECTED]]
> posted a reply to an email inquiry of mine, turning me on to Ed Hill's
> marvelous display tag library (Hi Rick!).  It turns out that Ed's web
> site URL is actually http://edhill.its.uiowa.edu/display-0.8/  (implying
> that Ed might have even a newer version of the tag library now, but I
> digress...)  :
>
> From: Rick Reumann [[EMAIL PROTECTED]]
>
> >Sent: Thursday, October 10, 2002 8:02 PM
> >To: Struts Users Mailing List
> >Subject: Re: Ideas for doing a spreadsheet-styled tables using Struts
>
> tags
>
> >On Thursday, October 10, 2002, 7:55:21 PM, David wrote:
> >
> >DM> I am currently looking for ideas on ways to display potentially
> >DM> large amounts of data in a spreadsheet format using Struts.
> >
> >Check out using this display tag:
> >http://edhill.its.uiowa.edu/display/
> >
> >I couldn't live without it:) (Even will provide a link that you
> >can click on to export the display to Excel).
> >
> >Excellent tag.
> >
> >--
> >
> >Rick
> >mailto:maillist@;reumann.net
>
> Since then, with Rick's help (and Rick deserves a lot of credit for
> figuring out how to use this display tag library by the way), I have
> managed to implement the display tag in my Struts based application and
> it seems to work just fine.  The problem?  My code is ugly as sin!  It's
> so bad, that after glancing over my shoulder the other day, one of my
> best friends at work (Hi Russ!) has already warned me that it will
> undoubtedly fail the upcoming code review.  He's got a point too - it is
> Coyote Ugly Code!
>
> The reason is that neither Rick nor I have figured out a way to make Ed
> Hill's display tag live peacefully with Struts logic iterate tags.  As a
> result, I have JSP code which looks something like the following :
>
> <%
> FooBarBean FooBarBean =
> (FooBarBean)request.getAttribute(FooBarBean.LOOKUP_KEY);
> %>
>  cellpadding="0" border="0" width="569" styleClass="DataTableBorder"
> scope="request">
> 
>    Beautiful Looking
> Spreadsheet in the Broswer Brought to you by Hideously Ugly Looking
> Code
>
>  styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="FooBar Code" />
> <% if (FooBarBean.isExistingColumn(0)) { %>
> styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="Stuff 01" />
> <% } if (FooBarBean.isExistingColumn(1)) { %>
> styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="Stuff 02" />
> <% } if (FooBarBean.isExistingColumn(2)) { %>
> styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="Stuff 03" />
>...etc., etc...
> <% } if (FooBarBean.isExistingColumn(29)) { %>
> styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="Stuff 30" />
> <% } %>
>  styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="FooBar Total" />
> 
>
> ... and Java code to support this which is simply to hideous looking to
> post in front of a family audience... (Russ happened to catch me
> desparately trying to prettify the most hideous looking class of the
> bunch!  There are some things which simply no combination of comments
> can help :-).
>
> So please, just shoot me already!  Either that, or help me with this
> agonizing problem which is causing me to lose sleep (normally I sleep
> late on Saturday mornings if I stay up late the night before).  Of
> course, it doesn't help that in this case, I have variable columns which
> may or may not appear (causing the need for the additional "if
> (FooBarBean.isExistingColumn(x))" scriptlet code.  Even without that
> problem though, it seems that I would still end up having to in line my
> display columns with silly looking class properties like stuff00,
> stuff01, stuff02, etc., all the way to stuff29 for each of my 30
> possible data columns when I would normally write a much sexier loop
> through an array (or even sexier - a collection) - all because Struts
> logic:iterate tags 

Re: Broken Pipe Exception Problem

2002-11-06 Thread Antoni Reus
Hi,

This has to do with http clients closing the connection while the server is 
writing to the response, so the container throws an IOException.

This is not a problem (besides the growing logs ;)


A Dimecres 06 Novembre 2002 23:21, Venkat R va escriure:
> Please advise if there is any resolution to this issue. We are experiencing
> same problem. Same configuation(iPlanet web server, Weblogic 6.1 )
>
>
>
> Thanks,
>
> Venkat.
>
>
>
> Date: Tue, 6 Aug 2002 10:13:38 -0700 (PDT)From: Vicky Das
> <[EMAIL PROTECTED]>Subject: Broken Pipe Exception ProblemContent-Type:
> text/plain; charset=us-ascii
>
> Hi,   We are seeing a lot of broken pipe exceptions inour weblogic log
> files. The configuration that we areusing is : iPlanet acting as a
> webserver (but servingonly the static assets) and WebLogic at the
> backend(with a bunch of other gizmos) . Listed below is thesnippet of the
> exception: javax.servlet.jsp.JspException: Input/output
> error:java.io.IOException: Broken
> pipe  atorg.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:
>149)   atjsp_servlet._jsp._US._en.__11_1_C._jspService(__11_1_C.java:183)  atwe
>blogic.servlet.jsp.JspBase.service(JspBase.java:27)atweblogic.servlet.inter
>nal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)atweblogic.servl
>et.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)atweblog
>ic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java
>:215)  atorg.apache.struts.action.ActionServlet.processActionForward(ActionSe
>rvlet.java:1759)   atorg.apache.struts.action.ActionServlet.process(ActionServ
>let.java:1596) atorg.apache.struts.action.ActionServlet.doGet(ActionServlet.
>java:492)  atjavax.servlet.http.HttpServlet.service(HttpServlet.java:740)  atc
>om.gm.process.framework.GO2MainServlet.service(GO2MainServlet.java:79) atjav
>ax.servlet.http.HttpServlet.service(HttpServlet.java:853)  atweblogic.servlet
>.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)  atweblogic
>.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)  at
>weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
>ntext.java:2456)   atweblogic.servlet.internal.ServletRequestImpl.execute(Serv
>letRequestImpl.java:2039)  atweblogic.kernel.ExecuteThread.execute(ExecuteThr
>ead.java:139)  atweblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)The
> exception always orginates from the same strutstemplate insert tag. Could
> anyone tell me the cause ofthis exception? I would be willing to provide
> you withmore details if what I have mentioned here is notsufficient.Thanks
> in advance.Cheers,- Vicky.
>
>
>
> -
> Do you Yahoo!?
> HotJobs - Search new jobs daily now


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Re[6]: java.util.Date

2002-11-06 Thread Antoni Reus
A Dimecres 06 Novembre 2002 22:55, Rick Reumann va escriure:
> On Wednesday, November 6, 2002, 4:51:58 PM, Antoni wrote:
>
> AR> The problem is that during execution of SimpleDateFormat.parse some
> private AR> fields of SimpleDateFormat are modified.
>
> A yes thank you. I bet I have this problem in other pieces of
> my code as well. What would you recommend doing? Should I
> synchronize the convert() method? or should I do it like I
> initially had it where I created a separate instance of
> SimpleDateFormat each time in the convert method? Which would
> incur less overhead and be faster? Or maybe neither of the above
> approaches is correct?
>

Your approaches are correct.

I haven't made any tests but I think that in most cases the faster method 
would be to synchronize on the SimpleDateFormat object before calling to 
format or parse.


> Thanks again for making this clearer.



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Re[4]: java.util.Date

2002-11-06 Thread Antoni Reus
Hi,

A Dimecres 06 Novembre 2002 22:31, Kris Schneider va escriure:
> Apologies if I'm misinterpreting, but I think Antoni's concern is that the
> SimpleDateFormat's parse and format methods are not thread-safe. The
> creation of the converters and their registration can obviously be
> accomplished in a thread-safe manner, but if multiple threads call into
> parse and/or format at the same time, this will cause a problem. If that's
> not what Antoni was saying...it's still a problem ;-). Shouldn't you code a
> Converter's convert method with the same approach to thread-safety as an
> Action's execute/perform method? If your Converter maintains a
> SimpleDateFormat instance field that it uses to either format or parse,
> it's not thread safe.
>

That's exactly what I was trying to say! 

Thanks for the clarification



> Quoting Rick Reumann <[EMAIL PROTECTED]>:
> > On Wednesday, November 6, 2002, 4:05:45 PM, Antoni wrote:
> >
> > AR> Hi, I don't speak english very very well, so this is a bit
> > AR> difficult for me to  explain, but I'll try ;-) 
> >
> > No problem. Most American's don't speak English very well
> > (including myself I'm sure:)
> >
> > AR> I have'nt looked at the beanutils Converter registration, do you have
> > to
> >
> > AR> register a class or an instance?
> >
> > It registers an instance one time in the static block at the top
> > of the action:
> >
> > static {
> > DateBeanUtilsConverter dateConverter = new
> > DateBeanUtilsConverter();
> > dateConverter.setFormatPattern( "MMdd" );
> > StringBeanUtilsConverterDate myStringConverter = new
> > StringBeanUtilsConverterDate();
> > myStringConverter.setFormatPattern( "MMdd" );
> > ConvertUtils.register( dateConverter, java.util.Date.class );
> > ConvertUtils.register( myStringConverter, String.class );
> > }
> >
> > AR> The problem here is that if there is only one instance of your class,
> > and
> >
> > AR> setFormatPattern is only called once, then if there are two request
> > that
> >
> > AR> require the use of your class a the same time, served by different
> > threads,
> > AR> the parse method in your instance of SimpleDateFormat might be called
> > AR> concurrently, so (as it isn't thread save) it might fail.
> >
> > I'm not sure how this would happen as Eddie have both pointed out
> > that the static block will only get called one time regardless of
> > how many instances are created (at least on a single JVM I'm
> > pretty sure that's the case). (On top of that I'm pretty sure on
> > one JVM user's all share one servlet instance unless you maybe use
> > that SingleThreadModel which I think hands them out from a pool.
> > Moot point though I think if I do the stuff in the static block.
> > But I could be wrong).
> >
> > --
> >
> > Rick
> > mailto:maillist@;reumann.net
> >
> >
> > --
> > To unsubscribe, e-mail:
> > 
> > For additional commands, e-mail:
> > 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Re[4]: java.util.Date

2002-11-06 Thread Antoni Reus
A Dimecres 06 Novembre 2002 22:19, Rick Reumann va escriure:
> On Wednesday, November 6, 2002, 4:05:45 PM, Antoni wrote:
>
> AR> Hi, I don't speak english very very well, so this is a bit
> AR> difficult for me to  explain, but I'll try ;-) 
>
> No problem. Most American's don't speak English very well
> (including myself I'm sure:)
>

:)

> AR> I have'nt looked at the beanutils Converter registration, do you have
> to AR> register a class or an instance?
>
> It registers an instance one time in the static block at the top
> of the action:
>
> static {
> DateBeanUtilsConverter dateConverter = new
> DateBeanUtilsConverter(); dateConverter.setFormatPattern( "MMdd" );
> StringBeanUtilsConverterDate myStringConverter = new
> StringBeanUtilsConverterDate(); myStringConverter.setFormatPattern(
> "MMdd" );
> ConvertUtils.register( dateConverter, java.util.Date.class );
> ConvertUtils.register( myStringConverter, String.class );
> }
>
> AR> The problem here is that if there is only one instance of your class,
> and AR> setFormatPattern is only called once, then if there are two request
> that AR> require the use of your class a the same time, served by different
> threads, AR> the parse method in your instance of SimpleDateFormat might be
> called AR> concurrently, so (as it isn't thread save) it might fail.
>
> I'm not sure how this would happen as Eddie have both pointed out
> that the static block will only get called one time regardless of
> how many instances are created (at least on a single JVM I'm
> pretty sure that's the case). (On top of that I'm pretty sure on
> one JVM user's all share one servlet instance unless you maybe use
> that SingleThreadModel which I think hands them out from a pool.
> Moot point though I think if I do the stuff in the static block.
> But I could be wrong).

The problem is not in the static code, the problem is reusing the same 
instance of SimpleDateFormat

Your initial aproach is fine. But let see what could happen if you move the 
SimpleDateFormat creation to the setFormatPattern method:

- when the class loader loads your Action the static bloc is executed:
1- an instance of your converter is created
2- the setFormatPattern is called and an instance off SimpleDateFormat is
 created.
3- the converter instance is registered

- there are 2 request at the same time that target an action that uses 
BeanUtils.copyProperties with a bean that has a Date.
- the 2 request are served by to differents threads A and B

4- thread A begins the execution of the Action.execute, 
5- thread A begins the execution of BeanUtils.copyProperties
6- thread A begins the execution of DateBeanUtilsConverter.convert
7- thread A begins the execution of SimpleDateFormat.parse 

8- thread A is stopped and thread B begins the execution

9- thread B begins the execution of the Action.execute, 
10- thread B begins the execution of BeanUtils.copyProperties
11- thread B begins the execution of DateBeanUtilsConverter.convert
12- thread B begins the execution of SimpleDateFormat.parse 

13- thread B is stopped and thread A begins the execution

14 - thread A continues the execution of SimpleDateFormat.parse , but a 
internal attribute of SimpleDateFormat where modified and it fails.

The problem is that during execution of SimpleDateFormat.parse some private 
fields of SimpleDateFormat are modified.


You can take a look at

http://developer.java.sun.com/developer/bugParade/bugs/4228335.html

for details on the format classes not being thread-save issue



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Re[2]: java.util.Date

2002-11-06 Thread Antoni Reus
Hi, I don't speak english very very well, so this is a bit difficult for me to 
explain, but I'll try ;-)  

see below ...

A Dimecres 06 Novembre 2002 21:37, Rick Reumann va escriure:
> On Wednesday, November 6, 2002, 3:21:28 PM, Antoni wrote:
>
>
> AR> Keep in mind that DateFormat (and SimpleDateFormat) is not thread safe
> so you AR> have to be very careful when reusing them.
>
> I like Max's suggestion though. I think I will move it to the
> setFormatPattern for sure. Correct me if I'm wrong here...
>
> Since the registration of this Converter takes places in a static
> block in the top of my DispatchAction the setFormatPattern should
> only be called once, since isn't only once instance of my
> DispatchAction created (and thus only one initial load in the
> static block?). I guess I could be extra careful and synchronize
> setFormatPattern since I don't think that should incur too much
> overhead since in my situation I can imagine more than one
> instance of the Action class being created.

I have'nt looked at the beanutils Converter registration, do you have to 
register a class or an instance?

The problem here is that if there is only one instance of your class, and 
setFormatPattern is only called once, then if there are two request that 
require the use of your class a the same time, served by different threads, 
the parse method in your instance of SimpleDateFormat might be called 
concurrently, so (as it isn't thread save) it might fail.





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Adding a parameter to a URL + can I use the JSTL expression language with struts?

2002-11-06 Thread Antoni Reus
Hi,

Why don't you just use an input of type hidden?

If you are using an ActionForm add the property objID and use



if not then you can just use




A Dimecres 06 Novembre 2002 07:03, Jim Collins va escriure:
> Sorry to be a pain but has anyone got any idea how to fix this problem?
> Also can I use the JSP expression language with struts?
>
> Thanks
>
> Jim
>
> > Hi,
> >
> > I have a JSP called upload.jsp with a form and file tag like this:
> >
> > 
> > Please Input The File You Wish to Upload:
> >   
> >   
> > 
> >
> > The page that calls upload.jsp also passes a parameter called objID, I
>
> would
>
> > like to add this parameter to the action URL but I don't know how to.
> >
> > I did try using a normal html form tag and jstl to add the paramerer like
> > this:
> >
> > 
> > 
> > 
> >
> > >
> > 
> > 
> >
> > This sets the correct action url in the generated html but I get a bean
> > utils exception when I press the submit button.
> >
> > Any help would be appreciated.
> >
> > Thanks
> >
> > Jim.
> >
> > PS I don't want to use a scriptlet if I can help it. I have seen previous
> > postings from Craig where he advises against using scriptlets.
> >
> >
> > --
> > To unsubscribe, e-mail:
>
> 
>
> > For additional commands, e-mail:
>
> 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: java.util.Date

2002-11-06 Thread Antoni Reus
Hi,

see below ...

A Dimecres 06 Novembre 2002 11:29, Max Kutny va escriure:
>  RR> I'm posting this with a different subject line so it will hopefully
>  RR> come up in the archives if someone needs to search for it.
>
>
>  RR> public class DateBeanUtilsConverter implements Converter {
>
>  RR>   private String formatPattern = null;
>
>  RR>   public void setFormatPattern(String formatPattern) {
>  RR> this.formatPattern = formatPattern;
>  RR>   }
>
>  RR>   public Object convert(Class type, Object value) {
>  RR> Date date = null;
>
>  RR> if (value != null && (value instanceof String) && (type ==
>  RR> Date.class)) {
>  RR> try {
>
>  RR> String s = value.toString();
>  RR> SimpleDateFormat formatter =
>  RR>new SimpleDateFormat(formatPattern);
>
> It's probably better to move SimpleDateFormatter creation to
> setFormatPattern method. This would help avoid unnecessary object
> creations.
>

Keep in mind that DateFormat (and SimpleDateFormat) is not thread safe so you 
have to be very careful when reusing them. 
 

>
>  RR> date = formatter.parse(s);
>
>  RR> } catch (Exception e) {
>  RR> //log error
>  RR> }
>  RR> }
>  RR> return date;
>  RR>   }
>
>  RR> }


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Nice labels for inputs.

2002-10-29 Thread Antoni Reus
Hi,


The struts-html tags have the styleId attribute, that will output and "id" 

Salut!

-- Antoni Reus

A Dimarts 29 Octubre 2002 22:31, Josh Berry va escriure:
> I am not real sure of what to call what I am trying to do, so nice labels
> will have to work.
>
> Due to my amazing irritation with having to check a tiny little box for a
> radio/checkbox select when there is a large label I could be checking, I
> used to use the  tag quite extensively.  I am not sure that this had
> any benefit in Netscape, but it did have the benefit of allowing a user to
> click on a label and having the  element associated update.
>
> Now, unfortunately, the time I tried to do this with struts, I ran into the
> problem of "id" not being allowed in any of the  input tags.  So,
> while I can still use the  tag all day, there is no way for me to
> associate it with the correct input element.  That is, a typical input
> (again, radio and checkbox receive the most benefit) should look something
> like this:
>
> Male
>
> Is there any reason that "id" is not allowed on the struts input tags? 
> Does anyone else see the benefit?  I know it sounds asinine, but that is
> one the often unused standard tags that I wish received more use.
>
> -josh

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>




Re: a little javascript problem

2002-10-25 Thread Antoni Reus
Hi,

A Divendres 25 Octubre 2002 20:30, Vincent Stoessel va escriure:
> Uh oh, it seems I can't use the 'id' attribute in html:* form elements.
>
> I need to do this in a form element :
> onClick="disableIt(document.getElementById("myID"))
>
> but I cannot do this on the target form element.
>
> 
> because that violates the DTD, I guess.
>
> Any workarounds?

The elements of a Form (javascript) object can be accessed by name with
theForm.elements["boo"]


Salut,

-- Antoni Reus



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>




Re: about images and db

2002-10-20 Thread Antoni Reus
Hi,

A Diumenge 20 Octubre 2002 17:09, Frederic Laub va escriure:
> Hi,
>
> I'm also interested in the two cases.
> The first case is clear to me, writing the byte data directly to out.
> The second case, I would appreciate if you could clarify. What do you mean
> by holding the content type in the bean.
> An example of the second option would be wonderful!
>

I mean creating a value object, something like an implementation of 
org.apache.struts.upload.FormFile

to hold the binary data, the content type ("image/png", "image/jpg"  ), 
etc ...

Then, the Action would call the business methods to get this value object and 
would save it in the request, and forward to a servlet that would retrieve 
the value object from the request, set the content type and write the data to 
the response.

This way you can reuse the servlet in case you have documents, like pdfs in 
your database as blobs or something.

Every time you need to stream a file, you only need to define an action that 
calls the business method to get the file value object and save it to the 
request.

In struts-config.xml you would have something like this:






   


and in web.xml

  
fileServlet
the.servlet.that.writes.the.Files
  

  
fileServlet
/fileServlet
  


Salut,

 --Antoni Reus

> Thanks in advance.
> Frederic
>
> -Original Message-
> From: Antoni Reus [mailto:antoni.reus@;wanadoo.es]
> Sent: 20 October 2002 16:12
> To: Struts Users Mailing List
> Subject: Re: about images and db
>
> A Diumenge 20 Octubre 2002 15:34, kiuma va escriure:
> > thx , for your reply but I meant if was possible something like
> >
> > 
> > ...
> > hello!
> > ..
> > 
> >
> > using only custom tags
>
> Then, the are 2 different requests, the one that returns the html and the
> one
> that returns the image (you can't include the image data in the html)
>
> In the html you could have:
>
> 
> ...
> hello!  
> ...
> 
>
> And  showImage.do  would be the Action that we talked about before.
>
> > Antoni Reus wrote:
> > >Hi,
> > >
> > >A Diumenge 20 Octubre 2002 11:47, kiuma va escriure:
> > >>What could you suggest to me to display images stored in a database.
> > >>When I get them in a bean what could I do to show them on a web d.
> > >> page?
> > >
> > >You can:
> > >
> > >1. In a Action:
> > >   response.setContentType( "the type of the image" );
> > >   OutputStream out = response.getOutputStream();
> > >   ... write the data (byte array?) to out 
> > >   return null;
> > >
> > >2. Or you could save the bean representing the image (content type, and
> > > data) in the request and forward to a servlet, and write the data to
> > > the response in the servlet.
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
> > > <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional
> > > commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>
> > >
> > >.


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>




Re: about images and db

2002-10-20 Thread Antoni Reus
Hi,

A Diumenge 20 Octubre 2002 11:47, kiuma va escriure:
> What could you suggest to me to display images stored in a database.
> When I get them in a bean what could I do to show them on a web d. page?

You can:

1. In a Action:
response.setContentType( "the type of the image" );
OutputStream out = response.getOutputStream();
... write the data (byte array?) to out 
return null;

2. Or you could save the bean representing the image (content type, and data) 
in the request and forward to a servlet, and write the data to the response 
in the servlet.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: about images and db

2002-10-20 Thread Antoni Reus
A Diumenge 20 Octubre 2002 15:34, kiuma va escriure:
> thx , for your reply but I meant if was possible something like
>
> 
> ...
> hello!
> ..
> 
>
> using only custom tags
>

Then, the are 2 different requests, the one that returns the html and the one 
that returns the image (you can't include the image data in the html)

In the html you could have:


...
hello!  
...


And  showImage.do  would be the Action that we talked about before.



> Antoni Reus wrote:
> >Hi,
> >
> >A Diumenge 20 Octubre 2002 11:47, kiuma va escriure:
> >>What could you suggest to me to display images stored in a database.
> >>When I get them in a bean what could I do to show them on a web d. page?
> >
> >You can:
> >
> >1. In a Action:
> > response.setContentType( "the type of the image" );
> > OutputStream out = response.getOutputStream();
> > ... write the data (byte array?) to out 
> > return null;
> >
> >2. Or you could save the bean representing the image (content type, and
> > data) in the request and forward to a servlet, and write the data to the
> > response in the servlet.
> >
> >
> >--
> >To unsubscribe, e-mail:  
> > <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional
> > commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>
> >
> >.


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>




Re: Can V in MVC be Swing in Struts?

2002-10-18 Thread Antoni Reus
Hi,

A Dijous 17 Octubre 2002 19:31, Xue-Feng Yang va escriure:
>  --- "Craig R. McClanahan" <[EMAIL PROTECTED]>
> wrote: >
>
> > On Thu, 17 Oct 2002, Xue-Feng Yang wrote:
> > > Date: Thu, 17 Oct 2002 13:19:48 -0400 (EDT)
> > > From: Xue-Feng Yang <[EMAIL PROTECTED]>
> > > Reply-To: Struts Users Mailing List
> >
> > <[EMAIL PROTECTED]>
> >
> > > To: Struts Users Mailing List
> >
> > <[EMAIL PROTECTED]>
> >
> > > Subject: RE: Can V in MVC be Swing in Struts?
> > >
> > > Let me copy your answer here with #, and tell me
> >
> > where
> >
> > > is your "correct" answer.
> > >
> > > > And you didn't understand the answer correctly
> > :
> > :-).
> > :
> > > # There are at least two different ways to
> >
> > accomplish
> >
> > > # this:
> > >
> > > #* Have your Action write the XML output directly
> >
> > to
> >
> > > #the response,
> > > #  and then return null (indicates that the
> >
> > response
> >
> > > #has been completed,
> > > #  so no forwarding is necessary).
> >
> > To use output directly generated by an Action
> > (either serialized objects,
> > or directly created XML), use this.
>
> Hahaha, where is the VO in your message with #? You
> only talked about XML not VO.
>


html, xml, serialized objects, pdf, svg,  what's the difference?

For serialized objects:

Set the content type to "application/x-java-serialized-object"
Grab the ServletOuputStream in a ObjectOutputStream and write(Object it)
return null 


Salut,

-- Antoni Reus


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>




Re: - Is it possible???

2002-10-18 Thread Antoni Reus
Hi,

A Divendres 18 Octubre 2002 01:09, Tuan H. Le va escriure:
> Hi,
> I have two classes Salary and Employee
>
> public class Salary {
>   private Date date;
>   private double amount;
>   private float meritPercent;
>   ...
>   // and Salary class accessor methods (setter/getter)
> }
>
> public class Employee {
>   Salary salary;
>   private int id;
>   private String lastName;
>   ...
>   // and Employee class accessor methods
> }
>
> In my JSP page, it needs to display a collection (List) of Employee records
> with Salary data.
>
>  indexId="idx"> 
> 
>
> How do I display the employee's salary record, ie: amount, merit percent,
> ...?
>

 

You can navigate through properties with the '.' operator.

The above means empleyee.getSalary().getAmount()


> Thanks in advance for your help!
>
> Tuan


Salut!

-- Antoni Reus

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>




Re: Structure Advice for logic:iterate

2002-10-15 Thread Antoni Reus

Hi,

what about a list_date_shedule

list_date_shedule : -  date_shedule *
date_shedule :- Date list_city
list_city :- city *
city :- String


To get the three columns you should do something like:



... output date  open table or tr etc...



 output name  
if  i % 3 = 0 change row



... close tr or table etc 




A Dimarts 15 Octubre 2002 21:46, Adam Sherman va escriure:
> On 10/15/02 12:33:11 -0700, Wendy Smoak wrote:
> > Adam wrote:
> >> I need to present data like this
> >> Heading One
> >> OneTwo Three
> >> Four   FiveSix
> >> Heading Two
> >> Seven  Eight
> >> Heaging Three
> >> Nine   Ten Eleven
> >> Etc.
> >
> > Not enough info... are the 'one' 'two' 'three' things all of the same
> > type? Will there always be exactly  three columns & two rows under
> > 'Heading One'? What do you mean 'etc.' at the end?  More headings?  Or
> > are the headings set in advance?
> >
> > Maybe if you mock up a static HTML example, it would be easier to see
> > what you need to do.  Be sure to note what things are variable-- if you
> > know the columns but the number of rows may vary, etc.
>
> http://www.teachandtravel.com/site/infosessions/schedule.php?division=Canad
>a
>
> This is the existing page, done in PHP.
>
> It's a rolling schedule, displays data from "today" until the end of the
> database.
>
> Thanks for the help!
>
> A.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Tiles - Forward problem

2002-10-14 Thread Antoni Reus

Hi,

A Dilluns 14 Octubre 2002 16:44, Heligon Sandra va escriure:
> I only have to not cast the result of the findForwardConfig method ?
>

No, you have to change the call to processActionForward for 
processForwardConfig. The  TilesRequestProcessor overwrites 
processForwardConfig to look for tiles definitions.


> Sandra
>
> -Original Message-
> From: Antoni Reus [mailto:[EMAIL PROTECTED]]
> Sent: 14 October 2002 16:39
> To: Struts Users Mailing List
> Subject: Re: Tiles - Forward problem
>
>
> Hi,
>
> A Dilluns 14 Octubre 2002 10:59, Heligon Sandra va escriure:
> > I have overridden the TilesREquestProcessor in order to test
> > if a user is authenticated for each request, but it doesn't work:
> >
> > protected boolean processPreprocess(HttpServletRequest request,
> > HttpServletResponse response)
> > {
> > // Get the session object
> > HttpSession session = request.getSession();
> >
> > try{
> >
> >   // Test if the request is a login request
> >   String path = processPath(request, response);
> >   if ( !path.equals((String) "/login") )
> >   {
> > // If not a login page, test if the user is authenticated on
> > the application server
> > User userInfo =
> > (User)session.getAttribute(Constants.USER_KEY);
> >
> > if ( userInfo == null ||
> >   (userInfo != null && userInfo.getSessionId() == 0) )
> > {
>
> Change this:
> > processActionForward(request, response,
> >
> > (ActionForward)appConfig.findForwardConfig("login"));
>
> for this:
>
>processForwardConfig(request, response,
>   appConfig.findForwardConfig("login"));
>
> > }
> >   }
> > }
> > // if a servlet exception occurs
> > catch (ServletException ex)
> > {
> > }
> > //if an input/output error occurs
> > catch (IOException ex)
> > {
> > }
> > return true;
> > }


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




Re: Tiles - Forward problem

2002-10-14 Thread Antoni Reus

Hi,


A Dilluns 14 Octubre 2002 10:59, Heligon Sandra va escriure:
> I have overridden the TilesREquestProcessor in order to test
>   if a user is authenticated for each request, but it doesn't work:
>
>   protected boolean processPreprocess(HttpServletRequest request,
> HttpServletResponse response)
>   {
>   // Get the session object
>   HttpSession session = request.getSession();
>
>   try{
>
> // Test if the request is a login request
> String path = processPath(request, response);
> if ( !path.equals((String) "/login") )
> {
>   // If not a login page, test if the user is authenticated on
> the application server
>   User userInfo =
> (User)session.getAttribute(Constants.USER_KEY);
>
>   if ( userInfo == null ||
> (userInfo != null && userInfo.getSessionId() == 0) )
>   {

Change this:

>   processActionForward(request, response,
>
> (ActionForward)appConfig.findForwardConfig("login"));


for this:

 processForwardConfig(request, response,
appConfig.findForwardConfig("login"));



>   }
> }
>   }
>   // if a servlet exception occurs
>   catch (ServletException ex)
>   {
>   }
>   //if an input/output error occurs
>   catch (IOException ex)
>   {
>   }
>   return true;
>   }
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: When *exactly* does reset get called?

2002-10-12 Thread Antoni Reus

Hi,

A Dissabte 12 Octubre 2002 14:08, Howard Miller va escriure:
> Hi,
>
> Can soebody explain when the reset method of ActionForm gets called?
>
> My problem is that I am using the method to prepopulate the form (which
> works). The previous jsp had a link to the following jsp (the jsp not its
> action - .jsp not .do, ok). The reset obviously runs and the preloaded
> values appear.
>
> When I submit the form, the reset method appears to get called again, so I
> lose my user entered values. Not wat I expected. And yes the 
> tag does point to the .do action.
>
> Confused very!
>
> HM

The reset method is called on every request that uses the form, before 
populating it with the parameters in the current request, and calling the 
action.

You can do a "selective" reset with something like this

public void reset ( mapping, request) {

if (!mapping.getPath().equals( "whatever"))  {
    // do the reset
} 
}



Salut,

-- Antoni Reus






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




Re: Struts 1.1B: Classpath entries in Manifest.mf file of struts.jar

2002-10-10 Thread Antoni Reus

Hi,

A Dijous 10 Octubre 2002 22:13, Hohlen, John va escriure:
> Unlike Struts 1.0, Struts 1.1 is built upon various libraries from the
> Jakarta Commons project.  As a result, these necessary libraries are listed
> as classpath elements in the "manifest.mf" file of the "struts.jar" file.
> More specifically:
>
> Class-Path: commons-beanutils.jar commons-collections.jar
> Class-Path: commons-dbcp.jar commons-digester.jar
> Class-Path: commons-logging.jar commons-pool.jar
> Class-Path: commons-services.jar commons-validator.jar
> Class-Path: jakarta-oro.jar
>
> My team is using WebLogic 6.1 SP 2.  If our "struts.jar" contains a
> "manifest.mf" with the above classpath elements, then we have to include
> the "struts.jar" file in the classpath used to boot WebLogic (even though
> the "struts.jar" file is included in the "WEB-INF\lib" folder).  Otherwise,
> we get the exception listed below.  Conversely, if we take the classpath
> elements out of the "manifest.mf" file, then the "struts.jar" does not need
> to be included in the WebLogic classpath, and the server boots fine.  Can
> anyone explain this?  Thanks, JOHN
>

I have deployed struts 1.1b2 apps to Weblogic 6.1sp3 without modifying server 
classpath. May be its a weblogic sp2 issue.


Salut,

-- Antoni Reus

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




Re: help on validate attribute

2002-10-10 Thread Antoni Reus

Hi,

A Dijous 10 Octubre 2002 19:43, Billy Ng va escriure:
> Hi folks,
>
> If I put validate=true in the action tag, the form will be validated once
> it is load.  Is it a right behavior?  Since there is no data in the form
> bean, some madatory fields that I specify in the validate method will be
> treated as error.  How should I handle it?
>
> Billy Ng

If you put validate="true" in a action-mapping the form will be populated and 
then validated before the perform (now execute) method of the action is 
called.

validate="true" should be used in the action that "receives" the post, not the 
action that generates the html form!


Salut,

-- Antoni Reus


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




Re: display Date in struts1.1

2002-10-10 Thread Antoni Reus

Hi,

A Dijous 10 Octubre 2002 16:53, Cathy Osekizoglu va escriure:
>  I got Date from DB, I used formatKey="EEE MMM d, yy hh:mm", in my jsp
> file.The Date is displayed as "Thu Oct 9, 02 09:37" on my page. I want to
> display it as "10-09-02 09:37". What format should I use to achieve this?
> Please help me.
> Best regards,
> Cathy
>
>

"MM-dd-yy hh:mm" 


>
> -
> Post your free ad now! Yahoo! Canada Personals


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: help, I'm desperate!!!!

2002-10-10 Thread Antoni Reus

Hi,


A Dijous 10 Octubre 2002 16:29, kiuma va escriure:
> This is the page and it is perfectly blank under IE
>
> 
> 
>  href="http://192.168.100.3:8080/webappointments/secure/userlist.jsp";>
> Lista utenti

1   

> 
> 
>