jsp - Java calling one servlet from two sources -
I am creating a Java web-application with a user profile. The second source profile has an "edit" button. Jsp: Now, in profiles, I want to either redirect the profile either to edit.profile.jsp or to redirect. Here is the code: But I'm getting java.lang.NullPointerException. Stacktrace: Your request parameter Additionally, make sure that the code Example: {former>
I have a profile that is responsible for surrender two pages: profile.jsp and editProfile.jsp
The first source, whose profile is being called Savelt, is a menu link at the top of the page, and so on See:
& lt; A href = "profile sarlet? Super = profile" & gt; Profile & lt; / A & gt;
& lt; Form Name = "Edit Profile" method = "Receive" Action = "ProfileServlet Ultimate = EditProp" & gt; Input type = "submit" value = "edit" & gt; & Lt; / Form & gt;
if (request.getParameter ("param"). Equals ("profile")) {response.sendRedirect ("profile.jsp"); } Else if (request.getParameter ("param"). Equals ("editprof")) {response.sendRedirect ("editProfile.jsp"); }
Can you please help?
24.04 Servlet.service () for servlet () [profilePage.profileServlet] in reference with path [/ linked] exceptions java.lang.NullPointerException Throw on profilePage.profileServlet: org.apache.catalina.core.StandardWrapperValve Great Call .doGet (profileServlet.java:126) org.apache.catalina at javax.servlet.http.HttpServlet.service (HttpServlet .java: 727) at javax.servlet.http.HttpServlet.service (HttpServlet.java:620). Apply on the core at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java208) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java 2020). Filter the application Earthfolder (ApplicationFilterChain.java.303) org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:122) org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java; Org.apache.catalina.valves.AccessLogValve.invoke at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:98) at rg.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:170) Org Org.apache.coyote at .apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java116) on org.apache.catalina.connector.CoyoteAdapter.service (Coyoteadator.java 408) .http11.AbstractHttp11Processor.process (AbstractHttp11Processor.java : 1040) org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process at (orb.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run) ) In (AbstractProtocol.java:607) JIoEndpoint Java: 315) java.lang.Thread.run on java.util.concurrent.ThreadPoolExecutor $ Worker.run on java.util.concurrent.ThreadPoolExecutor $ Worker.runTask (unknown source) (
param is probably empty, you get it
if ("profile" .equals (request.getParameter ("param")) {response.sendRedirect ("profile.jsp"); } And if ("editprof" .equals (request.getParameter ("param")) {response.sendRedirect ("editProfile.jsp");}
@ override protected zero doGet (HttpRervate Request Request), HTTPSvette Response Response) {handleGetAndPost (Request, Feedback);} @ Override Protected Zero DoPost (httpProvaillet Request Request, HTTPSvette Response) {handleGetAndPost (request, response);} G. Zero handleGetAndPost (HttpServletRequest request, HttpServletResponse response) {if ("Profile" .equals (request.getParameter ("param")) {response.sendRedirect ("profile.jsp");} if if ("editProf" .equals Request.GetParameter ("Ultimate")) {response.sendRedirect ("editProfile.jsp");}}
Comments
Post a Comment