How do i set attribute in jstl FROM JSP -- passing to servlet

Dear Java experts

How do i set  an attribute in jstl  FROM JSP pages and get it back inb the servlet. I want to pass an object from JSP  and get it back in the  servlet. this is urgent ..thanks a lot ..any help is very much appreciated.
Test subbu
TestsubbuAsked:
Who is Participating?
 
suprapto45Connect With a Mentor Commented:
Hi,

Alternatively, you can use <c:set> to do that.

http://www.jspzone.net/servlet-example-6.htm

You may modify the scope either in page or request or session or etc.

Regards
Dave
0
 
suprapto45Commented:
Hi subbu,

Why do you use JSTL?

>>" I want to pass an object from JSP  and get it back in the  servlet"
In your JSP, you can use scriptlet <% %> such as

<%
request.setAttribute("yourobject", object);
%>

Then in your servlet, you can have it like....request.getAttribute("yourobject");

Please let me know if you have different situation.

Regards
Dave
0
 
bloodredsunCommented:
As suprapto45 says you can use c:set, specifically setting a variable into the correct scope. either "requestScope" or "sessionScope". I would recommend that you avoid using scriplets in your code unless there is no other way.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.