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

Posted on 2005-05-08
Medium Priority
Last Modified: 2013-11-24
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
Question by:Testsubbu
  • 2
LVL 16

Expert Comment

ID: 13956256
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.

LVL 16

Accepted Solution

suprapto45 earned 2000 total points
ID: 13956269

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


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

LVL 29

Expert Comment

ID: 13957570
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.

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question