User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 423,575 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,476 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 728 | Replies: 1 | Solved
Reply
Join Date: Mar 2008
Posts: 117
Reputation: Thirusha is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 13
Thirusha Thirusha is offline Offline
Junior Poster

jsp servlet and bean problem

  #1  
Mar 11th, 2008
I have looked around this site but have not found anything to help me.

I have a jsp page which takes user input, the page is then posted to a servlet using ajax, the servlet then sets a bean value.

My problem is that when i go back to the main page, the bean value is not displaying in the jsp page.
I created a Bean class which has my setter and getter methods, and a servlet which sets the bean value.

in the servlet i used the following to set the value of the bean
SubscriberBean subscriberBeanRef = new SubscriberBean();
subscriberNameVar = request.getParameter("subscriberName");
subscriberBeanRef.setsubscriberName(subscriberNameVar);

In my jsp i use the jsp usebean tag which imports my bean class to get the value, and i set the scope to session. Is that correct?

I have read that i should set the httpsession to set the attribute, i have tried that as well, but still no results in my jsp page.
code used for setting the session attribute.
String subscriberNameVar;
HttpSession session = request.getSession(true);
subscriberNameVar = request.getParameter("subscriberName");
session.setAttribute("subscriberName", subscriberNameVar);

I have no clue what i m doing wrong please help

Thanx
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2008
Posts: 117
Reputation: Thirusha is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 13
Thirusha Thirusha is offline Offline
Junior Poster

Re: jsp servlet and bean problem

  #2  
Mar 12th, 2008
I have solved the problem, but ran into another one.

If a servlet gets rendered the same way a jsp does, if i place the jsp usebean tags in the servlet, shouldnt the bean display in the servlet?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 7:13 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC