JSP design

Hello Everyone,
Hope ye are all well.
Well I have been asked asked to develop a JSP project. Basically I just have to design a few configuration pages for one of our products here. I am not very comfortable with my JSP experience when it comes to design issues. I was wondering if anyone can recommend a good book/website for designing JSPs.
I will need answers to solutions such as:
1. How to handle DB connections that are needed in a JSP
2. How to send objects from JSPs to some other server side class e.g. do I use the session?
3. How should my JSP be formatted.? How much Java code is too much? How do I seperate the logic from the presentation.?
Thanks alot folks,
Joyce

1. How to handle DB connections that are needed in a
JSPIMHO, database connections and transactions should be best kept away from JSPs/servlets. A good design should never mix the database querying logic with the View of the MVC. It can be done by means of an EJB, which would be rather heavy for most purposes, or plain DAOs.
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
2. How to send objects from JSPs to some other server
side class e.g. do I use the session?Session is one mechanism, which is generally preferred since it is quite fast and it can hold a fairly large quantity of data. For simple String data, even hidden fields and cookies can be utilized.
3. How should my JSP be formatted.? How much Java
code is too much? How do I seperate the logic from
the presentation.?IMO, JSPs should only contain logic for displaying the results on a nice GUI. AS far as linking it to business logic is concerned, it should pass through a controller, which can be a simple servet or a group of servlets with plain Java classes. But the business logic needs to be kept separate from the view for managing the changes to the requirements of your application at a later stage.
You could always have a look at the core J2EE patterns and choose the ones which seem appropriate for your requirement.
$

Similar Messages

  • JSC2.1 Fedora5 and Chinese, jsp design view blank!!!

    Dear all,
    I can run JSC2.1 in Fedora 5 chinese language, but jsp design view is blank, I can not drop any componnent in it and cannot see anything., and if I change JSC2.1 to "-locale en", JSC2.1 is all Okay, please help me

    If you get the designer blank, there is some bug. Could you have a look into your log file? It is <your_userdir>/var/log/messages.log? There should be some exceptions causing that state. Send them here or file bug directly.
    In any case, try to workaround the problem by deleting <your_userdir> and restarting JSC.

  • JSP Design View in Linux?

    Hi,
    I've been going through the weblogic platform evaluation which uses workshop
    heavily. One example which keeps coming up is using the "Design View" of the
    JSP Designer. Unfortunately, I don't have a tab for this, nor do I find it in
    any of the menus.
    I'm running workshop under Gentoo Linux, which I know isn't an
    officially supported Linux distro, but everything else in workshop seems to work.
    Anyone have any ideas? Is this feature supported at all under Linux?
    Thanks,
    -Anthony

    Unfortunately, in 8.1 Design View for JSPs is not supported on Linux.
    This is being addressed in the next release.
    Josh
    Anthony Molinaro wrote:
    Hi,
    I've been going through the weblogic platform evaluation which uses workshop
    heavily. One example which keeps coming up is using the "Design View" of the
    JSP Designer. Unfortunately, I don't have a tab for this, nor do I find it in
    any of the menus.
    I'm running workshop under Gentoo Linux, which I know isn't an
    officially supported Linux distro, but everything else in workshop seems to work.
    Anyone have any ideas? Is this feature supported at all under Linux?
    Thanks,
    -Anthony

  • JSP Design view not working in JDeveloper 10.1.3.3

    Hi,
    The problem I have is that my JSPs all throw a class not found error in design view when I load them. The problem is related to the useBean tag (see error example).
    Error exercising tag : jsp:useBean
    java.lang.Exception: java.lang.ClassNotFoundException: com......client.jsp.testclass
    The application is divided into a web project, an EJB project, and a server classes project. The JSPs are in the web project and the problem classes are in the server classes project. I'm limited to source view editing of JSPs due to this and the problem is only in the IDE, deployment of the code to the server is fine.
    Any suggestions would be appreciated.
    Kaitain

    I think they are but I could be mistaken, as the libraries list for the web project shows the server classes as a library.

  • Jsp Design view not working

    For some reason I can't create or edit jsp files within the design view. I get a blank screen with the following text in the middle "Type, paste, or drag content onto this blank page, or drag and drop a component from the palette.
    The weird thing is that a few jsp pages that I try to edit will work but most of them won't display anymore. They were working a day or so ago.
    Does anyone have any idea what is wrong?
    I am running Studio Edition Version 10.1.3.0.4 (SU5).
    Please, any help would be greatly appreciated.

    Shay,
    I created a new jsf jsp page like the following:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1252"/>
    <title>one</title>
    </head>
    <body><h:form></h:form></body>
    </html>
    </f:view>
    When I go to the design view, I get the following messages on the console
    Sep 15, 2006 7:24:18 AM oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl
    verifyFilterIsInstalled
    WARNING: The AdfFacesFilter has not been installed. ADF Faces requires this fil
    ter for proper execution.
    Sep 15, 2006 7:24:18 AM oracle.adfinternal.view.faces.renderkit.core.CoreAdfRend
    eringContext _initializeSkin
    WARNING: There is no SkinFactory
    Sep 15, 2006 7:24:19 AM oracle.adfinternal.view.faces.io.HtmlResponseWriter endE
    lement
    SEVERE: Element End name:form does not match start name:script
    I see the severe error but it doesn't make any since becuase I don't have a script element in this file.
    Please help.....

  • Using struts - jsp design question

    Using struts. Have a JSP cust.jsp
    In it half of it is very specific to that page only. rest half is shown in this cust.jsp and another report.jsp too.
    want to implement this so that code can be re-used in the other one too.
    The way I have designed is for a jsp have a prepare action and dispatch action.
    But not sure how to design this page so that I can re-use the code in another too.
    any suggesions are appreciated.
    Thanks.

    have a look at frameworks like Struts

  • JSP Design View blank

    When viewing JSP using workshop 8.1(sp1 as well as sp2),
    I encountered a situation that the design view is blank,
    only a line in the bottom says:
    <netui-template:template><netui-template:section><netui:form><table><tr><td>
    The soruce view is working fine.
    What could go wrong?
    After I restarted workshop, it works fine.
    Must be a bug in workshop IDE.

    If you get the designer blank, there is some bug. Could you have a look into your log file? It is <your_userdir>/var/log/messages.log? There should be some exceptions causing that state. Send them here or file bug directly.
    In any case, try to workaround the problem by deleting <your_userdir> and restarting JSC.

  • 10g - stack dump in JSP design tab - minor.

    I have a JSP which references a style sheet on a remote server. Don't ask. Normally when I look at it in the JSP editor Design tab I get an alert box saying 'Error opening style.css". This is fine.
    Today I got the following stack dump instead.
    The page displayed OK after I dismissed the error dialog.
    java.net.SocketTimeoutException: connect timed out
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
         at java.net.Socket.connect(Socket.java:426)
         at sun.net.NetworkClient.doConnect(NetworkClient.java:137)
         at sun.net.www.http.HttpClient.openServer(HttpClient.java:386)
         at sun.net.www.http.HttpClient.openServer(HttpClient.java:602)
         at sun.net.www.http.HttpClient.<init>(HttpClient.java:303)
         at sun.net.www.http.HttpClient.<init>(HttpClient.java:265)
         at sun.net.www.http.HttpClient.New(HttpClient.java:336)
         at sun.net.www.http.HttpClient.New(HttpClient.java:317)
         at sun.net.www.http.HttpClient.New(HttpClient.java:312)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:481)
         at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:472)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:574)
         at java.net.URL.openStream(URL.java)
         at oracle.ide.net.URLFileSystemHelper.openInputStream(URLFileSystemHelper.java:962)
         at oracle.ide.net.URLFileSystem.openInputStream(URLFileSystem.java:1006)
         at oracle.ide.model.TextNode.loadURLContentIntoBuffer(TextNode.java:818)
         at oracle.ide.model.TextNode.reloadTextBuffer(TextNode.java:352)
         at oracle.ide.model.TextNode.reopen(TextNode.java:330)
         at oracle.ide.model.TextNode.open(TextNode.java:197)
         at oracle.ide.model.TextNode.acquireTextBuffer(TextNode.java:597)
         at oracle.ide.model.TextNode.getReader(TextNode.java)
         at oracle.jdevimpl.webapp.IdeHelper.getReader(IdeHelper.java:117)
         at oracle.jdevimpl.webapp.parser.css.Parser.characterStream(Parser.java:1559)
         at oracle.jdevimpl.webapp.parser.css.Parser.parseStyleSheet(Parser.java:228)
         at oracle.jdevimpl.webapp.model.css.SacDocumentBuilder.buildStyleSheet(SacDocumentBuilder.java:106)
         at oracle.jdevimpl.webapp.model.css.html.LinkedStyleSheet.load(LinkedStyleSheet.java:97)
         at oracle.jdevimpl.webapp.model.css.html.LinkedStyleSheet.getRules(LinkedStyleSheet.java:82)
         at oracle.jdevimpl.webapp.model.css.html.HtmlCSSValuesAssigner.insertStyleSheet(HtmlCSSManager.java:197)
         at oracle.jdevimpl.webapp.model.css.html.HtmlCSSValuesAssigner.<init>(HtmlCSSManager.java:182)
         at oracle.jdevimpl.webapp.model.css.html.HtmlCSSManager.getCSSValuesAssigner(HtmlCSSManager.java:65)
         at oracle.jdevimpl.webapp.view.DisplayManager._generateBoxes(DisplayManager.java:1415)
         at oracle.jdevimpl.webapp.view.DisplayManager.generateView(DisplayManager.java:910)
         at oracle.jdevimpl.webapp.view.DisplayManager.showContent(DisplayManager.java:476)
         at oracle.jdevimpl.webapp.editor.EditorImpl.showContent(EditorImpl.java:102)
         at oracle.jdevimpl.webapp.editor.html.HtmlEditor.updateDisplay(HtmlEditor.java:565)
         at oracle.jdevimpl.webapp.editor.WebAppEditor.syncIt(WebAppEditor.java:536)
         at oracle.jdevimpl.webapp.editor.WebAppEditor.access$4000271(WebAppEditor.java:54)
         at oracle.jdevimpl.webapp.editor.WebAppEditor$2.run(WebAppEditor.java:524)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:449)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

    Could you reduce your jsp and paste the contents here? We can examine it. Thanks, Steve Tom.

  • JSP Design View is gone

    I created a project and made some JSP pages successfully. Everything is working.
    When I started the Creator the second time, the design view of some of my JSP pages are gone. Theere's a grey panel for the design view.
    I checked the source view and it looks like the source is good and untouched.
    What's going on here? How can I recover the design view?
    thanks

    The dead designer is usually caused by problems (bugs) in the underlying subsystem that parses and models the source code. Take a look at the log file and if you have any interesting exceptions there, you can provide them here and we can take a look.
    One of the problems that was recently fixed for an EA update had to do with parsing arrays and array initializers. I am not sure when that update will be available, but, in the mean time, if you have arrays in your source, try commenting them out.
    Another problem that exists has to do with referencing types defined in your other sources. Try using fully-qualified classnames for those.
    I hope this helps.

  • Basic jsp design question

    I did this with a servlet and now I'm trying to figure out how to do this with a jsp.
    I have a screen that displays data
    If there is no data you get a message saying no data
    So I think that would be 2 jsps.
    If you hit the edit or save button you get a new screen that allows you to input data. If you hit save or cancel you go back to the 'display data' screen. I also need the ability to do next and previous on the display data screen.
    I have this done in servlets, I am having trouble figuring out how to design this for servlets. I am figure the following.
    1. jsp for display data screen
    2. jsp for the display data screen with no data
    3. jsp for the add/cancel screen
    Ok that is the html part. How do I manage the logic? can I do an 'action=''> and pass this to a javabean? then have the java bean act as a dispatcher with all my logic in it? I can't figure out how I write a class to manage all my logic for the jsps. How do I call the dispatcher class? how do i have the dispatcher class then call a jsp page?

    have a look at frameworks like Struts

  • Servlet - JSP design and performance (Tomcat)

    Hi everybody.
    I'm new in Tomcat and servlet/JSP development.
    My current design involves only one servlet (does the business logic, JSP page selections) which delegates the requests to several JSP-s (the JSP-s are included with the "jsp:include" tag).
    The questions:
    1. Has this design some performance drawbacks in contrast with a design in which several servlets are used (some of the included JSP pages will be the same)?
    2. How Tomcat resolves concurent requests (if the same servlet is involved or two separate servlets are involved)?
    Any response is greatly appreciated.
    Thanks.

    A few things to keep in mind:
    Every JSP is really a Servlet. Behind the scenes, these are compiled into Servlets which are then run. So, you really do have an implementation with more than one Servlet.
    Controller Servlet's (one per JVM) are a very popular architecture choice. Struts, Spring and a number of other frameworks use this model. There should not be a difference between running multiple versus a single Servlet, and even if there is, your application undoubtedly has scaling bottlenecks other than this (probably orders of magnitude higher) than worrying about this particular issue.
    Tomcat dispatches the request to whatever Servlet satisfies the servlet-mapping that the URL matches. Since Servlet's are designed to be written thread-safe, and since the container will manage those instances, do not worry.- Saish

  • JSP design issue

    I am working on an application, which is used by data entry people to enter approx 600 invoices/day thru web.
    The requirement is that the data entered should be saved in the database and a unique number should be generated and displayed to the user almost instantaneously as the user cannot wait longer for response. EJBs are used for persistence and db is oracle. I am afraid if I make a trip to database and get the number from the db, the response time could be more. Does anybody have ideas on how to implement this. Greatly appreciate any inputs.

    http://forum.java.sun.com/thread.jsp?forum=4&thread=210676

  • JSF/JSP design view not displaying correctly

    Hi there
    I am using jdeveloper version Studio Edition Version 11.1.1.3.0 on windows 7. When I create a 3 column layout JSF page , the design view does not show 3 columns (This used work properly). Instead
    it shows .
    - <>/oracle/templates/threecolumnTemplate.jspx
    I am used to seeing 3 columns start,middle and end (in blue). I have not changed any configuration settings.
    regards

    What does the source tab shows? what's the actual code of your page?

  • JSP Designer: Error: "Your browser is not JavaScript enabled"

    Oracle jDeveloper 11g 11.1.1.0.2
    FireFox 3.5b4
    IE 7.0.5730.13
    In the design view of an xml document created from the faces-config I'm getting an error that JavaScript is not enabled.
    "This page uses JavaScript and requires a JavaScript enabled browser. Your browser is not JavaScript enabled.
    I did not see an option to change the default browser in jDeveloper.
    I know that JavaScript is enabled in both browsers.

    Hi,
    this randomly happens to me as well and the way to resolve the issue is to delete the "systems" directory of JDeveloper and restart the IDE. I wished there was a way to always reproduce this behavior
    Frank

  • Design view for jsp custom tags.

    when we drag-and-drop custom tag control in the source of jsp page, when we switch to the design view of jsp we should be able to view controls as desired.
    Observation: 1) Eclipse 3.2 doesn't have design view for jsp pages.
    2) which software uses the design view. we need to extend eclipse core framework and we do not find any technical approach document to proceed further on this.
    3) RAD 6.0 we can see a JSP in design view.
    I'm searching for any technical approach document to create plugin that can intercept the custom tags and provide a design view.
    Will any one suggest the plugin for that.

    Jeff,
    I have checked with engineering and found that JSP Design View support on
    Linux is a planned feature for the next release. I don't think we will have
    this feature as part of a Service Pack for 8.1
    Regards,
    Raj Alagumalai
    WebLogic Workshop Support
    "Jeff Cassanvoa" <[email protected]> wrote in message
    news:3f4df04e$[email protected]..
    >
    Raj,
    Thanks for the information!! Any timeframe when it might be supportedon Linux
    Thanks,
    Jeff
    "Raj Alagumalai" <[email protected]> wrote:
    Jess,
    Unfortunately, the JSP design view is currently not supported on Linux.
    Workshop does allow to do remote development where the IDE is running
    on a
    Windows machine and connects to a server running on Linux/Solaris.
    Regards,
    Raj Alagumalai
    WebLogic Workshop Support
    "Jeff Cassanova" <[email protected]> wrote in message
    news:[email protected]..
    Does anybody else who is running the Linux version of Workshop 8.1have
    troubling
    getting the Design View of JSP files to come up. All I see is thesource,
    with
    no tabs at the bottom to switch to/from the Design View. When I bootover
    to
    Windows and run 8.1 Workshop, I see both tabs and I am able to useboth
    views.
    Is it something I have set in Preferences somewhere that disablesthe
    Design
    View ???
    Thanks,
    Jeff

Maybe you are looking for