getAttribute « API « JSP-Servlet Q&A





1. JSP Page HttpServletRequest getAttribute Typecasting    stackoverflow.com

Any ideas on the correct method of typecasting an Object out of a getAttribute request from a JSP page HttpServletRequest? I have googled but it seems that the common solution is just ...

2. getServletContext().getAttribute() returning null?    stackoverflow.com

When trying to set Context attributes like so:

void init()
{
    String testing = new String();
    testing = "This is a test";
    getServletContext().setAttribute("test", testing);
}
In ...

3. problem with setAttribute() and getAttribute() in servlets and jsp    stackoverflow.com

hi i want to set some attributes in a request in my servlet and get them back in a jsp. i used the following code but it didn't do that for me.when ...

4. Difference between getAttribute() and getParameter()    stackoverflow.com

What is the difference between getAttribute() and getParameter() ?

5. jsp can't get object from servlet using "getAttribute"    coderanch.com

Hello fellow, I am using servlet 1.1 and jsp 1.0. In servlet, I tried: req.setAttribute(a, b); res.sendRedirect("somejsp"); In somejsp: Object o = request.getAttribute(a); I didn't use "seeion.setAttribute" because I don't want session here. Now on the jsp side, the "request.getAttribute(a)" keeps returning null result. No compile error though. on jsp side, i also tried use but same ...

8. getAttribute and getParameter    coderanch.com

Please refer to the documentation for detailed differences. One of the differences is , in request.getParameter("var") method, you get the parameter value of the variable "var" which was sent through the HTML page and return a String value. But in case of the request.getAttribute(Object o) method, you get the attribute added for Object o as the return value. These value are ...





13. ServletRequest.getAttribute()    coderanch.com

15. jsp can't get object from servlet using "getAttribute"    coderanch.com

Hello fellow, I am using servlet 1.1 and jsp 1.0. In servlet, I tried: req.setAttribute(a, b); res.sendRedirect("somejsp"); In somejsp: Object o = request.getAttribute(a); I didn't use "seeion.setAttribute" because I don't want session here. Now on the jsp side, the "request.getAttribute(a)" keeps returning null result. No compile error though. on jsp side, i also tried use but same ...

16. getAttribute in a jsp    coderanch.com





18. getAttribute in HttpServletRequest    coderanch.com

19. JSP not picking up getAttribute from Servlet    coderanch.com

Hello All, I've been posting my problems here and I am glad it was answered. I have another assignment. I am halway there, but the last bit is not working. I have a servlet file which the code looks like this: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import javax.sql.*; import java.sql.*; import java.util.*; public class Search extends HttpServlet{ public void doPost(HttpServletRequest ...

20. Alternative to checking getAttribute for null in JSP    coderanch.com

First and foremost, the very use of scriptlets is over 8 years out of date. At this point, no Java code should ever be placed in a JSP. The JSTL and EL have been available since before the advent of JSP 2.0 in 2002 and the time to put Java code in JSPs is long passed.

21. getParameter(), getAttribute() methods    coderanch.com

22. req.setAttribute()- Action class and req.getAttribute() - Jsp    forums.oracle.com

I found 2 mistakes: 1. There is not req object in jsp. It is the request object. For ur information- request, response, page, application, out .... are the built in objects in jsp. 2. Type casting- you have to type cast to the required datatype-- see below for an example String str = "hello"; req.setAttribute("checkin",str); <% String checkin = (String)request.getAttribute("checkin"); %> ...