Hi i am new is web2py, and im very confused. this is what i do in java
but i dont know how to do this in web2py. For example, here i have my
form, but in web2py the form is in the controller? and tha labels are
in the model?
And in web2py i dont do insert statement. someone could help me? how
can i do this? is there a form to do this in web2py with this steps?
When i want to do a CRUD in java i do this
In my jsp i write my html code to make a page. for example
<form action="/FoodWeb/ActionServlet" method="post">
<table width="60%" border="0">
<tr>
<td>Puppy Food</td>
<td><input type="text" name="txtPuppy" /></td>
</tr>
<tr>
<td><input type="submit"
value="Submit"/></td>
</tr>
<input type="hidden" name="param" value="submit"/>
</table>
in the controller i have this
public void processRequest(HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException
{
String resource= "";
String param = request.getParameter("param");
if (param == null)
{
ProviderDAOImpl prov = new ProviderDAOImpl();
Collection c = prov.showProvider();
HttpSession sesion = request.getSession();
sesion.setAttribute("provider", c);
recurso = "/Registro.jsp";
} else {
if (param.equals("submit")) {
String puppy = request.getParameter("txtPuppy");
StoreBean ab = new StoreBean();
ab.setNPuppy(Integer.parseInt(puppy));
RegStoreDAOImpl reg = new RegStoreDAOImpl();
reg.submit(ab);
recurso = "/Registro.jsp";
}
}
response.sendRedirect(response.encodeURL("/BDFWeb" + recurso));
}
then in the controller i have the DAOImpl
public void submit(StoreBean ab) {
Connection con = null;
CallableStatement csmt = null;
String SQL = "{ call uspIngresoSacos(?,?,?,?) }";
con = conectar("jdbc/Store");
try {
csmt = con.prepareCall(SQL);
csmt.setInt(2, ab.getNPuppy());
csmt.execute();
} catch (SQLException e) {
e.printStackTrace();
} finally {
freeStatement(csmt);
freeConnection(con);
}
}
well this calls the DAO and the Datasource with songleton pattern
The next is the model: that have the getters and setters.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---