Yes. I pass in not only the HttpServletRequest but also the HttpServlet
class itself
and the HttpServletResponse. I then parse the request inside the perform,
parsing
each of the submit values on the form into calls to business object methods.
Since
the action classes are just really subprocs of the controller servlet,
passing down
all the servlet context classes works fine. I also need to pass the response
as the
last thing the action class always does is route to the next JSP.

I'm actually rather Javascript ignorant so I'm not sure if it'll solve my
problem.
Do you think it would be possible to have javascript convert hyperlinks into
submits
of the format my servlet requires?

Also, I'd prefer not to have to rely on javascript being enabled on the
browser. As
my app just wouldn't work without it set. I'm hoping there's a nice
server-side
solution to this.
Thanks,
Ferghil

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Tom
Copeland
Sent: Tuesday, June 06, 2000 10:11 AM
To: [EMAIL PROTECTED]
Subject: Re: Handling hyperlinks in an MVC servlet app (resending second
time)


Hi Ferghil -

        Just a quick question about this Model 2 arch - when you call
RetrieveVendors.perform(), do you pass the HttpServletRequest as a parameter
to perform()?  Or do you parse the parameters and then pass them in
individually?  Seems like you'd almost have to do the former... just
wondering how you do it.

        FWIW, I frequently use the Javascript onClick() event handle to do
various preprocessing on the form - concatenating arrays, setting a boolean,
etc.  Then I build the URL request string and call location.replace() on the
target frame, which can be the current frame or another one.  You probably
knew all that stuff already, but I figured it's worth mentioning.

        Yours,

Tom

-----Original Message-----
From: Ferghil O'Rourke [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 07, 2000 11:22 AM
To: [EMAIL PROTECTED]
Subject: Handling hyperlinks in an MVC servlet app (resending second
time)


Anyone got any ideas on how handle hyperlinks in an MVC controller servlet?

We've been in the process of developing a servlet based on the MVC model 2
architecture for the last few months now. And many thanks to Craig for his
key contributions here. I've implemented his action class mechanism
successfully to have a single "controller" servlet interact with java
business objects thru action objects.

Each action object maps to the name attached to a FORM SUBMIT in our JSP
pages. So, for example, a pushbutton submits the name "RetrieveVendors.do"
to the controller servlet, the servlet uses this string as a key to a
hashtable of action class names, instantiates the relevant action class, and
finally invokes it's perform() method. The action class then takes over and
performs processing relavant to that pushbutton. It also has the facility to
pull all the data from the SUBMIT into the relevant business object.

It all works very nicely. However, the whole mechanism does depend on all
interaction with the controller servlet being performed using FORM SUBMITS.
I'm fine with this but there are times when I'll want to interact with the
controller servlet via a hyperlink - or **via a SUBMIT that looks and
behaves like a hyperlink.**

SUBMITs will always look like button clicks - the mouse pointer doesn't turn
into a finger but remains as an arrow etc. There are ways to make SUBMITs
resemble hyperlinks using IE4 style tags but these don't work for netscape.

Anyone encountered this sort of problem before? I'd prefer to keep
everything as a SUBMIT so that I'm always routing through the servlet. I'd
like to compromise and use a real hyperlink only when the target page
contains static content.

Any ideas thoughts really welcome.
Thanks,
Ferghil O'Rourke
USMoving.com - chief programmer

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to