Hi Nelson,
you are missing something, when you call sendRedirect(url) what
actually happens is that the server asks the client to fetch a new
page given by your url, most of the time with new request.
So, no matter what attribute you set you gonna loose that.

But if you have to, then create a HttpSession object like
HttpSession session  = request.getSession();
then store whatever you want to store like

session.setAttribute("stFullName",stFullName);

you can take similar steps in jsp to get the session and
then get the attributes by

session.getAttribute("stFullName");


You can also use RequestDispatcher object. and use forward method.



Regards

Mearaj

On Aug 23, 5:26 pm, "Nelson Rodrigo - LHQ"
<nelson.rodr...@loadstarlk.com> wrote:
> Dear Ahish
>
>                 As your example, I have use that.
>
> So how I get those values in my jsp.
>
> Thanks & Kind Regards,
>
> Nelson Rodrigo
> Executive – Software Development
> LOADSTAR (PRIVATE) LIMITED
> Sri Lanka | Tel: +94 11 483 7914 | Fax: +94 11 224 0892 | Mobile: +94 77 311
> 6556
>
> P SAVE PAPER  - Please consider our environment before printing ü
>
> From: Ashish Mishra [mailto:misra.ash...@gmail.com]
> Sent: Monday, August 23, 2010 5:21 PM
> To: nelson.rodr...@loadstarlk.com
> Subject: Re: [java ee programming] Servlet Error
>
> Dear Nelson,
>
> You need to set the value to request in the " if block "
>
> --------------------------------------------------------------------------- -
> ---------------------
>
> if (rs.next()) {
>
> String stFullName = rs.getString("FullName");
>
>       request.setAttribute("<your attribute name>",stFullName);
>
>       response.sendRedirect("MainFrame.jsp");
>
> } else {  
>
> --------------------------------------------------------------------------- -
> ----------------------
>
> Regards,
>
> Ashish
>
> On Mon, Aug 23, 2010 at 5:14 PM, Nelson Rodrigo - LHQ
>
> <nelson.rodr...@loadstarlk.com> wrote:
>
> Dear Friends
>
> Hi Friends
>
> In my login servlet I have use as follows
>
> ResultSet rs = stmt.executeQuery("SELECT UsrName, PWord, FullName, SAPNo,
> eMail FROM tbllogin WHERE UsrName='" +lgNam+"'and PWord='"+lgPas+"'");
>
> And if success I want to use those db values to my jsp
>
> if (rs.next()) {
>
> String stFullName = rs.getString("FullName");
>
>       response.sendRedirect("MainFrame.jsp");
>
> } else {          
>
> In JSP I have use
>
> String sUserName = request.getParameter("stFullName");
>
> out.println("Name : " + sUserName  );
>
> but result is null
>
> what happened?  Where I missed?
>
> Thanks & Kind Regards,
>
> Nelson Rodrigo
> Executive – Software Development
> LOADSTAR (PRIVATE) LIMITED
> Sri Lanka | Tel: +94 11 483 7914 | Fax: +94 11 224 0892 | Mobile: +94 77 311
> 6556
>
> P SAVE PAPER  - Please consider our environment before printing ü
>
> --
> You received this message because you are subscribed to the Google
> Groups "Java EE (J2EE) Programming with Passion!" group.
> To post to this group, send email to
> java-ee-j2ee-programming-with-passion@googlegroups.com
> To unsubscribe from this group, send email to
> java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
> <mailto:java-ee-j2ee-programming-with-passion%2bunsubscr...@googlegroups.co m
>
> For more options, visit this group 
> athttp://groups.google.com/group/java-ee-j2ee-programming-with-passion?...
> l=en
>
> --
> Best Regards
> Ashish Mishra

-- 
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

Reply via email to