How to destroy a populated field (thru a java class) in a jsp

i m workin on jfp frmwrk....i m stuck somewhr....actualy wat my jsp is doin dat
it simply showin a error msg..wen a customer makes an error while inputtin data in a form,
but wen he makes som othr error...d same error msg is shown on d jsp....but i hv alreday defined a
diffrnt msg fr dat error.

Start writing normal human readable English sentences, then we'll look what we can do for you.

Similar Messages

  • How to  get the profile object in simple java class  (Property accessor)

    Hi All,
    Please guide me how to get the profile object in simple java class (Property accessor) which is extending the RepositoryPropertyDescriptor.
    I have one requirement where i need the profile object i.e i have store id which is tied to profile .so i need the profile object in the property accessor of the SKU item descriptor property, which is extending RepositoryPropertyDescriptor.
    a.I dont have request object also to do request.resolvename.
    b.It is not a component to create setter and getter.It is simple java class which is extending the RepositoryPropertyDescriptor.
    Advance Thanks.

    Iam afraid you might run into synchronization issues with it. You are trying to get/set value of property of a sku repository item that is shared across various profiles.
    Say one profile A called setPropertyValue("propertyName", value).Now another profile B accesses
    getPropertyValue() {
    super.getPropertyValue() // Chance of getting value set by Profile A.
    // Perform logic
    There is a chance that profile B getting the value set by Profile A and hence inconsistency.
    How about doing this way??
    Create PropertyDescriptor in Profile (i.e user item descriptor), pass the attribute CustomCatalogTools in userProfile.xml to that property.
    <attribute name="catalogTools" value="atg.commerce.catalog.CustomCatalogTools"/>
    getPropertyValue()
    //You have Profile item descriptor and also storeId property value.
    // Use CustomCatalogTools.findSku();
    // Use storeId, profile repository item, sku repository item to perform the logic
    Here user itemdescriptor getPropertyValue/setPropertyValue is always called by same profile and there is consistency.
    -karthik

  • How i can make  my own connection in java source of a jsp page

    How i can make my own connection in java source of a jsp page (How to get connection from JNDI datasource address) ?
    imagine that i have a rowset in a web page , now i want to do some operation using
    plain JDBC , so i will need a connection object.
    I tried to get one of my rowsets connection but it return null ?
    what is best way to retrive a connection from JNDI datasource that we define for our project?
    for example if i have
    myRowSet.setDataSourceName("java:comp/env/jdbc/be");
    in web page constructor
    now i want a pure connection from the same datasource ? JNDI
    Thank you

    It is not hard to get your own connection from datasource.
    in your case you need to do like the the following code.
    i provide sample to show you how to catch the exception and create an statement .
    Connection con =null;
    try{
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/be");
    con = ds.getConnection();
    java.sql.Statement st =con.createStatement();
    }catch(SQLException sqlex){
    sqlex.printStackTrace();
    sqlex.getNextException().printStackTrace();
    catch(NamingException nex){
    nex.printStackTrace();
    hth
    Masoud kalali

  • Help! How to read a .txt file into a Java class and make 2D array?

    Hi guys,
    Im a newbie with arrays, just started really using them.. please bear with me if I don't seem to understand much..
    I have a .txt file that contains either a square or rectangle (random width and length).. How can I read each line into a Java class into a 2D array with rows and columns?

    Example :
    import javax.swing.*;
    import java.util.ArrayList;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.File;
    public class ReadInto2DArrayExample {
        public static void main(String[] args) {
            ArrayList array = new ArrayList();
            char [][] twoDimesionArray = null;
            try
                JFileChooser fileChooser = new JFileChooser();
                if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
                    File file = fileChooser.getSelectedFile();
                    BufferedReader reader = new BufferedReader(new FileReader(file));
                    String data;
                    //Read from file
                    while ((data = reader.readLine()) != null)
                        //Convert data to char array and add into array
                        array.add(data.toCharArray());
                    reader.close();
                    //Creating a 2D char array base on the array size
                    twoDimesionArray = new char [array.size()][];
                    //Convert array from ArrayList to 2D array
                    for (int i = 0; i < array.size(); i++)
                        twoDimesionArray[i] = (char [])array.get(i);
                    //Test the 2D Array
                    for (int y = 0; y < twoDimesionArray.length; y++)
                        char [] temp = twoDimesionArray[y];
                        for (int x = 0; x < temp.length; x ++ )
                            System.out.print(temp[x]);
                        System.out.println("");
            catch (Exception ex)
                ex.printStackTrace();
    }

  • How can i have a refrence of a java class object instance in my c++ project

    Hi!
    How can i have a refrence of a java class object instance in my c++ project. Is there a way?

    hahaxia wrote:
    The second question is the big one. The first question is half of the problem of "c++ to java" invocation and access. But the other half which is "java to c++ " invocation and access is still not solved. jni only provide the "java to c++ " DLL invocation Wrong,
    Using JNI your java classes can have methods implemented in C/C++.
    Using JNI you can call java classes.
    There is no other possible interaction between C++ and java, so it does it all.

  • How to get user information in a standalone java class

    Is there a way to retrieve it in a stand alone java class (with no access to request object)? If so how do I get it?
    Thanks,
    Deepak

    Hi
    use this
    IWDClientUser currentUsers[]=WDClientUser.getClientUsers();
              //Displaying the count of logged on users
              wdComponentAPI.getMessageManager().reportSuccess("Number of logged on Users in the portal - "+(currentUsers.length-1));
              for(int i=0;i<currentUsers.length;i++){
                 if(currentUsers<i>!=null){
                     // Displaying the logged on users;
                     if(!currentUsers<i>.getLastName().equals("Guest")){
                          String first= currentUsers<i>.getFirstName();
                          wdComponentAPI.getMessageManager().reportSuccess("User - "currentUsers<i>.getFirstName()" "+currentUsers<i>.getLastName());
        //@@end

  • How to import a java class in a JSP

    Hi All,
    I have a java class file called myTest.class (i made after compilation of myTest.java). I have a JSP page that uses this java class file.
    These 2 files are in same folder called c:/test
    and iam importing this java class file into my jsp file and that too at the start of this jsp file:
    <%@page import="myTest" %>
    BUt iam getting an error ..............when iam running this JSP page:
    /opt/bea81sp2/user_projects/domains/wliDomain/./Managed2/.wlnotdelete/extract/Managed2_myTest_myTest/jsp_servlet/__test.java:20: '.' expected
    probably occurred due to an error in /test.jsp line 5:
    <%@page import="myTest" %>
    Please advise how to solve this problem
    -sangita

    Don't bother with the import
    when iam not importing this class file into my JSP, then on my JSP, the class file is not found.
    Here is my code: and these 2 class file are in c:/test
    import org.apache.tools.ant.taskdefs.Ant;
    import org.apache.tools.ant.taskdefs.Property;
    import org.apache.tools.ant.types.*;
    import org.apache.tools.ant.*;
    import org.apache.tools.ant.taskdefs.ExecTask;
    import org.apache.tools.ant.types.Commandline;
    import java.io.File;
    * Creates an Ant project to run an Ant build
    * @author myself
    * @version 1.0
    public class RunTest extends Ant {
        String applicationName;
        String buttonClicked;
        String boxName;
        String targetName;
        public void applicationName(String applicationName){
         this.applicationName = applicationName;
        public void boxName(String boxName){
         this.boxName = boxName;
        public void buttonClicked(String buttonClicked){
         this.buttonClicked = buttonClicked;
      public RunTest() {
    public void goTest() {
         if(this.buttonClicked.equalsIgnoreCase("deploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
           this.targetName = "deploy-scsmail-testnet";
         if(this.buttonClicked.equalsIgnoreCase("undeploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
           this.targetName = "undeploy-scsmail-testnet";
        Project project = new Project();
        project.init();
        System.out.println("printing 1 ....");
        ExecTask exec = new ExecTask();
        exec.setProject(project);
        exec.setExecutable("/opt/bea/weblogic81/server/bin/ant.bat");
         exec.setDir(new java.io.File("/export/home/beamon/bin"));
         Commandline.Argument arg = exec.createArg();
         // arg.setLine("-f scsmail.xml test -listener org.apache.tools.ant.XmlLogger -logfile D:/antProject/src/log.xml");
         arg.setLine("-f build.xml "+ targetName + " -listener org.apache.tools.ant.XmlLogger -logfile /export/home/beamon/bin/log.xml");
         System.out.println("printing 2....");
        //exec.setOutput(new File("D:/antProject/logs/prob.txt"));
        exec.execute();
        System.out.println("printing 3....");
    -----------------------the JSP page is called as test.jsp
    <%@page contentType="text/html" %>
    <%@page import="java.io.*" %>
    <%@page import="java.util.*" %>
    <%@page import="java.net.*" %>
    <%@page import="RunTest" %>
    <HTML>
    <TITLE>TESTING ANT GUI</TITLE>
    <HEAD>
    <META HTTP-EQUIV="Refresh" CONTENT="3000" >
    <meta http-equiv="Cache-Control" content="no-cache">
    </HEAD>
    <BODY BGCOLOR="silver" TEXT="333333">
    <table border=0>
    <tr align="left"><td align="left"><FONT SIZE="-1"><B>  Test Page <FONT SIZE="-1"><B></td></tr>
    </table>
    <hr></center>
    <form action="./test.jsp" method="POST" name="testForm">
    <table>
    <tr>
    <td>
    <select name="appName" size=1>
    <option value="">Select Application Name
    <option value="scsmail">scsMail
    <option value="clientmanager">ClientManager
    </select>
    </td>
    <td>
    <select name="boxName" size=1>
    <option value="">Select Box Name
    <option value="testnet">TestNet
    <option value="production">Production
    </select>
    </td>
    </table>
    <table>
    <input type="submit" name="deploy" value="deploy">
    <input type="submit" name="undeploy" value="undeploy">
    </table>
    <%
       RunTest rt = new RunTest();
       rt.applicationName(request.getParameter("appName"));
        String deployButton = "";
        deployButton=request.getParameter("deploy");
        String undeployButton = "";
        undeployButton=request.getParameter("undeploy");
        if(!deployButton.equalsIgnoreCase("")){
            rt.buttonClicked(request.getParameter("deployButton"));
        if(!undeployButton.equalsIgnoreCase("")){
            rt.buttonClicked(request.getParameter("undeployButton"));
       rt.boxName(request.getParameter("boxName"));
        rt.goTest();
    %>
    </form>
    </table>
    </BODY>
    </HTML>

  • How to access variables declared in java class file from jsp

    i have a java package which reads values from property file. i have imported the package.classname in jsp file and also i have created an object for the class file like
    classname object=new classname();
    now iam able to access only the methods defined in the class but not the variables. i have defined connection properties in class file.
    in jsp i need to use
    statement=con.createstatement(); but it shows variable not declared.
    con is declared in java class file.
    how to access the variables?
    thanks

    here is the code
    * testbean.java
    * Created on October 31, 2006, 12:14 PM
    package property;
    import java.beans.*;
    import java.io.Serializable;
    public class testbean extends Object implements Serializable {
    public String sampleProperty="test2";
        public String getSampleProperty() {
            return sampleProperty;
    }jsp file
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.sql.*,java.util.*"%>
    <html>
    <head>
    <title>Schedule Details</title>
    </head>
    <jsp:useBean id="ConProp" class="property.testbean"/>
    <body>
    Messge is : <jsp:getProperty name="msg" property="sampleProperty"/>
    <%
      out.println(ConProp.sampleProperty);
    %>
    </body>
    </html>out.println(ConProp.sampleProperty) prints null value.
    is this the right procedure to access bean variables
    thanks

  • How to represent XML inline tags in a Java class

    Dear all,
    I am currently dealing with the issue of how to transform an XML document into a Java representation. As far as the strucural elements are concerned, I'd represent them each one of them as a Java class. However, the XML structure also allows for inline tags, i.e. elements which specify formatting information for the text. I am looking for good ideas for how to best represent these in my Java class(es).
    Let's use an example. Suppose I have something like this:
    <root>
       <structure>A piece of text</structure>
       <moreStructure>A piece of <b>bold</b> text</moreStructure>
       <finalStructure>A piece of <inlineTag att="value"> more text!</inlineTag>   </finalStructure>
    </root>I this case I would build four classes for the strucural elements. But how do I represent <b> and <inlineTag>? In my XML documents I have several such inline tags, each of which may also have a bunch of attributes. I am sure this has been solved cleverly before. Any help greatly appreciated.
    Best regards,
    N.

    The XML term for "containing tags and text" is "mixed content". And XML designers generally don't care much for mixed content. You're finding out one of the reasons for that right now. They aren't elegant or clever, just inconvenient.
    However sometimes you have to deal with ugly structures. This is one of them. I would represent mixed content as a list, just as you already thought of. The elements in this list would be either text or elements. So in this example:<moreStructure>A piece of <b>bold</b> text</moreStructure>you would have three entries:
    1. Text "A piece of "
    2. A <b> element
    3. Text " text"
    And when retrieving from that list you would have to use "instanceof" to see if you had a String or an element of some kind.
    And if "standalone tags" versus "paired tags" is a complication, then you're looking at it wrong. XML doesn't care much about tags. Tags only exist to delimit an element, and you should be looking at elements.
    I'm guessing at your non-standard terminology here: a "standalone tag" is an empty element like
    , right? And "paired tags" means a non-empty element like <this>that</this>? They're all elements. The first is a "br" element and the second is a "this" element.

  • How to Run a .sql file from simple java class

    How to execute a .sql file consisting of Complex Queries,procedures through simple java class.
    The queries may have different delimiters,queries independant of each other.
    I am able to do with Specific De-limiter.But I need in such a way that there should not be any
    Constraints. Since My .sql may Contain different De-limiters.
    If any one can Suggest Some Solution.
    It will be Great Help.
    regards
    Anil

    Check out ibatis script runner, it' a third party library but quite handy for running sql files...
    m

  • How to pass an argument to a standalone java class in JDeveloper

    To the experienced:
    In JDeveloper when you write a java class with a main() method that takes no argument, you just right click the java file and select Run to run the program. But suppose the main() method takes arguments, how do you pass your arguments to the program? This is especially a problem as I use the studio version of JDeveloper (Versions 10.1.3.4 and 11.1.1.3) that each uses the version of JDK bundled with it, rather than the JDK (which is yet another different version) installed at the OS level of the PC.
    Many thanks for your help!
    Newman

    Hi, Puthanampatti,
    Suppose a java class has a main() method:
    <pre>
    public class FormatTerm {
    public static void main(String[] args) {
    String year = args[0];
    String semester = args[1];
    </pre>
    What I want to know is how to pass the arguments when invoking FormatTerm within JDeveloper (i.e., without going out of JDeveloper to invoke FormatTerm on a command line in DOS). I would appreciate it very much if you know how to do that in JDeveloper 11g (I use Version 11.1.1.3) and could help me out.
    Thank you very much for your help!
    Newman

  • How to used a JCR Data Control in Java class?

    Hi,
    I created a JCR Data Control to my UCM to obtain a treeTable with the datas. But it's impossible to create a treeTable like i want to.
    So I know how to create a treeModel to obtain the treeTable I want.
    Is there a way to used the getItems method of the dataControl in a Java Class?
    I tried this :
    BindingContext bc = (BindingContext)JSFUtils.resolveExpression("#{data}");
    DCDataControl dc = bc.findDataControl("UcmDC");
    But dc is null.
    There are some xml files (UcmDC.xml or getItems_return.xml). Is it a way to resolve my problem. And if so, how do I use?
    Best regards,
    Thomas

    please refer metalink id(305710.1)

  • How to set render true or false in java class

    Use case:
    i have a page in which i have one inputListOfValues attributes and two LOV .initial the LOV render attribute value is false .it means it show only one attribute in run time .inputListOfValues is content two value .suppose if first value A then the first LOV have to show and is it value is B then Second LOV have to show .i bind my LOV to class .but i do not know how to set render attribute at java class.

    <af:inputListOfValues label="Branch Name"
    popupTitle="Search and Result Dialog"
    id="ilov1"
    model="#{pageFlowScope.organizationLOV.param['bindings.Organization'].listOfValuesModel}"
    converter="#{pageFlowScope.organizationLOV.param['bindings.Organization'].convert['latinDesc']}"
    valueChangeListener="#{viewScope.salaryBenefitsReportForm.branchChange}"
    binding="#{viewScope.salaryBenefitsReportForm.branchName}"
    rendered="true" visible="false"/>
    <af:inputListOfValues label="Department Name"
    popupTitle="Search and Result Dialog"
    id="ilov2"
    model="#{pageFlowScope.objectLOV.param['bindings.Department'].listOfValuesModel}"
    converter="#{pageFlowScope.objectLOV.param['bindings.Department'].convert['latinDesc']}"
    valueChangeListener="#{viewScope.salaryBenefitsReportForm.departmentChange}"
    binding="#{viewScope.salaryBenefitsReportForm.departmentName}"
    rendered="true" visible="false"/>
    this is code in jsff .
    and class code are following
    public void reportBy(ValueChangeEvent valueChangeEvent) {
    String value=(String)valueChangeEvent.getNewValue();
    System.out.println(value);
    if(value.equals("Branch")){
    branchName.setVisible(true);
    departmentName.setVisible(false);
    AdfFacesContext.getCurrentInstance().addPartialTarget(branchName);
    AdfFacesContext.getCurrentInstance().addPartialTarget(departmentName);
    if(value.equals("Department")){
    departmentName.setVisible(true);
    branchName.setVisible(false);
    AdfFacesContext.getCurrentInstance().addPartialTarget(departmentName);
    AdfFacesContext.getCurrentInstance().addPartialTarget(branchName);
    }

  • Calling a servlet thru'  a Java class

    Hi,
    How can I write a Java class that calls/invokes a servlet?
    Thnks

    I blv you can do some thing like this to invoke a servlet
    URL test = new URL(myURL);
    where myURL should contain the complete URL of your servlet
    test.openStream();
    check more docs on the URL class

  • How to create a Concurrent Program around a java class

    Can anyone give me the steps I need to register a concurrent program based on a java class?
    I have a java class that basically opens a jdbc connection, reads values from a table, decompresses one column, and sends all info to XML Gateway. I just need to know how to deploy this thing.
    Thanks.
    -Jason

    Check Metalink Note:305710.1

Maybe you are looking for