servlet to jsp

hi all...how do i convert a servlet to a jsp?
[59 byte] By [victoriousa] at [2007-11-26 16:30:47]
# 1
Put all your servlet code, in the jsp scriplet. tag..shanu
mshanua at 2007-7-8 22:55:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Why do you need to convert Servlet to JSP?+Shagil
shagila at 2007-7-8 22:55:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

import java.rmi.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

public class JobServlet extends HttpServlet

{

public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException

{

PrintWriter out = res.getWriter();

res.setContentType("text/plain");

try

{

int jobno = Integer.parseInt(req.getParameter("jobno"));

JobInt e=(JobInt)Naming.lookup("rmi://localhost/job");

out.println("Details for job number "+jobno);

out.println("Registration Date: "+e.getdate(jobno));

out.println("Registration no of vehicle: "+e.getregno(jobno));

catch (Exception e1)

{

System.out.println(""+e1);

}

}

}

this is my servlet... how should i do it? ive tried it but i think i did it wrong...

thx in advance

victoriousa at 2007-7-8 22:55:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

i didn't try it but it should lookk like that

<%@ page language="java" contentType="text/plain"

import="java.rmi.*,javax.servlet.*,java.io.*"%>

<%

PrintWriter out = response.getWriter();

int jobno = Integer.parseInt(req.getParameter("jobno"));

JobInt e=(JobInt)Naming.lookup("rmi://localhost/job");

%>

Details for job number <%=jobno%>

Registration Date : <%=e.getdate(jobno)%>

Registration no of vehicle : <%=e.getregno(jobno)%>

alban.maillerea at 2007-7-8 22:55:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

this is what i did

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>

<%@ page import="java.rmi.*, javax.servlet.*" %>

<%@ page import="java.util.*, java.lang.*, java.io.*" %>

<html>

<head>

<title>Untitled Document</title>

</head>

<body>

<%

try {

int jobno = Integer.parseInt(request.getParameter("jobno"));

JobInt e=(JobInt)Naming.lookup("rmi://localhost/job");

out.println("Details for job number "+jobno);

out.println("Registration Date : "+e.getdate(jobno));

out.println("Registration no of vehicle : "+e.getregno(jobno));

} catch (Exception e1) {

out.println(""+e1);

}

%>

</body>

</html>

i get the exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 13 in the jsp file: /jobdetails.jsp

Generated servlet error:

JobInt cannot be resolved to a type

victoriousa at 2007-7-8 22:55:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
its quite obvious my friend, the error message is clearyou have to import JobInt classto...in the imprt attribute of the page tag... even if you don't know jsp , i'm sure you can do it
alban.maillerea at 2007-7-8 22:55:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...