JSR168 with JSP

Hi friends, I tried to work with the JSR 168 who send the request-response to JSP, here's the code.

Portlet
----------------------------
package com.xyz.portlet;

import java. IO;

Javax.portlet import. *;


SerializableAttribute public class NumberGuesserPortlet extends GenericPortlet {}


Protected Sub
doView (request, response RenderResponse RenderRequest)
throws PortletException, IOException {}
/ * see if a number is passed to the server as a parameter * /.
Number of strings = request.getParameter (response.getNamespace () + "number");

If no number has been entered, just display the form
If (number == null) {}
String url = "/ numberguesser.jsp";
getPortletContext()
.getRequestDispatcher (url)
include (request, response);
} else {}
/ * If a number was written, display the correct answer * /.
response.setContentType("text/html");
PrintWriter out = response.getWriter ();
out. Print ("You guessed" + number);
out. Print ("< BR > the number was 5");
out. Print ("< BR > please try again.");

/ * create a link to the portlet by using a PortletURL * /.
out. Print ("< A href =------" "");
out. Print (Response.createRenderURL ());
out. Print ("------" > try again < /A > "");
}
}

}

-------------------------------
IS3
------------------------------
< % @ taglib uri prefix = "http://java.sun.com/portlet' = 'portlet' % >
< % @ page language = "java" contentType = text/html"; charset = ISO-8859-1"
pageEncoding = "ISO-8859-1" session = "false" % >
< portlet:defineObjects / >


< FORM action = '< %=renderResponse.createRenderURL() % >' >
I think of a number between 1 and 10. < BR > < BR >
< i > what is it? < /I >
< INPUT type = "text" name = "< % = renderResponse.getNamespace ()" % > number "size ="10">"
< INPUT type = "submit" name = "SUBMIT" value = "Guess"! >
< / MAKE >
--------------------------------

portlet. XML
--------------------------------
<? XML version = "1.0" encoding = "UTF-8"? >
< version portlet-app = "1.0".
xmlns = "http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" >

< portlet >
< portlet-name > NumberGuesserPortlet < / portlet-name >
> class portlet < com.xyz.portlet.NumberGuesserPortlet < / portlet-class >
<>Media
<>mime-type text/html < / mime-type >
Display > portlet mode < < / portlet-mode >
< / media >
< portlet-info >
< title > NumberGuesserPortlet < / title >
< / portlet-info >
< / portlet >
< / portlet-app >


I am able to see the JSP page, when I entered the number and clicking on the button submit, then it shows the same page, I expect the number that I entered should appear.

Please help me what I do wrong here.

Thank you very much
Peter

Published by: user567405 on 24 Sep 2009 09:41

Hello Peter,.

During the validation of the data in a JSR168 portlet, an 'action' URL should be used. (GET-type forms may work with a render URL, but it's a good general practice to use an action URL).

So, if you have changed your code slightly:

Portlet
-----
package com.xyz.portlet;

import java. IO;

Javax.portlet import. *;

SerializableAttribute public class NumberGuesserPortlet extends GenericPortlet {}

' public Sub processAction (request, response ActionResponse ActionRequest) throws PortletException, IOException {}
Number of strings = request.getParameter("number");
response.setRenderParameter ("number", number);
}

Protected Sub
doView (request, response RenderResponse RenderRequest)
throws PortletException, IOException {}
/ * see if a number is passed to the server as a parameter * /.
Number of strings = request.getParameter("number");

If no number has been entered, just display the form
If (number == null) {}
String url = "/ numberguesser.jsp";
getPortletContext()
.getRequestDispatcher (url)
include (request, response);
} else {}
/ * If a number was written, display the correct answer * /.
response.setContentType("text/html");
PrintWriter out = response.getWriter ();
out. Print ("You guessed" + number);
out. Print(")
There were 5 ");
out. Print(")
Try again. ») ;

/ * create a link to the portlet by using a PortletURL * /.
out. Print ("Please try again");
}
}

}

-----
JSP
-----
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
< %="" @="" page="" language="« java »" contenttype="« text/html ;" charset="ISO-8859-1">< br="" >="" pageencoding="« ISO-8859-1 »" session="« false »" %="">


I think of a number between 1 and 10.

What is it?


-----

I also removed the spaces that you put on the parameter; the JSR168 portlet container is responsible for naming the workspace settings to avoid conflicts with other portlets, to add your own is not really necessary.

Kevin

Tags: Fusion Middleware

Similar Questions

  • by selecting a node in the 3d model with JSP in acrobat

    I made a little script to select a single node with JSP for 3D and want the selected node to display on the screen.

    But the result of the selection is not displayed in the form of acrobat.

    Can someone tell me where is the problem?

    Here is the part of the script used for the selection:

    Set selected node, axis CIHI is the selectable node, c3d is in this context of annote3d. The script is run after annotates it 3d is activated from interface.
    C3D. Scene.SelectedNode = axes;
    to display the result of the selection in the screen

    C3D. Scene.Update ();

    Thank you.

    Hello

    You don't need to update from the scene. The following code will select the first stitch of the scene and highlight automatically in the tree:

    C3D. Scene.SelectedNode = c3d.scene.meshes.getByIndex (0);

  • Flex with jsp?

    can someone tell me if flex can be integrated with jsp and if yes, can get a little example of it... Please help... its uugent

    http://Flex3.info/using-Flex-with-JavaServer-Pages/

    http://livedocs.Adobe.com/Flex/3/HTML/Help.HTML?content=data_access_2.html

    Ed http://www.coderanch.com/t/478820/Flex/application-frameworks/Flex-recive-Data-jsp-submitt

    If this post answers your question or assistance, please mark it as such.

    Greg Lafrance - Flex 2 and 3 certified ACE

    www.ChikaraDev.com

  • Array of objects display BPM with JSP HOWTO

    Hello!

    Could someone please tell me, how to list the elements of an array of objects BPM with JSP? The object has attributes, and I do not know the length of the array in advance, so I would need some kinf of loop.

    I have not found any documentation or forum thread on this subject, and I'm out of ideas.

    Thanks for any help!

    Hello

    Please find the code below. Hope this code will help you

    <% int count = 0; %>

                        
         
         
         
         
         <% count++ ; %>

    Sidonie

  • Update active field in flex active with JSP tags

    Hello coders.

    I am facing some problems when you try to set a field (field of active type) and then saving them, with WCS JSP tags.

    The assets I am tempting to save is an asset of flex, I have found online and test the same business with the base, all assets very well. But with active flex, I just can't handle.

    Does anyone of you can share a snippet as a reference?

    Kind regards

    Hello

    I don't think that there is any particular jsp tag update Active flex. A certain attribute can be updated for flex assets using ics: catalogmanager, yet once, it is recommended not average at all.

    So it's best to use Asset API (update section) discussed here - http://docs.oracle.com/cd/E29542_01/doc.1111/e29634/asset_api_tutorial.htm#WBCSD2403

    I have not tested but for your case, I think following should work (first check the implementation in a test environment):

    a.getAttributeData("__").setDataAsList (tables. asList (new AssetIdImpl ("", )));

    In addition, do not know if active flex can be updated & saved by using the combination of tags - asset: charge, asset: together and active: save

    Kind regards

    Guddu

  • SiteStudio and placeholder with jsp

    Hello
    We currently use SiteStudio and IdocScript to publish Web sites.
    We'd spend the HCSP, the use of IdocScript for JSP pages pages.
    Everything works find and we are now able to publish using jsp tags.
    However, we didn't find how to specify a placeholder in a JSP page.
    For the HCSP pages, we use the following synthax:
    <!-$wcmPlaceholder ("SYZ_PH_MAIN_CONTENT", "placeholderDefinitionDocName = SYZ_PH_GENERIC") - >

    Not found a method similar to the JSP page.
    You have an idea on how to specify a sitetudio placeholder in a JSP page?
    Thanks in advance,
    Leo

    A good question, but probably a little too late.

    SSXA was supposed to support the concept of 'WCM open' (if you deploy a few libraries on an application server, you should have WCM functions even in your J2EE web applications). 10gR 4 is the first support for some of these concepts - and then, with 11g SSXA has been released and Oracle not long later acquired FatWire (which btw has a similar concept as - and use the JSPs).

    If you really need WCM in JSP pages, maybe it's time to begin with WebCenter Sites. There little pros more - for example the display of pages on mobile devices.

  • Need help with jsp and java bean

    A Department has built its own site using jsp. I need to get this up and running through cf7.1

    I created a server instance, so it is separated from the rest of the intranet.
    Basically, I think I need to 'install' the javabean. But don't know how.

    Code added to the web.xml file
    < servlet-mapping >
    controller < servlet name > - < / servlet-name >
    *.do < url-pattern > < / url-pattern >
    < / servlet-mapping >

    The login page is called a link
    127.0.0.1/servlet/controller?page=login

    The jsp code is as Attaché (initial login page)

    There is a file 'LoginBean.java '.

    Now for the error

    jrun.jsp.tags.GetProperty$ NoSuchPropertyException: (/ loginPage.jsp:13) the loginBean bean has no property enteredcustomerid
    at jrun.jsp.tags.GetProperty.init(GetProperty.java:78)
    at jrun.jsp.tags.GetProperty.doStartTag(GetProperty.java:39)
    at jrun__loginPage2ejspe._jspService(jrun__loginPage2ejspe.java:75)
    at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
    at jrun.jsp.JSPServlet.service(JSPServlet.java:119)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    to jrunx.scheduler.ThreadPool$ ThreadThrottle.invokeRunnable (ThreadPool.java:426)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

    jrun.jsp.runtime.UncaughtPageException: unmanaged by the exception that is thrown from /loginPage.jsp:13
    at jrun.jsp.runtime.Utils.handleException(Utils.java:57)
    at jrun.jsp.runtime.JRunPageContext.handlePageException(JRunPageContext.java:384)
    at jrun__loginPage2ejspe._jspService(jrun__loginPage2ejspe.java:119)
    at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
    at jrun.jsp.JSPServlet.service(JSPServlet.java:119)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    to jrunx.scheduler.ThreadPool$ ThreadThrottle.invokeRunnable (ThreadPool.java:426)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


    Any help please...

    Ken

    Tim,

    I want to thank you for your help on this. If I you never have an event, drinks are on me.

    I created a new server through the cf admin instance, this created all required files files.
    Although the jrun - Web.xml wasn't in the web - inf folder. So I copied to this location and inserted your piece of code.
    I then copied the code from the web.xml file and the web_frim_beans.xml that we have with the application and paste it into the Web.XML of the server instance.
    Then I copied all the files of the classes in the application folder in the folder for the server instance class.
    I copied then only the application files in the cfusion.war file that was created.

    Then, I stopped and restarted the server instance, but because of the case in the login page, it did not work.
    So, I then made changes as you suggest to the loginPage.jsp and the LoginBean.java file.

    Then, I stopped and restarted the instance server again.

    Everything worked as it should.

    Again, thank you.

    Ken

  • Export DataGrid data to the file with JSP and Java

    My user must be able to load the data into a spreadsheet. I would like to stay with Flex and not use air. I used the windows clipboard, but I experience delays of Flash Player for the largest data sets if the closure of the DataGrid rows takes longer than 2 minutes. I would like to do with passing data to a JSP page or use BlazeDS and then download the file. I would just pass the ArrayCollection collection so I don't have to loop through the rows of the DataGrid. I know that I can receive a Java ArrayList using BlazeDS and it gets converted to an ArrayCollection collection. Is it possible to send an ArrayCollection collection to a JSP page or class Java with BlazeDS?

    If you want to use JSP and Java, I presented the following article on the Flex Cookbook site that explains how do.
    Flex generic data exporter to CSV file

  • Post an event customized with jsp portlet

    I have a portal page that contains a portlet to jsp and a few other portlets.
    The jsp has several links and when you click on the links and the page is redrawn on the portal, I want the fire jsp portlet to which other portlets to the page may respond to events.

    To achieve this, I have attached a backup file to a portlet to jsp and I have a custom event triggered (from the handlePostBack method) when certain conditions are met. The problem is that the handlePostBack method is not called in the life cycle jsp portlet (only init() and preRender() and destroy() are called). I realize that it is possible that URLS do not have the _nfpb parameter defined. I tried adding that the link url - but no luck.

    Someone will direct me as to what is the problem with the configuration described above.

    RAM memory.

    Hello Ram,

    You don't want to specify the path in your URL at all when you use one of the URL tags; If you want to add a parameter such as "cmd = 4", use the tag "render: param ' (inside the PostbackURL tag) to add parameters. The tag PostbackURL will get 'magical' the correct path to your portal and includes all the parameters "_nfpb" as well.

    Kevin

  • Dreamweaver CC 2014 - support JSP

    I use Dreamweaver CC 2014 (6733 Build) and I work mainly with JSP.  I read a few articles on how to activate the JSP support, by going to the cloud creative Add-ons and download an extension for Dreamweaver.  All very well until I tried to install the extension, I get the error message

    This extension cannot be installed, it requires Dreamweaver version 13 or more.

    Now, I'm used to have Dreamweaver CS5.5 on my computer, but recently updated. I'm running Mac OS X 10.7.5.  I can always open the JSP files, but only if I select all files (*. *) in the dropdown to allow the open dialog box.

    Can someone shed some light on why I'm having this problem and how to solve?

    Thank you.

    It took a few tries, but in the end, what I had to do was to uninstall Dreamweaver CC to the extensions Manager CC to acknowledge its existence.

    After that, the add-on installed fine.

  • Webcenter jsr168 for portal war file deployment

    I want integrated war jsr168 with Portal Center file. I only install WebCenter Portal without JDeveloper and content. So how should I deploy it?
    Thank you!

    Kind regards
    Jugela

    Hello!.

    You must deploy in WC_Portlet managed server. (WSRP)
    Save your portlet as a producer to WebCenter create a connection to your portlet, WSRP WebCenter portal / application Spaces.
    Add this portlet to the catalog of the resource and add it to a page with the composer Oracle to consume.

    Kind regards.

  • Oracle ADF with jDeveloper

    I am new to oracle adf with jdeveloper. I am impressed with the features of this product. I want to learn it. Are there pre-requesites to learn this product? I realize with JSP/Servlets, Struts 2.0, HTML, Javascript

    Are you sure that you watched
    http://download.Oracle.com/otn_hosted_doc/JDeveloper/11gdemos/ADFTour/ADFTour.html

    There is nothing on the functionality of the ADF - its on how to begin to learn the ADF - links to the community, downloads, tutorials, books, "getting started"...

  • I want to use jsp or jsf as the layer view without using the adf faces

    I have successfully build ADF application, but I have problem here
    I followed tutorial how to generate ADF application using the simple java class as services trade and JSF as the view layer http://blogs.oracle.com/shay/entry/java_class_data_control_and_ad layer
    the problem of the view layer ADF faces HERE IS THE PAGE

    * <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional / / IN."
    * "http://www.w3.org/TR/html4/loose.dtd" > * "
    * < % @ page contentType="text/html;charset=UTF-8"% >
    * < % @ taglib uri prefix = "http://java.sun.com/jsf/core' = 'f' % >
    * < % @ taglib uri prefix = "http://java.sun.com/jsf/html' = 'h' % >
    * < % @ taglib uri prefix = "http://xmlns.oracle.com/adf/faces/rich' = 'af' % >
    * < f: view > *.
    * < af:document title = "title" id = "d1" > *.
    * < af:messages id = "m1" / > *.
    * < af:form id = "f1" > *.
    * < af:outputText value = "#{bindings." Return.inputValue}"id ="ot1"/ > *.
    * < / af:form > *.
    * < / af:document > *.
    * < / f: view > *.

    I want to change the tags with JSP tags, how can I do this cause I don't want to use ADF Faces

    Replace af with h.

    "http://www.w3.org/TR/html4/loose.dtd" >
    <%@ page contentType="text/html;charset=UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>




  • What is the best way for a J2EE developer with oracle?

    Hello

    I am a J2EE developer, for the moment I'm working in a commercial bank as an enterprise application developer. Java, I learned when I was following a degree of local COMPUTER and with the help of books, work at my place of work and the internet, today I develop applications with JSP, Servlets, JSF2.0, EJB3.0 and third-party J2EE part libraries JSF etc (I also develop software using other programming languages such as Asp.net, c# .net, etc. WPF, but I prefer to be in the path of java). Other than that, I also work as the designer of the user interface of most of our applications.

    I have the skills and practice after having worked for 4 years as a developer of web/enterprise applications & UI designer, but now I have to focus on some grades of paper and so I do BCS.

    Now, I want to be a professional in the Oracle java path, and I need to know what is the best way, I choose to go with Oracle. I finished my SCJP courses, but did not take the exams, because there were rumors that Oracle will clear these reviews in the future. I am interested in Oracle university, but I'm unable to even think about it as I live in Sri Lanka and is not only a large part of the wealth to go to the USA and join.

    So I really appreciate if any professional Oracle could suggest me the best educational path based on what I mentioned about my technical and professional training. Because I have a dream to join Oracle a day as an employee and be a good contributor on the same forum, which I get help today!

    :-)

    Thank you!!!

    As you can see on our Web site, Oracle did not retire Java certifications. You can browse through the available certifications and I hope to help determine your path.
    http://education.Oracle.com/pls/web_prod-PLQ-dad/db_pages.GetPage?page_id=140

    SCJP became Oracle Certified Professional Java Programmer. You can find more information on these reviews on our site here: http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=320.

    Concerning training, virtual training live might be an option for you. You can find more information at http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=233.

    Kind regards
    Brandye Barrington
    Certification Forum Moderator

  • Included JSP/JSF page did not get rendered on the main page of JSF

    Hello

    I have a main JSF Page in which I have 2 pages included JSF.
    A JSF page has only an image and other JSF page has some data read from VO.

    When I run the main JSF page, the image gets displayed (first JSF included) but not the content of the second JSF page.

    When I run the second (page embedded JSF) individually, it shows the data of the VO.

    The two JSF pages are included with < jsp: include > tag.

    I missed something?

    Thanks for any help.
    Sameer

    Hello

    When you use jsp: including, the contents of the page fragment link container must be added to the parent PageDef file.

    Frank

Maybe you are looking for

  • Inbox

    I see only 1 month of mail in my Inbox. How can I change the settings so that I can see all my mail?

  • Need for external monitor for Portege R500

    The screen on the R500 (PPR50E-01301TEN) is fine for a use for an hour or two on the go, but if I use it constantly throughout the day, I get a bad neck and headache (perhaps the angle that you have to look as far as its small size). So I want to get

  • my laptop does not start and gives me the error, load the required DLLs for kernal

    When I went to start my computer would not start and just says load needed DLLs for kernal and communicate with my support. I don't know what the problem is or how to fix it. It was working fine when I finally stopped him. any help is greatly appreci

  • Error message: the parameter is incorrect, while playing music

    I have WMP 11 for Vista, and recently it stopped working properly for the songs I have. When I go to any folder with a song or a video and try to double click on it nothing happen. then I right click on the song or the video and choose the option "Op

  • Printer COPIES an impression that he just printed a file

    Please help me if you can.  I have a PSC 2355 all-in-one, which worked well for years on a regular basis.  Now, it copies text or an image starting from the plateau.   Either it prints light images or nothing at all.   It prints text and images of fi