Struts2 - Trim the form values

I am using Struts2.
I would like to trim the values submitted in any form before validations and before saving in DB.
Is there any inbuilt feature for the same?
Thanks
Krishan Babbar

Hi Frank, thanks for your answer.
I believe that my problem is more complex.
What happens if the View Object have certain transient attributes?
These attributes are not persistent in the Entity Object.
Can I use the collection from the Data Control Palette to create the Input Form?
Thanks again.
JuanFer HP

Similar Messages

  • Hacking into the form values file to retrieve a post after closing a window

    Okay, I'd just finished editing and re-editing a very long post and was doublechecking some of the links when I inadvertedly closed the entire window instead of merely closing the tabbed page I'd brought the new link up on to test it.
    I poked around and found a long binary file called "Form Values" in library/safari directory and I would just bet this has my full post in it. I copied it to the desktop because I had a feeling that if I opened another form with Safari, the info would be rewritten and lost forever. So I do have a safety copy now.
    Anyone have any idea at all how I could retrieve that information, and convert it from binary back into text form so I would not have to spend another two hours remembering and rewriting the post?
    Or a way of getting Safari to recognize it and read it into a new post form?
    Boy, recovering data with a menu item like "undo close window" or a reopen sure would be a nice feature... I bet I'm not the only person that's done this.
    THANKS!!

    I just downloaded Hex Editor and gave myself a trip down memory lane (hadn't used one of these editors since my DOS days). Anyway, as I expected, it looks like the Form Values file is encrypted - there are no recognizable text strings to extract. In any case, this file contains the data you used to fill out forms at particular sites, it does not carry the entire page or form.
    You could try Retrospective to see if you can find the page with the form in Safari's cache. If you do find it, the form could be filled out as when you closed the window or it could be blank as when it was last loaded into Safari - I don't know which because I haven't searched the cache with this puspose in mind before.

  • Making a JSP Form read only based on the form value present in DB

    I need suggestions/examples as i am newbie into java stream.
    I have two JSP pages 'Add Page' and 'Edit Page' .
    Add Page -> In add Page,I have many text boxes,select drop-downs options. In one select drop-down I have values as Locked and open .I can save this page contents in DB by entering those form values.
    Edit Page -> In eidtPage,once saved in DB, based on 'select drop-down- Locked and open' If it is locked i have to make all the fields (text boxes and select drop downs) as read only and if it is open i have to make it editable.
    I am taking all the values from DB,setting to 'form bean' and then setting up the values in session and forwarding it to JSP page to populate there .I am using beehive net UI tages in JSP. Please help me out.

    Not sure I'm following what you want, but this might help:
    In your select tag, put something like an 'onchange' event that calls a javascript function. In the javascript function it you add code to enable or disable your other fields based on the item selected from the drop down box.
    To determine what item was selected in a select tag, you write something like the following. I'm not sure of the exact syntax. You can look it up in a javascript book:
    var optionSelected = document.forms[0].selectTagName.options[document.forms[0].selectTagName.selectedIndex].value;
    To enable or disable a textfield, search for this in google:
    'jquery disable input'

  • 1     Unable to retrieve the form values entered by the user from the xpath expression(with or without s

    1.1 Description of the Workflow
    We have designed a Workflow, which has an init form HighLevelQuestionnaire.
    1. The user attempts to start the workflow by submitting this form, which has an XML schema embedded.
    2. When user submits the data, we set workflow variables to fetch data from the init-form and all the values entered by the user are stored in the database.
    3. Based on the values, value of Risk Level is calculated to be either High or Medium, and user is routed to one of the two routes.
    4. The user QPAC is used to show the next form to the user.
    Another form has been designed called AssessRisk in which user is asked to confirm the Risk Level.
    5. At this point, we use Script QPAC to print the values in the log.
    1.2 Problem description
    1. In the Point No. 6 of the workflow, the values are not printed in the log. A blank space is printed instead.
    2. Initially, we embedded the schema in the form. But when values were not printed, we removed the schema. Even then it didnt work.
    1.2.1 User QPAC Specifications
    Properties of user QPAC used in Step 4 of the workflow
    Mappings Tab: -
    Input Variable --- No variable
    Template URL ----- Form11.xdp
    Output Variable ---- myform
    Myform is a form-variable, which has template URL as Form11.xdp
    1.2.2 Script QPAC
    1.2.2.1 With XML Schema embedded
    import com.adobe.workflow.pat.service.*;
    System.out.println("----------- High Level Questions -----------");
    System.out.println("--1- the RiskLevel is: " + patExecContext.getProcessDataStringValue("/process_data/myform/form-data/data/xdp/dataset s/data/RiskLevel/general/Risk_Level") + " @@@@@");
    Note:- Here RiskLevel is the schema root of myform and Risk_Level is the schema variable mapped with textfield on the form
    1.2.2.2 Without XML Schema embedded
    System.out.println("--1.1- the RiskLevel is: " + patExecContext.getProcessDataStringValue("/process_data/myform/form-data/data/xdp/dataset s/data/fields/Risk_Level") + " @@@@@");
    1.2.2.3 Conclusion
    In both the cases, a blank value is printed. In both the cases, we get some output which is when we use
    System.out.println("--1.1- the RiskLevel is: " + patExecContext.getProcessDataStringValue("/process_data/myform/form-data/data/xdp/dataset s/data ") + " @@@@@");
    In this case all the values are printed with space in between.
    This is the basic feature which has to be used while developing workflows.

    Hi
    You might want to try using VariableLogger, at:
    http://www.avoka.com/avoka/qpac_library.shtml
    It's a little more reliable than the script QPAC, especially if one of your xpath expressions is wrong.
    Please note that embedding the schema makes no difference in how the data from the form is stored. What makes the difference is whether your fields are bound to specify schema elements, or whether they use the "normal" binding.
    Howard

  • How to Clear the form values

    Hi All,
    I am using JDeveloper11.1..1.5
    I have one main page inside that i am including 3 more pages by using <jsp:include> tag with the help of Radio buttons.
    For each and Every page one backing bean is associated as Session Scope. Now my problem is when i navigate from one page to another page the values are not getting cleared.
    Can anyone tell how can i achieve this?
    Thanks in advance

    Either you can use a reset method call in the taskflow between the page navigations. Also, you can try to include createinsert method call in between the pages. try and set the values to null on page load. It should work.

  • How to get the value of the current form values after "save" in MD form

    Hi,
    I am trying to run a procedure using the form values right after I save the current records in a master-detail form. When I pass the value using p_session.get_value to the procedure, there is only null value passed. I checked the package body generated and found that the OnReset function runs immediately following the saving of the current records and this onReset function is called within the OnSave procedure. So when I save the current changes, I loose the values in the p_session. Any PL/SQL code I write after OnSave, does not get any p_session value.
    Interestingly, in case of just one table form, the OnReset is not within the OnInsert function and it is possible to get the p_session values. OnReset runs after OnInsert and within this two functions we can write any pl/sql code on the Insert button PL/SQL handler.
    I have the following questions:
    1. Why is the procedure written differently in case of master-detail form ? Why is the OnReset inside the OnSave ? How do we write codes which we want to execute before onReset and after OnSave ?
    2. I want to run a procedure after onSave and before OnReset. How do I do that ? Do I have to change the package manually ?
    3. If the above is not possible, I can also try to store the values I need to run the procedure before I save in some variable. How do I do that ? It seems I cannot declare variables to store session values inside the pl/sql event code on Save button, because it gives me error. The variable declaration code goes in between the begin and end of genesys.. procedure and that is not allowed in pl/sql
    Please help me with this. I definitely need to run a procedure after saving for almost all of my forms. Otherwise I am not sure what to do with my development. I am completely stuck with this. Thanks a lot for helping me out.
    Mainak

    Never mind. I found the answer.

  • Issues in Processing the Master-Detail Form values

    We have a requirement in Oracle Internet Expenses (11.5.10) to fetch the form values from the Expense Allocations Screen.
    This page is based on Multiple VOs with Master Detail relationship. The data from the VOs mentioned are displayed in the Hgrid region.
    I need to fetch the input values for three fields (from different VOs) and pass them as paramater to the database function to perform the validation.
    Here, I am creating the handle for VO objects and using the Row object getting all rows in range (getAllRowsinRange()).
    The issue here is always, the Row length() is always fetched as 1 even it has multiple rows.
    Any help on this would be highly appreciated.

    Using Select Options u will get mulitiple values also u will get values like table.
    regards,
    kumar.

  • Form values null.

    Hi,
    I am having a form field in my jsp page and on sumit I am passing the request to a servlet but in the servlet the form values are null even though i have entered the values in the field. Can any one please help me.
    I am posting my jsp and servlet.
    My jsp page <body>
    <body>
            <form action="LoginHandler" method="post" onsubmit="return ValidateForm(this)">
                <p><label> Login ID</label> <br />
                <input type="text" name="Username" size="10" /><br />
                </p>
                <p><label>Password</label> <br />
                <input type="password" name="Password" size="10" /></p>
                <p><input type="submit" value="Submit" class="textfont" /></p>
            </form>
        </body>
    My servlet
    import java.io.*;
    import java.net.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import communication.ServerComm;
    public class LoginHandler extends HttpServlet {
        ServerComm server;
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
            server = new ServerComm();
          public void destroy() {
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            server.openConnection();
          //gets null value here
            String username = (String)request.getAttribute("Username");
            String password = (String)request.getAttribute("Password");
            /*other expressions*/
       protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        public String getServletInfo() {
            return "Short description";
    }Thank you.

    You are calling request.getAttribute().
    You should be calling request.getParameter().
    Attributes vs Parameters
    A parameter is a name/value pair sent with a request - they are always Strings. They are read only - ie can only getParameter()
    An Attribute is a java object you want to save. Attributes can be at the page, request, session or application level. They can be any java object type. You have both get/set attribute calls.
    Cheers,
    evnafets

  • Form values are not submitting to ActionForm class

    Hi All,
    I have a problem with <html:form> tag. When i am submitting the form using the submit button it is going to the Struts-config.xml file and getting the action mapping for the HazSummary.do. It is getting the HazardSummaryAction class and getting the input from HazardSummary Form class. If result is sucees it is going to the next jsp page.
    All above things are happening properly. But the form values are not getting in to the HazardSummaryForm.jav.
    Here in this case Action class is HazardSummaryAction.java, Action Form class is HazardSummaryForm.java and jsp page is Hazard.jsp.
    Here is the code for Hazard.jsp
    <html:form action="/HazSummary.do">
    <table width="100%" border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
         <tr colspan="4"><td>
         <%String jd="jmd";
         String st="closed";%>
         <input type="text" name="wkploc" value=<%=jd%>>
         <input type="text" name="hastat" value=<%=st%>>
    <html:submit property="action">
    <bean:message key="haz.save.label"/>
    </html:submit>
         </td></tr>
    </table>
    </html:form></body>
    Here is the code for HazardSummaryAction.java
    package com.prospecta.WSOProject.action;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class HazSummaryAction extends Action{
         public String hazstatus;
         public String workplace;
         public String prin1;
         public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
              HazardSummaryForm hsf = new HazardSummaryForm();
              HttpSession session = request.getSession(true);
         try{
         hazstatus=hsf.gethastat();
         System.out.println(hazstatus);
         workplace=hsf.getwkploc();
         System.out.println(workplace);
         session.setAttribute("stat",hazstatus);
         session.setAttribute("loc",workplace);
         return mapping.findForward("success");
         catch(NullPointerException nex){
              return mapping.findForward("failure");
              }catch(Exception e)
         e.printStackTrace();
         return mapping.findForward("failure");
    Here is the code for HazardSummaryForm.java
    package com.prospecta.WSOProject.action;
    import org.apache.struts.action.ActionForm;
    public class HazardSummaryForm extends ActionForm {
         public String wkploc;
         public String hastat;
         public void setwkploc(String wkploc)
              this.wkploc=wkploc;
         public String getwkploc()
              return this.wkploc;
         public void sethastat(String hastat)
              this.hastat=hastat;
         public String gethastat()
              return this.hastat;
    Here is the code for Struts-config.xml file
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
         <form-beans>
    <form-bean name="HazSumForm"     type="com.prospecta.WSOProject.action.HazardSummaryForm">
                   <form-property name="wkploc" type="java.lang.String"/>
                   <form-property name="hastat" type="java.lang.String"/>
         </form-bean>     
         </form-beans>
    <action-mappings>
    <action path="/HazSummary" input="/HazSumForm" name="HazSumForm" scope="request" validate="false" type="com.prospecta.WSOProject.action.HazSummaryAction">
                   <forward name="success" path="/HazardSummary.jsp"/>
                   <forward name="failure" path="/Hazard.jsp"/>
              </action>                                         
         </action-mappings>
         <controller processorClass="fr.improve.struts.taglib.layout.workflow.LayoutRequestProcessor" locale="true"/>
         <message-resources parameter="com.prospecta.WSOProject.ApplicationResources"/>
         <plug-in className="org.apache.struts.tiles.TilesPlugin">
              <set-property property="definitions-config" value="/WEB-INF/tileDefinitions.xml"/>
         <set-property property="moduleAware" value="true"/>
         <set-property property="definitions-parser-validate" value="false"/>
         </plug-in>
         <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
         <set-property property="pathnames" value="/WEB-INF/validator/validator-rules.xml,/WEB-INF/validator/validations.xml"/>
         </plug-in>
    </struts-config>
    i followed the same process for previous pages which they are working. But in this case it was not working properly.
    Please resolve this problem ....................

    Hi Sreelatha,
    When you develop any interactive form please keep in mind the below things which you need to check:
    1. The layout type of the form should be ZCI. Select it from the form properties tab in SFP t-code.
    2. In web dynpro application (in case you are using for the form), the form type should be selected as native.
    3. In the form layout insert web dynpro script using menu->utilities->insert web dynpro script.
    4. After that come out of the form and run the report FP_ZCI_UPDATE giving your form name, also select the update check box in the report.
    Once these things are done your form should work fine.
    Regards,
    Vaibhav

  • Using form values in query statement

    Hello~
    I am building a form where a user should choose a category
    from a
    dropdown menu populated from the "categories" table, and then
    a second
    dropdown menu should appear if there are any subcategories
    available
    for the selected category. I have joined the tables in Access
    so that
    there is a 1-to-many relationship between the categories.id
    field and
    the subcategories.categoryID field. This is the query that
    Access
    generated, and I then added the WHERE statement to include
    the form
    value that the user generates.
    I am getting the following error:
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC
    Microsoft Access Driver] Too few parameters. Expected 1.
    If anyone has any suggestions, they would be very welcome!
    Thanks.
    KC

    OK, let's see...
    The first dropdown menu that is prepopulated with the
    Categories is named "category".
    So... Once they choose a category from that menu, I have the
    second dropdown appear if any Subcategories are available in the
    database, stemming from the category that they choose in the first
    dropdown. Does that make sense? That's where the "if form.category
    is defined" bit comes from.
    Hypothetically, the query called "getSubcategories" should
    pull the ID of the category chosen in the first dropdown, look in
    the subcategories table and see if any of the subcategories have
    that ID as their categoryID.
    The WHERE statement in the getSubcategories query that I have
    right now:
    WHERE
    subcategories.categoryID = #form.category.getCategories.id#
    This was really just a shot in the dark when it didn't work
    with it like this:
    WHERE
    subcategories.categoryID = #form.category.id#
    I thought that maybe since the value of the first dropdown
    menu was set as <option value="#getCategories.id#">, then
    maybe it needed to be called like that in the query as well.
    Obviously, not so much!
    Does that answer your question?

  • Finding the form number - Simple Q !

    I am trying to process the form values inside a PL/SQL block on that page. I get the values and after processing I insert the values into a table. I have created a PL/SQL block.. and I am sure the block is called properly because everything is processsed but the form element processing which is based on the fxx.COUNT varible
    How should I find the form number ..?
    for use in the variable..apex_application.g_f??..
    I have tried in another application and used f01 and it worked fine. I guess the other application was a demo application and it was the first form I used in that application.
    Thanks in advance
    Message was edited by:
    tarumugam
    Message was edited by:
    tarumugam

    Since we don't know what you are using to create the fxx.... items, we can work backwards from the form itself.
    View the source of your rendered page and locate the HTML tag for one of the checkboxes. [<input type="checkbox" name="f??" value="???">] The value in the 'name' attribute is the fxx value that you are looking for. It is either assigned by APEX or by code on the page, depending on what was used to create the items themselves.

  • Form Values in "On Successful Submission of Form" PL/SQL Block

    I am having trouble capturing the form values in the "On Successful Submission" PL/SQL block.
    p_session is not directly recognized by this block as a global variable.
    I created a local p_session variable. It passes NULL values.
    I am using Portal 3.0.7.
    Thanks,
    James

    James,
    To answer your questions:
    DOMAIN and SUBDOMAIN can be any names of your choosing, but they must be consistent between the put and the get. They are not implicit.
    Here is what I chose to do...
    ON THE INSERT BUTTON:
    declare
    session portal30.wwsto_api_session;
    begin
    session :=
    portal30.wwsto_api_session.load_session('LLNL','LCAMS');
    session.set_attribute('buttonType','Insert');
    session.save_session;
    end;
    doInsert;--- This is the default handler
    So, in my case, the Domain is LLNL and the Subdomain is LCAMS.
    IN THE "ON SUCCESSFUL SUBMISSION OF FORM...":
    declare
    v_user_key_id lcams_db.user_token_link.user_key_id%TYPE;
    v_tkn_ser_no lcams_db.user_token_link.tkn_ser_no%TYPE;
    v_actv_ind lcams_db.user_token_link.utl_actv_ind%TYPE;
    v_event VARCHAR2(10);
    blk varchar2(10):='DEFAULT';
    my_url VARCHAR2(200);
    return_url VARCHAR2(200);
    session portal30.wwsto_api_session;
    begin
    v_user_key_id:=p_session.get_value_as_number(
    p_block_name=>blk, p_attribute_name=>'A_USER_KEY_ID');
    v_tkn_ser_no:=p_session.get_value_as_varchar2(
    p_block_name=>blk, p_attribute_name=>'A_TKN_SER_NO');
    v_actv_ind:=p_session.get_value_as_varchar2(
    p_block_name=>blk, p_attribute_name=>'A_UTL_ACTV_IND');
    session :=
    portal30.wwsto_api_session.load_session('LLNL','LCAMS');
    v_event := session.get_attribute_as_varchar2('buttonType');
    my_url := 'lcams_db.otp.otp_utl' &#0124; &#0124;
    '?p_event=' &#0124; &#0124; v_event &#0124; &#0124;
    '&p_user_key_id=' &#0124; &#0124; TO_CHAR(v_user_key_id) &#0124; &#0124;
    '&p_tkn_ser_no=' &#0124; &#0124; v_tkn_ser_no &#0124; &#0124;
    '&p_actv_ind=' &#0124; &#0124; v_actv_ind;
    call(my_url,return_url);
    end;
    The 'A_...' references are actual fields on the form, which are based on columns in my table.
    I use the get_value_as_... calls to get the values the end user entered and I pass them to a procedure in a package that I had previously defined.
    lcams_db is the schema, otp is the package and otp_utl is the procedure. The p_... names are the actual names of the parameters in the procedure.
    Let me know if you need additional clarification.
    Rene'

  • Passing form values to a Servlet

    I am trying to pass form value to a servlet once the user presses the submit button. How can I get access to the form values?
    Thanks

    Try this in your servlet.
    HttpSession session = request.getSession(true);     
    System.out.println(request.getParameter("xxxxx").toString());
    xxxx is the parameter name..
    Doesn't this work?

  • Writing XML document using form values

    Being new to java/xml I'm strugling with this task:
    I have a web form and I need to pass the values from the form to a class that will then create an xml file using the form values.
    I've looked through the JAXP tutorial and Sun's XML tutorial but can't find anything that would suit my needs.
    Could anyone help me on how I should go about doing this?
    Does anyone have any sample code?

    with JAXP, you can either :
    - build a new XML document from scratch, using DOM, and append each node, each value,
    - create a style sheet that generates an XML document, receiving the web form values as parameters, processed with XSLT.

  • Pass form value to Destination URI

    Hi ,
    I have
    Form Value: (CtDetRN.PerId)
    Form Value: (CtDetRN.PPId)
    when viewed the page view source
    <input id="PerId" type="hidden" value="2886870" name="PerId">
    <input id="PPId" type="hidden" value="2886870" name="PPId">
    Now i need to pass the any of the above param in my url(personalization)
    URL : OA.jsp?page=/oracle/apps/imc/ocong/party/person/webui/ImcPerProfile&ImcPartyId={@ASPKey_NtsRPId}&ImcMainPartyId=2886870
    For ImcMainPartyId=2886870 i need to pass any of the form value(dynamically instead of hard coding the value).
    I tried ImcMainPartyId={@PerId} and {@PPId}.
    But it didnt work out.
    any one help me for the ways of passing param of form value to url
    thanks

    so if the required params are not on my page then what should be the solution?
    >>> You will have to get it somehow otherwise your solution is not feasible. Your approach or design is wrong. For going from one page to another, there should be some related data and if it is your custom pages, then there is something missing on your analysis.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Unicode support in java.io.File.listFiles()

    I am trying to list all the files in a given directory using the File.listFiles() method, yet for some reason the File objects returned have invalid paths when a file has unicode characters in its filename. example .. a test directory has these files

  • Custom ContextMenu doesn't display when using hand cursor

    I have created a custom ContextMenu, which displays when right-clicking on the Canvas. If I am showing the hand/pointer cursor using the code below, and then right-click, the custom ContextMenu is not displayed. Is this a known issue in Flex 3 or is

  • Disk Utility says I need to repair disk

    My computer is running a little sluggish so I went into the Disk Utility and selected verify disk. I got the message below. I inserted the OS X disk but the repair disk option wasn't available. I bought the computer with Panther and got Tiger later,

  • When I take pics on my ipod touch it is using up a lot of memory....my sister has the same ipod and can tke way more pics

    When I take pics on my ipod touch it is using up a lot of memory...........my sister had the same one and can take way more pics. I tried restoring but still having memory problems...help

  • Having trouble accessing knownfolders

    I started noticing that my app isn't doing what it's suppose to do. So, I downloaded the following sample. https://code.msdn.microsoft.com/windowsapps/File-access-sample-d723e597 Scenario 1 throws an error everytime I try to create a file in the know