Re: JavaBeans creation

2001-07-07 Thread UEHARA Junji

Hi,

I have writen a tiny emacs macro function that create setter and
getter method from a Java variable definition.  I think its very
useful especially if you are a user of emacsen.

---snip---snip---snip---snip---snip
(defun make-accessor(&optional arg)
  "Generate and insert accessor methods. If apply with C-u, just
getter methods whould be inserted."
  (interactive "P")
  (save-excursion
(if (search-forward-regexp
 "\\(pubic\\|private\\|protected\\|static\\|[ \t\n]\\)+\\([a-zA-Z_0-9]+\\)[ 
\t\n]+\\([a-zA-Z_0-9]+\\)[ \t\n]*[;=]")
(progn
  (let* ((varname (buffer-substring (match-beginning 3) (match-end 3)))
 (vartype (buffer-substring (match-beginning 2) (match-end 2)))
 (capname (concat (upcase (substring varname 0 1))
  (substring varname 1)))
 )
(end-of-line)
(newline-and-indent)
(newline-and-indent)
(insert (format "public %s get%s() {" vartype capname))
(newline-and-indent)
(insert (format "return %s;" varname))
(newline-and-indent)
(insert "}")
(indent-according-to-mode)
(if (not arg)
(progn
  (newline-and-indent)
  (newline-and-indent)
  (insert (format "public void set%s(%s arg) {" capname vartype))
  (newline-and-indent)
  (insert (format "%s = arg;" varname))
  (newline-and-indent)
  (insert "}")
  (indent-according-to-mode)
  )))
---snip---snip---snip---snip---snip



Marc-andre Thibodeau <[EMAIL PROTECTED]> writes:
> Hi!
> 
> Could anybody suggest me a tool for generating JavaBeans setters and
> getters automatically?
> Thanks!
> 
> MA
> 
> 

-- 
--
UEHARA, Junji
Advanced System developing department,
Electronic Commerce Development Center

NTT Software corporation
223-1, Yamashita-cho Naka-ku Yokohama City, 
Kanagawa Pref. , Japan 231-8554
Tel: +81-45-212-7408
Fax: +81-45-212-7948



validation

2001-07-07 Thread cahana



I have a jsp page that has input fields for personal 
information, so i made a PersonalInfoForm with all the setters and getters and a 
validate method.  On this jsp i also have a drop down list that gets 
created by an array of beans:
 
        
 
I pass "ethncityArray", which is an array of TranslateItem 
beans, to this page via the request.  The problem i have is that when the 
validate method is called when i hit submit and an error occurs, it goes back to 
the jsp but the jsp can no longer find "ethnicityArray".  Subsequently an 
error is thrown.  Does anyone know how i can fix this, aside from putting 
it in the session?
 
cameron


Re: NotEqual or Present?

2001-07-07 Thread Martin Cooper

I have just added two new logic tags to Struts 1.1 which solve this problem.
Those tags are  and . In essence, 'empty' means
either null or an empty string. So your example would become:


show this if property "searchParam" is not equal to ""


--
Martin Cooper


- Original Message -
From: "Matt Raible" <[EMAIL PROTECTED]>
To: "Struts User" <[EMAIL PROTECTED]>
Sent: Monday, July 02, 2001 11:17 AM
Subject: NotEqual or Present?


I am trying to check if the user entered a value for a search criteria
in a results page.  My ActionForm sets a property to "" if the user did
not enter a value.

So in the following code, I want to only show it if the property does
not equal "".  But the following does not work, should it?


show this if property "searchParam" is not equal to ""


Thanks,

Matt






Re: If no ActionForm associated with Action....ActionForm isnull???

2001-07-07 Thread Martin Cooper

Yes.

--
Martin Cooper


- Original Message - 
From: "Jonathan Asbell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 05, 2001 5:23 AM
Subject: If no ActionForm associated with ActionActionForm is null???


Hello.  In places where there are no forms and thus did not configure an
ActionForm for a particular Action, does the ActionForm object which is
passed to the perform method have a "null" vlaue?






Re: Cannot find bean in scope null

2001-07-07 Thread Craig R. McClanahan



On Wed, 27 Jun 2001, Rama Krishna wrote:

> i get the same error
> 
> Cannot find bean org.apache.struts.taglib.html.BEAN in scope null because of
> this line
> 
> 
> 

One common cause for this kind of error is if the above statement is *not*
nested inside an .  As the documentation indicates, that is the
only legal use for .  But it's impossible to know if this is
the problem or not, unless you show us the entire page.

As a side comment, the normal JavaBeans convention is that property names
start with lower case letters, so you might want to change "Server" to
"server".  This will get translated into appropriate calls to the
getServer() or setServer() method of your bean.

Craig McClanahan


> 
> 
> - Original Message -
> From: "David Winterfeldt" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 27, 2001 2:49 PM
> Subject: Re: Cannot find bean in scope null
> 
> 
> > I'm not sure what it is just from the error.  If you
> > could you post your JSP, I would look at it.
> >
> > David
> >
> > --- Bob Byron <[EMAIL PROTECTED]> wrote:
> > > I am getting the following error when I try to
> > > process
> > > my user entry form.  Any ideas?  I would like a
> > > general idea of what I should do when I get this
> > > type
> > > of error.
> > >
> > > Included servlet error: 500
> > > Location: /test/userentry.jsp
> > > Error Location: /test/logon.jsp
> > > Internal Servlet Error:
> > >
> > > javax.servlet.ServletException: Cannot find bean
> > > org.apache.struts.taglib.html.BEAN in scope null
> > >
> > > Thank You,
> > > Bob Byron
> > >
> > >
> > > __
> > > Do You Yahoo!?
> > > Get personalized email addresses from Yahoo! Mail
> > > http://personal.mail.yahoo.com/
> >
> >
> > __
> > Do You Yahoo!?
> > Get personalized email addresses from Yahoo! Mail
> > http://personal.mail.yahoo.com/
> >
> 




Re: Is struts really loading the resources?

2001-07-07 Thread Craig R. McClanahan

What servlet container are you using?  Some containers have horrendous
bugs related to loading resource files via the web app class loader.

Craig McClanahan

On Wed, 27 Jun 2001, Bob Byron wrote:

> I am new to struts and trying to get down some of the
> basics.  I am trying to use the command: 
> 
> 
> When I do, I get the following exception:
> javax.servlet.jsp.JspException: Missing message for
> key header.title
> 
> I have verified that my ApplicationResources file does
> contain:
> header.title=MY TEST
> 
> Checking the log earlier, I find the following
> confirmation that the ApplicationResources properties
> were loaded, or were they:
> 2001-06-27 09:20:31 - path="/test" :action: Loading
> application resources from resource
> ApplicationResources
> 
> The previous log entry mentions nothing about the
> resource file being found and loaded successfully.  Am
> I missing something?  How do I know that they
> properties file was definately loaded?  How can I view
> the properties that are currently available?  I am
> just not sure what avenue of debugging to pursue at
> this point.
> 
> Thank You,
> Bob Byron
> 
> 
> 
> __
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
> 




Re: Global values as Tag parameters....How???

2001-07-07 Thread Craig R. McClanahan



On Wed, 27 Jun 2001, Jonathan wrote:

> I am creating a custom Struts tag which needs to search for an object
> in a HashMap.  I want the 'key" for the object in the HashMap to be
> some agreed upon, pre-defined, final global value defined in a file
> available to the whole application.  How do I refer to this value in a
> Tag attribute?
> 
> eg.
> 
> 
> where "Globals.MESSAGES_OBJECT" is some static final variable in a file
> 

One approach that is fairly close to this would be a runtime expression:



Craig





RE: Delegating the request processing to an Action class

2001-07-07 Thread Craig R. McClanahan

I would not be too concerned about the performance impact of Oleg's
suggested approach.  After all, the controller servlet is just going to do
a RequestDispatcher.forward() back to itself, which has no more
performance impact than the usual RequestDispatcher.forward() used to
transfer control to a JSP page in the usual case.

Craig


On Wed, 27 Jun 2001, Rey Francois wrote:

> 
> This will work as well indeed, and is a lot simpler than what I suggested.
> However it will go through the web server layers again before it gets to the
> container and then the ActionServlet, which will do the usual things as with
> any request. The solution I proposed was more an optimized solution and
> should be considered only if performance is an issue. We actually developped
> this solution as part of a DispatcherAction, which we use in forms so that
> the submit can forward to more than one action (using a parameter which
> contains the action path preceded by a special prefix).
> 
> Fr.
> 
> -Original Message-
> From: Oleg V Alexeev [mailto:[EMAIL PROTECTED]]
> Sent: 27 June 2001 14:39
> To: [EMAIL PROTECTED]
> Subject: Re: Delegating the request processing to an Action class
> 
> 
> Hello ssuku,
> 
> Wednesday, June 27, 2001, 4:24:58 PM, you wrote:
> 
> 
> 
> shhc> Hi,
> shhc>  How can a  request processing be delegated from an Action class
> to
> shhc> another?
> 
> shhc> Thanks
> shhc> Sandhya
> 
> Return forward to another action -
> 
>  return new ActionForward( "someaction.do" );
> 
> 
> 
> -- 
> Best regards,
>  Olegmailto:[EMAIL PROTECTED]
> 
> 
> 
> The information in this email is confidential and is intended solely
> for the addressee(s).
> Access to this email by anyone else is unauthorised. If you are not
> an intended recipient, you must not read, use or disseminate the
> information contained in the email.
> Any views expressed in this message are those of the individual
> sender, except where the sender specifically states them to be
> the views of Capco.
> 
> http://www.capco.com
> ***
> 
> 




Re: Dynamic label

2001-07-07 Thread Craig R. McClanahan



On Tue, 26 Jun 2001, Pal, Gaurav wrote:

> Hi,
> 
> I am trying to create a dynamic label HTML form through the bean:message
> tag. What I want to do is as follows:
> 
> 
> 

You got a compile error because this is not legal JSP syntax.  If you are
going to use a runtime expression, it must be the *entire* attribute
value.  Try this instead:

  "/>

> It gives a compilation error that the key string is unenclosed, anybody have
> any ideas how to do this?
> 
> Thanks in advance for your help,
> Gaurav
> 

Craig





XML library problem: Cannot load SAXParserFactory

2001-07-07 Thread Mike Bridge

Hi-

I'm trying to set up Struts 1.0 on tomcat-4.0b5, and I'm getting this error 
in the logs:

  javax.xml.parsers.FactoryConfigurationError: Cannot load class SAXParserFactory 
class "org.apache.xerces.jaxp.SAXParserFactoryImpl"

So I tried putting the Xerces-1.4.1 version of xerces.jar in $JAKARTA_HOME/common/lib, 
but I get the following error:

  javax.xml.parsers.FactoryConfigurationError: The specified class 
"org.apache.xerces.jaxp.SAXParserFactoryImpl" is not instance of 
"javax.xml.parsers.SAXParserFactory"

Any idea how to fix this problem?

Thanks,

-Mike



-- 
Mike Bridge 
<[EMAIL PROTECTED]>



Re: indexed properties

2001-07-07 Thread cahana

Niall-

Thanks i got the CourseList to work.

Cameron

- Original Message -
From: "Niall Pemberton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 11:10 AM
Subject: RE: indexed properties


> Cameron,
>
> Does the Action that is run when you submit the form have "CourseList"
> associated with it?
>
> If that sorts out the issue with not finding "CourseList" then I think
> "CourseList" should look like this:
>
> public final class CourseList extends ActionForm
> {
>   private ArrayList courseList = new ArrayList(6);
>
>  public ArrayList getCourseList() {
>   return(this.courseList);
>  }
>
>  public void setCourseList(ArrayList courseList) {
>   this.courseList = courseList;
>  }
>
>  public CourseForm getCourseList(int index) {
>   return (CourseForm)courseList.get(index);
>  }
>
> }
>
> Then in your "CourseForm" bean you need setters for all the properties
(i.e.
> crstitle, crsdept, crshrs, crsnum).
>
> Niall
>
>
>





Re: indexed properties

2001-07-07 Thread cahana

In my struts-config.xml, i have CourseList as the form associated with the
Action to submit.  I also put a  for CourseList in the jsp. But
it still doesn't work. I'll keep trying.

Do you know if there is a way to associate mulitple forms with a single
action in the struts-config.xml file i.e.

  



Cameron
- Original Message -
From: "Niall Pemberton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 11:10 AM
Subject: RE: indexed properties


> Cameron,
>
> Does the Action that is run when you submit the form have "CourseList"
> associated with it?
>
> If that sorts out the issue with not finding "CourseList" then I think
> "CourseList" should look like this:
>
> public final class CourseList extends ActionForm
> {
>   private ArrayList courseList = new ArrayList(6);
>
>  public ArrayList getCourseList() {
>   return(this.courseList);
>  }
>
>  public void setCourseList(ArrayList courseList) {
>   this.courseList = courseList;
>  }
>
>  public CourseForm getCourseList(int index) {
>   return (CourseForm)courseList.get(index);
>  }
>
> }
>
> Then in your "CourseForm" bean you need setters for all the properties
(i.e.
> crstitle, crsdept, crshrs, crsnum).
>
> Niall
>
>
>
> -Original Message-
> From: cahana [mailto:[EMAIL PROTECTED]]
> Sent: 07 July 2001 21:40
> To: [EMAIL PROTECTED]
> Subject: indexed properties
>
>
> Hi everyone-
>
> I need some help on using the indexed properties for html:text option.
> I've implemented Dave Hay's modification and can get the input boxes to
show
> up using the iterate tag.
>
> 
>  
> <%= courseNumber++ %>
>   maxlength="50" indexed="true"/>
>   indexed="true"/>
>   indexed="true"/>
>   indexed="true"/>
>  
>  
>
> This is what my CourseList bean looks like:
>
> public final class CourseList extends ActionForm
> {
>   private ArrayList courseList = new ArrayList(6);
>
>  public ArrayList getCourseList() {
>   return(this.courseList);
>  }
>
>  public void setCourseList(ArrayList courseList) {
>   this.courseList = courseList;
>  }
>
>  public CourseForm getCourseForm(int index) {
>   return (CourseForm)courseList.get(index);
>  }
>
>  public void setCourseForm(int index, CourseForm course) {
>   this.courseList.add(index, course);
>  }
> }
>
> The problem i have is that when i try to submit the information and try to
> access CourseList.getCourseList(), it bombs and says CourseList cannot be
> found. The scope is request. I tried putting it in the session and can
> access it that way but it doesn't have the changes that were made on the
> form. Anybody know what i'm doing wrong?
>
> thanks,
> cameron
>




javax.servlet.ServletException: cant remove Attributes from request scope

2001-07-07 Thread vj nas

I had successfully configured the example  war to run on jbuilder4
But I started getting this  error message on the scope,

I am  three days  old i n  using Struts. I like it very much.

Could you please tell me why it is occuring. Is  the Servlet.jar file too 
old.
or missing some settings in server.xml, etc..,

I tried to figure out myself. But going no where.
Your help is greatly appreciated.

Thanks,
Sincerely,

Vijai.


javax.servlet.ServletException: cant remove Attributes from request scope
at java.lang.Throwable.(Throwable.java:96)
at java.lang.Exception.(Exception.java:44)
at javax.servlet.ServletException.(ServletException.java:161)
at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:386)
at 
src._0002fsrc_0002flogon_0002ejsplogon_jsp_0._jspService(_0002fsrc_0002flogon_0002ejsplogon_jsp_0.java:395)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at 
com.borland.jbuilder.webserverglue.tomcat.jsp.JspLoaderEcho.service(Unknown 
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at 
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:498)
Root cause:
java.lang.IllegalArgumentException: cant remove Attributes from request 
scope
at java.lang.Throwable.(Throwable.java:96)
at java.lang.Exception.(Exception.java:44)
at java.lang.RuntimeException.(RuntimeException.java:49)
at java.lang.IllegalArgumentException.(IllegalArgumentException.java:45)
at 
org.apache.jasper.runtime.PageContextImpl.removeAttribute(PageContextImpl.java:236)
at org.apache.struts.taglib.html.FormTag.doEndTag(FormTag.java:591)
at 
src._0002fsrc_0002flogon_0002ejsplogon_jsp_0._jspService(_0002fsrc_0002flogon_0002ejsplogon_jsp_0.java:370)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at 
com.borland.jbuilder.webserverglue.tomcat.jsp.JspLoaderEcho.service(Unknown 
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at 
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:498)
_
Get your FREE download of MSN Explorer at http://explorer.msn.com




Re: Is there any way to start struts tag in heade.jsp and endit in f ooter.jsp??

2001-07-07 Thread Martin Cooper

I'm not sure I understand. If all you have at the top is the start of a
logic tag, and all you have at the end is the end of that tag, why would you
want to pull those out into separate files? Or am I not understanding what
you want to do?

In any case, the whole tag has to be in a single JSP page. If you really
need to put them in separate files, you can use the include directive to
include them at compile time, like this:

<%@ include file="header.inc" %>

You can't use the include tag to do this dynamically, though, because each
JSP page has to be compiled into its own servlet. Breaking the tag across
pages leaves you with illegal syntax for those servlets.

--
Martin Cooper


- Original Message -
From: "Vaibhav Patil" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 5:18 AM
Subject: Is there any way to start struts tag in heade.jsp and end it in f
ooter.jsp??


> Hello,
> I have a common part to be put into all files. That is nothing
> but starting a logic tag at the top and ending it at bottom.
> Is there any way to put the starting tag in header and end into footer..
> I tried doing that, but it is saying "User defined tag not ended
> properly".
>
> thanks..
> Vaibhav
>
>





Re: Select / drop-down box

2001-07-07 Thread Martin Cooper

Is your  tag inside a  tag? Since you are not
specifying the 'name' attribute, Struts will look for the property on the
associated form bean.

--
Martin Cooper


- Original Message -
From: "Rehana Sheikh (Contractor)" <[EMAIL PROTECTED]>
To: "Struts (E-mail)" <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 6:16 AM
Subject: Select / drop-down box


> Hi, I'm having a problem with implementing a drop-down select box using
> taglibs in my jsp.code I's using:
>
>  key="createGroup.privilegeLevel" /> : 
> 
> 
> 
> 
> 
> 
>
> I get "runtime failure in Custom Tag 'select'".any ideas or code???
>
> Regards.
>





RE: iterate: offset

2001-07-07 Thread Niall Pemberton

Rama

I tried what you wrote below and the jsp ,didnt compile.

This did though, and worked :-)

  <% int row=0; %>
  


   <% row++; %>

  

Also an alternative would be to use the indexId of the IterateTag which
means you dont have to declare and increment your "row" variable.

  




  

Just out of interest - this looks like a solution to iterating through
multiple collections in parallel - is that what your using it for?

Niall


-Original Message-
From: Rama Krishna [mailto:[EMAIL PROTECTED]]
Sent: 06 July 2001 18:46
To: [EMAIL PROTECTED]
Subject: iterate: offset


hi all,

i am trying to iterate with length and offset when length="1" all the time
and offset gets incremented with each outer iteration.

i am trying to do something like this

<% int row=0; %>





<% row++; %>



as offset takes an string i am enlosing the int in quotes. no errors, but
the value remains the same.

did any one try this.

any help is greatly appreciated.

thanks,
rama.




Re: More than one resource bundles.

2001-07-07 Thread Martin Cooper

The 'bundle' attribute specifies the name of the (application, or servlet
context) attribute under which the loaded message resources are used. To use
a second bundle, you will have to load it yourself and store it as an
attribute, so that your JSPs can access it.

Probably the best way to load additional bundles is by extending
ActionServlet and overriding one of the init* methods. (The initApplication
method is where Struts loads the 'application' bundle.) That way, the bundle
will always be loaded before any of your Actions are processed.

Hope this helps.

--
Martin Cooper


- Original Message -
From: "Jain, Shipra" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 3:01 PM
Subject: More than one resource bundles.


> Hi
>
> I am a new user of Struts.  I wanted more than one resource bundles for my
> application. For e.g., One resources bundle will contain all message
> strings( MessageResources). Another contains all the images.  (
> ImageResources )
> What I understand is that using  Struts Img tag , I can specify key to the
> src attribute for this generated tag. Also, using bundle attribute of the
> Img Tag, I can specify a different bundle other than the default one
loaded
> by
> 
> application
> MessageResources
>  
> in the web.xml.
> But when I use this bundle attribute , it gives me following error.
> javax.servlet.jsp.JspException
> java.lang.Throwable(java.lang.String)
> java.lang.Exception(java.lang.String)
> javax.servlet.jsp.JspException(java.lang.String)
> java.lang.String
> org.apache.struts.util.RequestUtils.message(javax.servlet.jsp.PageContext,
> java.lang.String, java.lang.String, java.lang.String, java.lang.Object [])
> java.lang.String
> org.apache.struts.util.RequestUtils.message(javax.servlet.jsp.PageContext,
> java.lang.String, java.lang.String, java.lang.String)
> java.lang.String org.apache.struts.taglib.html.ImgTag.src()
> int org.apache.struts.taglib.html.ImgTag.doEndTag()
> My jsp code looks like
> 
> If I remove bundle from here & put the img.i1 key in my default
> MessageResources, it works fine. But as mentioned earlier , I want a
> separation between the two kind of resources.
> So , my question is if I am using the bundle attribute of ImgTag correctly
&
> where do I keep my ImageResources File or preferably specify path to it ?
> Thanks in advance of all the answers.
> Shipra Jain
> Web Developer
> GTECH Corporation
>
>





Re: Bean Introspection and tag

2001-07-07 Thread Martin Cooper

What you are seeing is the correct behaviour. I think the piece of the
puzzle you are missing is that, in the part of the JavaBeans spec you are
looking at, it says:

"Thus when we extract a property or event name *from the middle of an
existing Java name*, we
normally convert the first character to lower case."

For example, when extracting the property name from a method named
'getLastName', the first character is converted to lower case, resulting in
the property name 'lastName'.

The thing that is a bit confusing is that the JavaBeans spec talks about how
to obtain the property name from a method (getter or setter) name, whereas
we (at least you and I, anyway!) tend to think of the process the other way
around, as in "what is the getter name for this property?".

Hope this helps.

--
Martin Cooper


- Original Message -
From: "Tim Colson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 12:12 PM
Subject: Bean Introspection and  tag


> As per the bean: struts API docs, I've included an "Employee" type object
> into the request scope called "emp".
>
> emp can get/set the "mLastName" property using getLastName() and
> setLastName()
>
> However - when I try the following
>
> 
>
> I'm told that there is no "getter" method
> javax.servlet.ServletException: No getter method for property LastName of
> bean
>
> If I make the property initial lower case, it works fine:
> 
>
>
> The Bean Spec Section 8.8 says this about capitalization:
> So for example, "FooBah" becomes "fooBah"
> ---
> So for example, "LastName" becomes "lastName"
> I tried adding the accessor "getlastName()" to my Employee class - still
> fails.
>
> Property   -> get method: result
> -
> "lastName" -> getLastName() : OK
> "LastName" -> getLastName() : Fails
> "LastName" -> getlastName() : Fails
> "LastName" -> get?()
>
> I searched the archives and read more of the bean spec - but didn't pull
up
> anything useful on this. :-(
>
> Thanks,
> Tim
>
>





RE: html:link problem

2001-07-07 Thread Niall Pemberton

No it just does a single parameter, for multiple params you need to use name
or name and property which points to a HashMap of parameters.

Niall

> -Original Message-
> From: Rama Krishna [mailto:[EMAIL PROTECTED]]
> Sent: 06 July 2001 01:40
> To: [EMAIL PROTECTED]
> Subject: Re: html:link problem
>
>
> Niall ,
>
> does it work for multiple param's??? or if not how do i tackle multiple
> params??
>
> thanks,
> rama.
>
> - Original Message -
> From: "Niall Pemberton" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, July 05, 2001 4:39 PM
> Subject: RE: html:link problem
>
>
> > Rama,
> >
> > Cant you use paramProperty?
> >
> >  paramName="myCollectionElement"
> > paramProperty="id">click here
> >
> >
> > Niall
> >
> > -Original Message-
> > From: Rama Krishna [mailto:[EMAIL PROTECTED]]
> > Sent: 05 July 2001 20:10
> > To: [EMAIL PROTECTED]
> > Subject: html:link problem
> >
> >
> > is this correct
> >
> > click here
> >
> > where myCollectionElement is a  collection
> > id is a property in the collection
> >
> > and i want  http:///target.cm?value=2 (value of id)
> >
> > i get null when i say
> >
> > req.getParameter("value"); in my action class??
> >
> > any help???
> >
> > thanks,
> > rama
> >
> >
>




Re: Where to do the init() for Actions?

2001-07-07 Thread Martin Cooper

You can override the setServlet() method to do this. That method is called
with a non-null value when an instance is being created and initialised, and
then called again with a null value when the instance is about to be cleaned
up.

--
Martin Cooper


- Original Message -
From: "Andreas Schildbach" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 10:01 AM
Subject: Where to do the init() for Actions?


> Is there a similar thing to Servlet.init() in Actions?
> I want to access EJB's in Actions and have to setup the InitialContext,
look
> up some Bean Remote Interfaces, etc. I don't want to do this every time my
> Action is called.
> If I were using a plain Servlet, I would put this stuff into init()...
>
> Thanks,
>
>  - Andreas
>
>
>





RE: indexed properties

2001-07-07 Thread Niall Pemberton

Cameron,

Does the Action that is run when you submit the form have "CourseList"
associated with it?

If that sorts out the issue with not finding "CourseList" then I think
"CourseList" should look like this:

public final class CourseList extends ActionForm
{
  private ArrayList courseList = new ArrayList(6);

 public ArrayList getCourseList() {
  return(this.courseList);
 }

 public void setCourseList(ArrayList courseList) {
  this.courseList = courseList;
 }

 public CourseForm getCourseList(int index) {
  return (CourseForm)courseList.get(index);
 }

}

Then in your "CourseForm" bean you need setters for all the properties (i.e.
crstitle, crsdept, crshrs, crsnum).

Niall



-Original Message-
From: cahana [mailto:[EMAIL PROTECTED]]
Sent: 07 July 2001 21:40
To: [EMAIL PROTECTED]
Subject: indexed properties


Hi everyone-

I need some help on using the indexed properties for html:text option.
I've implemented Dave Hay's modification and can get the input boxes to show
up using the iterate tag.


 
<%= courseNumber++ %>
 
 
 
 
 
 

This is what my CourseList bean looks like:

public final class CourseList extends ActionForm
{
  private ArrayList courseList = new ArrayList(6);

 public ArrayList getCourseList() {
  return(this.courseList);
 }

 public void setCourseList(ArrayList courseList) {
  this.courseList = courseList;
 }

 public CourseForm getCourseForm(int index) {
  return (CourseForm)courseList.get(index);
 }

 public void setCourseForm(int index, CourseForm course) {
  this.courseList.add(index, course);
 }
}

The problem i have is that when i try to submit the information and try to
access CourseList.getCourseList(), it bombs and says CourseList cannot be
found. The scope is request. I tried putting it in the session and can
access it that way but it doesn't have the changes that were made on the
form. Anybody know what i'm doing wrong?

thanks,
cameron




RE: No Need To Localize

2001-07-07 Thread Niall Pemberton

The  tag uses RequestUtils to find a message - this looks for
a locale stored in session scope under the key "Action.LOCALE_KEY".

The usual way for the "locale" to be stored under this key is using the
 tag - if you dont use that, then struts will
always use the default locale.

But...if you are sure you never want an internationalized app then why don't
you do away with resource bundles altogether - just put all your messages
directly in the jsps?

Niall

> -Original Message-
> From: David White [mailto:[EMAIL PROTECTED]]
> Sent: 07 July 2001 17:37
> To: [EMAIL PROTECTED]
> Subject: No Need To Localize
>
>
> We are developing a web application using struts which will not need to
> be internationalized. Is there some way to tell struts NOT to look for
> and manipulate Locale's? In other words, there will always be one and
> only one resource bundle for tha application.
>
> Any pointer is appreciated.
>
> Thanks,
>
> David
>




RE: session form beans

2001-07-07 Thread Niall Pemberton

It doesn't - they will go when the session ends, or you have to explicitly
remove them.

Niall

> -Original Message-
> From: Jerome Jacobsen [mailto:[EMAIL PROTECTED]]
> Sent: 06 July 2001 20:09
> To: [EMAIL PROTECTED]
> Subject: session form beans
>
>
> Hi,
>
> In what cases does the Struts framework remove a Session Form
> bean from the
> Session?  Is this supposed to be done explicitly by the JSP or
> Action object
> writer?
>
> Thanks,
>
> -Jerome
>




RE: Where to do the init() for Actions?

2001-07-07 Thread Niall Pemberton

ActionServlet is a "plain Servlet" you can extend it and override the init()
method (make sure you call super.init(), so that the standard Struts init(0
stuff is done.

Niall

> -Original Message-
> From: Andreas Schildbach [mailto:[EMAIL PROTECTED]]
> Sent: 06 July 2001 18:02
> To: [EMAIL PROTECTED]
> Subject: Where to do the init() for Actions?
>
>
> Is there a similar thing to Servlet.init() in Actions?
> I want to access EJB's in Actions and have to setup the
> InitialContext, look
> up some Bean Remote Interfaces, etc. I don't want to do this every time my
> Action is called.
> If I were using a plain Servlet, I would put this stuff into init()...
>
> Thanks,
>
>  - Andreas
>
>




indexed properties

2001-07-07 Thread cahana



Hi everyone-
 
    I need some help on using the indexed 
properties for html:text option. I've implemented Dave Hay's modification and 
can get the input boxes to show up using the iterate tag.
 
 
<%= courseNumber++ %> 
 
 
 
  
 
This is what my CourseList bean looks like:
 
public final class CourseList extends 
ActionForm{  private ArrayList courseList 
= new ArrayList(6); 
 public ArrayList 
getCourseList() {  return(this.courseList); }
 
 public void setCourseList(ArrayList 
courseList) {  this.courseList = 
courseList; }
 
 public CourseForm getCourseForm(int 
index) {  return 
(CourseForm)courseList.get(index);
 }  public void setCourseForm(int 
index, CourseForm course) {  this.courseList.add(index, 
course); }}
 
The problem i have is that when i try to submit the 
information and try to access CourseList.getCourseList(), it bombs and says 
CourseList cannot be found. The scope is request. I tried putting it in the 
session and can access it that way but it doesn't have the changes that were 
made on the form. Anybody know what i'm doing wrong?
 
thanks,
cameron


Re: MultipartRequest and oreilly's servlet package

2001-07-07 Thread Martin Cooper

By the time your perform() method is called, the input stream has already
been consumed by the Struts multipart handler, so there's nothing left for
the O'Reilly one to read. You'll need to disable the Struts multipart
handler first.

Unfortunately, there isn't a good way to disable the Struts multipart
handler. Although you can specify an alternative handler as an init-param,
that has to implement the MultipartRequestHandler interface, and there's no
way to specify "no handler".

To work around this, you should be able to call setMultipartClass() in
ActionServlet, passing it null for the class name. (I haven't tried this,
but it should work.) The best time to do this would be at initialization
time, which means you would have to extend ActionServlet and override one of
the init* methods (perhaps initUpload itself).

I recently took a different approach to work around some problems with the
Struts multipart handler. Since I already had a bunch of code that was built
around the Struts mechanism, I didn't want to have to change it all, so I
wrote my own implementation of MultipartRequestHandler. I'm using Resin as
my container, which has multipart support, so I layered my handler on top of
Resin's approach and just dropped in my handler as a replacement for the
Struts handler. It seems to work well.

Hope this helps.

--
Martin Cooper


- Original Message -
From: "Tobias Meyer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 6:59 AM
Subject: MultipartRequest and oreilly's servlet package


> Hi!
>
> I was trying to implement an upload feature using oreilly's
> com.oreilly.servlet package. http://www.servlets.com/cos/
> (...and NOT using the build-in functions in struts)
>
> The oreilly stuff works great, but when I combine struts and
> the oreilly classes I'm getting an IOException
> (Corrupt form data: premature ending) in the oreilly class.
>
> This seems strange to me, does struts somehow "corrupts"
> the HttpServletRequest so that it cannot be accessed by
> oreilly's MultipartRequest class?
>
> --
> public ActionForward perform(ActionMapping mapping,
>   ActionForm form,
>   HttpServletRequest request,
>   HttpServletResponse response)
> throws IOException, ServletException
> {
>
> try {
>MultipartRequest multi =
> new MultipartRequest(request, ".", 10*1024*1024); // 10MB
> ...
> --
>
> thanks,
>
> Tobias
>
>
>





No Need To Localize

2001-07-07 Thread David White

We are developing a web application using struts which will not need to
be internationalized. Is there some way to tell struts NOT to look for
and manipulate Locale's? In other words, there will always be one and
only one resource bundle for tha application.

Any pointer is appreciated.

Thanks,

David



MultipartRequest and oreilly's servlet package

2001-07-07 Thread Tobias Meyer

Hi!

I was trying to implement an upload feature using oreilly's
com.oreilly.servlet package. http://www.servlets.com/cos/
(...and NOT using the build-in functions in struts)

The oreilly stuff works great, but when I combine struts and
the oreilly classes I'm getting an IOException 
(Corrupt form data: premature ending) in the oreilly class.

This seems strange to me, does struts somehow "corrupts"
the HttpServletRequest so that it cannot be accessed by 
oreilly's MultipartRequest class?

--
public ActionForward perform(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
throws IOException, ServletException
{

try {
   MultipartRequest multi = 
new MultipartRequest(request, ".", 10*1024*1024); // 10MB
...
--

thanks,

Tobias





RE: JavaBeans creation

2001-07-07 Thread Kent Roylance

I would suggest using JBuilder Foundation because it is free.  It has the
features you are looking for.

-Original Message-
From: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 07, 2001 12:32 AM
To: '[EMAIL PROTECTED]'
Subject: RE: JavaBeans creation


hi
why not trying to use JDeveloper by Oracle. it is a very good IDE and it
gives you the setter and getter methods ready made.


Vikramjit singh,
eAngel Team,
Global Tele-systems Ltd.
Ph. 7612929-3140

Marc-andre Thibodeau a écrit :
>
> Hi!
>
> Could anybody suggest me a tool for generating JavaBeans setters and
> getters automatically?
> Thanks!
>
> MA




Re: Struts Templates Example in VAJ 3.5.3/WTE - Problem

2001-07-07 Thread Martin



Cedric, Jon,
 
Downloaded a more recent version of Struts (30 June 
2001), added flush='true', to template:get statements and Voila !, that 
does solve the template rendering problem,
 
Thanks,
Martin