Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why will this not work?  RSS feed

 
Bryan Scarbrough
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I simply trying to pass variables from a JSP form into a bean and then extract them with another JSP page and I cannot get it to work!!

Here is the code for my Login.JSP:


And here is the code for my success.jsp:


Finally, here is my bean code:


Any help would be very...Helpful!
Bryan
[ August 09, 2005: Message edited by: Bear Bibeault ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So at what point are you storing the values from your login form into the bean? Because I don't see where you have done that.
 
Bryan Scarbrough
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was curious about that as well, so how do I store them?
 
Sushma Sharma
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to put the first two lines of Login.jsp in success.jsp....
 
Bryan Scarbrough
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did that but Tomcat gives me the following error:

HTTP Status 500 -
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:359)
org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
org.apache.jasper.runtime.JspRuntimeLibrary.introspect(JspRuntimeLibrary.java:284)
org.apache.jsp.success_jsp._jspService(org.apache.jsp.success_jsp:52)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:320)
org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
org.apache.jasper.runtime.JspRuntimeLibrary.introspect(JspRuntimeLibrary.java:284)
org.apache.jsp.success_jsp._jspService(org.apache.jsp.success_jsp:52)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
Ola Daniel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From your Code the first two lines

<jsp:useBean id="login"...
<jsp:setProperty name="user"...

is not neccessary for your login.jsp page and there is a mistake there anyway. the id="login" should be the same with the name="login" as in:

<jsp:useBean id="login"...
<jsp:setProperty name="login"...

and not the way you used it. Take note.

As i was saying your login.jsp does not need the first two lines.

Now to your success.jsp page:

it should have some code similar to this at the top:

<jsp:useBean id='login' class='com.services.db.SqlConnect' scope='session'>
<jsp:setProperty name='login' property='userName' value='<%=request.getParameter("userName")%>'/>
<jsp:setProperty name='login' property='password' value='<%=request.getParameter("password")%>'/>
<jsp:useBean/>
<html>
...
.
.
.
</html>

if I were writing this I would be submitting to a servlet and not directly to a JSP.. anyways I hope this solves your problem
 
Ola Daniel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disregard the servlet comment...
 
Bryan Scarbrough
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SWEET!!! Thanks Ola Daniel, its alive!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!