|
-
Using JavaBean to generate HTML
Hello, I need your help please.
I'm a beginner when it comes to Jsp/JavaBeans development.
I am writing a Jsp which calls a JavaBean. I need the JavaBean
to write some html code to be used in the Jsp. My code for the
Jsp (NewHorizons1.jsp -> actually just where I implement useBean, setBean
and getBean) and JavaBean NewHorizons1Bean.java)
respecitively. I know my coding skills are lacking right now, but I'd appreciate
any help you can give.
Thank you sincerely for any help.
================================================
NewHorizons.jsp
================================================
<jsp:useBean id="NewHorizons1Id" scope="session" class="newhorizons1.NewHorizons1Bean"
/>
<jsp:setProperty name="NewHorizons1Id" property="*" />
<p><jsp:getProperty name="NewHorizons1Id" property="response" /><p>
===================================================
NewHorizonsBean
===================================================
package newhorizons1;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
//import java.util.*;
public class NewHorizons1Bean {
//Write the following HTML
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("JDK Version 1.3 Released");
out.close();
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks