RE: Turbine and StrutsHi ST,
What is this mess with your mail! Be patient, we have jet lag.
Nothing to do special, just run Turbine in your configuration... and it
work.
Example:
package pf.cs.csinterne.business.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Locale;
import java.util.Vector;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.turbine.util.db.Criteria;
import pf.cs.csinterne.business.om.ClientPeer;
import pf.cs.csinterne.business.om.Client;
/**
* Implementation of <strong>Action</strong> that populates an instance of
* <code>RegistrationForm</code> from the profile of the currently logged on
* User (if any).
*/
public final class EditClientAction extends Action {
// --------------------------------------------------------- Public
Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and
how
* control should be forwarded, or <code>null</code> if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param actionForm The optional ActionForm bean for this request (if
any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// Extract attributes we will need
Locale locale = getLocale(request);
MessageResources messages = getResources();
HttpSession session = request.getSession();
String action = request.getParameter("action");
String id = request.getParameter("ClientId");
if (action == null)
action = "Create";
if (servlet.getDebug() >= 1)
servlet.log("EditClientAction: Processing" + action +
"action");
if (action.equals("Edit"))
{
servlet.log("Action is Edit");
if (id == null)
servlet.log("no client Id");
else
try
{
servlet.log("new criteria...");
Criteria aCriteria = new Criteria();
servlet.log("add criteria");
aCriteria.add (ClientPeer.ID,id);
servlet.log("ClientPeer.doSelect (aCriteria)...");
Vector aResultList = ClientPeer.doSelect (aCriteria);
if (aResultList == null & aResultList.isEmpty())
servlet.log("No client found");
else if (aResultList.size()>1)
servlet.log("More thant 1 client for the id : " +
id);
else
{
servlet.log("get the client from the vector...");
Client aClient = (Client)
aResultList.firstElement();
servlet.log("setAttribute...");
session.setAttribute(Constants.CLIENT_KEY ,
aClient);
}
} catch(Exception e) {
servlet.log(e.getMessage());
// Route to error page
return (mapping.findForward("failure"));
}
}
}
}
-----Message d'origine-----
De : Santosh Thakur [mailto:[EMAIL PROTECTED]]
Envoy� : jeudi 21 juin 2001 19:11
� : [EMAIL PROTECTED]; [EMAIL PROTECTED]
Objet : RE: Turbine and Struts
hi Xavier..
Nice to know your problem. I have similar situation at my end
also.. We have started using struts for it's custom tags and properly
implemented in our 1st module.. but now we have to use DB service of
Turbine.. But now facing problems in understanding and implementing ?
As u had written that u have made one page using struts and
turbine ... So can tell me how it was? Have u modified Turbine.java servlet
for that? can u send that file ???
thanks and Regards
Santosh
-----Original Message-----
From: Xavier [SMTP:[EMAIL PROTECTED]]
Sent: Friday, June 22, 2001 6:59 AM
To: [EMAIL PROTECTED]
Subject: RE: Turbine and Struts
Good question! euuuuhhh... ;-)
It was simple to anderstand the struts action and actionform.
I can write my own tag or customize an existing one.
Use jsp for graphic page it's easier.
with struts-config.xml I can easly manage the forward for each action
I like the <html:errors> tags to validate the user's inputs
But, it's true, I think it's more because I begin my project and it was
faster to start with struts... but I came to Turbine for Torque and
Object
generation...So now, before spend time to anderstand velocity, I try to
see
if it's interresting to forget struts.
So, jon, did you use this solution (Turbine and Struts) or I'm doing
something wrong (the architectures are not done to works together...or I
don't know what)
Thanks
Xa.
-----Message d'origine-----
De : Jon Stevens [mailto:[EMAIL PROTECTED]]
Envoye : jeudi 21 juin 2001 14:19
A : Turbine-user
Objet : Re: Turbine and Struts
on 6/21/01 5:19 PM, "Xavier" <[EMAIL PROTECTED]> wrote:
> It was just to know if somebody use this solution
> Xa.
What exactly does that gain you?
-jon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]