Solved

call JSP in servlet,& use Bean in JSP

Posted on 2000-05-17
3
199 Views
Last Modified: 2013-11-24
1.Calling JSP in servlet, I tried several ways:
private performTask(HttpServletRequest req,HttpServletResponse res) throws ...
{
.....
// EmpPay is a instance of JavaBean
// way1
((com.sun.server.http.HttpServiceRequest)req).setAttribute("EmpPay",EmpPay);
((com.sun.server.http.HttpServiceRequest)req).callpage("/EmpPay.jsp");
// alternative way2
req.setAttributs("EmpPay",EmpPay);
res.sendRedirect("/EmpPay.jsp");
// alternative way3
req.setAttributs("EmpPay",EmpPay);
getServletContext().getRequestDispatcher("/EmpPay.jsp").forward(req,res);

 I was coding and testing in VAJava,both way1 and way3 were succesfully in VAJava and got correct output from JSP.
 my first question is : which one is Java Standard(pure Java) way as aboved to call JSP in servlet ? Somebody told me the way1 will not be supported in Standard Java.

2. Our deploy environment is WebLogic,I got error information in WebLogic as following:
 Compilation of 'c:\weblogic\...\EmpPay.java failed :
 c:\weblogic\..\_EmpPay.java:110:'try' ????????? 'catch' ?? 'finally' ...

 What I should add to my JSP ? who can provide me a example ?

thanks a lot

0
Comment
Question by:zhouwj
3 Comments
 
LVL 7

Accepted Solution

by:
Ravindra76 earned 100 total points
ID: 2816659
http://www.esperanto.org.nz/jsp/jspfaq.html


will solve all your problems
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 2816673
req.setAttribute(name, val);
getServletContext().getRequestDispatcher(jspPageName).forward(req, resp);
0
 

Expert Comment

by:ssghosh
ID: 2820001
way 3 is standard for enterprise development
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now