Hi All,
I am using Struts 1.0 on Windows 2000 running Weblogic 5.x
There's a lot of code on the bottom so please bear with me. I supplied the
code to give a clear understanding of what I'm doing. I promise to be
concise and to the point.
The page i am creating mypage.jsp displays fine initialy (w/0) submitting
the form. But when I submit the form I get a NullPointerException and a
unsynchronized error. In the my action class I have no logic other than to
return to my original page (mypage.jsp). The problem is occuring because of
a select tag that I am using.
One of the ways I tried to solved the problem was to first use a Vector
instead of an ArrayList since a Vector is synchronize and ArrayLists are
not. This didn't get rid of the synch error. Key word search for
"synchronize" and "synchronize select" at JGuru FAQ and struts-user Mail
Archive did not return me any listings of any help.
The way I am creating the select is at follows:
*** Begin of mypage.jsp
<bean:define name="myForm" type="java.util.Vector" id="bdMonth"
property="bdMonth"/>
<html:select property="selectedBdMonth">
<html:options collection="bdMonth" property="idValue"
labelProperty="displayValue"/>
</html:select>
*** End of mypage.jsp
*** Begin of MyForm.jsp
private Vector bdMonth = null;
private String selectedBdMonth = null;
// constructor
public MyForm(){
....
// BEGIN DATE
bdMonth = new Vector();
bdMonth.add(new OptionValues("01", "jan"));
bdMonth.add(new OptionValues("02", "feb"));
bdMonth.add(new OptionValues("03", "mar"));
bdMonth.add(new OptionValues("04", "apr"));
bdMonth.add(new OptionValues("05", "may"));
bdMonth.add(new OptionValues("06", "jun"));
bdMonth.add(new OptionValues("07", "jul"));
bdMonth.add(new OptionValues("08", "aug"));
bdMonth.add(new OptionValues("09", "sep"));
bdMonth.add(new OptionValues("10", "oct"));
bdMonth.add(new OptionValues("11", "nov"));
bdMonth.add(new OptionValues("12", "dec"));
}
// inner class for storing select box values.
public class OptionValues{
private String idValue = null;
private String displayValue = null;
public OptionValues() {}
public OptionValues(String idValue, String displayValue){
this.idValue = idValue;
this.displayValue = displayValue;
}
public String getDisplayValue() { return (this.displayValue); }
public void setDisplayValue(String displayValue) { this.displayValue =
displayValue; }
public String getIdValue() { return (this.idValue); }
public void setIdValue(String idValue) { this.idValue = idValue; }
}
*** End of MyForm.jsp
below is the error I get after submitting the form...
thanks in advanced,
- ej
**** start of weblogic error *****
java.lang.NullPointerException
at weblogic.utils.UnsyncHashtable.put(UnsyncHashtable.java, Compiled
Cod
e)
at
weblogic.servlet.jsp.PageContextImpl.setAttribute(PageContextImpl.jav
a, Compiled Code)
at
weblogic.servlet.jsp.PageContextImpl.setAttribute(PageContextImpl.jav
a:155)
at
org.apache.struts.taglib.bean.DefineTag.doStartTag(DefineTag.java:210
)
at jsp_servlet._cma.__auction._jspService(__auction.java, Compiled
Code)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:120)
at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
cherImpl.java:168)
at
org.apache.struts.action.ActionServlet.processValidate(ActionServlet.
java:2169)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:156
6)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:511)
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>