Struts 2 validation for HTML tags

Hi,
I am doing Struts2 validation with validation.xml for HTML tags. Here i am doing a binding between a form (bean) and the respective field in JSP and validation.xml. The validation error messages are populated without any problem but the value entered in the respective text field for HTML tags is not persisted. This problem does not occur if you use Struts 2 tags in JSP. Here is a snippet of what i am doing:-
JSP:-
<input:text name="accountForm.firstName" size="12" maxlength="20" />
Action:-
class AccountAction {
private AccountForm accountForm;
public void setAccountForm (AccountForm accountForm) {
this. accountForm = accountForm;
public String insertAccount () throws ApplicationException {
// To get the account details from the JSP
String first Name = accountForm.getFirstName ();
action-validation.xml:-
<validators>
<field name="accountBean.firstName">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message> First Name is required.</message>
</field-validator>
</field>
<validators>
Whether it is possible to persist the value with HTML tags with Struts 2 validation? or i need to go with Struts 2 tags in JSP. Please shed some light in to it.
Thanks,
JavaCrazyLover

FYI
I am using spring framework with struts2 UI
..pls
do the needful..
Thanks in advance
-Satish

Similar Messages

  • [svn:fx-trunk] 5289: Fix for - HTML tags in span tags in ASdoc comments not being parsed correctly.

    Revision: 5289
    Author: [email protected]
    Date: 2009-03-12 21:09:58 -0700 (Thu, 12 Mar 2009)
    Log Message:
    Fix for - HTML tags in
    tags in ASdoc comments not being parsed correctly.
    QE Notes: Some baseline will require update.
    Doc Notes: None.
    Bugs: SDK-19815
    tests: checkintests, asdoc
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-19815
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocUtil.java

    Resize/re-scale & optimize all images for the web in your graphics editor before you insert them into your web pages.  Saves bandwidth and reduces page load.
    Cycle2 is a responsive slideshow.  If you want all images to remain 400px and not responsive to layout,  you'll need to modify the CSS code a little.
    Details on using Previous & Next links are in the documentation.
    http://jquery.malsup.com/cycle2/demo/prevnext.php
    Nancy O.

  • Java wrapper for html tags

    Hi,
    I need one java wrapper class for html tags. If anyone is having such pls reply.
    Thanks in advance
    Sisir

    Like java.lang.String?
    You use it like this
    String textTag = "text";
    If that isn't what you had in mind then you might want to provide a bit more detail as to what you think it should do.

  • Replace function for HTML tags

    Hie Guys,
    I would like to get rid of the HTML tags from a column/object in my report using the "Replace" function. Basically, I want to replace whatever the content is between "<" & ">" i.e. the opening and closing tags. I know I can use the "Pos" function to identify the position of "<" & ">", but I am not sure exactly how to achieve this in Webi. FYI -  "Read content as HTML" & "Read content as Hyperlink" did not resolve the issue. Can anyone please help? Thanks.

    Hi Jeewan,
    It will be very tedious to do this at Webi level.
    I have tried below example. It might help you to work around your issue; however, not completely:
    1. Created an Excel and inserted single value in first column as:
    <html><b>this is yuvraj</b></html>
    2. Used it as source and created a Webi report in Rich client.
    3. Applied SubStr recursively using Pos function and created below variables:
    test : =Substr([column_1]; Pos([column_1];">")+1;Length([column_1]))
    test1: =Substr([test]; Pos([test];">")+1;Length([test]))
    test2 : =Substr([test1]; 0;Pos([test1];"<")-1)
    The output has been attached.

  • Setting style for html tags in flex

    I need to add display:inline style property to <p>tag in flex CSS. Is there anyway to do like the below in flex
    p{ display:inline}
    Thanks in advance.

    Hi rizmysl,
    You cannot directly set the backgroundColor to a Label control however you can do it by getting a reference to the underlying TextField control inside the Label, for that you need to write some actionscript.
    Check out the below code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
         <mx:Style>
              .texfield{ width:300; height:30; background-color:red; fontWeight:bold;}
         </mx:Style>
         <mx:Script>
          <![CDATA[
           import mx.core.IUITextField;
           private function init():void
            //Getting reference to the underlying TextFiled control inside Label
            var tf:IUITextField = (myTextField.mx_internal::getTextField());
            tf.background = true;
            tf.backgroundColor = 0XFF0000;
            tf.width = 300;
            tf.height = 30;
          ]]>
         </mx:Script>
         <mx:Label x="25" y="113" text="My Sample Text Goes Here ...."  styleName="texfield" id="myTextField" />
    </mx:Application>
    Thanks,
    Bhasker Chari    

  • Regex for HTML tags

    I would like to modify (enclose) the inner text of a td tag, such that:
    <td align="center">abc123</td> to become <td align="center">="abc123"</td>
    htmltext = htmtext.replaceAll("(<td\\b[^>]*>)(.*?)(</td>)", "$1=\"$2\"$3");That works, but I want to try the lookaround technique, as follows:
    htmltext = htmtext.replaceAll("(?=<td\\b[^>]*>)(.*?)(?<=</td>)", "=\"$1\"");but it yields ="<td align="center">abc123</td>"
    What would be the correct regex? Thanks.

    nguyenq87 wrote:
    Would you care to explain why the reluctant quantifier ? is omitted from (.*)?Note that "(.*?)" and "(.*)?" are tow different things! The first is a reluctant DOT-STAR. The latter means: "optionally match zero or more characters".
    nguyenq87 wrote:
    I thought without it, it would consume the closing tag also.It does, but then back tracks in favour of a match. It's safer to make the DOT-STAR reluctant instead of greedy. The greedy variant will match:
    "<td>foo</td> bbb <td>bar</td>" from a string like:
    "aaa <td>foo</td> bbb <td>bar</td> ccc" I assume you know it's rather tricky to parse HTML using regex... Just to name two issues: what about commented HTML? And what about td's that span more than one line?

  • How to disable html tags in richtext editor

    Hi All,
    I want to disable the html tags in rich text editor.I am able to disable the all components using the following code
    af:richTextEditor id="rte2" toolboxLayout="spellcheck"/>
    <f:facet name="spellcheck">
    <af:commandLink id="chek" text="Check Spelling" styleClass="linkcont"/>
    </f:facet>
    When page gets submitted i dont want all the html tags in it How i can achive this.
    Regards,
    Smaran

    Hi,
    I am not sure your question is complete as it seems to lack content, Anyway, did you try a value change listener to access the content and parse it for HTML tags?
    Frank

  • Unable to use HTML tags in the BPEL email component

    Hi,
    I am using BPEL email component to send mail notifications. I want the email should be in proper format.If I use HTML tags the workflow application build fails .It says invalid syntax for html tags.So, I removed the tags and just using the concat string operations as of now.To format i even tried '\n' like in java but it didnt help. Could you please let me know how do I achieve this?
    The JDeveloper version is 11.1.1.3 and SOA ,OIM both are 11.1.1.3
    The BPEL source code for the email content I configured is:
    <copy>
    <from expression="concat(string('AD Account access request has been rejected by manager.\n
    Here are some details about the request:\n
    Request ID : '), bpws:getVariableData('inputVariable','payload','/ns3:process/ns4:RequestID'),string('\n'),
    string('Employee First Name : '),bpws:getVariableData('empFName'),string('\n'),
    string('Employee Last Name : '),bpws:getVariableData('empLName'),string('\n'),
    string('Manager Employee ID : '),bpws:getVariableData('manager'),string('\n\n\n'),string('Thanks,\n IDM Administration')
    )"/>
    <to variable="varNotificationReq"
    part="EmailPayload"
    query="/EmailPayload/ns15:Content/ns15:ContentBody"/>
    </copy>
    Please suggest .
    Thanks,
    Piyasa

    Hi
    Here is the sameple email from BEPL email component. See if this helps:
    "<html>&#x0A;<body>&#x0A;<p>This is an automated message from the <b>Identity Provisioning Solution</b>. Please don’t reply to this email.</p>&#x0A;&#x0A;<p>An access request has been successfully submitted for <%concat(bpws:getVariableData('inputVariable','payload','/ns3:process/ns4:BeneficiaryDetails/ns4:FirstName'),' ',bpws:getVariableData('inputVariable','payload','/ns3:process/ns4:BeneficiaryDetails/ns4:LastName'))%> to access <%bpws:getVariableData('inputVariable','payload','/ns3:process/ns4:ObjectDetails/ns4:name')%>.</p>&#x0A;&#x0A;To view additional details of the request, login to the Identity Provisioning Solution.&#x0A;&#x0A;<br>Request ID: <%bpws:getVariableData('inputVariable','payload','/ns3:process/ns4:RequestID')%>&#x0A;<br>&#x0A;<br>&#x0A;<br>&#x0A;<br>Thank you,&#x0A;<br>Identity and Access Management&#x0A;</body>&#x0A;</html>&#x0A;"
    Regards
    user12841694

  • Html tags using javax.jws.WebService

    Hi,
    I am using javax.jws.WebService and I met a problem for html tags.
    In a String containing "<" and ">", the javax.jws.WebService implmentation of IBM transfered the String with "<" and ">" in the XML reply. How could this translation be avoided?
    Regards.
    Pengyou

    The XML content in the soap request looks like this:
    <myXml>
        <tagWithCdata><![CDATA[<test>123</test>]]></tagWithCdata>
    </myXml> The String "tagWithCdata" in the Java object looks like this: "<test>123</test>"
    And the marshalled XML in the soap response looks like this:
    <myXml>
        <tagWithCdata><test>123<test></tagWithCdata>
    </myXml>But I expect to have the same format as the soap request, i.e.
    <myXml>
        <tagWithCdata><![CDATA[<test>123</test>]]></tagWithCdata>
    </myXml>

  • Validate the user input against HTML tags

    There is text field in my form, the user inputs in this field should be validated against HTML tags. like:
    <H1>HAI</H1> ,
    and "<script>alert('Hai')</script>"
    it should say pls validate a text without HTML tags.
    Pls let me how can I achieve this?
    Regars,
    Nagalakshmi

    You have to spilt the text in the form field, identifiy the difference between the text and HTML tags. The available options are ucan use String.lastIndex("<") methos apply some logic to find the same
    baiju

  • HTML Tag Colors

    Is there any way to specify which tags get which colors for HTML tags (and to use this within a cfm page)
    If CFEclipse, you could specify <table> tags get "green", <input> tags get "orange", etc, but I'm not finding this capability in CFBuilder.  It seems to be an all or nothing deal (unless there's a way to specify the "keywords" within HTML -> Editors -> HTML -> Colors in preferences as is in some of the other Editors in CFBuilder)

    So - like - "not fit for purpose" then?
    That's my take.  I talked with a CFB dev at CFUnited '09 about this issue and it didn't sound like adding any DW/CFE'sh colorization was on the radar at that time.
    If there's not already one, I'll submit a feature request at http://cfbugs.adobe.com

  • Any external tool for HTMLB tags

    Hi all,
    we are having macromedia dreamweaver software for html tags
    i.e. it is a ready made software to develop HTML page, simply we will drag and drop desired fields and code will be generated automatically. My question is that is their such any ready made software for HTMLB, so we can use it in developing BSPs application.....if there are any such software plz send me the link to download the software....i will be thank u by giving points...
    thanks,
    Ali.

    Hi.
    This eclipse tool might have some support for BSP.
    http://www.ceon.com.au/abapeclipse/features.php
    I havn't tested it myself, but screenshots show how BSP editing is done with a preview window and some code completion.
    Perhaps not as nice HTML editor as dreamweaver but much nicer for ABAP development.
    Regards, Mikael

  • Java Regular Expression to grab html tags

    Dear all,
    I have written a regular expression in java to grab the pairs of html tags in a String. It worked fine except that it cannot handle space or new line. What have I done wrong?
    My regular expression (I would use <tr></tr> as an example):
    <tr[^>]*>(.*?)</tr>
    It would work for <tr><one>two<three></tr>
    but not <tr ><one>two<three></tr>
    or <tr> <one> two <three></tr>
    or <tr>
    <one>two<three>
    </tr>
    Thanks a lot in advance

    I have written a regular expression in java to grab the pairs of html tags in a String. I'll make one last-ditch suggestion that you grab a decent HTML parser, as the HTML specification allows for HTML tags that don't come in pairs. While I'm sure you will be able to eventually write regexes to handle this, it may be easier (depending on your requirements) to use tools to parse the HTML.
    Good luck!

  • Wls 8.1 sp2: weblogic.jspc complains about struts-html tags

              Hi,
              I am trying to compile jsps with weblogic.jspc, which use struts' html tags. However,
              the compilation fails with the following message:
              [java] Translation of /views/viewPageBody.jsp failed: (line 3): Error in using
              tag library uri='/tags/struts-html' prefix='html': The Tag class 'org.apache.struts.taglib.html.BaseTag'
              has no setter method corresponding to TLD declared attribute 'server', (JSP 1.1
              spec, 5.4.1)
              I opened the BaseTag class from the struts jar and found the setter exists for
              the attribute 'server' of html tld. So does the property 'server'. The property
              'server' is a string and the parameter in the setter is a string. I read about
              the jspc errors in wls 8.1 about the setter parameter being of different type
              than the property. However, that is not the case here. I tried using both Sun's
              and BEA's jdk. None of them help. Btw, there is another attribute mentioned in
              the html tld, which is 'target'. The compiler doesn't complain yet about this.:(
              Also, I happened to compile other apps which have struts logic tags.
              My environment:
              OS: Win2k sp3
              WLS: 8.1 sp2
              JDK: Sun's 1.4.2 sp4 / Bea's 1.4.1 sp5 (tried both)
              Ant: 1.5.3 (I had an issue earlier with ant until I found that Bea officially
              without any mention supports only ant 1.5.3.)
              I would appreciate any help in this regard.
              Thanks,
              Abbas
              

              What version of Struts are you trying to use?
              Are you certain you're not encountering a different instance of that class in
              an unexpected location in your classpath?
              "Abbas" <[email protected]> wrote:
              >
              >Hi,
              >I am trying to compile jsps with weblogic.jspc, which use struts' html
              >tags. However,
              >the compilation fails with the following message:
              >
              >[java] Translation of /views/viewPageBody.jsp failed: (line 3): Error
              >in using
              >tag library uri='/tags/struts-html' prefix='html': The Tag class 'org.apache.struts.taglib.html.BaseTag'
              >has no setter method corresponding to TLD declared attribute 'server',
              >(JSP 1.1
              >spec, 5.4.1)
              >
              >I opened the BaseTag class from the struts jar and found the setter exists
              >for
              >the attribute 'server' of html tld. So does the property 'server'. The
              >property
              >'server' is a string and the parameter in the setter is a string. I read
              >about
              >the jspc errors in wls 8.1 about the setter parameter being of different
              >type
              >than the property. However, that is not the case here. I tried using
              >both Sun's
              >and BEA's jdk. None of them help. Btw, there is another attribute mentioned
              >in
              >the html tld, which is 'target'. The compiler doesn't complain yet about
              >this.:(
              >Also, I happened to compile other apps which have struts logic tags.
              >
              >
              >My environment:
              >OS: Win2k sp3
              >WLS: 8.1 sp2
              >JDK: Sun's 1.4.2 sp4 / Bea's 1.4.1 sp5 (tried both)
              >Ant: 1.5.3 (I had an issue earlier with ant until I found that Bea officially
              >without any mention supports only ant 1.5.3.)
              >
              >I would appreciate any help in this regard.
              >
              >Thanks,
              >
              >Abbas
              

  • Struts portlet Instance Label problem: Appending the html tags in jsp

    I have created a struts portlet and given it a Instance Label. I have used struts-adapter-html.tld tld in my jsp which is referenced by my struts portlet. But the problem with using this taglib is that the portlet Instance Label is appended to all the html tags on the JSP as a result of which when the page is submitted, formbean will not pick any of the values as the name will not match. Has anyone has faced this kind of problem? How can I prevent the appending of the HTML tags with the portlet Instance Label?
    Please help me overcome this problem..
    Thanks in Advance ...

    1. To begin with, I would not recommend NOT to append portlet instance label to html tags. This is very much required. Take atleast 2 scenarios. If you dropped 2 instances for Same Portlet like News/Articles portlet etc on same page, you need to identify the html fields uniquely for each portlet so that backend java code works properly. Also if you have 2 different portlets assuming you did not give any name to form tag, and if you have html tags with same name, you need to identify them. Remember when portal or desktop is rendered, it is one big html file with html fragmetns from all .portlets files. So I am not sure if there is any option at all, to avoid the appending of instance label value to html tags.
    2. Coming to your usecase, I did had this problem once in 8.1 SPxx long back. All we did was, in the back end code, using BackingFile we could get the intance label value of the portlet. We can get this in pageflow also. Then pass this value and manually append this value to the html field of interest. In your case looks like you have Struts and tld tags. See somehow if you can get portlet instance label in jsp file and pass around to your tag lib code in request parameters etc. This is just one idea. I am not fully aware of your code, so try something along these lines.
    HTH
    Ravi Jegga

Maybe you are looking for