Legacy Servlet to JSF

Hi,
I am writing an application in JSF that will replace another Java Servlet but perform the same functions. The first step is to establish the front page in JSF with all the options, but link to the legacy servlet for all those options, and replace them one by one until the legacy servlet is gone.
I would like to run both applications in seperate containers, and use HTTP to redirect back and forth. Problem is, I don't know how to tell the legacy servlet to use the sessionid it has already established.
The first time I call to the legacy servlet, it will create a session, and I can acquire the sessionid from HttpSession.getSessionId(), then pass that back (somehow, haven't figured out yet how to call into the JSF servlet either). But once that has been done, I can provide that sessionid in any legacy servlet invocation.
Is this simple to do? How would I go about it?
The next problem I have is securing this transmission, which would probably entail encryption. Perhaps I should just be running these two servlets in the same context and avoid all this confusion.
Ideas?
Thanks for any suggestions.

Hi,
Before starting the very first JSF page (and before
the JSF front controller is invoked) I must use a
servlet to read some parameters, init some objects
and then jump to the first JSF page. Some objects
that the bean generates must be saved in a JSF
managed bean.
The question is, how can I set those parameters in
the managed bean if it wasn�t still initialised ?
Code like this:
ApplicationFactory factory = (ApplicationFactory)
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FAC
TORY);
Application app = factory.getApplication();
ValueBinding vb =
app.createValueBinding("#{AManagedBean}");
AManagedBean mb=  (AManagedBean)
vb.getValue(FacesContext.getCurrentInstance());     Fails with a null pointer exception (it seems to not
t be finding �AmanagedBean�).
you didn't even set the value, thats why you are getting a "null pointer exception". Try
vb.setValue(FacesContext.getCurrentInstance(), AManagedBean)
>
Do you know how to set the properties in the
s in the managed bean ? Any comment or help would be
really welcome.
First set any properties of the "AmanagedBean" and then create the value binding in any of the scopes(request, seesion, application)
>
Thanks in advance,
     - Juan

Similar Messages

  • Legacy servlets

    greetings,
    I am used to working with apache servers with the tomcat servlet engine, which is compliant with the servlet 2.3 specs -- entails the concept of web applications that are self contained . I am now working with an s1ws , specifically on a virtual server, and two directories have been created for me: 'public_html' and 'classes'. The public_html directory contains jsp/html and static content. The classes directory contains the servlet packages and classes.
    I am told that the servlet path is http:/domain_name:8000/servlet/ and I am also told that I must register the servlets with the server.
    How does one go about registering the servlets with the web server. Is is as simple as creating a deployment descriptor and placing it in the classes directory? According to servlet 2.3 specs the classes directory is supposed to be inside of the WEB-INF directory which contains the file web.xml. I have no WEB-INF directory. Any one know what the deal is?
    much obliged
    -Mani

    First, note that Web Server 6.1 supports Servlet 2.3 web applications and Web Server 6.0 supports Servlet 2.2 web applications.
    "Legacy Servlets" refers to a Servlet deployment methodology that predates both Servlet 2.2 and Servlet 2.3 (and hence predates the concept of web applications). Legacy Servlet support was deprecated in Web Server 6.0 and removed in Web Server 6.1. For information on using Legact Servlets, refer to the Programmer's Guide to Servlets at http://docs.sun.com/db/prod/s1websrv#hic

  • How migrate legacy servlets iPanet 4.1 to iPlanet 6.1

    Hi all.
    I have installed Java webserver 6.1on solaris.
    I cant migate my legacy servlets running on iPlanet 4.1 to Iplanet 6.1
    How do I do that?
    Please help me!!!
    PS: Is that possible?
    Thanks

    Hi Manish
    Thanks for your answer .
    We have verified what IPlanet 6.1 can deploy one sigle Legacy Servlet as "/".
    We need to deploy more than one servlet.
    Can You please explain me how can I deploy that on Single Virtual server 6.1 ?
    Thanks
    dany74

  • Deploy legacy servlet in S1AS

    Hi,
    Does S1AS support legacy servlet? As I know, Web Server 6.x support legacy servlet.
    Thanks

    Hi,
    I am getting this error....
    HTTP Status 404 - /servlets-examples/servlet/SendData
    type Status report
    message /servlets-examples/servlet/SendData
    description The requested resource (/servlets-examples/servlet/SendData) is not available.
    Thx,
    Babloo

  • Jsf VS wcm servlet- combine JSF & WCM tags in the same page

    Hey all,
    I wanted to get to you a problem I've encountered and see if you can direct me.
    Note: I found a way to work around the problem, we will see later -
    but this will not bring me to full integration.
    The problem arises when I create a region\page template file in the ucm system and make use
    of - (Jsf component (for example: h: outputpanel.
    In this situation, there are two servlets in the web.xml file that mapping of
    url which comes.
    1. wcm site template servlet that maps tree placement (that is when I
    went in url to the servlet
    http://localhost/application-name/context-root/section1/index.html
    know to map the url to the template defined tree under the same
    section.
    2. jsf servlet - when i used jsf components.
    When I turn to the page for wood and is defined in the UCM, the jsf
    servlet does not handle the request and therefore I get an error: Can
    not find facesContext.
    The problem: Can we find a way to make 2 the servlets work together
    and perform this mapping for us? Is there a way or example of a jsf
    page which can be combined with the ucm system defined tree (this
    detail is important, because if I just set up a page in application
    and came back to it, not through the tree can I combine Jsf -It's
    important for me to do it in the form submitted by the link mentioned
    above).
    Note: I found a roundabout solution like I mentioned, working with the
    iframe as separate jsf pages and read them from a page in the system.
    While this solution meets the requirements but still ran into some
    combinations between the two issues resolved was not trivial.
    I'd appreciate it if somebody could help \ guide me to resolve the problem.

    Thanks a lot for your answers.
    I just want to clear my point, the real problem is when i want to define in my site's tree(at jdeveloper) page X for Section SX
    but page X should include jsf tags.
    When we defined page(region template) in section properties placeholder, meaning at the site's tree, the explorer will show the page as http://machinehost:7001/context-root-site/sectionX/index.html.
    Each page in the site tree will had this pattern, therefor when we add a jsf tags to our page there is a conflict between the servlets (Faces VS WCM)
    because that jsf servlet could'nt map this url to faces url and i got faces context Error.
    I am just trying to clean my point, so it's not relevant to contributor mode...
    i just want to know for sure that there is no way to define region template at site tree for section X with jsf tags.
    I will very glad to know yours opinion about my solution- working with iframe, meaning that the page at site tree will include iframe to jsf page which exsit in the application. this solution solved the conflict problem because i have now two pages.
    thanks you again,
    Regards
    Eran zizler

  • Using JSPWiki Servlet within JSF

    I have got the fundamentals of my JSF webApp working
    Now I want to incorporate a JSPWiki page within my JSF page
    What is the best way of sorting this out
    I have been thinking along the lines of creating an application scope managed bean in which I can initalise a WikiEngine reference
    public static WikiEngine getInstance(javax.servlet.ServletContext context,
    java.util.Properties props)
    OR
    public static WikiEngine getInstance(javax.servlet.ServletConfig config,
    java.util.Properties props)
    How do I obtain ServletContext for the WikiEngine from inside my JSF ManagedBean
    Obviously my web.xml has
    <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    and
    <servlet>
    <servlet-name>WikiServlet</servlet-name>
    <servlet-class>com.ecyrd.jspwiki.WikiServlet</servlet-class>
    </servlet>
    But I can't find anything in the JSF Javadocs that is the equivalent of
    public ServletContext getServletContext()
    in the Servlet APIs
    I'd appreciate some clues
    Thanks

    Try this to get the ServletContext in your ManagedBean:
    FacesContext facesCtx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = facesCtx.getExternalContext();
    ServletContext servletCtx = (ServletContext) extCts.getContext();I think that will do it.

  • From a Servlet to JSF

    Hi,
    Before starting the very first JSF page (and before the JSF front controller is invoked) I must use a servlet to read some parameters, init some objects and then jump to the first JSF page. Some objects that the bean generates must be saved in a JSF managed bean.
    The question is, how can I set those parameters in the managed bean if it wasn�t still initialised ? Code like this:
    ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
    Application app = factory.getApplication();
    ValueBinding vb = app.createValueBinding("#{AManagedBean}");
    AManagedBean mb=  (AManagedBean) vb.getValue(FacesContext.getCurrentInstance());          Fails with a null pointer exception (it seems to not be finding �AmanagedBean�).
    Do you know how to set the properties in the managed bean ? Any comment or help would be really welcome.
    Thanks in advance,
         - Juan

    Hi,
    Before starting the very first JSF page (and before
    the JSF front controller is invoked) I must use a
    servlet to read some parameters, init some objects
    and then jump to the first JSF page. Some objects
    that the bean generates must be saved in a JSF
    managed bean.
    The question is, how can I set those parameters in
    the managed bean if it wasn�t still initialised ?
    Code like this:
    ApplicationFactory factory = (ApplicationFactory)
    FactoryFinder.getFactory(FactoryFinder.APPLICATION_FAC
    TORY);
    Application app = factory.getApplication();
    ValueBinding vb =
    app.createValueBinding("#{AManagedBean}");
    AManagedBean mb=  (AManagedBean)
    vb.getValue(FacesContext.getCurrentInstance());     Fails with a null pointer exception (it seems to not
    t be finding �AmanagedBean�).
    you didn't even set the value, thats why you are getting a "null pointer exception". Try
    vb.setValue(FacesContext.getCurrentInstance(), AManagedBean)
    >
    Do you know how to set the properties in the
    s in the managed bean ? Any comment or help would be
    really welcome.
    First set any properties of the "AmanagedBean" and then create the value binding in any of the scopes(request, seesion, application)
    >
    Thanks in advance,
         - Juan

  • How to connect servlet with jsf

    hello everybody, please help me
    on how to connect jsf to a simple servlet. jsf bean is populated with values entered by user, but to use that bean in servlet i have instantiated new bean object so how i can access values entered by user as bean object contains initial values of variables.
    actually i m developing a sample application jsf as component framework,hibernate as back end layer & spring as middle layer but right now i want to connect jsf to database using servlet & hibernate .So i want to access form bean of jsf so that i want to use form bean to do ORM in hibernate. but how can i get values entered by user in my servlet so that i can set these values in bean object.
    please reply
    Thanks
    Edited by: Manjinder on Oct 15, 2007 6:31 AM

    Please elaborate 'connect' in this context. This sounds a bit odd namely.
    You can invoke a servlet using a plain GET query or a POST query using a <form> element.
    If you're saying that you want to use some business logic which is available in a servlet, then you're looking in the wrong direction. Refactor that business logic in a separate class so that a simple Servlet as well as a JSF backing bean can use that logic. Then you can use JSF h:form with commandButton/Link to invoke the backing bean's action which on its turn invokes that logic.

  • It looks Oracle Form/Applet  die hard versus J2EE Servlet/JSP/JSF  & AJAX

    I left the form forum for a while and am busy with transfering our Oracle web forms app to Struts based J2EE application (just because the Oracle EE AS is the moving cause, it's out of my control.). After a year or so on J2EE which I enjoyed the fresh OO coding while keep enhancing Oracle webform app in production, I have some thought on Applet vs J2EE JSP/JSF plus AJAX.
    1) JSP itself is hard to avoid the full screen refreshing even though user just does partial changes ,e.g., lists, on the screen, it has to use AJAX to do the tricks. While partial refreshing in applet is natural default behavior.
    2) Forms is really an RAD, while J2EE's IDEs does help a bit(IBM's Websphere v6 even called iRAD) which takes way longer programming time compared to Forms. One IBM's article says it trys to win the Oracle Forms developers by giving the familiar graphical way of drag/drop GUI, so IBM recognizes the RAD coding power of Oracle Forms. So, IBM promotes the RAD similar to Oracle Forms.
    3) GUI/business rules related validation: Applet offered a great advantage over JSP/ even JSF which to avoid the full screen refresh, AJAX/JavaScript is used heavily. User friendly interaction of applet is way better than J2EE.
    4) Browser's back/refresh buttons also are headache to J2EE, expecially we need to support IE and Firefox. Applet basically is not bothered by these buttons.
    Recently, I read techi news said that the new chips will make the network transfer speed 10 time faster than now-even the cell phone transfer the image will be way faster. Then I predict the applet, just like IBM's mainframe, will see its Spring again, not like now in its winter. Especially the Oracle Forms makes coding easier than pure applet coding.
    Oracle folks, kepp beefing up the Oracle Forms, don't just pay attention to JDev. J2EE IDE, most of all, remove the Oracle EE ASxx block, be open. Oracle EE ASxx is really not a pretty baby, even though so Oracle thinks it is.

    1) Why we are transfering your Oracle web forms app to Struts based J2EE application?
    Since our corporate is IBM world-DB2/UDB, WebSphere AS (WAS) etc. It only allows Oracle Forms/reports servers to be compatible with the infrastructure. It does not allow to purchase another EE app server(espeically LDAP). We could not upgrade our forms/reports6i to 9i or 10g.
    2.Therefore the Oracle EE AS is the moving cause, it's out of my control because I did my best to talk to Oracle sales, but no avail. I am glad that I got a good chance to beef up my J2EE Struts skills.
    If extract out the forms/report9i/10g engines from the Oracle EE AS 9i/10g, (don't attempt to bundle sell the EE AS to customers-regardless of the shrinked 9.0.4 forms/reports services version, it's still another EE AS) and make them compatible with other ASs(espcially the LDAP), then Oracle Forms will have more customers.

  • Is there an idiots guide to JSF and scope somewhere?

    I am getting very confused with scope and JSF.
    I have a page that just displays customer details (from CustomerBean extends Customer) with a button that should allow the user to change the customer details. Both pages use the same backing bean (is that recommended?).
    customerDetail.jsp --> editCustomer.jsp
    If I set the scope of CustomerBean to session, editCustomer sees the same customer as customerDetail. It seems to me that I shouldn't really be using session scope as I don't want a particular customer to hang around once I have finished with him. So what should I be doing?
    Should customerBean be request scoped? If so how does editCustomer see it?
    Or should I somehow destroy the session scoped customerBean when I have finished with it?
    I also notice that some example jsps out there have a hidden field for the ID - should I simply look up the customer again from the database in editCustomer?
    I also tried to add a <h:inputHidden value="#{customerBean}"/> but that broke my jsp.
    I have bought and read the J2EE tutorial but I am still confused as to what the recommended way to drag the same Object through two jsp pages.
    It's probably very simple but it's doing my head in ;-)
    - David

    Yeah, forming a model in your head to explain something can be painful, sometimes. This question has come up before, including where I work, and I've never really seen a comprehensive answer, so I'll just write one. :)
    This is kind of a basic servlet concept, so I'll talk mostly about servlets. JSF is just flavor on top of this.
    The lifetime of the request is: from the time the user hits "submit" until the time the response is fully rendered, whatever page that is.
    So, you have a form the user has filled out and he/she hits "submit".
    The HTTP POST request goes to the server (open port 80, write some "key: value" headers to satisfy the HTTP protocol requirements, followed by a stream of text that represents the users' form field values, wait for a response) which then proceeds to process it by parsing the incoming data and making a bunch of subroutine calls. The last set of subroutine calls basically involves a bunch of println() calls to write HTML into an output stream, which is the response the requesting browser is listening for. When that stream is done, the browser displays the html.
    There's nothing that says the html that's displayed is the same as the html that originally held the form the user submitted. The first page is essentially garbage that somehow generated some form fields. The server could care less what it was, all it wants is the key=value pairs.
    You could, if you were so inclined, code all those println()s yourself. That's straight servlet programming. It's totally under your control. You could code println( "<html><body>Hi, Mom!</body></html>"); and be done.
    Or, you could write a JSP that, when compiled, turns into essentially a subroutine chock full o' println()s, and you could call that subroutine.
    You do that with RequestDispatcher.forward(). It's just a subroutine call. (But don't do any more scribbling on the output stream after it returns, 'cause the stream's essentially been closed.)
    It's all a big call tree with one thread of execution, single entry, single exit. One of the nice things about servlets is that the infrastructure makes available to you, in a contextual sorta way, the original request parameters plus whatever attributes you choose to attach to the request as your proceed w/your processing, kind of like charms on a charm bracelet (via ServletRequest.setAttribute()). (When I say "contextual", I mean the ServletRequest is passed in as a parameter to Servlet.service() so you can sling it around in your call tree.) Attributes you choose to attach while processing incoming form data are available later (for instance... in the subroutine that has all those println()s you so carefully coded up or allowed the JSP compiler to generate for you).
    When the call tree is done (you've finally printed "</html>", marked the output stream "done" somehow and shipped all that HTML back out to the browser), the ServletRequest object that held the incoming form parameters plus whatever attribute cruft it accumulated is garbage collected. (I could write something poetic about Elysium and gamboling among daisies, but... nah.) So, the lifetime of that data associated w/the ServletRequest is the duration of that request-processing call tree.
    JSF gives you a nice bunch of automatically-generated request attributes, corresponding to your request-scoped managed beans. It even very kindly transfers (via the value bindings) incoming form parameters into properties of beans which are attributed onto your ServletRequest, automagically.
    So, if, in your JSP, you bind your form data to request-scoped bean properties (not the bean itself, but the bean's properties), those exact same bean properties will be visible on whatever JSP you eventually wind up on and it will be available to whatever intervening logic you code up ("Invoke Application" phase), and when the request is done, it all vanishes into thin air.
    To be more specific to your question: yes, I believe it is recommended to have the same bean between pages. That's kind of the whole point. If you find yourself at the end of a request trying to destroy session data that was created at the beginning of that request, you should probably be using request scoping, not session.
    I could be wrong, but I don't think you can bind an entire bean to an html element value. You bind bean properties. Of course, there's nothing to say that a bean property couldn't be... another bean!
    In your particular case, I guess you have a bunch of display-only strings that come from your customer bean, plus a hidden "key" field somewhere. You could bind that hidden field to the customer.key property and Customer.setKey() would do whatever's necessary to get the rest of the data into the bean. That could be a d/b lookup or a map or array (cache) fetch. Or you could have a "current customer" in your session (that would have to be session-scoped, because you paint the detail screen w/one request and then paint the "edit" screen w/the same customer but in a different request). That "current customer" concept might cause you some problems later when you go multi-window or multi-frame in your webapp (truuuuuuuust me).
    Also, I'm not sure why you need a CustomerBean separate from Customer. Can you just make Customer a bean and be done with it?
    Holy cow, what an essay this turned out to be.
    John Lusk.

  • With iPlanet6.0 how can I include servlets in the cgi directory?

    I have created a cgi directory ex. http://hostname/cgi-bin to refer to the cgi.exe's. However.. I have developed a new servlet that replaces one of the cgi programs. The servlet context must fit in with our existing architecture so the servlets context must map to the cgi URL we have in place. This works fine with every web app server under the sun .. even Sun One7... but not on iPlanet 6.0. This is because it seems that every resource mapped by a CGI directory must be a CGI program - the web server doesn't have the intelligence to know that a servlet with the same context is available and so when the CGI directory is enabled... the servlet is not found, yet when it is removed the servlet is referenced just fine.
    Has anyone any ideas? Unfortunately I can't change the context of the servlet as our existing systems depend on the original cgi structure.
    Many thanks,
    Mark

    Right /cgi must reference a cgi and /servlet is for legacy servlets that arent deployed as applications.
    I dont think you are going to make it work like that, maybe do a redirect from /cgi/cginame to /servlet/servletname . That's the only thing that may work.

  • Servlets and Application Beans

    Hi I'm reviewing some sample code that was originally done as a JSF application. I however will not be doing a JSF application but rather a simple Model 2 architecture using servlets. I'm trying to confirm what the equivalent to an application managed and session beans in JSF would be in a servlet environment. For example the following xml in a JSF app...
    - <managed-bean>
    <managed-bean-name>jpaResourceBean</managed-bean-name>
    <managed-bean-class>oracle.toplink.jpa.example.inventory.services.impl.JPAResourceBean</managed-bean-class>
    <managed-bean-scope>application</managed-bean-scope>
    </managed-bean>
    - <managed-bean>
    <managed-bean-name>inventoryService</managed-bean-name>
    <managed-bean-class>oracle.toplink.jpa.example.inventory.services.impl.ManagedInventoryBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    - <managed-property>
    <property-name>jpaResourceBean</property-name>
    <value>#{jpaResourceBean}</value>
    </managed-propert
    Would that simple be using the servlet context and session variables? Any other tips on the right way to do this?
    Thanks

    fsa3 wrote:
    I'm trying to confirm what the equivalent to an application managed and session beans in JSF would be in a servlet environment.JSF application scoped beans are stored as ServletContext attributes and JSF session scoped beans are stored as HttpSession attributes. So do the same in a servlet and you're fine.

  • JSF Components are not being rendered - Websphere

    First, I don't mean rendered as in rendered="true'' What I mean is that a page I've created doesn't show any of the components rendered. Even while looking at the source, the HTML is not generated.
    Example: test.jsp
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib prefix="af" uri="http://xmlns.oracle.com/adf/faces" %>
    <%@ taglib prefix="afh" uri="http://xmlns.oracle.com/adf/faces/html" %>
    <%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk" %>
    <f:view>     
         <afh:html>
         <afh:head title="CIAS Case Management"/>
         <afh:body >
         <h:form id="createRfiForm">      
         <h:commandButton id="button" action="#{summaryRfiAction.promptCreateNewRfi}" value="Create New RFI"/>     
    </h:form>
         </afh:body>
         </afh:html>
    </f:view>
    When viewed the page is blank. The url I goto is :9080/cias/secure/test.do
    However if I put "Hello World" anywhere (I put it under the af:outputText) it will show up, so I know that the faces-config-nav is working correctly (it maps the .do to .jsp in terms of the file). What I don't think is working correctly is the invocation of the FacesServlet. In web.xml I have this defined.
    <servlet>
              <description>JSF controller</description>
         <servlet-name>FacesServlet</servlet-name>
         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
         <load-on-startup>1</load-on-startup>
         </servlet>
         <!-- Requests handled by JSF -->     
         <servlet-mapping>
              <servlet-name>FacesServlet</servlet-name>
         <url-pattern>*.do</url-pattern>
         </servlet-mapping>
    Anyone with any thoughts? This works in tomcat (yay apache), but doesn't work when I use Websphere.

    Hi,
    I've the same problem using WepSphere AppServer V6.1.0.5 on Linux.
    Are there some solutions/ideas solving this problem?
    The Application runs on Tomcat, JBoss, Glassfish but not on WAS.
    SystemOut.log shows only this:
    [16.02.07 15:31:02:185 CET] 00000028 ServletWrappe I SRVE0242I: [application] [application] [index.jsp]: Initialisierung erfolgreich.
    [16.02.07 15:31:02:998 CET] 00000028 ServletWrappe I SRVE0242I: [application] [application] [login.jsp]: Initialisierung erfolgreich.
    index.jsp redirects to login.jsp.
    tia,
    Andreas

  • Managing blob images using ADF and JSF or struts

    Hello everyone. I am an ADF newbe and I am developing a web app. that has to manage (display, insert,update and delete) blob images from/to an oracle DB. I've seen the "howto" on image managing using intermedia and struts, but, for this new app I wanted to use JSF (something that is not mandatory) and, what is important is that the DB has already stored the images in blob format.
    Can anybody point me in the right direction please??? Is there any howtos on this subject???
    Thanks in advance.

    jfin wrote:
    but so far I have to say that I like the fact that I'll have to do very little
    System.out.println(<..../>....<>....</>).Assuming that you rather mean out.println() where out is the ServletOutputStream reference returned by HttpServletResponse#getOutputStream(), I can only agree with you. That's certainly not the way how JSP/Servlet code is to be written. The maintainability, extendability, reusability and testability would be far below the freezing point then. You need to write presentation logic in JSP files, not in Servlets and absolutely not in scriptlets inside a JSP.
    When you need to write presentation logic which may change per request, use JSTL and EL for that. Again, not scriptlets. For business and controlling logic, use Servlets. For transfer of data, use javabeans (DTO's, VO's). For data access logic, use DAO classes which are to be interacted by servlets.
    JSF removes the need for creating Servlets and using JSTL/EL in JSP files. You just have JSP pages with JSF tags for presentation and javabeans for the request values and backing beans for business logic.
    When would one use JSF over the other two? When Struts2? When Shale?And you ask that in a JSF forum? At least my opinion is predictable :)

  • JSF 1.2 - Roundtrip just to create a simple Go Back link scenario

    From what I've read, it seems JSF 1.2 treats everything as HTTP POST. Hence, doing a simple Go Back means one has to do a round trip to the backend database and back. Here's how I've done it:
    1. Create a form and populate it with a list of information. For each line of info in the list, I define a h:outputLink that have four f:param directives to pass the parameters I want to a second form. Of course, the name/id of these params have to be unique. Say, if you want to create a second set of h:outputLink for the list, you have to define new unique name/id. Yuck! Why must name/id be unique? After all, they just going to become URL parameters.
    2. To create a "Go Back" link on my second form, I define a h:outputLink with the same number of f:params deriving their values from the URL parameters received from the first form. I have tried the h:commandLink/h:commandButton without success - they just resubmitted the second form without redirecting back to the first form.
    3. Once the "Go Back" link is clicked, I have to do a roundtrip to the backend database just to "refresh" the first form - and if I have multiple backing beans providing data for this form - this roundtrip can become quite expensive.
    What I gather from doing the JSF for the last five weeks:
    1. All requests are submitted as HTTP POSTs - this much is obvious. Thus, this will break the ability to do "light" navigation (such as a Go Back link), bookmarking and so forth due to the POST nature of JSF 1.2 or earlier. JSF 2.x might be different though - I may have to check the spec to confirm this. I have heard that one may need to use Facelets and not JSP as the view technology - otherwise certain features of this implementation will not be available.
    2. To pass information as parameters means one has to validate URL parameters to prevent URL tampering from third parties.
    3. I can use session scope for the form - but this is an "ugly" way of doing it i.e. If I move to a different area of the website and come back to the form, I can still see the previously generated data - until the session expired of course - then the form is reset to it's pre-submit status. I can appreciate the use of session scope in situation where one want to keep certain information active e.g. when a user logged into a forum or a secured session (HTTPS). To use session scope to just navigate between forms (while maintaining the status of the displayed data) is too much of an overkill.
    If there are better ways of doing something trivial like a Go Back link or bookmarking then I'm all open ears. If not, I might have to ditch JSF 1.2 and investigate JSF 2.0. Hopefully, this release would be less painful.
    Looking forward to JSF experts' comments surrounding this issue. I'm sure I'm not the first to complain about this framework and I won't be the last. Enough rant...
    Edited by: icepax on 26/11/2009 11:32
    Edited by: icepax on 29/11/2009 05:45

    BalusC wrote:
    First, outputlinks do not generate POST.Appreciate your reply. I stand corrected with this comment. But reading a few articles, for example: [JSF Discussions and Blogs|http://ptrthomas.wordpress.com/2009/05/15/jsf-sucks/], one has to wonder how JSF 1.x stacks up.
    >
    Second, how would you do it all in plain HTML/JSP/Servlet without JSF? If you tell how you would do it, then we can suggest the JSF way of it (but with the time you should probably already have realized that your concern/rant makes no sense).Sorry, Bauke, I went from Java straight to JSF for the past five weeks but if I have to guess one would use HttpServletRequest or HttpServletResponse in HTML-JSP-Servlet scenario. What I have done with the roundtrip actually works for me albeit I'm hitting the backend twice instead of once (there are pros and cons of doing it this way but I won't go into detail here). However, this still begs the question about doing something trivial like a Go Back link or bookmarking and why it's not so trivial in JSF.
    >
    At any way, you may find JBoss Seam interesting. It has an extra scope between request and session in: the conversation scope.Thanks. I could try it or move straight to JSF 2.0 or later.
    Don't get me wrong, I love JSF. But I won't see its real potential until I move to JSF 2.x or later. Integrated Facelets support is something I'm looking forward to -:)

Maybe you are looking for

  • Blank screen after upgrade fiasco

    I got a G3 IMac given to me that wasn't booting. It would come up to a flashing question mark so I surfed the net looking for a solution. I was told to reinstall the OS but I didn't have a copy so I tried my copy of panther. As it was loading I conti

  • Cannot Get Mail for more than 5 accounts at a time

    I have a total of 9 POP email accounts setup in Mail. The problem is that my dedicated server doesn't allow for more than 5 simultaneous send/receives per IP (which unfortunately cannot be changed). When I click on "Get Mail", I see it tries to get m

  • How can I get the data back from my game

    How can I get the data back from minecraft if I deleted the app and bought with a different Apple ID

  • How to use lock object? what we lock either total ztable or only record?

    Hi How to use lock object? what we lock either total ztable or only particular record? Don't tell create lock object on se11 with E letter & acll it in program with eENQUEUE & DEQUEUE. just tell me we will lock only particular record or total ztable?

  • Batch expiration date check when goods issue

    Dear expert, In batch expiration date check, we have a requirement that when do goods issue with delivery note we should have a expiration date check for expired batch(the system needs to give a warning message when we want to pick a expired batch(in