pb avec un formulaire : bean non trouvé
salut,
j'ai une page jsp qui contient un formulaire :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <%
String actionParam ="/web/clientCloseOpe.do?" + urlParam;
String comparator = ""+webbean.getComparator();
String portfolio = webbean.getPortfolio();
%>
<html:form action="<%= actionParam%>" method="post">
<div class="boxc1" style="margin-top:3px;">
<div class="boxc1fd">
<div class="boxc1Right"><%=bundle.getString("portfoliodead_date_buy")%>
<html:text style="width: 160px;" property="fromDateForm" name="fromDateForm"></html:text>
<html:text style="width: 160px;" property="toDateForm" name="toDateForm"></html:text>
</div>
</div>
</div>
<div class="fleft" style="margin-left:8px;margin-top:4px;margin-right:18px;"><img src="../files/images/commun/ok.gif" width="28" onclick="document.forms.ClientCloseOpeForm.submit();" style="cursor:pointer;" alt="" /></div> |
struts config :
Code:
1 2 3 4
| <form-bean name="ClientCloseOpeForm" type="com.clickoptions.web.form.portfolio.ClientCloseOpeForm"/>
<action path="/web/clientCloseOpe" type="com.clickoptions.web.action.portfolio.ClientCloseOpeAction" name="ClientCloseOpeForm" scope="session" input="/portfolio/clientcloseope.jsp">
<forward name="success" path="clientcloseope"/>
</action> |
bean de formulaire :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| public class ClientCloseOpeForm extends ClientOperationForm{
protected String fromDateForm;
protected String toDateForm;
public ClientCloseOpeForm()
{
super();
date = DaysSelectBean.ALL;
comparator = ""+ClickOptionsComparators.CLIENTOPE_BY_UNDERLYING_DESC;
}
public int getComparatorAsInt() {
int comp = 0;
try {
comp = Integer.parseInt(comparator);
}
catch (Exception e) {
comp = ClickOptionsComparators.CLIENTOPE_BY_UNDERLYING_DESC;
}
return comp;
}
/**
* @return Returns the fromDateForm.
*/
public String getFromDateForm() {
return fromDateForm;
}
/**
* @param fromDateForm The fromDateForm to set.
*/
public void setFromDateForm(String fromDateForm) {
this.fromDateForm = fromDateForm;
}
/**
* @return Returns the toDateForm.
*/
public String getToDateForm() {
return toDateForm;
}
/**
* @param toDateForm The toDateForm to set.
*/
public void setToDateForm(String toDateForm) {
this.toDateForm = toDateForm;
}
} |
mon bean :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
| public class WebClosePositionBean implements WebRequestBeanIntf, Serializable {
private String fromDateForm;
private String toDateForm;
private List webOpenPositionObjList;
Map positionMap;
int comparator = ClickOptionsComparators.CLIENTOPE_BY_TRANSACTION_ID_DESC;
int nbOperations = 0;
Date dateFrom = null;
Date dateTo = null;
int nbElementsByPage = 10;
int currentPage=1;
private double investedAmount=0.0d;
private double currentValue=0.0d;
private double latentValue=0.0d;
private double latentPerformance=0.0d;
private double potentialGain=0.0d;
private boolean isGameParticipate = false;
private String portfolio = null;
/** Creates new CurrentOperationBean */
public WebClosePositionBean() {
webOpenPositionObjList = new ArrayList();
}
public Map getPositionMap() {
return positionMap;
}
public void setPositionMap(Map positionMap) {
this.positionMap = positionMap;
}
/** Get the nbOperation of the liste of the bean
* @return return the number of operation
*/
public int getNbOperations() {
return nbOperations;
}
/** Get the list of operation
* @return The liste of operations
*/
public List getList() {
return this.webOpenPositionObjList;
}
/** Get the list of operation
* @return The liste of operations
*/
public void setList(List liste) {
webOpenPositionObjList = liste;
}
/** Set the comparator
* @param _comparator the comparator id
*/
public void setComparator(int _comparator) {
this.comparator = _comparator;
}
/** Get the comparator Id
* @return the comparator id
*/
public int getComparator() {
return this.comparator;
}
/** Set the mapping
* @param _mapping A string which describe the mapping
*/
/*public void setMapping(String _mapping) {
this.mapping = _mapping;
}*/
/** Get the current mapping
* @return the mapping
*/
/*public String getMapping() {
return mapping;
}*/
/** Set the nbElements by page
* @param nbElements nbElements of the list
*/
public void setNbElementByPage(int nbElements) {
this.nbElementsByPage = nbElements;
}
/** Get the nb elements by page
* @return the nbElementsByPage
*/
public int getNbElementByPage() {
return this.nbElementsByPage;
}
/** Get the dateFrom set by the user
* @return Date from
*/
public Date getDateFrom() {
return this.dateFrom;
}
/** Set the date from
* @param _dateFrom the dateFrom
*/
public void setDateFrom(Date _dateFrom){
this.dateFrom = _dateFrom;
}
/** Get the date To
* @return the date To
*/
public Date getDateTo() {
return this.dateTo;
}
/** Set the date To
* @param _dateTo the date To set by the user
*/
public void setDateTo(Date _dateTo) {
this.dateTo = _dateTo;
}
/** Set the list of all operations
* @param liste List of all operation
*/
public void setListe(List liste) {
this.webOpenPositionObjList = liste;//PortfolioUtil.toListeWebDeal(liste);
}
/** set the liste of operations
* @param liste the liste of operations
*/
public void setWebOpenPositionObjList(List liste) {
this.webOpenPositionObjList=liste;
}
public int getCurrentPage() {
return this.currentPage;
}
public void setCurrentPage(int page) {
this.currentPage=page;
}
/**
* @param i
*/
public void setNbOperations(int i) {
nbOperations = i;
}
/**
* @return Returns the isGameParticipate.
*/
public boolean isGameParticipate() {
return isGameParticipate;
}
/**
* @param isGameParticipate The isGameParticipate to set.
*/
public void setGameParticipate(boolean isGameParticipate) {
this.isGameParticipate = isGameParticipate;
}
/**
* @return Returns the portfolio.
*/
public String getPortfolio() {
return portfolio;
}
/**
* @param portfolio The portfolio to set.
*/
public void setPortfolio(String portfolio) {
this.portfolio = portfolio;
}
public double getCurrentValue() {
return currentValue;
}
public void setCurrentValue(double currentValue) {
this.currentValue = currentValue;
}
public double getInvestedAmount() {
return investedAmount;
}
public void setInvestedAmount(double investedAmount) {
this.investedAmount = investedAmount;
}
public double getLatentPerformance() {
return latentPerformance;
}
public void setLatentPerformance(double latentPerformance) {
this.latentPerformance = latentPerformance;
}
public double getLatentValue() {
return latentValue;
}
public void setLatentValue(double latentValue) {
this.latentValue = latentValue;
}
public double getPotentialGain() {
return potentialGain;
}
public void setPotentialGain(double potentialGain) {
this.potentialGain = potentialGain;
}
/**
* @return Returns the fromDateForm.
*/
public String getFromDateForm() {
return fromDateForm;
}
/**
* @param fromDateForm The fromDateForm to set.
*/
public void setFromDateForm(String fromDateForm) {
this.fromDateForm = fromDateForm;
}
/**
* @return Returns the toDateForm.
*/
public String getToDateForm() {
return toDateForm;
}
/**
* @param toDateForm The toDateForm to set.
*/
public void setToDateForm(String toDateForm) {
this.toDateForm = toDateForm;
}
} |
et dans mon action, je fais ça :
Code:
1 2
| bean.setFromDateForm(clientForm.getFromDateForm());
bean.setToDateForm(clientForm.getToDateForm()); |
et j'ai l'exception suivante :
javax.servlet.jsp.JspException: Cannot find bean: "fromDateForm" in any scope at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:934) at org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:121) at org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(BaseFieldTag.java:102) at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:81) at org.apache.jsp.portfolio.clientcloseope_jsp._jspx_meth_html_text_0(org.apache.jsp.portfolio.clientcloseope_jsp:1938) at org.apache.jsp.portfolio.clientcloseope_jsp._jspService(org.apache.jsp.portfolio.clientcloseope_jsp:587) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263) at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:302) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.clickoptions.web.filter.TrackingFilter.doFilter(TrackingFilter.java:59) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.clickoptions.web.filter.ResourceBundleFilter.doFilter(ResourceBundleFilter.java:223) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.clickoptions.web.filter.XSSFilter.doFilter(XSSFilter.java:114) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.clickoptions.web.filter.IPFilter.doFilter(IPFilter.java:94) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:744) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:674) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:866) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source)
quelqu'un pourra m'aider ?
merci