?
Solved

call JSP in servlet,& use Bean in JSP

Posted on 2000-05-17
3
Medium Priority
?
223 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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

649 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