JSP doPost getAtribute null value
Posted
by newbie123
on Stack Overflow
See other posts from Stack Overflow
or by newbie123
Published on 2010-05-30T16:07:37Z
Indexed on
2010/05/30
16:12 UTC
Read the original article
Hit count: 216
I want to pass value to servlet but I keep get null value.
<jsp:useBean id="Helper" class="model.Registration" scope="request"/>
<form action="/Project/Registration" method="post" enctype="multipart/form-data">
<input type="text" size="20" name="name" value="<%=Helper.getName()%>">
<input type="submit">
</form>
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
Registrationh2 = (Registration) request.getAttribute("Helper");
if(h2!=null){
System. out.println(h2.getName());
}
else
System. out.println("NULL");
}
Is there anything wrong with my code?
© Stack Overflow or respective owner