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
Solved

call JSP in servlet,& use Bean in JSP

Posted on 2000-05-17
3
207 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

828 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