?
Solved

call JSP in servlet,& use Bean in JSP

Posted on 2000-05-17
3
Medium Priority
?
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
Ravindra76 earned 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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…
Suggested Courses

752 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