RE: html form widgets not appearing

2001-04-27 Thread Scott Cressler

Well, at least now you know you're invoking the bean:message tag.  ;-)
That's a problem I've found with debugging custom tags: if you forget the
taglib directive or screw it up, you get no complaints.

It seems to be saying it can't find your message by that key.  Can you find
any messages?  Do you have the correct reference to the properties file in
your web.xml file, e.g.:

  
  
action
org.apache.struts.action.ActionServlet

  application
  com.propel.webapp.Resources


In my case, that means the file is at
/classes/com/propel/webapp/Resources.properties .  I don't think
it necessarily has to be there (isn't there some search path for finding
it?), but that has worked for me (using resin).

Make sure you can find any message and then make sure your tag is
referencing the message key correctly, e.g., I would expect given what
you've said it would be:



Scott

> -Original Message-
> From: G.L. Grobe [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 27, 2001 4:51 PM
> To: [EMAIL PROTECTED]
> Subject: Re: html form widgets not appearing
> 
> 
> I don't get it, if I match prefix="struts-bean" w/ a tag of 
>  key ...
> it can't find the keys in the properties file, which I'd say is to be
> expected. But if I change the prefix="bean" w/ tags of 
>  making the prefix and tag the same like it should be, then I get the
> following error.
> 
> 500 Internal Server Error
> javax.servlet.jsp.JspException: Missing message for key main.title at
> org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag
> .java:242) at
> /index.jsp._jspService(/index.jsp.java:136) (JSP page line 9) at
> com.orionserver[Orion/1.4.8 (build
> 10374)].http.OrionHttpJspPage.service(Unknown Source) at
> com.evermind[Orion/1.4.8 (build 10374)]._aj._nxd(Unknown Source) ...
> 
> I traced this file in the struts code and the file is being 
> found, the key
> is in the file, there are no invisible characters, but it's 
> not find the
> key.
> 
> - Original Message -
> From: Scott Cressler
> To: '[EMAIL PROTECTED]'
> Sent: Friday, April 27, 2001 5:59 PM
> Subject: RE: html form widgets not appearing
> 
> 
> prefix="struts-html", but tag uses are  ?
> -Original Message-
> From: G.L. Grobe [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 27, 2001 3:30 PM
> To: [EMAIL PROTECTED]
> Subject: html form widgets not appearing
> 
> 
> My pages are showing up fine and the form Actions are working, w/ one
> exception, all of my pages are not displaying any of the form 
> widgets like
> radio buttons or text entry boxes and even bean message keys, 
> yet no errors
> are occurring. Is there anything wrong w/ the below page that 
> would prevent
> forms from not showing?
> 
> A problem I had before of not finding message keys was that 
> in the taglib
> lines where the prefix was only - prefix="bean" - and I 
> actually needed -
> prefix="struts-bean", though I've seen no examples of it 
> anywhere's, just
> from somebody's post, so I tried it and it worked.
> 
> TIA
> 
>  my
> index.jsp ---
>  <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="struts-bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="struts-html" %>
> 
> 
> 
> 
> 
>
> 
> 
> <%@ include file="menubar.js" %>
> <%@ include file="main.css" %>
> 
> 
> 
> 
> 
> 
> <%@ include file="header.jsp" %>
> <%@ include file="mainMenu.jsp" %>
> 
> 
> 
> 
>
>   
>  
>   
>  
>   
>   
>  
>  
>  
>   
>   
>  
>  
>  
>   
>
> 
> 
> 
> 
> <%@ include file="footer.jsp" %>
> 
> 
> 
> 



RE: html form widgets not appearing

2001-04-27 Thread Scott Cressler



prefix="struts-html", but tag uses are  
?

  -Original Message-From: G.L. Grobe 
  [mailto:[EMAIL PROTECTED]]Sent: Friday, April 27, 2001 3:30 
  PMTo: [EMAIL PROTECTED]Subject: html form 
  widgets not appearing
  My pages are showing up fine and the form Actions 
  are working, w/ one exception, all of my pages are not displaying any of 
  the form widgets like radio buttons or text entry boxes and even bean message 
  keys, yet no errors are occurring. Is there anything wrong w/ the below page 
  that would prevent forms from not showing?
   
  A problem I had before of not 
  finding message keys was that in the taglib lines where the prefix 
  was only - prefix="bean" - and I actually needed - prefix="struts-bean", 
  though I've seen no examples of it anywhere's, just from somebody's post, so I 
  tried it and it worked.
   
  TIA
   
   my index.jsp 
  ---
   <%@ page language="java" %><%@ 
  taglib uri="/WEB-INF/struts-bean.tld" prefix="struts-bean" %><%@ 
  taglib uri="/WEB-INF/struts-html.tld" prefix="struts-html" %>
   
  
   
     
   
  <%@ include file="menubar.js" %><%@ 
  include file="main.css" %>
   
  
   
  
   
  <%@ include file="header.jsp" %><%@ 
  include file="mainMenu.jsp" %>
   
  
   
     
    
      
    
    
     
    
    
   
   
   
       
  
  
   
  
  <%@ include file="footer.jsp" %>
   
  


RE: Iterate certain number of times?

2001-04-27 Thread Scott Cressler

Or a related feature, to know how many times you've iterated?  I had need to
know when I was on my last iteration so I could not put in an .  I think
it could be done differently, but right now, I'm actually porting an
existing site to struts.  I broke down and just put some Java code in to
have a counter that I could check.

I do hope improving the logic tags is on the list somewhere.  They are
pretty restrictive if you don't want to extend them.

Scott

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 27, 2001 1:46 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Iterate certain number of times?
> 
> 
> 
> 
> Thanks, but I don't need all that functionality.  I have 
> already set up the
> paging in my actions, but want to generate the links myself 
> simply looping
> through.
> 
> Is there not a way to loop through some HTML a set number of 
> times in struts
> (rather than over a collection)?!
> 
> Dave
> 
> 
> 
> 
> "Karl Basel" 
> <[EMAIL PROTECTED]> on 04/27/2001
> 04:21:17 PM
> 
> Please respond to [EMAIL PROTECTED]
> 
> To:   [EMAIL PROTECTED]
> cc:(bcc: David Hay/Lex/Lexmark)
> Subject:  RE: Iterate certain number of times?
> 
> 
> 
> Hi,
> 
> There's a good pager taglib at jsptags.com. I've used it in a 
> struts app and
> does the job quite well when embedded in the iterate tags.
> 
> 
>
>  Item Details
>
> 
> 
> Hope it helps,
> karl
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 27 April 2001 09:29
> To: [EMAIL PROTECTED]
> Subject: Iterate certain number of times?
> 
> 
> 
> 
> Hi.
> 
> Am wanting to iterate a certain number of times, based on a 
> value in my form
> bean, to create a set of page links for the number of pages 
> the user can
> view
> (similar to at the bottom of most search engine results).
> 
> How do I do this with Struts?  Obviously I am not iterating over a
> collection.
> But surely it is possible - what am I missing?
> 
> Many thanks,
> 
> Dave
> 
> 
> 
> 
> 
> 
> 
> 
> 



RE: How can I use a Image as a submit button using struts

2001-04-26 Thread Scott Cressler

Oops, guess I'm not a "nightly build" kind of guy...but maybe I should be?
I've been trying to treat this more as a product, but I suppose it's not
quite there, yet.  ;-)

Thanks (and sorry for the bug, Craig),
Scott

> -Original Message-
> From: Dan Miser [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 26, 2001 8:30 AM
> To: [EMAIL PROTECTED]
> Subject: RE: How can I use a Image as a submit button using struts
> 
> 
> Scott,
> 
> Bug #3 you referred to has been fixed for a while, and is 
> available in the 
> nightly build. Just wanted to save you the headache of adding 
> that bug too!
> --
> Dan Miser
> http://www.distribucon.com
> 
> >From: Scott Cressler <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: "'[EMAIL PROTECTED]'" 
> <[EMAIL PROTECTED]>
> >Subject: RE: How can I use a Image as a submit button using struts
> >Date: Thu, 26 Apr 2001 08:14:08 -0700
> >
> >Anyway, I ended up trying the tag (just removing height, 
> width and border):
> >
> >
> >
> >And the  tag it generated was screwed up (BUG 3)!  
> This is what I
> >got:
> >
> > alt="Save">
> >
> >Notice the missing closing double quote after "done".
> 
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 



RE: Help me defend Struts taglibs!!!

2001-04-26 Thread Scott Cressler

One thing this argument might come down to is why custom tags, especially
for "if...else" stuff (which, BTW, IMHO is not handled real well by the
struts tags...would be nicer to have more flexibility in the conditions you
can check and to have the ability to do else, rather than
.but
that's another discussion :-).  In other words, if it is so easy to just
slap some Java in their to do some conditional stuff, why use a clumsy tag.

I think that simply comes down to what someone already referred to as a
"separation of church and state" belief, but I think of it more practically.
If you currently or would like to eventually have "HTML people" do your
presentation, reserving the "Java people" to do the programming, then you
need to provide the HTML people tools that are consistent with the type of
things they are used to and also with the tools they use.  It is easier to
get Java syntax wrong, for someone who isn't a Java programmer, than it is
to get a tag wrong.

Now, if you always plan to use Java programmers to do your presentation (bad
idea, IMHO), this is not as strong of an argument, but then the other
arguments that have been used are better (i18n, etc.).

Good luck,
Scott

> -Original Message-
> From: Firmin David [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 26, 2001 1:47 AM
> To: '[EMAIL PROTECTED]'
> Subject: Help me defend Struts taglibs!!!
> 
> 
> Hi all,
> Members of my team are gradually turning against using the 
> Struts taglibs
> and resorting to scriptlets.
> IMHO: scriptlets bad,  tags good. I've had more experience in 
> using them
> than the others, but I'm finding it difficult to fight my 
> corner in the face
> of ever increasing skepticism.
> Could anyone out there with really valid arguments as to why 
> the use of the
> Struts taglibs (especially the logic tags as they're getting 
> the most grief
> from my team at the moment) or taglibs in general is "good", 
> or why the use
> of scriptlets is "bad" help me out (in the interest of 
> fairness, vice versa
> arguments also happily received!)??
> 
> Thanks in advance
> 
> Regards
> David
> 
> **
> **
> 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: help..bean write not working..

2001-04-26 Thread Scott Cressler

The thing this has always been for me was forgetting to have the taglib
directive for the bean tags at the top of my JSP.  If you forget that, the
tag is just ignored, or rather, it is just output.

Scott

> -Original Message-
> From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 26, 2001 7:17 AM
> To: '[EMAIL PROTECTED]'
> Subject: help..bean write not working..
> 
> 
> hi all, 
> 
> i cant seem to get this bean write tag to work, any ideas?
> 
> 
>  scope="request" />
> 
> 
> 
> 
> 
> 
> 
> 
> 
> type="text/css">
> 
> 
> 
> " >
> .
> ..
> .
> 
> thanx
> 



RE: How can I use a Image as a submit button using struts

2001-04-26 Thread Scott Cressler

I'm not sure what you're referring to with a gray button with an image on
top of it.  What we use in our app, without worrying about using a struts
tag to get it, is the HTML:



This is supported HTML (as of some version, but I believe it's supported by
all "modern" browsers) and simply does what you want, displays an image and
clicking on it does a submit of the form.

I believe  (not ) is supposed to generate an  tag, but, unfortunately, it does a very buggy job of it (yes,
I plan on submitting the bugs).  I thought I could just shift to the
following tag:



Turns out, the  tag doesn't even support width or height (BUG
1).  I think that's a mistake (unless it were to generate them
automatically) because these tend to help the browser display faster (I
think).  Also, the tag is documented as having a border attribute, but it
isn't defined in the tld file and so you get a complaint if you try to
specify one (BUG 2)!

Anyway, I ended up trying the tag (just removing height, width and border):



And the  tag it generated was screwed up (BUG 3)!  This is what I
got:



Notice the missing closing double quote after "done".

However, to the original question, I believe that you can and should just
use an  tag as I've done above, or Kyle's JavaScript
version, if you prefer, as either should work fine in a form generated using
.  The only thing you're missing out on, I think, is the ability
to have the URL for the image come from a message properties file, which
would aid in localization of the button.  However, perhaps the 
tag will be fixed by 1.0 ;-) and also you could probably implement that
yourself using the  tag to retrieve the "message" which was
actually the image URL.

Have fun...off to bugzilla for me.  ;-)

Scott


> -Original Message-
> From: Kyle Robinson [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 25, 2001 4:33 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: How can I use a Image as a submit button using struts 
> 
> 
> That will make a gray button with the image on top of it.  I 
> think that
> looks ugly.  The version I use makes only the image the 
> button so you can
> make your web apps look alot nicer.
> 
> -Original Message-
> From: Scott Cressler [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 25, 2001 16:08
> To: '[EMAIL PROTECTED]'
> Subject: RE: How can I use a Image as a submit button using struts 
> 
> 
> Um, I thought the  tag did this and doesn't it generate an
>  tag?
> 
> Scott
> 
> > -Original Message-
> > From: Kyle Robinson [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, April 25, 2001 4:00 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: How can I use a Image as a submit button using struts 
> > 
> > 
> > The best way I've found of doing this is with a little javascript as
> > follows:
> > 
> > 
> > 
> > 
> > 
> > For the purposes of using Struts we made a custom tag to 
> > create these...
> > 
> > -Original Message-
> > From: Natra, Uday [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, April 25, 2001 15:45
> > To: '[EMAIL PROTECTED]'
> > Subject: How can I use a Image as a submit button using struts 
> > 
> > 
> > Hi,
> > Can anybody tell me how I can simulate the functionality of 
> > 
> > 
> > I mean I need to use an Image as a submit button.
> > 
> > 
> > Thanks,
> > Uday.
> > 
> 



RE: How can I use a Image as a submit button using struts

2001-04-25 Thread Scott Cressler

Um, I thought the  tag did this and doesn't it generate an
 tag?

Scott

> -Original Message-
> From: Kyle Robinson [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 25, 2001 4:00 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: How can I use a Image as a submit button using struts 
> 
> 
> The best way I've found of doing this is with a little javascript as
> follows:
> 
> 
>   
> 
> 
> For the purposes of using Struts we made a custom tag to 
> create these...
> 
> -Original Message-
> From: Natra, Uday [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 25, 2001 15:45
> To: '[EMAIL PROTECTED]'
> Subject: How can I use a Image as a submit button using struts 
> 
> 
> Hi,
> Can anybody tell me how I can simulate the functionality of 
> 
> 
> I mean I need to use an Image as a submit button.
> 
> 
> Thanks,
> Uday.
> 



RE: Packaging Question - Include Source in Binary Distributions?

2001-04-25 Thread Scott Cressler

EXTREMELY useful!!  Please continue to do so.  It allows me to go beyond the
User Guide and Javadocs to understand how things work and so how to make
them work for me.

Thanks!

Scott

> -Original Message-
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 23, 2001 1:31 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Packaging Question - Include Source in Binary Distributions?
> 
> 
> As we move towards a 1.0 release of Struts (really!  :-), one of the
> things I am cleaning up is the way that binary distributions are
> packaged.  Currently, we follow the typical Jakarta pattern 
> of including
> the source code for Struts in the binary distribution (in the "etc",
> "src", and "web" directories), as well as in a separate download.
> 
> My question is, do people find the fact that the binary distribution
> includes source code useful, or would it be OK to just point 
> you at the
> download URL for the source distribution if you want it?  For recent
> builds, this would cut the size of the binary distribution by 
> about one
> third.
> 
> I'm fine with doing it either way, but wanted to get some 
> feedback from
> the community before making a final decision.
> 
> Craig
> 
> 



RE: ActionForwards / validation control flow questions

2001-04-25 Thread Scott Cressler

As I understand it, the flow is:

1. User hits submit button to submit against an Action, e.g., /logon in your
example
2. This is actually redirected to and handled by ActionServlet
3. ActionServlet instantiates/finds LogonForm instance
4. ActionServlet populates LogonForm from "same named" parameters from POST
5. ActionServlet calls validate() method of LogonForm (if validate=true in
 tag)
6. If ActionErrors returned by validate() is non-null and non-empty,
ActionServlet forwards to input= attribute of action definition, which is
"/logon.jsp" for you, and errors are displayed
7. If there are no errors, ActionServlet instantiates/finds LogonAction and
calls perform() method of LogonAction
8. LogonAction returns ActionForward
9. ActionServlet forwards to ActionForward returned

That said, I'm not sure what your problem is, since I don't recall getting
that exact exception.  What is "jasper"?  Is that basically a "page not
found" error for apache?  Do you have JSPs configured, that is, can you hit
JSP pages directly?  Otherwise, forwarding to "/logon.jsp" would not work.
I've also had some situations where I needed to have the input attribute be
set to something like "/logon.do" because I needed to do some setup before
displaying errors.  That was when I was initially trying to convert an app
to use struts, so I'm not so sure I needed to do it or that it was a good
idea, but you might try that.

Good luck,
Scott

> -Original Message-
> From: Roxie Rochat [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 24, 2001 5:50 PM
> To: [EMAIL PROTECTED]
> Subject: ActionForwards / validation control flow questions
> 
> 
> I'm getting a javax.servlet.ServletException
> at
> org.apache.jasper.runtime.PageContextImpl.handlePageException(
> PageContextImp
> l.java:449)
> when I try to do validation, so I went back to the basic 
> struts example 
> and tried to dissect it.  I've ended up being even more confused about
> how control flow and ActionForwards work and would appreciate
> some enlightenment about the conclusions I've drawn.
> 
> When I run the logon.jsp page and click submit without typing
> anything in, LogonForm.validate() returns errors and 
> LogonAction is never instantiated.  Somehow, magically,
> the logon.jsp page is re-displayed with the errors.
> 
> If LogonForm.validate() is modified so that it does not add 
> any errors, 
> LogonAction is instantiated.  It can find the "success" 
> forward, but not
> the forward for mapping.getInput():
> 
>   System.out.println("success forward = " +
> mapping.findForward("success"));
>   System.out.println("mapping.getInput() = " + 
> mapping.getInput());
>   System.out.println("input forward = " + new
> ActionForward(mapping.getInput()));
> 
> results in:
>   success forward = ActionForward[success]
>   mapping.getInput() = /logon.jsp
>   input forward = ActionForward[null]
> 
> Again, even if there are errors, the logon.jsp page is re-displayed.
> 
> my struts-config.xml:
>path="/logon.jsp"/>
>   
>  type="org.apache.struts.webapp.example.LogonAction"
>name="logonForm" scope="request"
>input="/logon.jsp">
> 
>   
> 
> So, if the form returns errors, its associated jsp page automatically
> displayed again?
> 
> Why can't ActionForward(mapping.getInput()) find the path?  Or is this
>  ActionForward[null] just a misleading artifact?  [I can't 
> get Forte for
> Java 
> configured to debug and I'm tired of printlns. I sure hope 
> VAJava3.5.3 works
> soon.]
> 
> Thanks in advance,
> Roxie
> 



RE: please help...is it possible to dynamically set the form action a ttribute dynamically eg

2001-04-25 Thread Scott Cressler

Sorry, no red code for me.  ;-)

If the action= is the only change between your forms, you could just define
a bean with the action name and then use it in the form tag, e.g.:

 

 
 

 


...

I think that will work.  Then, of course, if other things in your form need
to be different, you'll have other logic tags to control that.

Another strategy might be to set a bean (or attribute on your form bean) in
the Action class called before this page that contains the name of the
action to post to.  You could then access it here in a similar manner,
rather than having the logic code here.

BTW, I'm not clear on some of your logic below.  You have several places
where, in pseudo-code, you do something like:

if (user) then
   do something
   if (user) then
  do something else
   end if
end if

Why are you checking again when you're in code that will only be reached if
the user is present?  ;-)

Scott

> -Original Message-
> From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 25, 2001 3:18 AM
> To: '[EMAIL PROTECTED]'
> Subject: please help...is it possible to dynamically set the 
> form action
> a ttribute dynamically eg 
> 
> 
> currently i'm doing the following:
> 
> I'm using the logic tag to display one of two forms with the 
> action of each
> for set differently, based on whether the user bean object is in the
> session. 
> Is this ok, or is there a better way? Look at the red code
> 
> 
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> 
> 
> 
> 
> 
>  value="Edit">
>   
> 
> 
>  value="Add">
> 
> 
> 
> 
>  value="Add">
>
> 
> 
>  value="Edit">
>
> 
> 
> 
> 
> 
> 
>   
> 
> 
>key="eFilerMenu.menu"/>
>
> 
> 
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
>   
>   
> 
> 
> 
> 
>   
> 
> 
>key="eFilerMenu.menu"/>
>   
> 
> 
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
>  
> 
> 
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 



Submitting from one webapp to another

2001-04-24 Thread Scott Cressler

We're trying to separate the pages in our app into secure and non-secure.
As part of that, we would like to have situations like the login page, the
one that displays the form for getting your username and password, to be in
the non-secure section and the Action that receives the submit from the
login form to be in the secure section.  But the  tag won't let
us do that because it would mean something like this:

https://secure.site.domain/handleLogin.od";>

or some such URL.   appears to expect/require an Action (defined
in your local struts-config.xml file) to be the value of the "action="
attribute.

Why is this required, that is, while it is nice for  to attempt
to help out when setting up the "action=" of the  tag it generates,
why won't it also allow any old URL?

Of course, I could just use my own  tag with the correct "action=" to
POST to the secure Action, but I think that means I can't use the rest of
the  tags, like , right?

Is this just a limitation of struts that should/will be addressed?  Or are
we trying to do something that we shouldn't try to do?  For example, we
could, of course, put both the page to display the form and the Action to
accept it on the same, secure server, but that wasn't the way we wanted to
design things.  Are we trying to design it in a bad way, or is struts
unnecessarily limiting us?

Thanks for any info,
Scott



RE: Performance of of action?

2001-04-19 Thread Scott Cressler

Hmmm, maybe I made it too complicated by mentioning templates...that really
isn't my question.  My question is more about the performance of doing a
 of a JSP file versus an Action (that is, something like
"header.do").  Another aspect of my question is what are the negative
implications of pulling the business logic out of the JSP and into a custom
tag as opposed to an Action class.  If you do this, the architecture of your
app becomes a little more complicated and a little harder for others to
understand, doesn't it?

Scott

> -Original Message-
> From: Mario Laureti [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 8:47 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Performance of  of action?
> 
> 
> I am not sure if I understand your question correctly but
> have you check the struts-template web application example
> that comes with the struts framework? This might give you
> a good indication on how to build a good template using Struts.
> 
> You can also create custom tags instead of having Java in your jsp...
> 
> Mario L.
> 
> >>> [EMAIL PROTECTED] 04/19/01 11:27AM >>>
> I'm trying to decide how to structure our app.  We want to 
> use templates to
> separate the layout from the content, and we want to use the Struts
> framework to separate the business logic from the 
> presentation.  I've been
> converting several parts of our site and am happy with the results.
> However, we also want to, as much as possible, separate out 
> reusable parts
> of the presentation into separate JSP pages (sort of 
> "components").  For
> example, we have a header and have it separated into 
> header.jsp.  This JSP
> page can take parameters and can also adjust itself based on its
> "environment", that is, what it finds in the request.  But to 
> do so, it has
> a bunch of Java in the JSP (it was also developed before I 
> came and without
> an eye to keeping the business logic separate).
> 
> What I'd like to do is change the header.jsp to pull the Java 
> out.  I see
> several possible ways to do that.  One is to essentially 
> develop an Action
> that sets up for the JSP and then forwards to the JSP.  So, 
> for example,
> that would change the code in my current pages like:
> 
>  name="atab" value="main"/>
> 
> to look like:
> 
>  name="atab" value="main"/>
> 
> but I'm not sure what the performance implications of this 
> would be.  That
> is, what is the difference between a  of a JSP 
> page versus an
> Action.  In the case of the Action, it would be routed through the app
> server (resin in our case...for now), through the 
> ActionServlet and Action,
> and then forwarded to the JSP.  (Now that I think of it, I'm 
> not sure this
> would even work, but I think it should.)  In the JSP case, is 
> it also routed
> through the app server, so the only difference is where the 
> business logic
> is done?
> 
> Another idea I have is to create one or more custom tags that 
> will set up
> for the header JSP.  That way, the JSP could be included just 
> as header.jsp,
> but the Java and business logic would have been extracted to 
> the custom
> tag(s).  The negative of this is it is a departure from the Struts
> architecture and puts the business logic in a sort of 
> unexpected place.
> 
> The last idea I had was to somehow cause the Action for the 
> enclosing page
> (that is, the page that does the  of the header) 
> to do the
> logic and setup necessary for the header.  Then the header 
> would just get
> what it needs from the request and could remain a JSP, not an 
> Action.  The
> negative of this is that the logic for the header would be 
> performed by the
> Actions of all the pages, although it could be included in 
> the BaseAction
> that I extend for my Actions.
> 
> BTW, we have one motivation that others may not have: we are 
> developing an
> example application that will be given to our customers to 
> base their app
> on.  So we want to structure things in the best, most 
> understandable way.
> 
> Thanks for any help,
> Scott
> 



Performance of of action?

2001-04-19 Thread Scott Cressler

I'm trying to decide how to structure our app.  We want to use templates to
separate the layout from the content, and we want to use the Struts
framework to separate the business logic from the presentation.  I've been
converting several parts of our site and am happy with the results.
However, we also want to, as much as possible, separate out reusable parts
of the presentation into separate JSP pages (sort of "components").  For
example, we have a header and have it separated into header.jsp.  This JSP
page can take parameters and can also adjust itself based on its
"environment", that is, what it finds in the request.  But to do so, it has
a bunch of Java in the JSP (it was also developed before I came and without
an eye to keeping the business logic separate).

What I'd like to do is change the header.jsp to pull the Java out.  I see
several possible ways to do that.  One is to essentially develop an Action
that sets up for the JSP and then forwards to the JSP.  So, for example,
that would change the code in my current pages like:



to look like:



but I'm not sure what the performance implications of this would be.  That
is, what is the difference between a  of a JSP page versus an
Action.  In the case of the Action, it would be routed through the app
server (resin in our case...for now), through the ActionServlet and Action,
and then forwarded to the JSP.  (Now that I think of it, I'm not sure this
would even work, but I think it should.)  In the JSP case, is it also routed
through the app server, so the only difference is where the business logic
is done?

Another idea I have is to create one or more custom tags that will set up
for the header JSP.  That way, the JSP could be included just as header.jsp,
but the Java and business logic would have been extracted to the custom
tag(s).  The negative of this is it is a departure from the Struts
architecture and puts the business logic in a sort of unexpected place.

The last idea I had was to somehow cause the Action for the enclosing page
(that is, the page that does the  of the header) to do the
logic and setup necessary for the header.  Then the header would just get
what it needs from the request and could remain a JSP, not an Action.  The
negative of this is that the logic for the header would be performed by the
Actions of all the pages, although it could be included in the BaseAction
that I extend for my Actions.

BTW, we have one motivation that others may not have: we are developing an
example application that will be given to our customers to base their app
on.  So we want to structure things in the best, most understandable way.

Thanks for any help,
Scott



RE: handling the errors

2001-04-12 Thread Scott Cressler

   Object aeObj = request.getAttribute(Action.ERROR_KEY);
   if (aeObj != null && aeObj instanceof ActionErrors) {
   ActionErrors ae =  (ActionErrors)aeObj;
   if (!ae.empty()) {
   ...

Scott

> -Original Message-
> From: Charlemagne L. Rey [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 12, 2001 12:25 PM
> To: [EMAIL PROTECTED]
> Subject: Re: handling the errors
> 
> 
> no, nothing to be sorry... thank you for your help.
> anyway, i'm moving on and i have this situation...
> i tried your idea, to forward to another page if ever
> i encounter an error. now, my problem is i do not know
> how to access the ActionErrors instane from my jsp
> error page, do you have any idea?
> 
> thanks a lot.
> 
> John Raley wrote:
> > 
> > Sorry, thought it was #2...
> > 
> > "Charlemagne L. Rey" wrote:
> > 
> > > i would like to have a separate jsp page for errors.
> > > from the choices that you've given me, it's #1.
> > >
> > > Anthony Martin wrote:
> > > >
> > > > I interpreted two possible questions form your message:
> > > >
> > > > 1. You want to have a JSP devoted to showing a 
> form and a separate
> > > > JSP devoted to showing the validation errors?
> > > > 2. You want to have a general error page for 
> handling exceptions
> > > > that occur.
> > > >
> > > > Which one were you asking?  Or was I wildly off base?
> > > >
> > > > Anthony
> > > >
> 



RE: Finding DTD when disconnected from Internet

2001-04-11 Thread Scott Cressler

Short of taking the nightly build, I just extracted the required DTDs out of
the struts.jar file and put them beneath WEB-INF/classes (I'm using resin).
That seemed to work fine, but, of course, it would be nice if the software
could find them in struts.jar.  ;-)

Scott 

> -Original Message-
> From: Rob Leland [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 11, 2001 4:13 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Finding DTD when disconnected from Internet
> 
> 
> Update to the latest nightly build, this problem was fixed about
> 5 weeks ago.
> 
> -Rob
> 
> "Assenza, Chris" wrote:
> > 
> > Well, here I am again - new problem. :| (BTW, thanks to all 
> for helping,
> > this is by far one of the best list I've been on).
> > 
> > Problem:
> > 
> > Okay, I've been working with WebSphere and JBoss to get a Struts app
> > working. So far my efforts have been very successful. 
> However, today I hit a
> > new bug. Assume your PC is not connected to the Internet -- 
> ie. its just a
> > local app.  In WebSphere in particular, but also in JBoss, 
> Struts will fail
> > because it goes out to find the DTD for web_app_2_2 from Sun and
> > struts-config from the Jakarta site.
> > 
> > After countless efforts to make Digester search for the DTD 
> locally, I have
> > had no success.  I am required to use the SYSTEM identifier 
> and not PUBLIC.
> > The only thing I've had success with is making the two xml 
> files standalone
> > (ie. standalone="yes"). SAX returns beaucoup errors, but the app
> > "half-works" -- pages will at least come up.
> > 
> > Does anyone know how to fix this easily...without 
> connecting the machine to
> > the Net (it's an Intranet app). My knowledge of XML is 
> okay, DTD's fairly
> > week (incl. !DOCTYPE).
> > 
> > Thanks,
> > 
> > Chris Assenza
> 



RE: Extending struts classes

2001-04-11 Thread Scott Cressler

When an action request is received by the ActionServlet, one of the things
it tries to do is set up the form bean (specified by a combination of a
 tag and your  tag in your struts-config.xml file).  It
tries to reuse one, and if it can't find one under the attribute name you
gave, it creates one.  Then it calls one of the util routines to populate it
from the request using reflection.  So, you should have an instance of your
form bean, saved in the request under the attribute name you specified,
available when your Action class' perform() method is called.

I'm trying to figure out some similar "timing" things, and what I was
thinking of doing was to create a base class that extends Action.  Then I
can do things in that class that are common to all (or a set of) my Actions
and then continue with the perform activities specific to a particular
Action.

So, for example (pseudo code):

public class BaseAction extends Action {

...

public ActionForward perform(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
throws IOException, ServletException {
... stuff for all Actions ...
}
}

public class MyAction extends BaseAction {
...

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

... do my stuff ...

OR, you could do...

initUsingSession(...);  // assuming this is defined in your
BaseAction

... do my stuff ...
}
}

Hope this helps,

Scott

> -Original Message-
> From: Steve A Drake [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 11, 2001 9:02 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Extending struts classes
> 
> 
> On Wed, 11 Apr 2001 [EMAIL PROTECTED] wrote:
> 
> > I want to add a function to all of my forms in which the
> > form is capable of initialising its contents. e.g.
> >
> > public void initUsingSession(HttpSession session)
> >
> > I want to pass the session to this function so that I can
> > populate values on the form depending on what is
> > stored in the session.
> >
> > The trouble with this is that when would I call this
> > function?  I looked in the FormTag class, and I noticed
> > that if it couldn't find the form class then it just created
> > a new instance of it.  This means I can't call that
> > function.
> >
> > Any ideas?
> 
>  Don't know if it'll meet your needs but, instead of invoking your JSP
> directly, you could invoke the associated action class. In this class,
> you can get a handle on the session object and your action 
> form object.
> Once you've initialized the ActionForm, forward to the view JSP.
> 
> 



RE: Where are Struts messages found?

2001-04-11 Thread Scott Cressler

Your application's web.xml file (probably in your WEB-INF directory) should
include a  tag that defines and configures the ActionServlet.  Part
of that is something like:


  application
  com.yourdomain.yourpackage.Resources


This is used to find the messages file, which in this case would be the file
at:

WEB-INF/classes/com/yourdomain/yourpackage/Resources.properties

Scott

> -Original Message-
> From: James Howe [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 11, 2001 8:34 AM
> To: [EMAIL PROTECTED]
> Subject: Where are Struts messages found?
> 
> 
> I'm working with Struts and I'm trying to build an error page 
> for my JSP 
> application.   In looking at the Struts tag code I see 
> statements which 
> look like this:
> 
> throw new JspException(messages.getMessage("getter.bean", 
> beanName)));  
> 
> which looks like it should be populating the exception with 
> some useful 
> information.  However, when I execute this code in a 
> debugger, the message 
> assigned to the Exception is null because there is no message 
> with the name 
> "getter.bean".  Where would I find definitions for messages such as 
> "getter.bean", "optionsTag.iterator", etc?
> 



RE: How to use the html:img tag?

2001-04-10 Thread Scott Cressler

Probably something like:


  


?

> -Original Message-
> From: Suriyanarayanan, Senthil Kumar
> [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 10, 2001 5:01 PM
> To: [EMAIL PROTECTED]
> Subject: How to use the html:img tag?
> 
> 
> Hello,
>   I would like to know create an hyperlink image using 
> the html:img ?
>   Basically I want to convert the following html in to 
> html:img ...
>src="images/registration.gif">
> 
> 
> Thanks
> Senthil Kumar.S
>  
> **
> 
> The Information transmitted herewith is sensitive information 
> intended only
> for use to the individual or entity to which it is addressed. 
> If the reader
> of this message is not the intended recipient, you are hereby 
> notified that
> any review, retransmission, dissemination, distribution, 
> copying or other
> use of, or taking of any action in reliance upon, this information is
> strictly prohibited. If you have received this communication in error,
> please contact the sender and delete the material from your computer.
> 



RE: Problem finding classes after forward (resend)

2001-04-05 Thread Scott Cressler

Problem solved.  See solution in response to RE: how to access related
ActionForm from within .jsp?

Scott

> -Original Message-
> From: Scott Cressler [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 05, 2001 11:03 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Problem finding classes after forward (resend)
> 
> 
> Ummm, I'm not using WebLogic  ;-)
> 
> I've figured out some of the problem.  I can't do a 
>  of my
> formBean because (in ActionServlet.processActionForm() ) the 
> bean is put
> into the request as an ActionForm, not as my class.  So I can 
> cast it to
> ActionForm, but not to my class 
> (com.propel.webapp.actions.AddressForm).
> 
> I can probably figure out a way around that (maybe by using 
> the bean tags?),
> but the other problem I'm having is still confusing me
> 
> Keep on digging,
> Scott
> 
> > -Original Message-
> > From: Abraham Kang [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 05, 2001 11:07 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: Problem finding classes after forward (resend)
> > 
> > 
> > Hi Scott,
> > 
> > This might be a problem with WebLogic.  I think this problem 
> > is prevelant in
> > WebLogic 5.1.  You might want to do a search on 
> > ClassCastException in the
> > WebLogic 5.1 docs and newsgroups.
> > 
> > --Abraham
> > 
> > > -Original Message-
> > > From: Scott Cressler [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, April 05, 2001 8:50 AM
> > > To: '[EMAIL PROTECTED]'
> > > Subject: Problem finding classes after forward (resend)
> > >
> > >
> > > Many apologies for resending this, but I had not finished
> > > subscribing when I
> > > sent it the first time, and I don't know if it was, therefore,
> > > filtered out
> > > (since I didn't receive it ;-).
> > >
> > > Sorry, but I'm still having the problem described below:
> > >
> > > -Original Message-
> > > From: Scott Cressler
> > > Sent: Thursday, April 05, 2001 8:22 AM
> > > To: '[EMAIL PROTECTED]'
> > > Subject: Problem finding classes after forward
> > >
> > >
> > > I'm trying to refit an existing page to use struts.  The 
> > JSP page that I
> > > forward to at the end of my Action class uses some 
> classes, but when
> > > forwarding to it through the struts ActionForward mechanism, the
> > > page seems
> > > unable to find the classes.  Strangely enough, one that it can't
> > > find is my
> > > form bean class, which it just used in the Action class.  I 
> > was trying to
> > > get to that class both through a  and through
> > > .  The exception I get is:
> > >
> > > java.lang.ClassCastException: 
> com.propel.webapp.actions.AddressForm
> > >   at _jsp._abe2__jsp._jspService(/abe2.jsp:26)
> > >   at com.caucho.jsp.JavaPage.service(JavaPage.java:89)
> > >   at com.caucho.jsp.JavaPage.subservice(JavaPage.java:83)
> > >   at com.caucho.jsp.Page.service(Page.java:280)
> > >   at com.caucho.jsp.QServlet.service(QServlet.java:161)
> > >   at
> > > 
> > com.caucho.server.http.AbstractRequest.service(AbstractRequest
> > .java:450)
> > >   at
> > > 
> > com.caucho.server.http.AbstractRequest.service(AbstractRequest
> > .java:393)
> > >   at
> > > com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
> > >   at com.caucho.server.http.PageCache.service(PageCache.java:103)
> > >   at 
> > com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
> > >   at
> > > com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatch
> > er.java:14
> > > 7)
> > >   at
> > > com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatch
> > er.java:80
> > > )
> > >   at
> > > org.apache.struts.action.ActionServlet.processActionForward(Action
> > Servlet.ja
> > > va:1697)
> > >   at
> > > 
> > org.apache.struts.action.ActionServlet.process(ActionServlet.j
> > ava:1540)
> > >   at
> > > 
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
> > >   at javax.servlet.http.HttpServlet.service(HttpServlet.java:102)
> > >   at javax.servlet.http.HttpServlet.service(HttpServlet.java:83)
> > >   at
> > > 
> > com.caucho.server.http.Abstra

RE: how to access related ActionForm from within .jsp?

2001-04-05 Thread Scott Cressler

OK, problem solved!

The problem was a (for me) very esoteric aspect of Java.  The class loader
used when loading the class when it was created (within struts) was
*different* from the class loader used when attempting to load the class,
e.g., for casting, within my .jsp files.  This made a difference, *even
though* the class that was loaded was the same file from the *SAME*
directory!  Apparently, the internal identifier used to identify the class
is different depending on the class loader used.  The problem was that I had
put my /WEB-INF/classes directory in the class path used by resin
as well as the fact that it is the class directory used automatically to
find classes used by .jsp files.  So struts used one class loader and the
.jsp system used another.

The solution was to remove the classes from /WEB-INF/classes
directory.  Instead, I put it in the directory tree used to build our
product's jar file, which is already in the resin classpath.  So there was
only one way to find the class.

I don't much like this solution, because I think the actions are specific to
the particular application and so should fit in the
/WEB-INF/classes directory.  Unfortunately, if I remove them from
the resin classpath, struts can't find them.  I'll have to think some more
on how best to organize this.  Maybe I'll put them in a jar file that is
specific to the application, but which is not in the
/WEB-INF/classes directory.

If you are still having trouble getting access to the form bean, let me know
and I'll give you specific code examples of how I do it.

Scott

> -Original Message-
> From: Deadman, Hal [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 05, 2001 1:16 PM
> To: [EMAIL PROTECTED]
> Subject: RE: how to access related ActionForm from within .jsp?
> 
> 
> You are using redirect="false", correct? It shouldn't matter 
> what type is
> used when the action form is put in the request. setAttribute takes an
> Object so you can put anything in there but it will actually 
> be the type of
> the form bean specified in struts-config.xml. Can you submit 
> the section of
> the struts-config.xml file that contains the actions you are 
> using? There
> should be one action that forwards to the jsp with a 
> redirect=false. There
> should be another action that your jsp submits to. Both 
> actions should use
> the same form. You may want to submit part of the jsp that 
> tries to access
> the form bean. 
> 
> Hal
> 
> > -Original Message-
> > From: Scott Cressler [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 05, 2001 3:58 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: how to access related ActionForm from within .jsp?
> > 
> > 
> > I was just looking at this code to try to figure out my 
> > problem (Problem
> > finding classes after forward (resend)).  I have learned 
> some things,
> > although I wouldn't say I really understand all of them, yet.
> > 
> > When you go into the ActionServlet and are being directed to 
> > an Action, if
> > there is a formbean associated with the action (the "name=" 
> > attribute of the
> > action tag in the struts-config.xml file), the ActionServlet 
> > will try to get
> > such a named object from the request.  If it doesn't find it, 
> > it creates an
> > instance of the class you specified in the form-bean tag 
> (also in the
> > struts-config.xml file) and then puts it in the request under 
> > the name you
> > specified in the action tag.  So, theoretically, you should 
> > just be able to
> > pull it out of the request in your .jsp file and use it, 
> either using
> >  or scriptlet code that uses request.getAttribute().
> > 
> > Okay, here's the bad news...it doesn't work for me.  I found 
> > that the reason
> > it doesn't work is that the ActionServlet code is referring 
> > to the formbean
> > object as an ActionForm at the time that it puts it into the 
> > request.  I'm
> > not sure why, but when you take it out, using one of the 
> > above techniques,
> > it can only be cast to be an ActionForm!  The reason the 
> >  tags, like
> > , work is because they don't try to cast to your 
> > class.  Instead,
> > they use introspection to call the getter for the property.
> > 
> > It may be possible to use the  tags to access that 
> > bean, but our ISP
> > is currently having problems, so I can't check  :-(
> > 
> > Does anyone else think this is a problem?  Shouldn't I be 
> able to do a
> >  on a bean that is my class?  For example, I 
> > (like Daniel?)
> > 

RE: how to access related ActionForm from within .jsp?

2001-04-05 Thread Scott Cressler

I was just looking at this code to try to figure out my problem (Problem
finding classes after forward (resend)).  I have learned some things,
although I wouldn't say I really understand all of them, yet.

When you go into the ActionServlet and are being directed to an Action, if
there is a formbean associated with the action (the "name=" attribute of the
action tag in the struts-config.xml file), the ActionServlet will try to get
such a named object from the request.  If it doesn't find it, it creates an
instance of the class you specified in the form-bean tag (also in the
struts-config.xml file) and then puts it in the request under the name you
specified in the action tag.  So, theoretically, you should just be able to
pull it out of the request in your .jsp file and use it, either using
 or scriptlet code that uses request.getAttribute().

Okay, here's the bad news...it doesn't work for me.  I found that the reason
it doesn't work is that the ActionServlet code is referring to the formbean
object as an ActionForm at the time that it puts it into the request.  I'm
not sure why, but when you take it out, using one of the above techniques,
it can only be cast to be an ActionForm!  The reason the  tags, like
, work is because they don't try to cast to your class.  Instead,
they use introspection to call the getter for the property.

It may be possible to use the  tags to access that bean, but our ISP
is currently having problems, so I can't check  :-(

Does anyone else think this is a problem?  Shouldn't I be able to do a
 on a bean that is my class?  For example, I (like Daniel?)
need to get data out of the bean outside of the  context (e.g.,
to display the user's name when editing the address)?

BTW, I may have some configuration problem that is making this not work for
me...so it might work for you.  I'm going to try something else and will
report if it works.

Scott

> -Original Message-
> From: Deadman, Hal [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 05, 2001 12:11 PM
> To: [EMAIL PROTECTED]
> Subject: RE: how to access related ActionForm from within .jsp?
> 
> 
> The form bean is associated with an action, not a jsp. The 
> jsp may contain
> an html:form which references an action, thereby gaining 
> access to the form
> associated with that action. A jsp could have multiple html:forms. 
> 
> The form bean associated with the action is available in 
> request scope for
> the jsp but I don't know how you would get access to it 
> without using the
> name of the form. Is there a struts tag that will get 
> actionmapping values
> when given the name of the action? That would allow you to 
> get the form bean
> name using the same action used by the html:form. 
> 
> Maybe you could use the bean:struts tag to get the action 
> mapping and then
> get the form from that. 
> 
> Hal
> 
> > -Original Message-
> > From: Daniel Toms [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 05, 2001 2:50 PM
> > To: Struts-User
> > Subject: how to access related ActionForm from within .jsp?
> > 
> > 
> > I am having a common problem all over the place.
> > Struts allows you to associate a bean(the ActionForm)
> > with a given .jsp.  It then magically gets and sets
> > input fields for you.  Great.
> > 
> > But all of the other struts tags require a reference
> > to a bean by name, using the name="foo" argument
> > to the tag.
> > 
> > My problem is, I want to reference the bean associated
> > with my jsp, so that when I want to iterated over a collection
> > it contains, I can do so without having to know the bean's name.
> > 
> > example:
> > 
> > 
> > public final class FooForm extends ActionForm
> > {
> > public Collection bar;
> > 
> > public Collection getBar()
> > {
> > return bar;
> > }
> > 
> > public void setBar(Collection b
> > {
> > this.bar = b;
> > }
> > }
> > 
> > then in my jsp:
> > 
> >   
> > 
> > 
> >property="propertyName"/>
> >   
> >property="propertyValue"/>
> >
> > 
> > 
> > So the iterate tag doesn't work because it wants a bean by 
> > name, but is
> > there something I haven't gotten that will make struts use the bean 
> > associated with the jsp and not one specified by name?  
> > 
> > thanks,
> > 
> > dan
> > 
> 



RE: Problem finding classes after forward (resend)

2001-04-05 Thread Scott Cressler

Ummm, I'm not using WebLogic  ;-)

I've figured out some of the problem.  I can't do a  of my
formBean because (in ActionServlet.processActionForm() ) the bean is put
into the request as an ActionForm, not as my class.  So I can cast it to
ActionForm, but not to my class (com.propel.webapp.actions.AddressForm).

I can probably figure out a way around that (maybe by using the bean tags?),
but the other problem I'm having is still confusing me

Keep on digging,
Scott

> -Original Message-
> From: Abraham Kang [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 05, 2001 11:07 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Problem finding classes after forward (resend)
> 
> 
> Hi Scott,
> 
> This might be a problem with WebLogic.  I think this problem 
> is prevelant in
> WebLogic 5.1.  You might want to do a search on 
> ClassCastException in the
> WebLogic 5.1 docs and newsgroups.
> 
> --Abraham
> 
> > -Original Message-
> > From: Scott Cressler [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 05, 2001 8:50 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: Problem finding classes after forward (resend)
> >
> >
> > Many apologies for resending this, but I had not finished
> > subscribing when I
> > sent it the first time, and I don't know if it was, therefore,
> > filtered out
> > (since I didn't receive it ;-).
> >
> > Sorry, but I'm still having the problem described below:
> >
> > -Original Message-
> > From: Scott Cressler
> > Sent: Thursday, April 05, 2001 8:22 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: Problem finding classes after forward
> >
> >
> > I'm trying to refit an existing page to use struts.  The 
> JSP page that I
> > forward to at the end of my Action class uses some classes, but when
> > forwarding to it through the struts ActionForward mechanism, the
> > page seems
> > unable to find the classes.  Strangely enough, one that it can't
> > find is my
> > form bean class, which it just used in the Action class.  I 
> was trying to
> > get to that class both through a  and through
> > .  The exception I get is:
> >
> > java.lang.ClassCastException: com.propel.webapp.actions.AddressForm
> > at _jsp._abe2__jsp._jspService(/abe2.jsp:26)
> > at com.caucho.jsp.JavaPage.service(JavaPage.java:89)
> > at com.caucho.jsp.JavaPage.subservice(JavaPage.java:83)
> > at com.caucho.jsp.Page.service(Page.java:280)
> > at com.caucho.jsp.QServlet.service(QServlet.java:161)
> > at
> > 
> com.caucho.server.http.AbstractRequest.service(AbstractRequest
> .java:450)
> > at
> > 
> com.caucho.server.http.AbstractRequest.service(AbstractRequest
> .java:393)
> > at
> > com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
> > at com.caucho.server.http.PageCache.service(PageCache.java:103)
> > at 
> com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
> > at
> > com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatch
> er.java:14
> > 7)
> > at
> > com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatch
> er.java:80
> > )
> > at
> > org.apache.struts.action.ActionServlet.processActionForward(Action
> Servlet.ja
> > va:1697)
> > at
> > 
> org.apache.struts.action.ActionServlet.process(ActionServlet.j
> ava:1540)
> > at
> > org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:102)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:83)
> > at
> > 
> com.caucho.server.http.AbstractRequest.service(AbstractRequest
> .java:450)
> > at
> > 
> com.caucho.server.http.AbstractRequest.service(AbstractRequest
> .java:393)
> > at
> > com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
> > at com.caucho.server.http.PageCache.service(PageCache.java:103)
> > at 
> com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
> > at com.caucho.server.http.Request.dispatch(Request.java:211)
> > at
> > 
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:201)
> > at
> > 
> com.caucho.server.http.HttpRequest.handleConnection(HttpReques
> t.java:142)
> > at com.caucho.server.TcpConnection.run(TcpConnection.java:145)
> > at java.lang.Thread.run(Thread.java:484)
> >
> > This is happening at the useBean line:
> 

Problem finding classes after forward (resend)

2001-04-05 Thread Scott Cressler

Many apologies for resending this, but I had not finished subscribing when I
sent it the first time, and I don't know if it was, therefore, filtered out
(since I didn't receive it ;-).

Sorry, but I'm still having the problem described below:

-Original Message-----
From: Scott Cressler 
Sent: Thursday, April 05, 2001 8:22 AM
To: '[EMAIL PROTECTED]'
Subject: Problem finding classes after forward


I'm trying to refit an existing page to use struts.  The JSP page that I
forward to at the end of my Action class uses some classes, but when
forwarding to it through the struts ActionForward mechanism, the page seems
unable to find the classes.  Strangely enough, one that it can't find is my
form bean class, which it just used in the Action class.  I was trying to
get to that class both through a  and through
.  The exception I get is:

java.lang.ClassCastException: com.propel.webapp.actions.AddressForm
at _jsp._abe2__jsp._jspService(/abe2.jsp:26)
at com.caucho.jsp.JavaPage.service(JavaPage.java:89)
at com.caucho.jsp.JavaPage.subservice(JavaPage.java:83)
at com.caucho.jsp.Page.service(Page.java:280)
at com.caucho.jsp.QServlet.service(QServlet.java:161)
at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:450)
at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:393)
at
com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
at com.caucho.server.http.PageCache.service(PageCache.java:103)
at com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
at
com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:14
7)
at
com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:80
)
at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja
va:1697)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1540)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:102)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:83)
at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:450)
at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:393)
at
com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
at com.caucho.server.http.PageCache.service(PageCache.java:103)
at com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
at com.caucho.server.http.Request.dispatch(Request.java:211)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:201)
at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:142)
at com.caucho.server.TcpConnection.run(TcpConnection.java:145)
at java.lang.Thread.run(Thread.java:484)

This is happening at the useBean line:



I'm not sure why it's a ClassCastException, as that would seem to imply that
the useBean found something under the property "addressForm", but that it
was of the wrong class?

I've also tried just adding scriptlet code to use a different class, but one
that I know is in the classpath and is also in the WEB-INF/classes of the
docroot.  I also get a ClassCastException from the following code:

<% 
 PageHelper pageHelper = (PageHelper)request.getAttribute("pageHelper");
 if (pageHelper == null) pageHelper = new PageHelper(request, response);
%>

I have the correct import above to find this class.

The thing that leads me to think there's either a bug in struts or I'm
missing something about how to use it is that this JSP page works fine if I
just load it directly, that is, hitting it's URL directly.  The classes can
be found just fine.

Any ideas why this would be happening?  Is this a known bug with struts or
am I just missing some configuration?

We are using Resin standalone for our JSP/Servlet engine/web server.

Thanks for any help,
Scott



Problem finding classes after forward

2001-04-05 Thread Scott Cressler

I'm trying to refit an existing page to use struts.  The JSP page that I
forward to at the end of my Action class uses some classes, but when
forwarding to it through the struts ActionForward mechanism, the page seems
unable to find the classes.  Strangely enough, one that it can't find is my
form bean class, which it just used in the Action class.  I was trying to
get to that class both through a  and through
.  The exception I get is:

java.lang.ClassCastException: com.propel.webapp.actions.AddressForm
at _jsp._abe2__jsp._jspService(/abe2.jsp:26)
at com.caucho.jsp.JavaPage.service(JavaPage.java:89)
at com.caucho.jsp.JavaPage.subservice(JavaPage.java:83)
at com.caucho.jsp.Page.service(Page.java:280)
at com.caucho.jsp.QServlet.service(QServlet.java:161)
at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:450)
at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:393)
at
com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
at com.caucho.server.http.PageCache.service(PageCache.java:103)
at com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
at
com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:14
7)
at
com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:80
)
at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja
va:1697)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1540)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:102)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:83)
at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:450)
at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:393)
at
com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
at com.caucho.server.http.PageCache.service(PageCache.java:103)
at com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
at com.caucho.server.http.Request.dispatch(Request.java:211)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:201)
at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:142)
at com.caucho.server.TcpConnection.run(TcpConnection.java:145)
at java.lang.Thread.run(Thread.java:484)

This is happening at the useBean line:



I'm not sure why it's a ClassCastException, as that would seem to imply that
the useBean found something under the property "addressForm", but that it
was of the wrong class?

I've also tried just adding scriptlet code to use a different class, but one
that I know is in the classpath and is also in the WEB-INF/classes of the
docroot.  I also get a ClassCastException from the following code:

<% 
 PageHelper pageHelper = (PageHelper)request.getAttribute("pageHelper");
 if (pageHelper == null) pageHelper = new PageHelper(request, response);
%>

I have the correct import above to find this class.

The thing that leads me to think there's either a bug in struts or I'm
missing something about how to use it is that this JSP page works fine if I
just load it directly, that is, hitting it's URL directly.  The classes can
be found just fine.

Any ideas why this would be happening?  Is this a known bug with struts or
am I just missing some configuration?

We are using Resin standalone for our JSP/Servlet engine/web server.

Thanks for any help,
Scott