JSP argument mapping

Hi,
I am new to JSP and was trying my hands at using JSP in BPM.I was able to build a simple JSP where the user enetered the name and his age which I had retrieved in BPM by using BPM tag library.The form also has two buttons Submit and Cancel button and when users clicks any of them , I am then determining my next set of actions.
But i am not able to get the button action in BPM.There is something called 'Show Out' in the argument mapping and has number of output arguments.However i am clueless which one of them to use and how.If anybody has an idea or some kind of basic tutorial on JSP n BPM,please help.
I have also tried using the sample exp given for JSP in OBPM but there is no argument mapping in that :(
Thanx in advance,
Ritu

Hi Ritu,
You want to navigate to another page clicking on the SUBMIT/CANCEL button.
For doing so you have to add the following code
<form method="post" name="sampleForm" id ="sampleForm" action="<f:postResults/>">
<input type="submit" id="SUBMIT" value="Submit" onclick="submitForm('SUBMIT')">
<input type="submit" id="CANCEL" value="Cancel" onclick="submitForm('CANCEL')">
<input type="hidden" id="selectedButton" <f:fieldName att="bpmObject.selectedButton"/> value="<f:fieldValue att="bpmObject.selectedButton" onlyValue="true"/>"/>
</form>
<SCRIPT type="text/javascript">
function submitForm(buttonId) {     
document.getElementById("selectedButton").value = buttonId;
</SCRIPT>
Now you can get the value of the bpm attribute in process layer and you can make use of the value of the bpm attribute and make a conditional flow if the value of the attribute is SUBMIT then have a conditional flow and if not then do another conditional/unconditional flow.
I hope this will help you out
Bibhu
Edited by: Bibhuti Bhusan on May 21, 2010 1:36 AM

Similar Messages

  • How do I cast an heir in an argument mapping?

    I'd like to be able to use a generalization of an instance variable in my main process flow but inside of a subprocess or screenflow to use a specialization(heir) of the variable. I've tried every combination of cast or conversion syntax in the argument mapping but it will not allow me to save. I've also tried the inverse with a specialization cast into the generalization with no luck.
    Is this possible? Is there another mechanism to accomplish this?
    -Matt
    Edited by: Matt Pichette on Apr 30, 2009 2:06 PM

    Hi Matt,
    Even with inheritance, I don't think you'll be able to cast an incoming argument variable BPM Object to an instance variable that is a BPM Object of another type.
    Know you know this, but if you have defined a "Person" BPM Object; you might also have a "Client" BPM Object. You can make the Client object inherit the attributes and methods from the Person object if you double click the Client object in the catalog -> click the "Properties" tab in the upper right corner -> change the "Type Inheritance" to "Type" and change the "Inherits Type" to "Person". If you're creating the inheritance by right mouse clicking the Person object and clicking "Create Heir" you're doing almost the same thing except you're creating the Client object with "Behavior" inheritance.
    When you write the logic that sets the Client object to the Person object everything looks like it's okie dokie:
    <pre class="jive-pre"><p />p as Person
    c as ClientType
    p.id = "1234"
    if c is Person then
    display "Hey I'm a person"
    if c is ClientType then
    display "Hey I'm also a client!"
    // try casting the pup right here (this is going to cause an error at runtime)
    c = ClientType(p)
    end
    end
    display c.id</pre>
    If you defined the Client object with Behavior inheritance you'll have syntax error in the statement that casts the person object into the Client (the "c = ClientType(p)" statement). If you used Type inheritance, you won't have a syntax error, but when you try running this the logic you will instead get a runtime error.
    Sure you've probably already thought of these, but here are a couple ideas.
    (1) Consider creating the Client object without inheritance and instead add the Person object as an attribute of the Client. This would have the advantage of easily setting all the parent's attributes inside the Client with just one line of logic:
    <pre class="jive-pre"><p />p as Person
    c as Client
    c.person = p</pre>
    (be sure to set the "person" attribute to the Person object's constructor inside the Client object's constructor).
    The obvious drawback to this approach is that it's not using inheritance, but the advantages are that
    a) you're still able to use the attributes and methods of the Person object
    b) you're able to set (not cast) the Person attribute in a single line of logic ("c.person = p") and
    c) as additional attributes get added to the Person object you will not have to edit this logic to set the additional attributes.
    (2) (you're going to hate this idea) Consider biting the bullet and forget casting. Keep the inheritance, but set each of the individual attribute in the Client object to the corresponding attribute in the Person object.
    The drawback to this is significant. You're going to have a line of code to set each individual attribute. If you add more attributes to the Person object, you'd have to remember to add more lines of code to set these new individual attributes as well in the Client.
    Sorry - wish I had a better answer for you,
    Dan

  • Overriding default jsp servlet mapping

    I want to override the default jsp servlet mapping under a specific directory. I have the following entries in my application's web.xml file:
    <servlet>
    <servlet-name>CMS</servlet-name>
    <jsp-file>/template/main.jsp</jsp-file>
    </servlet>
    <servlet-mapping>
    <servlet-name>CMS</servlet-name>
    <url-pattern>/raw/*.html</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>CMS</servlet-name>
    <url-pattern>/raw/*.jsp</url-pattern>
    </servlet-mapping>
    When I call up the page /raw/test.jsp, it is processed as a normal jsp page instead of by the custom mapping. Calling up the page /raw/test.html works as expected.
    I am using the embedded server under JDeveloper 10.1.2.1.0.
    Isn't an entry in the application's web.xml file meant to override system wide mappings?
    Thanks for any help.
    Martin

    I'm no expert on this but I have a hunch. 1st of all, your using a servlet mapping for a JSP. That's good and well but it seems that the container is complaining that there is no servlet named org.apache.jsp.jsp.info.ContactUs_jsp. In other words it looks like the JSP has not been compiled. At least not yet. Maybe try two things. Visit the JSP once with a browser at it's actual path "http://localhost:8080/<webapp>/jsp/info/ContactUs.jsp" the coerce a page compile. Then try it with your new mapped path. You see, just telling the container that there is a servlet mapped to the new URL doesn't force the container to generate the class. Something or someone must generate the servlet class file.
    Honestly, I'm not sure of what your end goal is but maybe you might consider using a JSP pre-compiler? Or even better, register a servlet at the mapped path that fowards all requests into the desired folder.
    Cliff

  • Invoke or Invokel - error on argument mapping

    Hi...
    I'm trying to call a bpm method (witch receives 1 arg) from my jsp page, running from a Global Interactive, and i`m getting the error below
    The task could not be successfully executed.
    Reason: 'fuego.web.execution.exception.InternalForwardException: UnExpected error during internal forward process.'.
    Caused by: UnExpected error during internal forward process.
    Caused by: Ambiguos method. There are more than one method of name 'getTeste' with '1' arguments.
    fuego.lang.ComponentExecutionException: The task could not be successfully executed.
    Reason: 'fuego.web.execution.exception.InternalForwardException: UnExpected error during internal forward process.'.
    THERE IS ONLY ONE METHOD NAMED getTeste ON MY BPM OBJECT
    I believe i'm doing something stupid here, but i can't figure it out.
    How should I have called this method? should be static? If should, how to call it from jsp?
    JSP code:
    <c:set var="qtde" scope="page" value="0"/>
    <f:invokel var="${filtro}" methodName="getTeste" retAttName="qtde" args="0"/>
    <c:out value="${qtde}"/>
    thanks for your help
    Edited by: Alexandre MF on 07/05/2010 16:02

    I found an workaround to this problem.
    <c:set var="qtde" scope="page" value="0"/>
    <f:invoke var="${filtro}" methodName="getTeste" retAttName="qtde">
    <f:jarg value="mesmo" className="java.lang.String"/>
    </f:invoke>
    <c:out value="${qtde}"/>
    using jarg with full class name mapping it works...

  • JSP Servlet Mapping  in web.xml

    Hi!
    I have a JSP page by name "ContactUs.jsp" located in the folder <root>/jsp/info and I am using Tomcat Server. As I want to access this file using the URL "http://localhost:8080/<webapp>/ContactUs.jsp" instead of "http://localhost:8080/<webapp>/jsp/info/ContactUs.jsp". For this I added the follwing lines to web.xml file of my web app.
    <servlet>
    <servlet-name>org.apache.jsp.jsp.info.ContactUs_jsp</servlet-name>
    <servlet-class>org.apache.jsp.jsp.info.ContactUs_jsp</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>org.apache.jsp.jsp.info.ContactUs_jsp</servlet-name>
    <url-pattern>/ContactUs.jsp</url-pattern>
    </servlet-mapping>
    But I am getting the error saying that
    "ClassNotFoundException: org.apache.jsp.jsp.info.ContactUs_jsp"
    Is there any thing else to be modified? Please help me.
    Thanks in advance
    Geethanadh.K

    I'm no expert on this but I have a hunch. 1st of all, your using a servlet mapping for a JSP. That's good and well but it seems that the container is complaining that there is no servlet named org.apache.jsp.jsp.info.ContactUs_jsp. In other words it looks like the JSP has not been compiled. At least not yet. Maybe try two things. Visit the JSP once with a browser at it's actual path "http://localhost:8080/<webapp>/jsp/info/ContactUs.jsp" the coerce a page compile. Then try it with your new mapped path. You see, just telling the container that there is a servlet mapped to the new URL doesn't force the container to generate the class. Something or someone must generate the servlet class file.
    Honestly, I'm not sure of what your end goal is but maybe you might consider using a JSP pre-compiler? Or even better, register a servlet at the mapped path that fowards all requests into the desired folder.
    Cliff

  • How to map ALL .jsp to a Main servlet ?

    the problem is that i want to submit all forms on web pages to be processed by servler but to see in adress bar of my browser url with .jsp
    i tried to map main sertvlet in such a way
    <url-mapping>/*.jsp</url-mapping>
    but it didn't work...
    is there a way to invoke servlet but to see *. jsp as an url ?
    in other word, is it possible by calling index.jsp invoke some servlet behind the scene ?
    if i could map *.jsp this could be done automatically.....

    In theory you can use:<url-mapping>/*.jsp</url-mapping>However most web servers already intercept that mapping and it may bypass your mapping.
    For example in Tomcat there is a web descriptor in the <TOMCAT_HOME>/conf directory that maps all jsp extensions to org.apache.jasper.servlet.JspServlet.
    If you want to work with jsps on this level, try using filters intead, they may not be affected by the JspServlet as they have to pass through the filter first.
    Anthony

  • How to use an BPM Instance Variable in JSP page

    Hi All,
    I am using the JSP Presentation, but i don't know how to use an Instance variable in JSP page, that instance already declared in the process. And Can u explain the syntax that to include the JS file into jsp page
    Regards
    Vasu.
    Edited by bpmvasu at 04/03/2007 10:43 PM

    Hi Mariano,
    I'm using JSP presentation too. In "Interactive Component Call" active i'm using "Use JSP presentation", but i only can define one instance variable, i need to add more instance variables. In "Advanced" option of this task, i have the argument mapping .. but i don't understand how to use it.
    I have a instance variable called "genders" of the type String[Int] (Associative Array) and i'm mapping this instance variable in "Arguments Show In" option of the advanced option of JSP presentation. In JSP presentation i have the code:
    <select <f:fieldName att="person.gender"/>>
                   <c:forEach var="gender" begin="0" items="${genders}" varStatus="status">
                        <c:choose>
                             <c:when test="${person.gender == gender}">
                                  <option value="<c:out value="${gender}"/>" selected="true"><c:out value="${gender}"/></option>
                             </c:when>
                             <c:otherwise>
                                  <option value="<c:out value="${gender}"/>"><c:out value="${gender}"/></option>
                             </c:otherwise>
                        </c:choose>
                   </c:forEach>
              </select>And in my screenflow i have the code:
    genders[0] = "Male"
    genders[1] = "Female"But when i run my application, i have the error: "The task could not be successfully executed. Reason: 'java.lang.ClassCastException: java.lang.Integer'."
    What's the problem?

  • Import xobject in JSP not working

    Hi,
    i am trying to pass some feugo business objects as JSPattributes.
    first i am importingthe classes
    <%@page import="xobject.com.comp.proj.BO.MyBPMObject"%>
    and then i am trying to assign the attributes
    <% MyBPMObject o = (MyBPMObject) request.getAttribute("myObject"); %> as suggested in the thread
    Re: JSP and Instance Variables
    However while compiling the jsp is throwing an error- package xobject.com.comp.proj.BO not found
    Can you please help me out?
    ---

    When I have instance variables in addition to the one specified as the selected BPM Object variable I use the 'attributes' argument mapping.
    You can set an 'in' argument called 'attributes' and map a list of instance variables. Example below:
    attributes = [ "jspVarName1" : instVar1, "jspVarName2" : myObject.getData ]
    You can then access these vars in your jsp as normal i.e. ${jspVarName1}
    Hope it helps,
    Mike.

  • JSP and Instance Variables

    I have some questions about JSP presentation (Interactive Component Call in Screenflow):
    - Only BPM Objects are possible to be mapped in JSP?
    - Is possible to map two or more BPM Objects to the JSP?
    - What is the difference of mapping using the variable "attributes" in argument mapping and the option "Select BPM object variable" in main task of Interactive Component Call activity?

    I seem to be having a similar problem.
    If I include this fragment, for an instance variable called "contacts" which is a BPMObject of type "ITSSContactRequest".
    <%
    Object r = request.getAttribute("contacts");               
    Class cl = r.getClass();
    out.println(cl.getName());
    %>
    I get the following output:
    xobject.ITSSContactManagement.ITSSContactRequest
    and I can access the object via reflection:
    <%
    Object r = request.getAttribute("contacts");               
    Class cl = r.getClass();
    out.println(cl.getName());     
    Method getGeneralContacts = cl.getMethod("getGeneralContacts", null);               
    Object rv = getGeneralContacts.invoke(r);
    %>
    and access the rv variable accordingly.
    However, if I try and cast the variable directly:
    <%
    Object r = request.getAttribute("contacts");
    Class cl = r.getClass();               
    out.println(cl.getName());
    xobject.ITSSContactManagement.ITSSContactRequest rq = (xobject.ITSSContactManagement.ITSSContactRequest)r;
    %>
    I get the following error message:
    "The task could not be successfully executed. Reason: 'fuego.web.execution.exception.InternalForwardException: UnExpected error during internal forward process.'.
    See log file for more information [Error code: workspace-1258985548580] "
    The same error occurs if I try and import the object via
    <%@ page import="xobject.ITSSContactManagement.ITSSContactRequest" %>
    Thanks for any help.

  • How to check the Conditional transition while submit the jsp as screenflo

    Hi All,
    I want to know that how to check the conditional transition, which result is used to decide the next Activity while submit the JSP as Screen Flows
    Edited by bpmvasu at 03/27/2007 11:14 PM

    Hi,
    Unlike BPM Object Presentations where the 'selectedButton' is automatically assigned to the predefined screenflow 'result' variable, when using JSP Persentations you need to do the mapping yourself (I don't think there is a way around this).
    Assuming you're using a JSP Presentation with a Fuego Object Interactive Call, click the 'Advanced' button at the bottom of the Main Task dialog.
    Select the 'showOut' argument set, add a new argument mapping. Select 'result' from the Screenflow's instance variables and map it to 'parameters["paramName"]'. Where paramName is the name of the HTML submit input element in your JSP.
    Hope this helps,
    Tim

  • Message Mapping-Generating Headers and corresponding Line items in 1 file

    Hi,
    I am working on JDBC to File scenario.
    There is a staging table in SQL Server. XI polls the table every 20 secs and picks up all the data with flag = 0. After fetching the records it sets the flag to 1 so that the same data do not get fetched the next time.
    The record have one Bill No and there can be more than 1 line items associated with that bill no.
    The target structure is as follows:
    Record          1
       Bill No          0...unbounded
       Line item     1
            Line items    0...unbounded
    Now the requirement is to generate a file with header and all the corresponding line items below it.  That is one file can have many headers but all the line items should succeed its corresponding header.
    I have written a UDF to generate the same.
    For Bill No.:
    Bill No -> RemoveContext -> Sort - > UDF -> SplitBy Value -> CollapseContext
    UDF just removes the duplicate Bill No and generates the list.
    Now the issue is if Bill No as per source is 8,4,1,3 then the ones getting generated in the target str is in the same order as it is in source that is 8,4,1,3. But  I want this in the sorted order ie. 1,3,4,8. Althoug I have used Sort func, its not getting generated.
    Please help.

    chk this:
    BillNo-removeContext--sort--splitByValue(valuechange)---collapse Context---Record
    BillNo-removeContext--sort--splitByValue(valuechange)---collapse Context---splitbyvalue(each Value)---BillNo(Target)
    BillNo-removeContext---------------------------
                                -------------------------- SortByKey----------FormatByExample(2nd argument mapping below)---UDF2---Line Item
    BillSerailNo(set its context to Row)--UDF1---removeContext--
    BillNo-removeContext--sort--splitByValue(valuechange)----2nd argument mapping of "formatbyexample"
    BillNo-removeContext---
                                --------SortByKey----FormatByExample(2nd argument)---UDF2--splitbyvalue(each value)-Bill Serial No
    BillSerailNo(set its context to Row)----UDF1---removeContext-----
    BillNo-removeContext--sort--splitByValue(valuechange)----2nd argument mapping of "formatByExample"
    udf1: Input will be var1
    Execution type: all values of a context
    String a="";
    for(int i=0;i<var1.length;i++)
    a = a + var1<i>+ ";";
    int b= a.length();
    result.addValue(a.substring(0,b-1));
    UDF2: input will be var1
    Execution type: all values of a context
    for(int b=0;b<var1.length;b++)
    String [] a = var1<b>.split(";");
    for(int i=0;i<a.length;i++)
    result.addValue(a<i>);
    Input:
    <MT_Source>
       <ROW>
            <Bill_No>8</Bill_No>
             <LineItems>
                <BillSerailNo>second</BillSerailNo>
               <LineItems>
              <LineItems>
                <BillSerailNo>second1</BillSerailNo>
             </LineItems>
         </Row>
          <ROW>
            <Bill_No>5</Bill_No>
             <LineItems>
                <BillSerailNo>First</BillSerailNo>
               <LineItems>
              <LineItems>
                <BillSerailNo>First1</BillSerailNo>
             </LineItems>
         </Row>
    <ROW>
    <Bill_No>8</Bill_No>
             <LineItems>
                <BillSerailNo>Third</BillSerailNo>
               <LineItems>
              <LineItems>
                <BillSerailNo>Third1</BillSerailNo>
             </LineItems>
         </Row>
    <MT_Source>
    Target:
    <MT_Target>
        <Record>
            <Bill_No>5</Bill_No>
             <LineItems>
                <BillSerailNo>First</BillSerailNo>
               <LineItems>
              <LineItems>
                <BillSerailNo>First1</BillSerailNo>
             </LineItems>
       </Record>
       <Record>
           <Bill_No>8</Bill_No>
             <LineItems>
                <BillSerailNo>second</BillSerailNo>
               <LineItems>
              <LineItems>
                <BillSerailNo>second1</BillSerailNo>
             </LineItems>
             <LineItems>
                <BillSerailNo>Third</BillSerailNo>
               <LineItems>
              <LineItems>
                <BillSerailNo>Third1</BillSerailNo>
             </LineItems>
           </Record>
        <MT_1>

  • Combine two jsp pages into single

    hai how to combine two jsp pages in to one
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionMessage;
    import org.apache.struts.action.ActionMessages;
    import com.latchiya.Constants;
    import com.latchiya.model.Staffinfo;
    import com.latchiya.service.Manager;
    import com.latchiya.webapp.form.StaffinfoForm;
    * Action class to handle CRUD on a Staffinfo object
    * @struts.action name="staffinfoForm" path="/staffinfos" scope="request"
    * validate="false" parameter="method" input="mainMenu"
    * @struts.action name="staffinfoForm" path="/editStaffinfo" scope="request"
    * validate="false" parameter="method" input="list"
    * @struts.action name="staffinfoForm" path="/saveStaffinfo" scope="request"
    * validate="true" parameter="method" input="edit"
    * @struts.action-forward name="edit" path="/WEB-INF/pages/staffinfoForm.jsp"
    * @struts.action-forward name="list" path="/WEB-INF/pages/staffinfoList.jsp"
    * @struts.action-forward name="search" path="/staffinfos.html" redirect="true"
    public final class StaffinfoAction extends BaseAction {
    public ActionForward cancel(ActionMapping mapping, ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    return mapping.findForward("search");
    public ActionForward delete(ActionMapping mapping, ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    if (log.isDebugEnabled()) {
    log.debug("Entering 'delete' method");
    ActionMessages messages = new ActionMessages();
    StaffinfoForm staffinfoForm = (StaffinfoForm) form;
    // Exceptions are caught by ActionExceptionHandler
    Manager mgr = (Manager) getBean("manager");
    Staffinfo staffinfo = (Staffinfo) convert(staffinfoForm);
    mgr.removeObject(Staffinfo.class, staffinfo.getStaffId());
    messages.add(ActionMessages.GLOBAL_MESSAGE,
    new ActionMessage("staffinfo.deleted"));
    // save messages in session, so they'll survive the redirect
    saveMessages(request.getSession(), messages);
    return mapping.findForward("search");
    public ActionForward edit(ActionMapping mapping, ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    if (log.isDebugEnabled()) {
    log.debug("Entering 'edit' method");
    StaffinfoForm staffinfoForm = (StaffinfoForm) form;
    // if an id is passed in, look up the user - otherwise
    // don't do anything - user is doing an add
    if (staffinfoForm.getStaffId() != null) {
    Manager mgr = (Manager) getBean("manager");
    Staffinfo staffinfo = (Staffinfo) convert(staffinfoForm);
    staffinfo = (Staffinfo) mgr.getObject(Staffinfo.class, staffinfo.getStaffId());
    staffinfoForm = (StaffinfoForm) convert(staffinfo);
    updateFormBean(mapping, request, staffinfoForm);
    return mapping.findForward("edit");
    public ActionForward save(ActionMapping mapping, ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    if (log.isDebugEnabled()) {
    log.debug("Entering 'save' method");
    // Extract attributes and parameters we will need
    ActionMessages messages = new ActionMessages();
    StaffinfoForm staffinfoForm = (StaffinfoForm) form;
    boolean isNew = ("".equals(staffinfoForm.getStaffId()) || staffinfoForm.getStaffId() == null);
    Manager mgr = (Manager) getBean("manager");
    Staffinfo staffinfo = (Staffinfo) convert(staffinfoForm);
    mgr.saveObject(staffinfo);
    // add success messages
    if (isNew) {
    messages.add(ActionMessages.GLOBAL_MESSAGE,
    new ActionMessage("staffinfo.added"));
    // save messages in session to survive a redirect
    saveMessages(request.getSession(), messages);
    return mapping.findForward("search");
    } else {
    messages.add(ActionMessages.GLOBAL_MESSAGE,
    new ActionMessage("staffinfo.updated"));
    saveMessages(request, messages);
    return mapping.findForward("edit");
    public ActionForward search(ActionMapping mapping, ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    if (log.isDebugEnabled()) {
    log.debug("Entering 'search' method");
    Manager mgr = (Manager) getBean("manager");
    request.setAttribute(Constants.STAFFINFO_LIST, mgr.getObjects(Staffinfo.class));
    return mapping.findForward("list");
    public ActionForward unspecified(ActionMapping mapping, ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    return search(mapping, form, request, response);
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.upload.FormFile;
    import com.latchiya.Constants;
    import com.latchiya.webapp.form.UploadForm;
    * This class handles the uploading of a resume (or any file) and writing it to
    * the filesystem. Eventually, it will also add support for persisting the
    * files information into the database.
    * <p>
    * <i>View Source</i>
    * </p>
    * @author Matt Raible
    * @struts.action name="uploadForm" path="/uploadFile" scope="request"
    * validate="true" input="failure"
    * @struts.action-forward name="failure" path="/WEB-INF/pages/uploadForm.jsp"
    * @struts.action-forward name="success" path="/WEB-INF/pages/uploadDisplay.jsp"
    public class UploadAction extends Action {
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    // Did the user click the cancel button?
    if (isCancelled(request)) {   
    request.removeAttribute(mapping.getAttribute());
    return (mapping.findForward("mainMenu"));
    //this line is here for when the input page is upload-utf8.jsp,
    //it sets the correct character encoding for the response
    String encoding = request.getCharacterEncoding();
    if ((encoding != null) && (encoding.equalsIgnoreCase("utf-8"))) {
    response.setContentType("text/html; charset=utf-8");
    UploadForm theForm = (UploadForm) form;
    //retrieve the name
    String name = theForm.getName();
    //retrieve the file representation
    FormFile file = theForm.getFile();
    //retrieve the file name
    String fileName = file.getFileName();
    //retrieve the content type
    String contentType = file.getContentType();
    //retrieve the file size
    String size = (file.getFileSize() + " bytes");
    String data = null;
    String location = null;
    // the directory to upload to
    String uploadDir =
    servlet.getServletContext().getRealPath("/resources") + "/"
    + request.getRemoteUser() + "/";
    //write the file to the file specified
    File dirPath = new File(uploadDir);
    if (!dirPath.exists()) {
    dirPath.mkdirs();
    //retrieve the file data
    InputStream stream = file.getInputStream();
    //write the file to the file specified
    OutputStream bos = new FileOutputStream(uploadDir + fileName);
    int bytesRead = 0;
    byte[] buffer = new byte[8192];
    while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
    bos.write(buffer, 0, bytesRead);
    bos.close();
    location = dirPath.getAbsolutePath()
    + Constants.FILE_SEP + file.getFileName();
    //close the stream
    stream.close();
    // place the data into the request for retrieval on next page
    request.setAttribute("friendlyName", name);
    request.setAttribute("fileName", fileName);
    request.setAttribute("contentType", contentType);
    request.setAttribute("size", size);
    request.setAttribute("data", data);
    request.setAttribute("location", location);
    //destroy the temporary file created
    file.destroy();
    //return a forward to display.jsp
    return mapping.findForward("success");
    ===========================================================================================
    i want to get second jsp file ie upload file to student file
    if anybody know please tell i am new to java side
    regards
    ranga

    ur not able to give solution
    insted giving comment mind ur words being in software fied
    commentting like bad words not good i warn u mind ur words

  • Creating pocess intance of a different process and passing arguments

    Creating Process instance of a different process:
    I have two different process: Main_Flow (id: MainFlow) and Second_Flow (id: SecondFlow). In the first process I am reading a csv file. Each line of the file has four columns. After reading each line I have to initiate Second_Flow and pass the read data from the file. (Pls find the code below for the whole process):
         fileReader = FileReader(arg1 : fullFileName);//filename is of file type and have file name and path
         Java.Io.BufferedReader reader = BufferedReader(arg1 : fileReader);
         String str;
         int countLines = 0;
         while ((str = reader.readLine()) != null)
              strColumn = str.split(delim : ",");
                   int ColumnCnt = 0;
                   while (ColumnCnt < 4)
                        //defining variables
                        String appNo;
                        String custNo;
                        String loanAmm;
                        String loanDate;
                        //logMessage("Value at Column: " + ColumnCnt + " is " + strColumn[ColumnCnt]);
                        if (ColumnCnt == 0)
                             arrLoanData["appNo"] = strColumn[ColumnCnt];
                        else if (ColumnCnt == 1)
                             arrLoanData["custNo"] = strColumn[ColumnCnt];
                        else if (ColumnCnt == 2)
                             arrLoanData["loanAmm"] = strColumn[ColumnCnt];
                        else if (ColumnCnt == 3)
                             arrLoanData["loanDate"] = strColumn[ColumnCnt];
                        arrLoanData["descriptionArg"] = "AutoInstance: " + formatTime('now', timeStyle : Time.SHORT);
                        arrLoanData["genByArg"] = "Automatic";
                        ProcessInstance.create(processId : "/SecondFlow", arguments : arrLoanData, argumentsSetName : "BeginIn");
                        ColumnCnt = ColumnCnt + 1;
              countLines = countLines + 1;     
    (“The code is in Java and not in PBL”)
    I have to pass appNo, custNo, loanAmm and loanDate as the arguments. The Argument will be of Any[String] type. The argument set name of Second_Flow is “BeginIn”. But I am not getting anything in Second_Flow.
    What can I do in the argument mapping of begin of Second_Flow to get the passed argument (array)?

    the argument 'arguments' for the method ProcessInstance.create receives a map of the arguments that the 'argumentSetName' argument set will receive.
    so for example if your second flow has 2 arguments, String name, Decimal value and String[] content your method invocation would be:
    ProcessInstance.create(processId : "/SecondFlow", arguments : {"name": strNameFromCsv, "value": valueFromCsv, "content": ["a","b","c","d"]}, argumentsSetName : "BeginIn");

  • Secure Map Rendering on Javabean based API

    Hi,
    I need to apply secure mapping functionality using Mapviewer’s JavaBean based API. I’ve created a secure data source by adding the plsql_package="web_user_info" statement on the data source definition. For testing purposes I’ve used mvdemo data set and followed the steps of Secure Map Rendering Demo. I created "web_user_info" package on mvdemo schema as well as a view on CUSTOMERS table (create or replace view customers_view as select * from customers where account_mgr = web_user_info.get_user) and a geometry theme: mycystomers on that view.
    I also added the appropriate authenticated web users to the OC4J container(e.g. alex) and assigned them the "users" role.
    Finally I included the relative path of JSP Demo (with mapclient lib) that resides at http://server:port/mapviewer/demo/mapinit.jsp to the <security-constraint> element of web.xml file so that the data source can get the web user name from J2EE user:
    <!-- For Secure Map Rendering demos only -->
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Secure mapping demo page</web-resource-name>
    <description>MapViewer secure map rendering demo</description>     
         <url-pattern>/demo/secure-mapping.html</url-pattern>
         <url-pattern>/demo/mapinit.jsp</url-pattern>
         <url-pattern>/demo/map.jsp</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>secure_maps_role</role-name>
    </auth-constraint>
    </security-constraint>
    After authenticating to the http://server:port/mapviewer/demo/mapinit.jsp JSP demo through mapviewer's login page that was automatically generated because of the security-constraint, I filled in the required fields asking for base map: demo_map. I also modified "demo_map" by adding "mycustomers" theme to it. Unlike Oracle Maps Map Rendering Demo (http://server:port/mapviewer/demo/secure-mapping.html) that displays only those customers that belong to the authenticated user, the generated map does not display any customer data at all.
    Does Secure Map Rendering Demo apply just for the Oracle Maps Javascript API and the XML API or is there any other parameter that I’m missing and needs to be configured in order for it to run for the JavaBean based API as well?
    Any help on the above matter would be really appreciated.
    Thanks in advance.

    Hi,
    The reason the JSP files did not show the secured customers, is because while you authenticated to the J2EE server when accessing these JSP files, the JSP file themselves did not authenticate to the J2EE server. In other words, there are two sessions involved. One session is between your browser and the J2EE server, which contains the authenticated user ID. This session is initiated when you try to open the mapinit.jsp page.
    The other session is established when the JSP page (map.jsp) opens a new HTTP Connection to the server to send the XML map request generated from various JavaBean API calls. To be more specific, when the JSP page invokes MapViewer.run(), this method internally gathers all the themes/basemaps you have added to the client handle, then constructs a single XML map request out of these pieces of information. It then opens a HTTP connection back to the same server to send the XML doc to mapviewer for processing. The problem is that to the J2EE server this is a new session (initiated by map.jsp), and it does not contain any authentication info.
    Because currently the JavaBean API does not support setting a cookie or user credential directly on its internal Http connections, there seems to be no easy work around for this issue for now. Please contact us offline if you would like to open an enhancement request.
    Thanks
    LJ

  • Drop Down list issues in jsp

    Hi,
    I am facing an issue with drop down list in jsp pages on page postback. Let me explain in detail. I have a client.jsp page which has a drop down list and a text box. The drop down list is populated from an Action class (lets say testAction.java). In the client action form class there is a validation which requires the user to enter some value in the text box.
    So here is the problem, when the client.jsp page loads, the drop down list is populated perfectly, but then the user clicks submit button without entering anything in the textbox, the page loads again with an error message ("Please enter some value in the textbox"). At this point the drop down list does not contain any value. Any ideas what could I do?
    I am posting the code here for individual pieces,
    Struts-config.xml_
    <action path="/client" type="com.myapp.struts.testAction" scope="session">
    <forward name="success" path="/createClient.jsp"/>
    </action>
    <action input="/createClient.jsp" name="ClientActionForm" path="/createClient" scope="session" type="com.myapp.struts.ClientAction">
    <set-property property="cancellable" value="true" />
    <forward name="success" path="/loginSuccessful.jsp"/>
    <forward name="cancel" path="/Welcome.do"/>
    </action>
    index.jsp_
    <h5><html:link action="/client" styleClass="purplelink">Create a new client</html:link></h5>
    testAction.java_
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    ArrayList<String> arrList = new ArrayList<String>();
    arrList.add("sports");
    arrList.add("music");
    arrList.add("test 1");
    arrList.add("test2");
    request.setAttribute("mylist", arrList);
    return mapping.findForward(SUCCESS);
    createClient.jsp_
    <select name="droplist">
    <c:forEach var="itemName" items="${mylist}">
    <option><c:out value="${itemName}" /></option>
    </c:forEach>
    </select>
    <html:text property="clientName" />
    ClientActionForm_
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
    ActionErrors errors = new ActionErrors();
    if (getclientName() == null || getclientName().length() < 1) {
    errors.add("name", new ActionMessage("error.name.required"));
    return errors;
    Here is the process/page flow.
    index.jsp is the first page which is loaded.
    Link on index.jsp calls action="/client"
    This pulls mapping from struts-config and calls testAction.java
    This populates the arraylist and returns to the createClient.jsp page (mapping from struts-config.xml)
    Now createClient.jsp page has two fields (dropdown list and textfield=clientName) and a submit button
    if user clicks submit, clientActionForm is called and does not enter anything into clientName text field, error message is returned.
    At this point, the drop down list in createClient.jsp is not populated and is returned as empty, even though the scope=session in struts-config.xml
    Please provide some inputs on how can I handle this issue.
    Thanks
    Ashish

    I think one solution would be instead of putting the list in the request, but it in your ActionForm.
    Add a field to the ClientActionForm with getters and setters.
    Then change your action.
    ArrayList<String> arrList = new ArrayList<String>();
    arrList.add("sports");
    arrList.add("music");
    arrList.add("test 1");
    arrList.add("test2");
    ClientActionForm frm = (ClientActionForm)form;
    frm.setMyList(arrList);
    return mapping.findForward(SUCCESS);

Maybe you are looking for