Hi folks,
I'm really weird looking this kind of problem.
I'm using
JSP file as my view and it submits my form Data to a
Struts.
addDrug.jsp:
-------------
<jsp:useBean id="drug" class="DrugDTO" scope="request"/>
<jsp:setProperty name="drug" property="*"/>
<HTML>
<FORM action="./addDrug.do" method="post">
Drug Name:<input type="txt" name="drugName"><BR>
Drug Level:<input type="txt" name="tier"><BR>
Requirements / Limits:<input type="txt" name="requirementsLimits"><BR>
<input type="submit" name="Add Drug">
</FORM>
</HTML>
Here my Form Bean DrugDTO.java:
--------------------------------
public class DrugDTO {
String drugName = null;
String tier = "--";
String requirementsLimits = null;
public String getDrugName() {
return drugName;
}
public String getRequirementsLimits() {
return requirementsLimits;
}
public String getTier() {
return tier;
}
public void setDrugName(String string) {
drugName = string;
}
public void setRequirementsLimits(String string) {
requirementsLimits = string;
}
public void setTier(String string) {
tier = string;
}
}
Action Class AddDrugAction.java
---------------------------------
public class AddDrugAction extends Action{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException{
return mapping.findForward("success");
}
}
struts-config.xml:
-------------------
<struts-config>
<action-mappings>
<action path="/addDrug" type="AddDrugAction">
<forward name="success" path="result.jsp"/>
</action>
</action-mappings>
</struts-config>
result.jsp
-----------
<jsp:useBean id="drug" type="DrugDTO" scope="request"/>
<HTML>
<BODY>
<p>
<%= drug.getDrugName() %><BR>
<%= drug.getRequirementsLimits() %><BR>
<%= drug.getTier() %><BR>
</P>
</BODY>
</HTML>
Now my problem is i'm getting all Null values if i specify scope as session in both addDrug.jsp and result.jsp. And server throws an exception if i specify scope as "request".
[10/16/05 0:28:54:262 PDT] 6b14e69c WebGroup E SRVE0026E: [
Servlet Error]-[bean drug not found within scope ]: java.lang.InstantiationException: bean drug not found within scope
at org.apache.jsp._test._jspService(_result.java:89)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:357)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:675)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:773)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at FormularySearchActionServlet.process(FormularySearchActionServlet.java:92)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
I is really appreciate if any one Help. Thanks in advance.
-murthy