Solved

call JSP in servlet,& use Bean in JSP

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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

690 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