How to add a OutputText/InputHidden field on a jspx page (ADF 10g)

Stics Post in oracle, oracle ADF,Tags: , ,
0

Level: Advanced
Prerequisits: Model, DataControl and Backing-bean class

1. Find the page you need to add the field to i.e. CreateNewEmp.jspx

2. In the body > form of the jsp(x) page you should typically have a “panelForm” where fields are placed on, add a “panelLabelAndMessage” item:

r-click on af:panelForm > Insert inside af:panelForm > PanelLabelAndMessage

3. Then add an “OutputText” item (to display the field):

r-click on af:panelLabelAndMessage > Insert inside af:panelLabelAndMessage > browse… > OutputText

4. Switch to source-view and set a value to the item, to be able to display it:

<af:outputText value="#{uploadSession.empid}"

If you need to save it to a database table you need to add a “Binding” to it:

binding="#{backing_app_CreateNewEmp.empid}"/>

Note: if the binding doesn’t exist inside the backing bean, it will be created (a set and get method).

The full chunk of code (.jspx):

<af:panelLabelAndMessage label="Emp Id">
<af:outputText value="#{uploadSession.empid}"
binding="#{backing_app_CreateNewEmp.empid}"/>
</af:panelLabelAndMessage>

java backing-bean (declaritively created from jsp):

public void setEmpid(CoreOutputText empid) {
this.empid = empid;
}

public CoreOutputText getEmpid() {
return empid;
}

To make the field hidden from user view, do the same procedure as with OutputText but use InputHidden instead. Note that you shouldn’t just change the code inside the jsp as it will not change the variables created in the backing-bean class. This depends on what you select at first when adding the new field type on the jsp page.

 

 

Check or change default port numbers of Oracle Database

Stics Post in database, linux, oracle,Tags: , ,
0

Check or change the default port numbers by editing the file (in VI):

vi $ORACLE_HOME/install/portlist.ini

how to configure QEMU to boot off a USB in windows

Stics Post in virtual machine,Tags: , ,
0

After QEMU installation:

  1. Create a new VM from Qemu Manager
  2. Type a name for the new VM > Next
  3. Select, “do not use an image” > Next
  4. Output, “QEMU Manager Default” > Finish
  5. Then under the “Advanced tab of the new VM properties set additional QEMU parameters with…
-hda //./PhysicalDrive2

shorcuts to standard methods for Java IDEs

Stics Post in java, JDeveloper,Tags: , ,
0

System.out.println():

Netbeans: sout -> Tab
Eclipse: syso -> Ctrl + Space
JDeveloper: sop -> Ctrl + Enter

System.err.println():

JDeveloper: sep -> Ctrl + Enter

some credits: Java-Servlet-Jsp Blog

how to setup windows PuTTY to load x-windows via xming

Stics Post in linux,Tags: , , ,
0

Once you have XMing installed on windows do as follows:

  1. Set xming shorcut target as:
    "C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow
    

    :0 sets the x,y stating point of the displayed window

  2. Start xming (you should see a xming icon next to clock on desktop.
  3. Start PuTTY and configure as:
    • Select the session
    • On the left go to -> Connection -> SSH -> x11
    • Under x11 Forwarding:
      • Check “Enable X11 Forwarding”
      • X display location: localhost:0 //or whatever was set in step 1
    • Open the session
    • Enter username/password
  4. Execute a relevant x-window application i.e. gedit, firefox, etc.

credit: Novell Cool Solutions: Tip


how to create a cursor to read through table rows

Stics Post in database, oracle, oracle pl/sql,Tags: , ,
0
declare
  counter1 number := 0;
  counter2 number := 0;
  cursor cur_t is
    SELECT * from emp where e_name = 'Ptere'; --set cursor, a select statement
  rec_t emp%rowtype; --defines this is a row from the database

begin
  counter1 := 0;
  counter2 := 0; --some counters to log the records being changed
  open cur_t; --open cursor

  loop
    --begin loop

    fetch cur_t
      into rec_t; --fetches cursor row into the rec_t variable

    exit when cur_t%notfound;
    UPDATE emp SET e_name = 'Peter' where e_name = 'Ptere';
    counter1 := counter1 + 1; --increment updates
    insert into update_log
      (record_id, table_name, description) --useful for ref. purposes
    values
      (rec_t.emp_id, 'emp', 'Peter');
    counter2 := counter2 + 1; --increment inserts
    commit;
  end loop;
  --row_count := sql%rowcount; --sql counter for update statements
  dbms_output.put_line('EMP: ' || 'name changed, updated: ' || counter1);
  dbms_output.put_line('insert into UPDATE_LOG: ' || counter2);
  close cur_t; --close the cursor
end;

Note for DBMS output we need to set the command prompt:

set serveroutput on size 1000000 

format wrapped

how to find specific text in oracle schema using a procedure and save to table

Stics Post in database, oracle, oracle pl/sql,Tags: ,
0

The following function will find any text matching the variable set within the procedure.
(the output will display on screen -dbms_output)

To execute: <SQL>

execute update_found_records_proc;

We could also add a parameter on calling the procedure as:
CREATE OR REPLACE PROCEDURE FIND_IN_RECORDS_PROC(val IN varchar2) IS…
note: ‘val’ is set once and used anywhere later in the code

Credit:: Rene Nyffenneger on Oracle

PL/SQL code: More »

how to find specific text in oracle schema using a function

Stics Post in database, oracle, oracle pl/sql,Tags: ,
0

The following function will find any text matching the arguments given at command line.
(output may not display on screen, but data will be inserted in the relevant table)

To execute:

select find_in_schema('ABC_553') from dual;

Credit:: Rene Nyffenneger on Oracle

PL/SQL code: More »

how to configure tnsname.ora, hosts and internet browser correctly

Stics Post in database, Windows
0

The following configuration should fix problems between tnsname, the hosts file and browser:

tnsnames.ora (file)

DBNAME_DEV =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.99.98)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORADB1)
)
)
DBNAME_PRD=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.99.99)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORADB2)
)
)

hosts (file)

#127.0.0.1       localhost
192.168.99.98    WEB1
192.168.99.99    WEB2

internet browser

under network/connection > LAN > Do not use proxy for:

192.168.99.*;web1,web2

 

how to add a printer port mapped to a shared printer (win7)

Stics Post in Installations, Windows,Tags: ,
0

How to add a printer port mapped to a shared printer (most useful windows when it gets stubburn not installing the drivers):

1. Add Printer
2. Create New Port: Local Port
3. Enter Port Name: \\server\printShareName
4. Next: use Windows Update to find a driver or browse to find it
5. Finish

You should now have setup a printer on a shared resource.