Struts2 - Dynamic values in expression while doing validations using annota

Hi,
I am using Struts2. I am doing validations using annotations in action class.
I have many forms having same type of fields say zip code.
I am adding validations like below in each action class having zip code field
@Action(value = "/saveData")
@Validations(
     regexFields = {
          @RegexFieldValidator(fieldName = "databean.zipCode", expression = "^([1-9]{1}[0-9]{4}(-[0-9]{4})?)$", key = "errors.zipcode.format", message = "errors.zipcode.format")
public String saveData() throws Exception {
Now, in case if I need to change the expression for zip code validations, then I need to modify the same in each action class.
I would like to know if there is any way to use java variable or property for expression so that i only need to change at one place (value of variable) and all actions get modified.
I want something like below
private static final String ZIP_CODE_FORMAT_EXPRESSION = "^([1-9]{1}[0-9]{4}(-[0-9]{4})?)$"
@Action(value = "/saveData")
@Validations(
     regexFields = {
          @RegexFieldValidator(fieldName = "databean.zipCode", expression = "${ZIP_CODE_FORMAT_EXPRESSION}", key = "errors.zipcode.format", message = "errors.zipcode.format")
public String saveData() throws Exception {
Thanks
Krishan Babbar

Thanks
That is working..
I defined my expression as constant in my another file and it is working fine....
One more question i need to check space in expression but its not working... I tried following:
expression = "^([a-zA-Z0-9@_.-\\s]+)$" and expression = "^([a-zA-Z0-9@_.-\\\\s]+)$"

Similar Messages

  • Error while doing cloning using Duplicate command

    Hi,
    I am facing issue while doing clonning using duplicate command 'Active database'
    The error i am facing is as follows.
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 02/19/2013 07:31:10
    RMAN-05501: aborting duplication of target database
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-03009: failure of backup command on c14 channel at 02/19/2013 07:31:09
    ORA-17628: Oracle error 19510 returned by remote Oracle server
    Please help me in this.Not able to resolve it
    Thanks

    Aman wrote:
    Hi,
    I am facing issue while doing clonning using duplicate command 'Active database'
    The error i am facing is as follows.
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 02/19/2013 07:31:10
    RMAN-05501: aborting duplication of target database
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-03009: failure of backup command on c14 channel at 02/19/2013 07:31:09
    ORA-17628: Oracle error 19510 returned by remote Oracle server
    Please help me in this.Not able to resolve it
    Thanks[oracle@ora11gr2ee ~]$ oerr ora 17628
    17628, 00000, "Oracle error %s returned by remote Oracle server"
    // *Cause:  Oracle server on the remote instance has returned an error.
    // *Action: Look at remote instance alert log/trace file for more information
    // and take appropriate action or contact Oracle Support Services
    // for further assistance
    Seems pretty straightforward... is the target instance up?

  • While doing comparison using SDK received a warning message

    Hi,
    While doing comparison using Adobe Acrobat 8 SDK - receiving a warning message "The Organizer database is damaged and will be reset the next time Acrobat is launched. Quit the application and close any currently opened web browsers."
    Can any body help me how to rectify the above problem?
    Thanks,
    Sudhakar
    Note: I have reparied the Acrobat professional but still the problem not solved.

    Dear Chaka,
    If my understanding is correct normally even after setting the TECO status set,you can do confirmations,and you can issue
    components against the order.
    After technical completion you can still make postings for the order. For instance, material withdrawal or a confirmation can be
    posted if they were previously forgotten.
    Check this link
    http://help.sap.com/saphelperp60_sp/helpdata/en/a3/664a3397e311d1b5a70000e8359890/content.htm_
    But generally in order to block the confirmation or goods movement for a TECO status set order,we can either an user Exit or
    else block it using the settings in BS22- System status.
    But you check this BADI - WORKORDER_UPDATE using the method at save or else withi this REORG_STATUS_ACT_CHECK
    Check and revert
    Regards
    S Mangalraj

  • Issue while doing Segmentation using Relationship Category

    Hello Experts
    We are implementing SAP CRM Lean Marketing using CRM 7.0. We are implementing segmentation, mail forms and using "Follow-up Processing of Target Group" functionality to send e-mail/fax to the BPs in target group. We are not using Campaigns. The "Follow-up Processing of Target Group" functionality provides facility to send bulk mail by using the available "Export to Channel" function from the opened target group itself.
    Our business requirement is to do segmentation based on Company attributes and Relationship Category. The output of the target group should enlist the persons related to the Company based on the relationship category selected while doing the segmentation. e.g. While doing segmentation if I have selected company attributes Industry Sector of companies as Agriculture, company type as Partnerships and selected relationship category Has Supplier, then for the Companies matching the segmentation criterion, the target group should enlist all the persons related with the company with relationship category Has Supplier. As a further step the e-mail/fax will be sent to all these persons
    As per my understanding using standard InfoSet   CRM_MKTTG_BP_ORG_CDE and while creating data source selecting BUT000_PER-PARTNER_GUID in the field business partner, I am able to get the list of persons matching the segmentation query as documented in the example above. But the issue is , the output of the target group only enlists matching Persons, it does not enlist the matching company ID /name in the output of the target group. So business is unable to understand the Person enlisted belongs to which Company.
    We tried enhancing the output of the target group in order to add Company ID/ Name , but the issue is the BADI gets Input as persons BP id, nothing else, due to this if a person is having relationships with multiple companies, the BADI is unable to identify which company to choose as Relationship Category is not available to the BADI. And further issue is if a Person is having same relationship category with 2 companies e.g. Supplier for company A and for Company B too , in this case too the BADI is unable identify correct Company to return to the target group output.
    Highly appreciate your early response in order to resolve this critical issue.  
    Thanks
    Ambar

    Hello Experts,
    Elaborating the issue further
    Using standard InfoSet CRM_MKTTG_BP_ORG_CDE and while creating data source selecting BUT000_PER-PARTNER_GUID in the field business partner, I am able to get the list of persons matching the segmentation query as documented in the example above. But the issue is , the output of the target group (shown as an ALV grid , when the target group is opened) only enlists matching Persons, it does not enlist the matching company ID /name in the output of the target group. So business is unable to understand the Person enlisted belongs to which Company. Can we enhance this ALV grid output of the target group ? if yes , how can it be achieved ?
    As an alternative we tried implementing the BADI CRM_MKTTG_SEG_MEM_EX , that is used to define data export from the target group. But the BADI gets Input as persons BP id, nothing else, due to this if a person is having relationships with multiple companies, the BADI is unable to identify which company to choose as Relationship Category is not available to the BADI. And further issue is if a Person is having same relationship category with 2 companies e.g. Supplier for company A and for Company B too , in this case too the BADI is unable identify correct Company to return to the target group output.
    Any suggestion solution to resolve this issue. Appreciate your early response.
    Thanks
    Ambar
    Edited by: AMBAR ADHAV on Sep 10, 2011 11:00 AM

  • Double consumption of Material while doing Picking using COIK T. code.

    Hi,
    I have a component for process order which is WM managed and is withdrawn from storage type 100. The component qty is  1504 PC and the stock in storage type 100 is 199 PC. While doing COIK the system issues double the qty ( 398) of the component from storage type 100  against the process order resulting in -199 PC ( Negative) stock in storage type.
    What could be the reason for this?
    Regards,
    Parasad

    Hi,
    Check whether the BOM & Receipe is maintain correctly in the PP & check from APO also the master data for the consumption of BOM & Activity,Whether the Qty is double or not.
    Regards,
    Raj

  • Problem in picking base value from PO while doing goods receipt for multiple POs

    Hi,
    Our user is trying to post goods receipt for two purchase orders which have same vendor. After the materials of two POs are allocated in the item detail screen and checked the item ok, system throwing error as "Please check the base value of the item is zero" ( also excise tab does not appear for last three line items). This error does not occur when we are trying to do the goods receipt separately for each POs. Only when we do goods receipt for both the POs together, we are facing this error.
    Please let us know what could be the reason. Is there an issue with standard CIN? Any notes to be applied? Please help!

    Refer these notes for the issue.
    1528009 - MAA: incorrect distribution of goods receipt
    quantities
    and
    1677707 - Determining the valuation type for stock transport orders
    at the time of GI
    For Excise tab not appearing, you have to check J1ID for "Material-ChapterId combination" and "Cenvat Determination".
    Regards
    Binoy

  • $ expression while creating Query using Query generator

    hello friends,
            I m using qurery generator for Approval templates. I want Quantity value of GRN at a runtime.So for that I have to write a query I got some example of that for Business partner this is done using $[$3.24] for card code in business partner.But I want to know about this $ expression with following number.
    I found this query while searching
    SELECT (T0.[CreditLine]-$[$3.24.Number]) FROM OCRD T0  INNER JOIN POR1 T1 ON T0.CardCode = T1.BaseCard WHERE T0.[CardCode] = $[$3.18]
    Plz tell me abt this $ expression frm where its come.Is it store somewhere??
    Thanks & Regards,
       Swati
    Edited by: Rui Pereira on Dec 23, 2008 4:49 PM

    Hello Swati,
    It has something to do with Format Search. Please find the attached for Format Search Introduciton. Or you may go to Forrum  [SAP Business One|SAP Business One Application; for more information, which is the right place for this question. Thanks.
    Regards, Yatsea

  • While doing BRS using ZF032 (Manual Bank Statement)

    Dear Experts,
    We have successfully doing BRS thru ZF032 for existing banks. We have opned up new Bank in ICICI Bank for which necessary master House Bank ID creation with 3 GL code Main,Incoming & Out going a/c has been created, we have assigned default profit centre for doc splitting for these 3 GL codes. In automatic posting also assigned Out going GL code to the house bank Id. Now while running GL codes we are facing below error message and no batch processing is carried out,
    WFV                  058Beginning balance does not match prior ending balance 50,000.00-
    SFV                  051Statement/list saved
    SFV                  041Statement/list posted
    SBT                  864Printer not suitable for job step; automatic output not possible
    S00                  344No batch input data for screen SAPMF40K 0101
    Can any body suggest what else need to be done.
    Regards,
    Alok

    Hi,
    It appears that this is not the first BRS statement you are entering manually. You must have entered at least one statement. The closing balance of the last statement entered is (50,000.00 - ) not tallying with the opening balance of the current statement. This is causing the error. Match the closing balance of previous statement & opening balance of this statement.
    Thank You.
    Regards,
    AVD

  • Calculate maximum value of subarray while creating it using a case structure and shift registers

    I have two 1D arrays that contain cyclical information (kind of like a sine wave).  One that contains information on position in degrees and another that contains torque.  I would like to calculate the maximum torque value each time the position is within a certain range (e.g. from 30-80 degrees).  The ranges are repeated - that's why it is cyclical.   I use the "in range" function, a case structure and shift registers to build a new array with values that fall within the range I specify - this was the easy part (see VI attached).  I'm struggling with a way to calculate a maximum value for each subarray formed when values are "in range".   Your help is much appreciated.
    Solved!
    Go to Solution.
    Attachments:
    Simple Calculate between anatomical position range.vi ‏16 KB

    It's not really noise - it's more inconsistency.  So a position output can run: 20, 30, 40, 50, 60 etc.  OR, it could run: 21, 24, 32, 41, 44, 51, 59 etc. But, it is always cyclical. 
    Attached you will find a .csv file with the data arrays - I'm using POS (ANAT) degrees column (column D if you open in excel).  There you also see torque in ft-lbs along with some other information.
    Attachments:
    025C.csv ‏224 KB

  • Error while doing Delta using 0FI_AA_11 ..

    Hi Experts,
    I am trying to load ODS : 0FIA_DS11 (Transactions (Delta) using standard datasource : 0FI_AA_11 (FIAA: Movements).
    When I am trying to load I am getting following error :
    " <b>Extraction of 0FI_AA_11 not possible. Extract 0ASSET_AFAB_ATTR first     BWFIAA     4"</b>
    I have already loaded 0Asset_afab, both texts and attributes and activated.
    Also I have activated : BAdi: <b>FIAA_BW_DELTA_UPDATE</b> in R/3, which SAP Help says we need to activate it.
    This error comes only when i  tryig to do Delta or Init with data trsnfer.Init without data transfer and full load works fine.Also RSA3 shows record.
    Any Help wud b appreciated and rewarded by points!!
    Thanks!!
    Sorabh

    Please load master data first that load 0ASSET_AFAB_ATTR first and some other master data and then load the ODS 0FIA_DS11.
    Hope it helps.....

  • Multiple Invoice Check while doing GR using MIGO

    Hi all,
    I have made the Check Double Inv check in Vendor master and also maintained the config for set check for duplicate invoice.
    In set check for duplicate invoice i selected all the 3 options.
    Still i am able to make GR on the same Invoice more than once.
    kindly suggest what else should be done.

    Hi,
    You can not do GR more then PO quantity & set message as Error or Warning (based on requirement) for Message no. M7-064 in following path:
    Material Management->Inventory Management and Physical Inventory->Define Attributes of System Messages
    For duplicate Invoicing, do following settings
    1. Select check box in vendor master data to check duplicate invoice.
    2. Make "Reference number" mandatory in 'Required during document entry segment' in "RE" document type in OBA7 t.code
    3. Set Error for message M8-471,M8-108 & M8-462 in t.code: OMRM & save.
    When you do invoice, enter u201Cvendor invoice numberu201D in MIRO in field of u2018Reference numberu2019 and post invoice. If users do MIRO again with respect to same vendor invoice, system would not allow proceeding for transaction again.
    Regards,
    Biju K

  • Error while doing dblookups using MS Access database

    Hi everyone,
      I am trying to perform dblookups in a file to file scenario but it is showing some error.I have used receiver JDBC adapter channel for dblookup.If anyone knows the solution kindly reply it thanks in advance.Here is the error
    Exception during processing the payload.Problem when calling an adapter by using communication channel.  XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error when attempting to get processing resources: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: DriverManagerException: Cannot establish connection to URL 'jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=
    XI\data\XI_Workbench\1234\DB\EMP.mdb;Uid=1234;Pwd=abcd;': SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.'.

    Hi,
    ->Have you installed the JDBC drivers on XI server. Can you please check.
    ->Which DB are you polling?
    Please check if respective drivers are installed in the J2ee stack. you can get a help 4m ur basis team on this.
    DB drivers (jar files)can be obtained from respective vendors.
    have a look in the following discussion,it looks like the drivers are different
    Re: JDBC driver for J2EE AE that supports MS SQL 7.0
    IDOC to JDBC :Error using JDBC
    Please Reward points if it helps
    Thanks
    Vikranth

  • Lookup dynamic values

    Hello Experts,
    I have seen different post's and syntax for lookup expression, but all against a static value.
    e.g.
    &lt;Type&gt;LookupValue("TODO_TYPE", "To Do")
    &lt;Type&gt;=LookupValue("TODO_TYPE", "To Do")
    I am trying to lookup a dynamic value. Unfortunately this does not work.
    LookupValue("OCCAM_LEAD_SOURCE", FieldValue('&lt;ProductInterest&gt;'))
    Has anyone tried something like this? or have any suggestions to make it works.
    Thanks
    Min
    {color:#ffffff}Innoveer{color}

    Hi Max,
    At the moment there is no specific example, it's just something i'm playing with.
    But here is a made up scenario.
    Field: Fav Choc1
    Pick list values: Snickers, Lion, Bounty, Mars
    Field: Fav Choc2
    Free Text: Mars
    Field: Fav Choc3
    Default Value: if Fav Choc2 is a value in Fav Choc1 then return Fav Choc2 else return "Another Brand"
    Regards
    Minesh

  • Dynamic value mapping

    hi,
    can u plz explain about Dynamic value mapping and where it actually use this
    thanks
    guna

    Hi ,
    Dynamic value mapping.is nothing but
    It is FixValues and ValueMapping under Conversion Functions.
    Eg:
    You need such a requirement. Where the values in the source are mapped to someother value in the target as below.
    1--> Mr
    2--> MS
    3--> MRS
    FixValues is used when you know the entire set of Key value pair in the Design Time. You give the Key and the value in the FixValues and the mapping checks and maps the values to the target.
    In the case of Value mapping, you maintain this Key - Value pair in the Integration Directory and thereby make changes easily and also use them in the Mapping in IR
    Refer These blogs
    ValueMapping using the Graphical Mapping Tool -value mapping using grapic mapping tool
    Value Mapping replication - value mapping replication
    Accessing Value Mapping defined in Directory using Java functions - accesing value mapping
    Dynamic Date Conversion in Message Mapping - dynamic date conversion
    Dynamic Configuration of Some Communication Channel Parameters using Message Mapping - dynamic confighuration
    Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II - dynamic file name
    and also
    Refer this link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d7/e551cf896c3a49bb87bb4ce38c99c8/frameset.htm - external context mapping
    Regards,
    Suryanarayana

  • Unit test with Dynamic Value Query

    Hi,
    I am planing a function which should return a table name for a given ROWID. The ROWID will be selected from a view. Now I am trying to setup a unit test which consists of Startup and Teardown Process as well as a Dynamic Value Query. During Startup Process one dataset is inserted in a table which is part of a view definition. The dataset should be selected during Dynamic Value Query. However I am getting the following error message: Unable to run the test because no rows were returned by the dynamic query. Is there the possibility that within a Dynamic Value Query I can't make use of datasets which where inserted by a Startup Process? I am asking because the selection outside the unit testing framework supplies the dataset as expected.
    SQL Developer: 3.2.20.09 Build MAIN-09.87
    Java: 1.6.0_45
    Regards.

    Dynamic SQL is very tricky.  Since you can get the data outside your application extract and test the dynamic SQL as it is generated.  When working with dynamic SQL I find it useful to first generate the SQL text as a string and then if necessary store it in a table (CLOB type) for later reference.  Because of the uncertainty of obtaining bind variable values later I prefer to hard-code such values into dynamic SQL - possibly slightly less efficient for Oracle at run time but a lot easier to work with when debugging and tuning (again, apart from the built-in inefficiency of not using bind variables)  I usually find the overhead of the hard-coded values not too bad and the ability to know the data values at a glance useful.  I also find it useful to write dynamic SQL in such a way so that the resulting statement can be pasted in to any normal SQL tool (SQL*PLUS, SQL*Developer) and run without any editing.
    There may be some quirk in the generated dynamic SQL preventing it from finding anything.
    Good luck.

Maybe you are looking for