?
Solved

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

Posted on 2005-05-08
3
Medium Priority
?
480 Views
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
0
Comment
Question by:Testsubbu
  • 2
3 Comments
 
LVL 16

Expert Comment

by:suprapto45
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.

Regards
Dave
0
 
LVL 16

Accepted Solution

by:
suprapto45 earned 2000 total points
ID: 13956269
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
 
LVL 29

Expert Comment

by:bloodredsun
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.
0

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