struts Token usage.

2002-01-20 Thread Robert Tyler Retzlaff

Exactly what are transaction tokens used for?  How are they used?

rob

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




Form doesn't get new values from page

2002-01-20 Thread Freeman-Nguyen, Cary

The data for my page is displayed properly when the page first comes up,
but when the user clicks the submit button, and I look at the form data
in the action, all the form data is as it was originally.  Does anyone
know how to get the form to have the data from the page?

I have the following on my jsp:









The form has the following:

public class AssignSitesForm extends ActionForm {

private AssignedSites assignedSites = null;

public AssignedSites getAssignedSites() {
return assignedSites;
}

public void setAssignedSites(AssignedSites assignedSites) {
this.assignedSites = assignedSites;
}
}

The AssignedSites class has:

public class AssignedSites implements Serializable {

private Collection unassignedEmployerSites = null;

public AssignedSites() {
}

public Collection getUnassignedEmployerSites() {

return unassignedEmployerSites;
}

public void setUnassignedEmployerSites( Collection
unassignedEmployerSites ) {

this.unassignedEmployerSites = unassignedEmployerSites;
}
}




Re: Validation Question?

2002-01-20 Thread David Winterfeldt

The issue is associating error messages, error message
arguments, and validation information like masks,
dates, etc. for different locales.  Also it would
start getting messy having regexp expression and other
things all directly associtaed with the custom jsp
tags.  Also, to store this information in the jsp page
would start cluttering your view with business logic.

There are a few other validation frameworks that
people have written.  They are posted here if you want
to look at them.

http://jakarta.apache.org/struts/userGuide/resources.html

David

--- Matt Koidin <[EMAIL PROTECTED]> wrote:
> I'm looking for a straightforward way to handle
> basic form validation. I
> downloaded the Struts Validator from Dave
> Winterfeldt and I really like
> the capabilities, but I'm wondering if anyone has a
> solution that is
> more generic? My big problem with the Validator
> design is the need for
> another xml file that I need to fill out for every
> form I want to
> validate. 
> 
> Maybe I am missing something, but is there a way a)
> either using this
> tool, or b) with another validator - that I can
> validate a field at the
> tag level.
> 
> For example, I'd like to write:
> 
>  maxlength="30"
> validate="required"/>
> 
> -or-
> 
>  validate="required,
> email"/>
> 
> and not have to deal with a FORM-SPECIFIC xml file.
> Obviously, I'd have
> to detail what it meant to be "required" and what a
> valid "email" is.
> That seems to be done with the validator-rules.xml
> file. Why can't I
> access that directly?
> 
> I might just go build this myself, but I was curious
> if it has already
> been done, or if I am missing something with the
> Struts Validator.
> 
> Thanks,
> Matt
> 
> --
> To unsubscribe, e-mail:  
> 
> For additional commands, e-mail:
> 
> 


__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




query string parameters?

2002-01-20 Thread Robert Tyler Retzlaff

Does struts have any nice way of handling parameters received via
the query string?  Perhaps something similar to the ActionForm object
that I can forward back to the source page if a validate() method
fails?

Thanks

rob

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




Handling FormActions correctly

2002-01-20 Thread Alberto Bolchini

Hi all, I'm a struts newbie.
 
I'm tryingto implement a database backed app using postgresql.
 
I'm experiencing a problem over the process of editing/inserting records
with ActionForms.
Following Craig's struts-example and Ted's scaffolding app, to edit a
record, I have an Action to do the fetching from the db, store it in a
bean, copying the bean properties to the perform()'s ActionForm form and
forwarding to the form.jsp.
 
Everything seems to work fine, and before forwarding, form has all the
correct properties (checking with servlet.log()). 

Once I forward to the jsp, the  tags display the data if and
only if I use a 
name="administratorForm" in each tag (being administratorForm the name
of the form-bean of the ActionForm, and the attribute "name" of the
).
 
This seems strange, and moreover, it breaks the validate()-ing process
handled by struts, as I get an exception from the jsp
(javax.servlet.ServletException: No bean found under attribute key
administratorForm) when submitting the Form with not valid values.
 
This is the perform() method:
 
public ActionForward perform(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
 throws IOException, ServletException {
 HttpSession session = request.getSession();
 String action = request.getParameter("action");
 String key = request.getParameter("key");
Integer iKey = null;
if (key != null)
iKey = new Integer(key);
// Identify the relevant administrator
 Bean bean = null;
 if (action.equals("Create")) {
 bean = new Bean();
 } else {
try{
bean = new Bean();
Collection result = Access.select((Object) bean, iKey);
Iterator i = result.iterator();
if (i.hasNext())
bean = (Bean) i.next();
} catch (Exception exc) {
throw new ServletException("EditAction: unable to
retrieve administrator for key " + 
key);
}
 }
 if (bean == null) {
 if (servlet.getDebug() >= 1)
  servlet.log(" No administrator for key " + key);
 return (mapping.findForward("failure"));
 }
bean.setAction(action);

 // Populate the administrator form
 if (form == null) {
if (servlet.getDebug() >= 1)
servlet.log(" Creating new AdministratorForm bean under
key "
+ mapping.getAttribute());
 form = new Form();
if ("request".equals(mapping.getScope()))
request.setAttribute(mapping.getAttribute(), form);
else
session.setAttribute(mapping.getAttribute(), form);
 }
Form subform = (Form) form;
if (servlet.getDebug() >= 1)
servlet.log(" Populating form from " + bean);
try {
PropertyUtils.copyProperties(subform, bean);
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
if (t == null)
t = e;
servlet.log("AdministratorForm.populate", t);
throw new ServletException("AdministratorForm.populate", t);
} catch (Throwable t) {
servlet.log("AdministratorForm.populate", t);
throw new ServletException("AdministratorForm.populate", t);
}
if (servlet.getDebug() >= 1)
servlet.log("form.getId()="+((Form) form).getId());
 // Forward control to the edit subscription page
if (servlet.getDebug() >= 1)
servlet.log(" Forwarding to 'success' page");
 return (mapping.findForward("success"));
}
and this is the excerpt from the struts-config.xml:
   
   
   
 
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

Thanx for the help.
alberto.
 



Re: Reporting Writing

2002-01-20 Thread Andy Noble

Chris,

Whilst I've not tried it yet, you may want to look at Jasper Reports. This
is open source and seems to fit what you want. BTW, if you try it out, could
you let me know what you think? Thanks.

http://sourceforge.net/projects/jasperreports

Regards
Andy

- Original Message -
From: "Chris Hane" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, January 17, 2002 8:12 PM
Subject: Reporting Writing


>
> Group,
>
> This is a bit off topic; however, there seems to be a good discussion
going
> on.  I'm new to the java world (less than 1yr) and am using struts to
> develop an internal application.  One of the requirements is to generate
> reports.  I'm currently rolling my own reports using struts/jsp.
>
> I was wondering if any out there had experience with robust reporting
> packages (free or commercially available) that they would recommend to
help
> create dynamic reports pulling information from a SQL database.  I know of
> several that run on windows NT; however, I am looking for a Java based
> application or API set that could run on Linux & windows.
>
> I found one out there called Espress Report that I just started to
> evaluate.  If anyone has had experience with it, what are your thoughts.
>
> Thanks,
> Chris
> [EMAIL PROTECTED]
>
>
> --
> To unsubscribe, e-mail:

> For additional commands, e-mail:

>


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




Re: bean:replace ?

2002-01-20 Thread Ted Husted

bean:define calls PageContext.setAttribute(), which does return an error
if the attribute already exists. 

http://java.sun.com/j2ee/j2sdkee/techdocs/api/javax/servlet/jsp/PageContext.html#setAttribute(java.lang.String,
java.lang.Object, int)

The options seem to be 

A) Extend bean:define so that it can remove a bean first.
B) Create a new tag to remove a bean if it exists (e.g. bean:undefine)
C) Use a scriptlet
D) Change the ItemList template so that you can pass the name of the
item list as a Tiles attribute

I'd go with D :)


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


João Guilherme Del Valle wrote:
> 
> Hi,
> 
> I want to replace a bean. But bean:define does not work the way I thought.
> I´d like to do something like this:
> 
> ---
> Check the new items:
> 
> 
> 
> Check the most popular:
> 
> 
> ---
> 
> The page "ItemList.jsp" looks for a bean called "items" and prints it.
> But this code gives me a compilation error, "variable items already
> defined". I know this could be solved with the following scriptlet:
> ---
> <% request.setAttribute("items", request.getAttribute("mostLoanedItems") );
> %>
> ---
> But I have an application with 35 pages and it´s scriptlet-free. I wouldn´t
> like to put one because of these. In resume, there are other solutions, but
> any ideia of an elegant one?
> 
> João.
> 
> Joao Guilherme Del Valle
> [EMAIL PROTECTED]
> Visionnaire Informática SA
> http://www.visionnaire.com.br
> Tel/Fax: +55 41 373-7400 r: 217
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Minor problems with the nested library by keyboard monkey...

2002-01-20 Thread Alex Paransky

I have ran in to some issues with the nested library, I am wondering if any
one has come across these issues:

1. The nested-tags.tld is missing the "Nested" on the class name
representing tag "define"
2. The class name for tag "form" is incorrect
3. The iterator tag does not create a scripting variable the way struts does

This is preventing me from using this library in some cases.  If there is no
work around, is there a way to mix struts/nested tags.  For example, if I
cannot use the nested:iterator, I would like to use struts:iterator, but
then go back to using the nested tags for the body of the iterator.

Thanks.
-AP_
www: http://www.alexparansky.com


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




Struts Fast Track (my 2 pennies worth)

2002-01-20 Thread Andy Noble

Having finally received my copy, which was labelled 'beta edition' (??!)
I've come to some very quick conclusions. I've been using Struts for about 6
months now, together with Struts Validation, Struts Layout, Struts Menu,
Declarative Exceptions, Struts Security, PostgreSQL, Poolman, log4j, junit,
ORO, javascript, CVS, Tomcat, Forte (netbeans) and I had a go with Tiles but
decided i didn't want to use it and more recently looked at the Display
taglib.

With all this stuff spinning around in my head (plus my regular Oracle Apps
& DB stuff I do for a living) I was hoping for a book that takes you step by
step through each portion of Struts, with detailed worked examples, along
with tips and tricks; this would help me quickly 'relearn' so I didn't have
to rely too heavily on my memory. I was disappointed because this is
*definitely not* what this book is about. It is based around 'lab' work and
you are expected to figure the detail out on your own. This is fine for
beginners, but I've spent the last 6 months doing just that without this
book. The layout and lack of detailed content makes this book look ideal for
an instructor lead course, but not really self teaching and *not* reference.
There are 27 chapters in about 250 pages (thats less than 10 pages per
chapter on average), and in that there are quite a few blank pages, full
page screen shots and very large margins on the A5 paper it is printed on.

My conclusion is that the documentation that comes with Struts and all its
add ons is probably the best source of information to date. Waste of money?
Not totally, but at $70 + $20 P&P to UK not value for money. Maybe it should
be a $30 PDF download... that would be better I think, as $90 hurts!

Andy

- Original Message -
From: "Robert D. Morse" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Saturday, January 19, 2002 4:48 PM
Subject: RE: Vik's book on Struts (basebeans book)


> Don't waste your money.  Get "Professional JSP Site Design"  ISBN:
> 1861005512
>
> It is *significantly* better.
>
> -Original Message-
> From: Mark Galbreath [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, January 19, 2002 7:29 AM
> To: Struts Users Mailing List
> Subject: Re: Vik's book on Struts (basebeans book)
>
>
> $60 is quite a piece of change to pay for a book that's already outdated!!
>
> Mark
>



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




Re: Resin X Tomcat

2002-01-20 Thread Ted Husted

Heck, use both :)

Develop on Tomcat (prefereably over Linux), then unit test and deploy on
Resin. 

I'm aware that jGuru and many other production sites are very happy with
Resin. 

Right now, jGuru is 100% Java, and getting *a lot* of good use out of
our sister Jakarta product, Lucene.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Rubens Gama wrote:
> 
> what JSP Engine i must to use, Tomcat or Resin?
> what is the best?
> 
> thanks in advance...
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: Error - MultipartIterator: no multipart request data sent

2002-01-20 Thread Ted Husted

I can't help much with the multipart stuff, but redirect does not clear
the request object per se, but actually issues a HTTP redirect to the
client. The client then turns around and makes a new request for the
specified URI. Since this is now a new request, it gets a new request
object. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Antony Stace wrote:
> 
> Hi
> 
> This is an old post that follows.  I have found the same problem with Struts
> 1.01.  Is this behaviour a bug or is it how Struts is meant to work?
> Also can someone please tell me what setting
> the value of redirect="true" does besides clearing the request attributes.
> 
> Cheers
> 
> Tony
> 
> >Hello,
> >
> >It seems to work like that. But as you wrote, if the redirect attribute is set
> >to 'true', it is cleaning all the attributes in request. I had put my
> >attributes in session instead of request.
> >Anyway, Thanks a lot.
> >
> >Regards
> >Nuray
> >
> >-Original Message-
> >From: mikael.eriksson [mailto:[EMAIL PROTECTED]]
> >Sent: Montag, 2. Juli 2001 00:18
> >To: struts-user
> >Subject: Re: Error - MultipartIterator: no multipart request data sent
> >
> >
> >Hello
> >
> > I noticed the same problem when moving to 1.0. It seems that
> >the requesthandler notices that the request is a multi-part and
> >tries to find the multi-part data, even when the request are
> >already handled and you are only forwarding to the next
> >action. (I only got the problem when going to another action.)
> >
> > The way I handled it was to set redirect="true" in struts-config.xml
> >for the action that I forwarded to, this made the multi-part info
> >go away from the request (and all other parameters too of course,
> >so if you are expecting request parameters in the next action this
> >will not work.)
> >
> > I guess this could be fixed in the code too, maybe by having the request
> >reader setting a request attribute so that it knows the next time
> >that it already has gotten the data. But I did not go deep enough
> >into the code to know if that is feasible or not.
> >
> > Regards
> > Mikael
> >
> >
> >[EMAIL PROTECTED] wrote:
> >
> >> Hi everbody,
> >>
> >> I am writing a program that needs to process form data. I have an uploadForm
> >> (that is an insatance of org.apache.struts.action.ActionForm). I have no
> >> problem with uploading a file via this form. After uploading the file, I am
> >> executing a couple of procedures inside the uploadAction(instance of
> >> org.apache.struts.action.Action) and afterwards forwarding the request to
> >> another page. While it is forwarding the request, it gives the following
> >error:
> >>
> >> javax.servlet.ServletException: MultipartIterator: no multipart request data
> >> sent
> >> java.lang.Throwable(java.lang.String)
> >> java.lang.Exception(java.lang.String)
> >> javax.servlet.ServletException(java.lang.String)
> >> void org.apache.struts.upload.MultipartIterator.parseRequest()
> >>
> >> org.apache.struts.upload.MultipartIterator(javax.servlet.http.HttpServletRequest
> >> , int, long, java.lang.String)
> >> void
> >> org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(javax.servlet
> >> .http.HttpServletRequest)
> >> void org.apache.struts.util.RequestUtils.populate(java.lang.Object,
> >> java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest)
> >> void
> >> org.apache.struts.action.ActionServlet.processPopulate(org.apache.struts.action.
> >> ActionForm, org.apache.struts.action.ActionMapping,
> >> javax.servlet.http.HttpServletRequest)
> >> void
> >> org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletReq
> >> uest, javax.servlet.http.HttpServletResponse)
> >> void
> >> com.ubs.cristal.actions.CristalActionServlet.process(javax.servlet.http.HttpServ
> >> letRequest, javax.servlet.http.HttpServletResponse)
> >> void
> >> org.apache.struts.action.ActionServlet.doPost(javax.servlet.http.HttpServletRequ
> >> est, javax.servlet.http.HttpServletResponse)
> >> void
> >> javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest,
> >> javax.servlet.http.HttpServletResponse)
> >> void
> >> javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
> >> javax.servlet.ServletResponse)
> >> void
> >> org.apache.tomcat.core.ServletWrapper.doService(org.apache.tomcat.core.Request,
> >> org.apache.tomcat.core.Response)
> >> void
> >> org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request,
> >> org.apache.tomcat.core.Response)
> >> void
> >> org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request,
> >> org.apache.tomcat.core.Response)
> >> void
> >> org.apache.tomcat.facade.RequestDispatcherImpl.forward(javax.servlet.ServletRequ
> >> est, javax.servlet.ServletResponse)
> >> void
> >> org.apache.struts.action.ActionServlet.processActionForward(org.apache.struts.ac
> >> tion.ActionF

Re: forwarding back to the same action

2002-01-20 Thread Ted Husted

The getPath property won't have the /do prefix or *.do suffix (or
whatever you are using). 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


"William G. Bohrer" wrote:
> 
> As part of my logic for a generalized controller Action I've written, I want
> to forward back through the same action I came from if no local or global
> forward has been configured, in other words I want to go to the action (not
> the input jsp)
> 
> Can someone tell me why the following code inside my perform method isn't
> working, and what I should be calling instead, or if there's something else
> I need to be doing to the new ActionForward object?
> 
> ActionForward forward = new ActionForward(mapping.getPath(), true);
> 
> Thanks,
> 
> Bill Bohrer
> Athens Group, Inc.
> An employee owned consulting firm integrating technology strategy and
> software solutions.
> http://www.athensgroup.com
> [EMAIL PROTECTED]
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: Using struts-template as taglib

2002-01-20 Thread Ted Husted

Yes, you should be able to use the template taglib outside of Struts, or
Tiles. 

Tiles is in the contrib folder of hte nightly build, and also available
here:

http://www.lifl.fr/~dumoulin/tiles/

As mentioned, Cedric and I are getting ready to propose Tiles to
Taglibs. The template taglib should really live there too, but David
doesn't come around much anymore :(

Cedric, do you think we could join the codebases in some way. People
mention the simplicity of the template taglib. Could we propose
something to taglibs that carried both packages? 

I know David has talked about a successor to templates, but that doesn't
seem to be materializing. And if it did, he could just join us in
Taglibs.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Andras Balogh wrote:
> 
> Hi all,
> 
> I want to ask you about the posibility to using the struts-template
> taglib in a project that is not using struts at all.
> Initally i searched for a template taglib at
> http://jakarta.apache.org/taglibs/
> but i couldn't find any.
> I then thought about using the struts-template taglib.
> So i took struts.jar and removed anything not related to
> struts-template. This is legal to do?
> I wonder if will be available the struts-template as taglib?
> 
> Sorry for being off-topic a little bit ..
> 
> Andras.
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: Setting Content-Type text/html

2002-01-20 Thread Ted Husted

The ActionServlet exposes the standard response object to the perform
method. If you use this object, it is just like using it from a plan
HTTP servlet. You do it all yourself, there are no "Struts" defaults
here. 

So, you should set the content type and everything else, just like you
would from any plain servlet. Struts doesn't touch this object, but
simply passes it along as a convenience :) 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/Chris Hane wrote:

 
> I'm experiencing a problem with pages being returned with a content-type of
> 'text/plain' instead of text/html.  I have a fairly standard setup:
>   Struts build from November 09
>   Tomcat 4.0
> 
> I'm using Cactus and HttpUnit to text my struts actions.  The action I'm
> testing returns a jsp page where I dynamically build a table.  In the
> cactus end method I'm using the HttpUnit WebResponse object to grab an
> instance of the table.  I'm getting an error message informing me that the
> content type is text/plain.  I have not specifically set the type to be
> text/plain anywhere in the application and thought the default in struts
> was text/html.  Any thoughts on what is happening?
> 
> The error message is:
> com.meterware.httpunit.NotHTMLException: The content type of the response
> is 'text/plain': it must be 'text/html' in order to be recognized as HTML
> at com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:789)
> at com.meterware.httpunit.WebResponse.getTables(WebResponse.java:334)
> at
> com.hane.lms.command.cart.TestUserCart_Cactus.endView(TestUserCart_Cactus.java:220)
> at
> org.apache.cactus.AbstractTestCase.callEndMethod(AbstractTestCase.java:304)
> at
> org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:425)
> at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
> at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
> 
> Thanks,
> Chris
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: checkbox

2002-01-20 Thread Ted Husted

http://jakarta.apache.org/struts/struts-html.html#checkbox

"WARNING: In order to correctly recognize unchecked checkboxes, the
ActionForm bean associated with this form must include a statement
setting the corresponding boolean property to false in the reset()
method."


"Serge A. Redchuk" wrote:
> 
> Hello struts-user,
> 
>   I'm newbie in Struts and encountered a problem when tried to get
>   boolean value of checkbox state from my form bean.
> 
>   I always have 'true', even if I unchecked my checkbox on form.
> 
>In JSP I wrote:
>Published: 
> 
>In Action that must handle the form data:
>...
>ef.getPublished() - ever true !
>...
> 
> What have I done in wrong way ?
> 
> --
> Best regards,
>  Serge  mailto:[EMAIL PROTECTED]
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: Simple example of MultipartIterator() use

2002-01-20 Thread Ted Husted

There is a simple example in the excercise application in the
distribution. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Tony wrote:
> 
> Hi
> 
> Can someone please point me in the direction of a simple example of using
> MultipartIterator(), I am not having much luck getting it to work.  I
> always get an error when I try and create a instance of this class using
> 
> MultipartIterator iterator = new MultipartIterator(request);
> 
> --
> 
> Cheers
> 
> Tony
> -
> 
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: No action instance for path-only with sub-sub-class of Action

2002-01-20 Thread Ted Husted

Something is misfiring when the ActionServlet attempts to create an
instance of the subclassed Actions. If the log detail is no help, you
may need to start over, and add the helper methods one-by-one to uncover
where the initilization error is occuring. 

There is nothing wrong with the approach -- I do this sort of thing all
the time. 



-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/

Kelly Davis wrote:
> 
> I have created a class called DefaultAction which extends Action. It
> contains some common helper methods which all my actions will use. I
> then extend DefaultAction for my actual action fooAction. When I do this
> I get 'No action instance for path /foo could be created'. Now, when I
> extend Action directly instead of using DefaultAction, I don't get the
> error. This confirms to me that my struts-config.xml is setup correctly.
> Doesn't anybody know why this is happening?
> 
> --
> Kelly Lawrence Davis
> [EMAIL PROTECTED]
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: response.sendRedirect as a POST?

2002-01-20 Thread Ted Husted

A good place to post a question like this is the jGuru Servlet forum. 

http://jguru.com/forums/Servlets



Asad Bukhari wrote:
> 
> Hi,
> General servlet-api Qs:
> I'm using HttpServletResponse.sendRedirect for
> directing to a new URL and I normally add parameters
> as a query-string to that URL like:
> https://test.com?param1=a¶m2=b¶m3=c
> I think this goes as 'GET'. Is there anyway we can use
> the sendRedirect with the POST instead. I can not use
> dispatchInterface as my request is not in the same
> application context (web-app) & I need to use absolute
> URL. Please advise?
> 
> __
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: RequestUtils - bug? design limitation?

2002-01-20 Thread Ted Husted

The bean:message tag is trying to find a locale attribute in the session
scope, so it can decide what message bunder to use. 

See also 

http://www.mail-archive.com/struts-dev@jakarta.apache.org/msg04095.html


"Esbrook, Scott" wrote:
> 
> In some of my JSPs I've tried setting the page directive <%@ page
> session="false" %> (for performance reasons) but when the JSP includes
>  tags this results in the following exception at compilation
> time:
> 
> java.lang.IllegalArgumentException: can't access SESSION_SCOPE without an
> HttpSession
> at org.apache.jasper.runtime.PageContextImpl.getAttribute(Unknown
> Source)
> at
> org.apache.struts.util.RequestUtils.message(RequestUtils.java:577)
> 
> I have set the locale attribute to false in the web.xml file for this
> application.
> 
> Browsing through the latest version of RequestUtils.java, it looks like the
> offending line is
> 
>Locale userLocale = (Locale)pageContext.getAttribute(locale,
> PageContext.SESSION_SCOPE);
> 
> Isn't this wrongfully assuming that there will be a session object to
> retrieve the attribute from?
> 
> Any help/comments greatly appreciated. Thanks,
> 
> Scott Esbrook
> Software Developer
> Compuware Corporation
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/

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




Re: html:errors error?

2002-01-20 Thread Ted Husted

Did you switch over to the messages tag? 

The orignal errors tag requires a errors.header and errors.footer in the
properties files, to provide markup, but these are optional with the
messages tag. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Frank Lawlor wrote:
> 
> I just noticed that my error messages are acting strange.
> I recently changed to a nightly build (approx 1/2).
> For example, instead of getting the text:
>   You must specify a Contact Name.
> I am now getting:
>   null You must specify a Contact Name. null
> There are no substitution parms in the properties spec:
>   error.no_contact_name=You must specify a Contact Name.
> The html generated almost looks like there are two
> null error entries:
> 
> null
> You must specify a Contact Name.
> null
> 
> but when I add my message the error array is empty.
> 
> Anyone else on a nightly build noticed any funny error messages?
> 
> Thanks,
> 
> Frank Lawlor
> Athens Group, Inc.
> (512) 345-0600 x151
> Athens Group, an employee-owned consulting firm integrating technology
> strategy and software solutions.
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: Question about forwarding back.

2002-01-20 Thread Ted Husted

One generic approach is to put a hidden control on the presentation
page, that the Action can use to determine what page submitted the
request, and what to do about it afterwards. 

In pure MVC terms, the Action should be able to deduce what page to
display next based on the state of the model. But its hard to be more
specific without knowing what A and B actually do. 

It sounds like C is being shared by two workflows. If that is the case,
then there may be some existing indicator as to which workflow is
active, or you can provide an indicator as a hidden field in the page.
So, if the C is rendered a part of workflow A, then the Action could
forward control accordingly. 

So, the A and B pages would at some point have their workflow property
set, and pass this along to the Action for C. Page C would retain the
workflow property, and submit it back to the Action, so it would know
whether to later return to A and B. 

If permitted, this is also a place where session attributes can be
useful to store information between requests, but hidden properties work
nearly as well. They require the assistance of the page designer, but
consume fewer server resoruces. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/



"Witt, Mike (OH35)" wrote:
> 
> Hello all,
> 
> Does anyone know how to forward back to a previous jsp?  For example, if I
> have A.jsp and
> B.jsp and both of these can link to an action and a page called C.jsp.  Is
> there anything Struts specific that I can do in my action to forward back to
> either A.jsp or B.jsp depending on which one forwarded to C.jsp in the first
> place?
> 
> Thanks for your help,
> 
> Mike Witt
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: Suggestion

2002-01-20 Thread Ted Husted

This code really should map directly over to the Struts html:text,
select, and options tags without any difficulty. The list would be
created in the Struts action, and the forwarded to the JSP in the
request. 

In the Javascript, be sure to use the html:rewrite tag if they need to
be logged in to use the application. 

Here's an example. 





This opens a remote window that displays a related record, based on the
item key (passed as "aRecord). 

The doRecord script can be called like this:



-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Sidhartha Jain wrote:
> 
> Hi
> Could anyone suggest a good way to code these lines in struts.I Am converting normal 
>JSP to a struts JSP and launchsearch is an Javascript function which is to be 
>called.I am totally confused and wanna do it in struts .
> 
> 
> LinkedList list = (LinkedList) pd.getValue(field);
> out.println("");
> out.println("");
> Iterator iter = list.iterator();
> while(iter.hasNext())
> {
> BioClass b = (BioClass) iter.next();
> if (b != null){}
> out.println("" + b + "");
> }
> out.println("");
> out.println(" Add");
> 
> out.println("      launchEdit(document.editForm." + field + "Sel, document.editForm." + field + ",true, 
>'" + fia[i].getType() + "')\">Add New");
> 
> Thanks in Advance
> 
> Sidh
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Beginner question, how to get URL back...

2002-01-20 Thread Alex Paransky

How do I get back the URL with which the page was called?  For example, if
the request looked like this:

http://www.testServer.com/mainPage.jsp?arg=2&arg=3

I would like to get back the /mainPage.jsp?arg=2&arg=3 part.  I know I can
call request.getRequestURI() and concat that with request.getQueryString(),
but I was hoping that there would be a more elegant (tag/bean) solution to
do this.

Thanks.

-AP_
www: http://www.alexparansky.com


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




Re: Beginner questions

2002-01-20 Thread Ted Husted

The Struts bean tags do not require the useBean read tape, and it is
rare for a Struts application to ever need to do this :) 

Struts is designed to encourage architectures based on the MVC paradigm.
Generally, we recommend that all the beans be created and properties set
by an Action object (org.apache.struts.Action) before forwarding control
the presentation page. The page should just be outputing data, and
shouldn't to do any additional processing. That's the Action's job :)

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Ronan-Yann LORIN wrote:
> 
> Hi all,
> 
> Excuse me if those questions looks stupid, I've seeked the documentation but
> couldn't find the answer.
> 
> 1) How do I write the following lines with struts:
> 
> 
> I tried to create the bean the following way without success:
> 
> and how to set all it's properties from parameters?
> 
> 2) How do I set a bean's property from an other bean property? (something
> like "logonForm.username = argv.utilisateur")
> 
> Thanks in advance for your help
> Ronan-Yann Lorin
> Banque AGF
> Direction des Opérations, Service Informatique
> tél : 01 44 86 27 99
> fax : 0 811 013 002
> mél : [EMAIL PROTECTED]

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




if statement inside html:iterate tag?

2002-01-20 Thread Hai Hoang

As I loop through the html:iterate tag, is there a way
for me to add some kind of if statement or comparison
tag inside the iterator that compares the property
with a parameter?









__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: bean:replace ?

2002-01-20 Thread Ted Husted

Oops, let me retract (A)-(C). Reusing an id on the same JSP page is
disallowed by the JSP 1.1 specification. 

-Ted.

Ted Husted wrote:
> 
> bean:define calls PageContext.setAttribute(), which does return an error
> if the attribute already exists.
> 
> 
>http://java.sun.com/j2ee/j2sdkee/techdocs/api/javax/servlet/jsp/PageContext.html#setAttribute(java.lang.String,
> java.lang.Object, int)
> 
> The options seem to be
> 
> A) Extend bean:define so that it can remove a bean first.
> B) Create a new tag to remove a bean if it exists (e.g. bean:undefine)
> C) Use a scriptlet
> D) Change the ItemList template so that you can pass the name of the
> item list as a Tiles attribute
> 
> I'd go with D :)
> 
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Building Java web applications with Struts.
> -- Tel +1 585 737-3463.
> -- Web http://www.husted.com/struts/
> 
> João Guilherme Del Valle wrote:
> >
> > Hi,
> >
> > I want to replace a bean. But bean:define does not work the way I thought.
> > I´d like to do something like this:
> >
> > ---
> > Check the new items:
> > 
> > 
> >
> > Check the most popular:
> > 
> > 
> > ---
> >
> > The page "ItemList.jsp" looks for a bean called "items" and prints it.
> > But this code gives me a compilation error, "variable items already
> > defined". I know this could be solved with the following scriptlet:
> > ---
> > <% request.setAttribute("items", request.getAttribute("mostLoanedItems") );
> > %>
> > ---
> > But I have an application with 35 pages and it´s scriptlet-free. I wouldn´t
> > like to put one because of these. In resume, there are other solutions, but
> > any ideia of an elegant one?
> >
> > João.
> >
> > Joao Guilherme Del Valle
> > [EMAIL PROTECTED]
> > Visionnaire Informática SA
> > http://www.visionnaire.com.br
> > Tel/Fax: +55 41 373-7400 r: 217
> >
> > --
> > To unsubscribe, e-mail:   
> > For additional commands, e-mail: 

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