Hi, All!
I am having some kind of weird problem.
I have 54738276256347 jsp forms working ok, but one is not woirking.
This "not working form" is just like the others, I revised that 324 times....
But it does not work and the others work. :(((
I am expend 2 days now trying to determine the problem, but unsucessfull.
:((((((
I discover somethings:
- The form object is instanciated on JSP loading and again when JSP is
submitted
- The JSP fields are not copyed to form object fields (that is the
problem!!!)
- The request have a non filled form object
- Text fields does not work, too. :((
- The JSP is rendered property.
- The validation method on form object is executed, but none of the setters.
:((((
PLEASE!!!!!! I really need some help.
Thanks for all.
The struts-config.xml
have:--------------------------------------------------------------------------
<form-bean name="SellReportForm" type="athena.form.sell.ReportForm"/>
<forward name="/sell/SellReportForm" path="/sell/forms/report.jsp"/>
<action path="/sell/SellReportForm" type="athena.action.sell.ReportAction"
name="SellReportForm" scope="request" input="/sell/forms/report.jsp">
<forward name="result" path="/sell/report.jsp"/>
</action>
End of
file-------------------------------------------------------------------------------------------
The Form
Page:---------------------------------------------------------------------------------------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<jsp:useBean id="nb" class="baltar.sell.BPNatureBean" scope="request" />
<bean:define id="n" property="all" type="java.util.List" name="nb" />
<jsp:useBean id="tb" class="baltar.sell.BPTypeBean" scope="request" />
<bean:define id="t" property="all" type="java.util.List" name="tb" />
<jsp:useBean id="cb" class="baltar.sell.BPCategoryBean" scope="request" />
<bean:define id="c" property="all" type="java.util.List" name="cb" />
<jsp:useBean id="eb" class="baltar.sell.BPEspecieBean" scope="request" />
<bean:define id="e" property="all" type="java.util.List" name="eb" />
<jsp:useBean id="gb" class="baltar.sell.BPGroupBean" scope="request" />
<bean:define id="g" property="all" type="java.util.List" name="gb" />
<jsp:useBean id="ob" class="baltar.sell.ReportBean" scope="request" />
<bean:define id="o" property="orders" type="java.util.List" name="ob" />
<html>
<body>
<html:errors/>
<h2>
Relatorios:
</h2>
<html:form action="/sell/SellReportForm">
Pontos de Neg�cios:
<ul>
<li>
Natureza:
<html:select property="BPNature">
<option value="0">Todas</option>
<html:options collection="n" property="oid" labelProperty="name" />
</html:select>
<br/>
</li>
<li>
Tipo:
<html:select property="BPType">
<option value="0">Todas</option>
<html:options collection="t" property="oid" labelProperty="name" />
</html:select><br/>
</li>
<li>
Grupo:
<html:select property="BPGroup">
<option value="0">Todas</option>
<html:options collection="g" property="oid" labelProperty="name" />
</html:select><br/>
</li>
<li>
Especie:
<html:select property="BPEspecie">
<option value="0">Todas</option>
<html:options collection="e" property="oid" labelProperty="name" />
</html:select><br/>
</li>
<li>
Categoria:
<html:select property="BPCategory">
<option value="0">Todas</option>
<html:options collection="c" property="oid" labelProperty="name" />
</html:select><br/>
</li>
</ul>
Ordena��o:
<html:select property="BPCategory">
<html:options collection="o" property="value" labelProperty="caption" />
</html:select>
<br>
<html:submit/>
</html:form>
</body>
</html>
End of
file-------------------------------------------------------------------------------------------
The Form
Object:---------------------------------------------------------------------------------------------
/*
* Created on 16/10/2003
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package athena.form.sell;
import java.sql.Date;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorForm;
import org.apache.commons.logging.*;
/**
* @author Jim Bruno Goldberg
*
* MD5 Servi�os Internet (C) 2003 (R) All right reserved
*/
public class ReportForm extends ActionForm {
int order;
long btype;
long bespecie;
long bcategory;
long bnature;
long bgroup;
Log log=LogFactory.getLog("SellReportForm");
/* CONSTRUCTORS */
public ReportForm() {
}
/* GETTERS */
public long getBPType() {
log.info("Type returned:"+btype);
return btype;
}
public long getBPEspecie() {
log.info("Especie returned:"+bespecie);
return bespecie;
}
public long getBPCategory() {
log.info("Category returned:"+bcategory);
return bcategory;
}
public long getBPNature() {
log.info("Nature returned:"+bnature);
return bnature;
}
public long getBPGroup() {
log.info("Group returned:"+bgroup);
return bgroup;
}
public int getOrder() {
log.info("Order returned:"+order);
return order;
}
/* SETTERS */
public void setPBType(long a) {
log.info("Type set to "+a);
btype = a;
}
public void setPBNature(long a) {
log.info("Nature set to "+a);
bnature = a;
}
public void setPBGroup(long a) {
log.info("Group set to "+a);
bgroup = a;
}
public void setPBEspecie(long a) {
log.info("Especie set to "+a);
bespecie = a;
}
public void setOrder(int a) {
log.info("Order set to "+a);
order=a;
}
//// THE FOLLOW METHOD is EXECUTED FINE..../////////
public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
log.info("Validating....");
log.info("Btype value is:"+btype); /// THIS BTYPE RETURNS 0
return errors;
}
}
End of
file-------------------------------------------------------------------------------------------
My action
have:---------------------------------------------------------------------------------------
public class ReportAction extends HibernateAction {
athena.form.sell.ReportForm form;
RegionalContext rc = new RegionalContext();
public ActionForward execute(
ActionMapping mapping,
ActionForm f,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException, Exception {
servlet.log("Initializing report action");
/* Inicializa Action */
form = (athena.form.sell.ReportForm) f;
////HERE//// The Follow command always return 0 on each get !!!!!
servlet.log(
form.getBPCategory()
+ " / "
+ form.getBPType()
+ " / "
+ form.getBPGroup()
+ " / "
+ form.getBPEspecie()
+ " / "
+ form.getOrder()
+ " / "
+ form.getBPNature());
(... The action continues.....)
End of
file-------------------------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]