You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurie Harper <la...@holoweb.net> on 2008/04/01 13:04:54 UTC
Re: Servlet Exception While editing the values
The exception is the result of something in your JSP -- probably a bug
in some of the embedded Java code. I would suggest:
1) wrapping the entire JSP with <% try{% > and <%} catch (Throwable t) {
t.printStackTrace(); }%> to isolate the problem
2) if that's not enough to solve it, start simplifying the JSP, until
you figure out which portion is causing the error
You should also consider replacing all the scriptlet and runtime
expression fragments with equivalent Struts or JSTL tags and/or moving
logic into your action.
L.
puneet duggal wrote:
> frnds when i have applied Validations on my form so when i submit My Form in Edit Mode after leaving one field Empty then it throws a servlet Exception
>
> heres My formbean:-
>
> <form-bean name="auditorMasterbean"
> type="org.apache.struts.validator.LazyValidatorForm"
> scope="request">
>
> <form-property name="searchresult"
> type="java.util.ArrayList"/>
> </form-bean>
>
> heres My action :-
>
>
> <action
> path="/update"
> type="updateaudit"
> input="/EditAuditor.jsp"
> name="auditorMasterbean"
> scope="request"
> validate="true">
> <forward name="success" path="/auditormaster.jsp?a=1"/>
> <forward name="failure" path="/pages/AddAuditor.jsp"/>
>
> </action>
>
>
>
>
> <html>
> <head>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
>
> <LINK href="css/StyleSheet.css" type=text/css rel=stylesheet>
> <title>Add Auditor</title>
> </head>
> <body>
> <html:form action="update">
> <%
> if(request.getParameter("a")!=null) {
> if((Integer.parseInt(request.getParameter("a")))==1 ) {
> %>
> <p class="savemsg"><FONT COLOR="green"><B>RECORD SAVED</B></FONT>
> <%
> }else if((Integer.parseInt(request.getParameter("a")))==0){
> %>
> <FONT color="red"><B> Error !Try Again</B></FONT></p>
> <%
> }else if((Integer.parseInt(request.getParameter("a")))==3){
> %>
> <FONT color="red"><B>Auditor Name Already Exist</B></FONT></p>
> <%
> }
> }
> %>
> <%
> String s= request.getParameter("id");
> %>
> <table width="90%" align="center">
> <tr>
> <th id="Pageheader" align="left">Edit Auditor </th></tr>
> <tr>
> <td>
> <table width="100%" align="center">
> <tr>
> <td>
> <div id="divPersonal">
> <div id="PType" style="font-size: 11px; width: 100%; font-family: verdana">
> </div>
> </div>
> <div id="divOthers">
> <div id="OType" style="font-size: 11px; width: 797; font-family: verdana; height: 346">
> <fieldset>
> <legend>Auditor Detail </legend>
> <html:hidden property="ids" value="<%=s%>"/>
> <%
> java.util.ArrayList l=(java.util.ArrayList)session.getAttribute("searchresult");
> session.setAttribute("l",l);
> %>
>
> <logic:iterate id="result" name="l">
>
>
> <logic:equal name="result" property="id" value="<%=s%>">
> <table width="814" align="center">
> <tr>
> <td align="right" width="303" colspan="">
> Name
> <span id="Label40" style="display:inline-block;color:Red;height:10px;width:3px;">*</span></td>
> <td width="202" style="height: 26px" >
>
> <html:text name="result" property="Nam" maxlength="50" styleId="tbxnames" tabindex="1" style="color:Black;border-width:1px;border-style:solid;font-family:verdana;font-size:11px;height:20px;width:200px;" size="20"/></td>
>
> <td width="295" style="height: 26px" >
> <html:errors property="Nam"/> </td>
> </tr>
> <tr>
> <td align="right" width="303" colspan="">
> <span id="Label9">Address 1</span>
> <span id="Label29" style="display:inline-block;color:Red;height:10px;width:3px;">*</span></td>
> <td width="202" style="height: 26px" >
> <html:text name="result" property="Address1" maxlength="50" styleId="tbxAddress1" tabindex="2" style="color:Black;border-width:1px;border-style:solid;font-family:verdana;font-size:11px;height:20px;width:200px;" size="20" /></td>
>
> <td width="295" style="height: 26px" >
> <html:errors property="Address1"/></td>
>
> </tr>
> <tr>
> <td align="right" style="height: 17px" width="303">
> <span id="Label10">Address 2</span></td>
> <td style="height: 17px" width="202" >
> <html:text name="result" property="Address2" maxlength="50" styleId="tbxAddress2" tabindex="3" style="color:Black;border-width:1px;border-style:solid;font-family:verdana;font-size:11px;height:20px;width:200px;" size="20" /></td>
>
> <td style="height: 17px" width="295" >
> </td>
>
> </tr>
> <tr>
> <td align="right" style="height: 17px" width="303">
> <span id="Label10">Address 3</span></td>
> <td style="height: 17px" width="202" >
> <html:text name="result" property="Address3" maxlength="50" styleId="tbxAddress3" tabindex="4" style="color:Black;border-width:1px;border-style:solid;font-family:verdana;font-size:11px;height:20px;width:200px;" size="20" /></td>
>
> <td style="height: 17px" width="295" >
> </td>
>
> </tr>
> <tr>
> <td align="right" style="height: 22px" width="303">
> City
> <span id="Label31" style="display:inline-block;color:Red;height:10px;width:3px;">*</span>
> </td><td style="height: 22px" width="202" >
> <html:text name="result" property="City" maxlength="50" styleId="ab" tabindex="5" style="color:Black;border-width:1px;border-style:solid;font-family:verdana;font-size:11px;height:20px;width:200px;" size="20" /></td>
> <td style="height: 22px" width="295" >
> <html:errors property="City"/></td>
>
> </tr>
> <tr>
> <td align="right" style="height: 21px" width="303"> Pincode<span id="Label32" style="display:inline-block;color:Red;height:10px;width:3px;">*</span>
> </td>
> <td style="height: 21px" width="202">
> <html:text name="result" property="Pincode" maxlength="6" styleId="tbxpincode" tabindex="6" style="color:Black;border-width:1px;border-style:solid;font-family:verdana;font-size:11px;height:20px;width:200px;" size="20" /></td>
> <td style="height: 21px" width="295">
> <html:errors property="Pincode"/></td>
> </tr>
>
> <tr>
> <td align="right" style="height: 31px" width="303" >
> <span id="Label41">State</span><span id="Label33" style="display:inline-block;color:Red;height:10px;width:3px;">*</span></td>
> <td align="left" style="height: 31px" width="202">
>
> <html:select name="result" property="stat" tabindex="7" size="1">
> <html:option value="Andaman and Nicobar Islands">Andaman and Nicobar Islands</html:option>
> <html:option value="Andhra Pradesh">Andhra Pradesh</html:option>
> <html:option value="Arunachal Pradesh">Arunachal Pradesh</html:option>
> <html:option value="Assam">Assam</html:option>
> <html:option value="Bihar">Bihar</html:option>
> <html:option value="Chandigarh">Chandigarh</html:option>
> <html:option value="Chattisgarh">Chattisgarh</html:option>
> <html:option value="Dadra And NagarHaveli">Dadra And NagarHaveli</html:option>
> <html:option value="Daman And Diu">Daman And Diu</html:option>
> <html:option value="Delhi">Delhi</html:option>
> <html:option value="Goa">Goa</html:option>
> <html:option value="Gujrat">Gujrat</html:option>
> <html:option value="Harayana">Harayana</html:option>
> <html:option value="Himachal Pradesh">Himachal Pradesh</html:option>
> <html:option value="Jammu And Kashmir">Jammu And Kashmir</html:option>
> <html:option value="Jharkhand">Jharkhand</html:option>
> <html:option value="Karnataka">Karnataka</html:option>
> <html:option value="Kerala">Kerala</html:option>
> <html:option value="Lakshadweep">Lakshadweep</html:option>
> <html:option value="Manipur">Manipur</html:option>
> <html:option value="Madhya Pradesh">Madhya Pradesh</html:option>
> <html:option value="Maharashtra">Maharashtra</html:option>
> <html:option value="Meghalaya">Meghalaya</html:option>
> <html:option value="Mizoram">Mizoram</html:option>
> <html:option value="Nagaland">Nagaland</html:option>
> <html:option value="Orissa">Orissa</html:option>
> <html:option value="Pondicherry">Pondicherry</html:option>
> <html:option value="Punjab">Punjab</html:option>
> <html:option value="Rajasthan">Rajasthan</html:option>
> <html:option value="Sikkim">Sikkim</html:option>
> <html:option value="TamilNadu">TamilNadu</html:option>
> <html:option value="Tripura">Tripura</html:option>
> <html:option value="uttarPradesh">uttarPradesh</html:option>
> <html:option value="Uttranchal">Uttranchal</html:option>
> </html:select>
> </td>
>
> <td align="left" style="height: 31px" width="295">
> </td>
>
> </tr>
>
>
> <tr>
> <td align="right" style="height: 31px" width="303" >
> Membership Info</td>
> <td align="left" style="height: 31px" width="202">
> <html:text name="result" property="Membershipinfo" maxlength="50" styleId="tbxCity0" tabindex="8" style="color:Black;border-width:1px;border-style:solid;font-family:verdana;font-size:11px;height:20px;width:200px;" size="20" /></td>
>
> <td align="left" style="height: 31px" width="295">
> </td>
>
> </tr>
>
>
> <tr>
> <td align="right" style="height: 31px" width="303" >
> PAN
> <span id="Label35" style="display:inline-block;color:Red;height:10px;width:3px;">*</span></td>
> <td align="left" style="height: 31px" width="202">
> <html:text name="result" property="Pan" maxlength="16" styleId="tbx" tabindex="9" style="color:Black;border-width:1px;border-style:solid;font-family:verdana;font-size:11px;height:20px;width:200px;" size="20" /></td>
>
>
> <td align="left" style="height: 31px" width="295">
> <html:errors property="Pan"/></td>
>
>
> </tr>
> </logic:equal>
> </logic:iterate>
>
>
> <tr>
> <td align="right" style="height: 31px" width="303" >
> </td>
> <td align="left" style="height: 31px" width="202"> </td>
>
> <td align="left" style="height: 31px" width="295"> </td>
>
> </tr>
>
>
> </table>
>
>
>
> <div id="ValidationSummary2" style="color:Red;width:377px;display:none;">
> </div>
> <p> </p>
> </fieldset>
> </div>
> </div>
> </td>
> </tr>
> </table>
> </td>
> </tr>
> <tr>
> <td align="left"><html:link action="page1">Back</html:link></td>
> </tr>
> <tr align="right">
> <td><hr>
> <p>
> <html:submit/>
> <input id="btnCancel" style="font-weight: bold; font-size: 11px; width: 120px; color: white; font-family: verdana; height: 20px; border-style: none; background-color: #630000" tabIndex="22" type="reset" value="Cancel" name="btnCancel"></td>
> </tr>
> </table>
> </html:form>
> </body>
> </html>
>
> So when i submit this form leaving a field blank it through a servlet exception but it works fine if i dont leave a fiied blank csee below the exception:-
>
> exception
> javax.servlet.ServletException at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459) at javax.servlet.http.HttpServlet.service(HttpServlet.java:716) at javax.servlet.http.HttpServlet.service(HttpServlet.java:809) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPi
> peline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve
>
>
>
> root cause
> org.apache.jasper.JasperException at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:207) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187) at javax.servlet.http.HttpServlet.service(HttpServlet.java:809) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:627) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:306) at org.apache.struts.chain.commands.servlet.PerformForward
>
>
>
> ---------------------------------
> Yahoo! for Good helps you make a difference
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org