• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Forwarding an attribute from 1 jsp to another?

 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Here's my requirement:
In my database I have username, password and FullName.
I have a Login page ("Login.jsp"); where I get parameters, username, password.. I post these parameters to a Servlet (Login.java) which queries the database to find if the username exists.
Now on successful login.. I need to forward the FullName;
For request parameter; I am setting the attribute("fullname",rs.getString(fullname));
Using RequestDispatcher I am dispatching it to WelcomeWiz.jsp; Here I have a frame whre the full name needs to be displayed.
Is there a way I can forward an attributed from an Jsp to a HTML page?
Or should I use 1 more JSP for this? How to forward attributes from 1 jsp to another?
TIA
RAVI

Now
 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understood your question correctly then it is in following way
You have one servlet called Login.java which have following lines

1 request.setAttribute("fullname",rs.getString(fullname));
2 RequestDispatcher rd=request.getRequestDispatcher("WelcomeWiz.jsp");
rd.forward(request,response);
And your WelcomeWiz.jsp has some thing like this


and you want to pass fullname from WelcomeWiz to either t1 or t2.html
now comes your question
Is there a way I can forward an attributed from an Jsp to a HTML page?
There is no such way (as per my knowledg,plz update it if there is ).
You need to call jsp instead of your html (t1 or t2)as follows

And TEMP.jsp will have
<%=request.getParmeter("fullname")
%>
OR
you can also put full name in session in Login.java
and access it directly in Welcome.jsp
cheers
Praful
[ November 06, 2003: Message edited by: Praful Thakare ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic