RE: How to generically forward to page you came from?

2001-08-30 Thread David Noll

Alex,

Here is one approach. When linking to the generic action class, include the
URI of the page that the link is on as a parameter. For example:

<% String referrer = request.getRequestURI();
   request.setAttribute("referrer", referrer); %>

Click here

Within the action, parse the parameter that designates the referrer, and
construct an ActionForward back to it: For example:

return new ActionForward(request.getParameter("referrer"));

Error checking code ommitted for the sake of brevity.

David


-Original Message-
From: Alex Colic [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 4:04 PM
To: Struts
Subject: How to generically forward to page you came from?


Hi,

I am creating a generic action class that after it is finished it needs to
forward to the page that called it. I have tried "mapping.getInput()" but
obviously since I haven't specified a input page in the struts.xml for the
action class I can't use that. Any thoughts?

Alex




RE: input in XML config

2001-06-06 Thread David Noll


Forget what I said last night about calling setInput() from the
ActionForm. Setting the input in the ActionForm's validate method
flagrantly violates Struts' MVC architecture; flow of control should
always be defined by the controller servlet and struts-config.xml. But
saving request scope variables as part of an ActionForm isn't always
an option. I think the best solution to Max's problem is to define the
input as the full path to the original action, then make sure that the
form coming from that page includes the necessary parameters to
recreate the original action page.

The following hypothetical situation should make this a bit clearer:

- You are running an online bookstore backed by a database. To display
  books you have defined an action as "viewbook.do". The action takes
  one parameter, an ISBN, so the user ends up seeing the url
  http://server/viewbook.do?ISBN=123.

- On the book's page, you have a form asking users to rate the
  book. Part of the rating form uses a select box generated from a
  database of possible ratings (this list, all the possible ratings,
  is the kind of request scope variable that one would *not* want to
  store as part of a form; the list doesn't pertain to data the user
  entered, it merely defines *possible* input values).

- When the user submits the ratings form, an ActionForm validates the
  input. In struts-config, the input attribute for the "save ratings"
  action is defined as "viewbook.do". Now suppose that the ratings
  ActionForm generates errors... in order for the "view book" action
  to successfully recreate the page that the ratings form was
  submitted from, it needs an ISBN parameter. The solution to that
  seems fairly simple--just drop in a hidden ISBN field in the ratings
  form.

What I don't like about this solution is that information essential to
successfully defining the flow of control--a parameter that is part of
the definition of the input page--has to be in an HTML form. Perhaps a
feature for Struts 1.1 could be a special input value that signified
"use the form's HTTP referrer header, including all request
parameters, as the input for this form". Or, quite possibly, there is
an even more elegant solution that someone out there has discovered.

Cheers,
David

-Original Message-
From: Ted Husted [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 05, 2001 9:11 PM
To: [EMAIL PROTECTED]
Subject: Re: input in XML config


Could you create these request scope beans as properties of the
ActionForm?

David Noll wrote:
>
> Max,
>
> I don't know if it's the official way to do it, but in my ActionForm's
> validate() method, I call mapping.setInput() with the full path of the
> original Action. An important thing to note is that if your Action class
> pre-populates an ActionForm for the page, you should check for the
> ActionForm's existence before populating it.
>
> All that said, it does seem a bit cumbersome to go through all that merely
> to return to a dynamically generated input page if there are form errors.
> Does anyone on the list know of a cleaner way to achieve this?
>
> David
>
> --
> David Noll, Public Digital
> [EMAIL PROTECTED]
>
> -Original Message-
> From: LORENA MASSIMO [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 05, 2001 6:37 AM
> To: '[EMAIL PROTECTED]'
> Subject: input in XML config
>
> Hi,
> in an action mapping i'd like to reexecute the complete action instead of
a
> simple jsp when the validate method of the form fails, because i need to
> create some beans having request scope
> So my question is...
> Is it possible to have an action in the input fiele of a mapping instead
of
> a simple jsp?
> thanks Max




RE: input in XML config

2001-06-05 Thread David Noll

Max,

I don't know if it's the official way to do it, but in my ActionForm's
validate() method, I call mapping.setInput() with the full path of the
original Action. An important thing to note is that if your Action class
pre-populates an ActionForm for the page, you should check for the
ActionForm's existence before populating it.

All that said, it does seem a bit cumbersome to go through all that merely
to return to a dynamically generated input page if there are form errors.
Does anyone on the list know of a cleaner way to achieve this?

David


--
David Noll, Public Digital
[EMAIL PROTECTED]

-Original Message-
From: LORENA MASSIMO [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 05, 2001 6:37 AM
To: '[EMAIL PROTECTED]'
Subject: input in XML config


Hi,
in an action mapping i'd like to reexecute the complete action instead of a
simple jsp when the validate method of the form fails, because i need to
create some beans having request scope
So my question is...
Is it possible to have an action in the input fiele of a mapping instead of
a simple jsp?
thanks Max




RE: Any hosting sites that use Struts?

2001-05-30 Thread David Noll


I can recommend Servlets.net quite strongly. They recently switched to Resin
1.25 which works very well with Struts. I've successfully hosted a 50,000
session/month site with them. They are a small shop, but their support staff
is responsive and they offer a plethora of services--CVS, MySQL, Postgres,
&c.

In short, I would use them for anything that didn't require a dedicated box.

Cheers,

David


-Original Message-
From: Jeff Trent [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 12:12 PM
To: [EMAIL PROTECTED]
Subject: Any hosting sites that use Struts?


Anyone know of a hosting facility that offers Java web hosting + Struts?




RE: Hide and Show Problem

2001-05-22 Thread David Noll


Your problem is being caused by differences in the JavaScript Document
Object Model between browsers. The simplest solution is to use a JavaScript
library which accounts for such differences, such as the DynAPI:

http://sourceforge.net/projects/dynapi.

That said, this is not really a Struts-related problem and would best be
discussed somewhere like this:

http://forums.devshed.com/

Cheers,
David

-Original Message-
From: Dinesh Chaturvedi [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 7:25 AM
To: [EMAIL PROTECTED]
Subject: RE: Hide and Show Problem


well doing it on server side does not make sense i want it on client
side.

Thanks & Regards

Dinesh Chaturvedi
Programmer Analyst
Nihilent Technologies Pvt Ltd.
Pune 6054452 Ext 349


-Original Message-
From: William Jaynes [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 4:36 PM
To: [EMAIL PROTECTED]
Subject: Re: Hide and Show Problem


I would do this on the server side by wrapping the text box in a logic
tag.




But perhaps you have a requirement to do it on the client.

- Original Message -
From: "Dinesh Chaturvedi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 22, 2001 4:56 AM
Subject: Hide and Show Problem


Hello Friends i am facing a problem.i want to hide and show a text box
(html element )  at run time. using both netscape 4.x and IE 4.x the
problem is it works fine with IE if i use a style sheet with the element
and at run time using java script functions i can say

for hide

document.forms[0].element.style.dispaly="none";

for show

document.forms[0].element.style.dispaly="block";

but when i try to use style with netscape 4.x it does not support style
sheet.
also it is difficult or rather not possible to access a div tag usin
netscape.

CAN any body of you help me find a way out of this problem or can
anybody suggest a newsgroup or place where i can put forward my
problem.please help.i am getting frustrated with the problem i
have tried many ways but 

Dinesh





JDBC driver specific functionality/GenericConnections

2001-05-04 Thread David Noll

Hello,

I would like to access functionality specific to the MM MySql driver in an
application that uses Struts' datasource pool and am having a bit of
troubling casting a GenericConnection back to an
org.gjt.mm.mysql.Connection. Casting from a GenericConnection to an
org.gjt.mm.mysql.Connection results in a class cast exception; casting a
Statement or PreparedStatement generated by the GenericConnection produces a
null pointer exception. I am working with Struts 1.0-beta-1 and MM Mysql
2.0.4.

If it sheds any light on the problem, the MM function I would like to access
is PreparedStatement.getLastInsertID(). Has anyone successfully prosecuted
this?

On a tangential note--why is the getConnection() method in GenericConnection
private? Were it public, I assume I could use it to get an MM Connection and
execute MySql specific functions to my heart's content.

Thanks is advance,
David






RE: sending user to a anchor on a page.

2000-12-18 Thread David Noll

Perhaps an interstitial jsp like this?

<%
  String url = request.getParameter("url");
  String anchor = request.getParameter("anchor");
  String whereTo = url + "#" + anchor;
  response.sendRedirect(whereTo);
%>

referenced in action.xml as:

...

...

If your servlet engine throws an exception on the redirect, you could
alternately write in a meta refresh tag, with the downside that the
interstitial would show up in the browser.

D.

--
David Noll, Public Digital
[EMAIL PROTECTED]


-Original Message-
From: Oleson, Rex [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 18, 2000 5:57 PM
To: '[EMAIL PROTECTED]'
Subject: sending user to a anchor on a page.


I was wondering if there was any way to send a user to a specific
portion of
a page after the action class has executed.

as an example lets say that I have a user registration page. If the
user
inputs some bugus information I would like to return
them to that exact area of the page that they need to correct the
info.

So there is the page
userReg.jsp
The Form class
UserRegForm.java
the Action class
UserRegAction.java

what I was thinking for the action.xml doc is something like
  







where zip is the name of an anchor on userReg.jsp

This does not work though
all I get is a 404 error and nothing in the webservers output or log
files.

Any help or suggestions would greatfully appreciated.
Thank you,
Rex Oleson




RE: path info

2000-12-04 Thread David Noll

Thanks for the response. The path mapped servlets didn't work when I
tried them; the same error was thrown, which I think makes sense. In a
url like this:

/do/action/whatever

the path info starts at the second slash, and struts is setup to
expect a leading slash in an action path. An eventual solution might
be to allow regex matching in the action path attribute. Then a
struts action class would only need to delete the "real" action path
from the beginning of the path info to get path info relative to the
action. If that sounds like a reasonable idea to the list, I'll put a
feature request in bugrat.

BTW, the whole point of this exercise is to create a means of
browsing a database that is friendly to search engines that don't
recognize pages with query strings.

Cheers,
David

-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 04, 2000 8:02 PM
To: [EMAIL PROTECTED]
Subject: Re: path info


David Noll wrote:

> Hello,
>
> Hopefully this is a no-brainer. How can I configure struts to call
an
> action, and include the path info? EG - my normal action is called
at:
>
>server/action.do
>
> I would like to call this action like this:
>
>   server/action.do/some/extra/random/parameters/etc
>
> and later on, in my action class access that extra info via
> javax.servlet.http.HttpServletRequest.getPathInfo(). With out of the
> box servlet init params and action.xml values, I get an error
> specifying that an invalid path was requested. I'm developing
against
> struts .5, if it makes a difference.

Well, it's simple but not necessarily obvious ...

The servlet spec's definition of extension mapping is that it only
looks for an
extension after the last slash.  In effect, that means you cannot use
path info
with extension mapped servlets.  Alternatives:

* Use path-mapped servlets instead (maybe "/do/*").

* Pass the extra info as a query string rather than
  as extra path info.

>
> Thanks,
> David
>

Craig McClanahan






path info

2000-12-04 Thread David Noll

Hello,

Hopefully this is a no-brainer. How can I configure struts to call an
action, and include the path info? EG - my normal action is called at:

   server/action.do

I would like to call this action like this:

  server/action.do/some/extra/random/parameters/etc

and later on, in my action class access that extra info via
javax.servlet.http.HttpServletRequest.getPathInfo(). With out of the
box servlet init params and action.xml values, I get an error
specifying that an invalid path was requested. I'm developing against
struts .5, if it makes a difference.

Thanks,
David

--
David Noll, Public Digital
[EMAIL PROTECTED]




Re: mailing list accessable from web

2000-11-17 Thread David Noll


http://www.mail-archive.com/struts-user%40jakarta.apache.org/

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 17, 2000 7:37 AM
Subject: mailing list accessable from web



Hello

I must admit that I'm not used to using mailing lists.
I prefer news groups, so that I can easily browse and search old
messages, for example using www.deja.com.

Is there any way as of today to browse and search the mailing list
for struts-user / struts-dev using my browser ?

If not, is there any plans for a news group / mailing list archive
on the web ?

Just asking
Alf Hogemark