开发者

request.getParameter returning null values in firefox

I have a jsp form element that looks like this..

<form method="post" action="candicreate" name="Candi_Creation" id="new_candi" ons开发者_开发知识库ubmit="return validateForm();">
    <table width="600" cellpadding="0px" cellspacing="5px">
    <tr>
        <td>
        <div class="leftDiv" align="left"><strong>Candidate First Name</strong></div>
        </td>
        <td>
        <div class="rightDiv" align="right">
            <input required="required" form="Candi_Creation" name="cfname" type="text"/> 
        </div>
        </td>
    </tr>
</table>
</form>

And my Servlet is like this

public class CandiCreateServlet extends HttpServlet
{
    public void doPost(HttpServletRequest request, HttpServletResponse response) 
    throws IOException, ServletException 

    {      
        String fname = request.getParameter("cfname");
    }
}

here is my web.xml

<servlet>
    <servlet-name>CreateCandi</servlet-name>
    <servlet-class>com.web.formgetter.CandiCreateServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>CreateCandi</servlet-name>
    <url-pattern>/jsp/candidates/candicreate</url-pattern>
</servlet-mapping>

The problem I am facing is that the when I try to submit the form using firefox the request.getParameter returns null in the servlet. it is working with chrome and ie. Should there be any browser configurations that I should do for this to work like cookies etc??

I can provide any more clarifications if needed. I really appreciate any help. Thanks in Advance


Setting form="Candi_Creation" means the input is associated with the form which has id="Candi_Creation", not whatever form happens to be its ancestor. But your form's id is a different value, so the input is not associated with any form at all in your case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜