Iterate Map on JSPX
I appreciate if someone can help me to iterate Map on jspx via ADF components.
package view.mb;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.binding.BindingContainer;
import view.vo.EmployeeVo;
public class PageController {
public PageController() {
private Map<String, EmployeeVo> employees = null;
public void loadData() {
employees = new HashMap<String, EmployeeVo>();
empList = new ArrayList<EmployeeVo>();
for (int i = 1; i < 10; i++) {
EmployeeVo vo = new EmployeeVo();
vo.setId("" + i);
vo.setName("username-" + i);
vo.setEmailId("username-" + i + "@yahoo.com");
employees.put("" + i, vo);
} // for (int i=0; i<10; i++)
refreshObject("employeesIterator");
private void refreshObject(String iterName) {
BindingContainer bindings =
BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iterBind = (DCIteratorBinding)bindings.get(iterName);
iterBind.executeQuery();
public void setEmployees(Map<String, EmployeeVo> employees) {
this.employees = employees;
public Map<String, EmployeeVo> getEmployees() {
return employees;
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1"
binding="#{backingBeanScope.backing_DisplayMapObjectViaIterator.d1}">
<af:messages id="m1"/>
<af:form id="f1"
binding="#{backingBeanScope.backing_DisplayMapObjectViaIterator.f1}">
<af:pageTemplate viewId="/oracle/templates/threeColumnTemplate.jspx"
id="pt1">
<f:facet name="center">
<af:panelBox>
<b>Iterate Map</b>
<table border="1">
<tr>
<th>Id</th>
<th>Name</th>
<th>Email</th>
</tr>
<tr>
<td colspan="3">
// prints on UI as '{3=view.vo.EmployeeVo@16f5633, 2=view.vo.EmployeeVo@84655f, 1=view.vo.EmployeeVo@1b6e66, 7=view.vo.EmployeeVo@ed0022, 6=view.vo.EmployeeVo@1a3f113, 5=view.vo.EmployeeVo@281b56, 4=view.vo.EmployeeVo@11ae18c, 9=view.vo.EmployeeVo@1cde750, 8=view.vo.EmployeeVo@10d5d18}'
<af:iterator value="#{bindings.employees.collectionModel}"
var="row"
rows="#{bindings.employees.rangeSize}">
<af:outputLabel value="#{row.element}"/>
</af:iterator>
</td>
</tr>
<tr>
<td colspan="3">
<af:iterator value="#{bindings.employees.collectionModel}"
var="row"
rows="#{bindings.employees.rangeSize}">
<af:outputLabel value="#{row.element.labelSet}"/>
</af:iterator>
</td>
</tr>
<af:iterator value="#{bindings.employees.collectionModel}"
var="row" rows="#{bindings.employees.rangeSize}">
<af:iterator value="#{row.element.labelSet}" var="rowVo">
<tr>
<td>
<af:outputText value="#{rowVo.id}"/>
</td>
<td>
<af:outputText value="#{rowVo.name}"/>
</td>
<td>
<af:outputText value="#{rowVo.emailId}"/>
</td>
</tr>
</af:iterator>
</af:iterator>
</table>
</af:panelBox>
</f:facet>
</af:pageTemplate>
</af:form>
</af:document>
</f:view>
</jsp:root>
<?xml version="1.0" encoding="UTF-8" ?>
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
version="11.1.1.59.23" id="DisplayMapObjectViaIteratorPageDef"
Package="view.pageDefs">
<parameters/>
<executables>
<invokeAction Binds="loadData" id="invoke" Refresh="always"/>
<variableIterator id="variables"/>
<iterator Binds="root" RangeSize="25" DataControl="PageController"
id="PageControllerIterator"/>
<accessorIterator MasterBinding="PageControllerIterator" Binds="employees"
RangeSize="25" DataControl="PageController"
BeanClass="view.vo.EmployeeVo" id="employeesIterator"/>
<accessorIterator MasterBinding="PageControllerIterator" RangeSize="25"
DataControl="PageController"
BeanClass="view.vo.EmployeeVo" id="employeeIterator"/>
</executables>
<bindings>
<methodAction id="loadData" RequiresUpdateModel="true" Action="invokeMethod"
MethodName="loadData" IsViewObjectMethod="false"
DataControl="PageController"
InstanceName="PageController.dataProvider"/>
<tree IterBinding="employeesIterator" id="employees">
<nodeDefinition Name="employees0">
<AttrNames>
<Item Value="element" >
<!--
<tree IterBinding="employeeVoIterator" id="employee">
<nodeDefinition>
<AttrNames>
<Item Value="id" />
<Item Value="name" />
</AttrNames>
</nodeDefinition>
</tree>
-->
</Item>
</AttrNames>
</nodeDefinition>
</tree>
</bindings>
</pageDefinition>
Hi,
delete previous binding for employee. add an iterator and a tree binding for that iterator in pageDef
suppose you name the treebinding as employees.
AFAIK you are trying to display id,name,emailid for each row... is that right ? then go through my following code.
<af:iterator value="#{bindings.employees.rangeSet}"
var="row">
<tr>
<td>
<af:outputText value="#{rowVo.id}"/>
</td>
<td>
<af:outputText value="#{rowVo.name}"/>
</td>
<td>
<af:outputText value="#{rowVo.emailId}"/>
</td>
</tr>
</af:iterator>Regards,
Santosh.
Similar Messages
-
ADF Bindings Servlet/Filter not invoking Faces Servlet
I'm getting ADF Faces and Facelets working properly with pages written in jspx format, but the Faces Servlet being mapped to jsf format.
The problem I'm getting is while displaying ADF Tables with data retrieved from the database using Toplink and bindings provided by ADF Databindings.
The following is the Web.xml mappings for Faces Servlet and ADF bindings filter:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>resources</servlet-name>
<url-pattern>/adf/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<filter>
<filter-name>adfBindings</filter-name>
<filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>adfBindings</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>adfBindings</filter-name>
<url-pattern>*.jspx</url-pattern>
</filter-mapping>
I'm getting the ADF tables displayed using ADF Bindings, if the faces servlet is mapped for jspx format;but, at the cost of losing Facelets...Facelets is not working with Faces Servlet mapped to jspx format(though written in jspx format, the faces servlet mappping has to be made for jsf format.On the other hand, if I use faces servlet mapping for jsf pages I'm getting Facelets working but ADF Databindings are not working ,(I guess) and hence ADF Faces Tables are not being displayed(I'm getting Access Denied message).
I even tried to change the ADF binding filter mappings
---- from ---- jsp &jspx---- to ----- jsp and jsf ----
But I got the same Access denied message.
I read a similar post on this forum by Mr.Ashish Kumar who said he is using java script and automatic form submission, to refresh the page and that gave him the table working.
as quoted in the post:
af:table displays Access Denied
Why should the page be refreshed at all. I Guess , the Faces Servlet is not being invoked by the ADF Bindings Filter/Servlet, and for this , I suppose , Mr.Ashish is using java script to provide the action required.
And one more thing which that Automatic Refreshing of page using JavaScript cannot do.
Suppose,
I need customised display, rather than just a Table or Form,like:
public String getEmp() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding =
bindings.getOperationBinding("findAllEmp");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
List<Emp> res=(List<Emp>)result;
for(int i=0;i<res.size();i++)
Emp myrec=res.get(i);
System.out.println("Employee ["+myrec.getEname()+"], Salary ["+myrec.getSal()+"]");
return "";
where I do some customisation in the backing bean.
and I call that method binded to a button as below:
<af:commandButton
text="findAllEmp"
disabled="#{!bindings.findAllEmp.enabled}"
binding="#{backing_Success.commandButton1}"
id="commandButton1"
action="#{backing_Success.getEmp}"/>
What I'm getting is a disabled button.
Why doesn't ADF bindings servlet invoke the faces Servlet?
Can't we make ADF Bindings Servlet invoke Faces Servlet by configuring in the web.xml?
Can't we get ADF Bindings filter mapped to work with jsf pages?
Won't ADF Bindings work with jsf pages, will they work only with jspx pages?
ADF Team,
Please Help me.
Thanking you,
SambaHi! Frank,
Thankyou for your Reply.
Yes, Mr.Adam Winer has contributed that library, I guess.
But I already have that adf-facelets.jar in my lib folder ; and with out that the Facelets won't work with ADF faces , in the first place.
I'm getting Facelets working excellently with ADF Faces but I'm not getting ADF Bindings working with Faceletpages.
The thing is even in another application which does not have facelets in it, if we use mapping for jsf pages, ADF Bindings are not working.
I think the ADF bindings filter is configured some where to work with jspx pages only.Could you tell me where to change that entry to make ADF Bindings work with jsf extension?
Thanking you,
Samba. -
Iterate through a list containing Map items using struts
Hi friends,
I have a small problem. I want to iterate through a list of items, using struts.
The list actually contains map structres for example:
list(0)
map(..key..value..)
map(..key..value..)
map(..key..value..)
list(1)
map(..key..value..)
map(..key..value..)
map(..key..value..)
list(2)
map(..key..value..)
map(..key..value..)
map(..key..value..)can I use <logic:iterate/> for this? if yes how? Because I have used this tag for list containing bean objects not Map.
Any suggestions are much appreciated.
Thanks,
VishalNormally, each object exposed by the iterate tag is an element of the underlying collection you are iterating over. However, if you iterate over a Map, the exposed object is of type Map.Entry that has two properties:
key - The key under which this item is stored in the underlying Map.
value - The value that corresponds to this key.
So, if you wish to iterate over the values of a Hashtable, you would implement code like the following:
<logic:iterate id="element" name="myhashtable">
Next element is <bean:write name="element" property="value"/>
</logic:iterate>
Best Regards
Maruthi -
Hi
I have to override toString() to print out everything in my HashMap. It�s like I have a totally black out. Help me please.
This is what I have:
This Map is a graph filled with Cities and each City has an ListArray with Edges (containing info about transport way and weight of edge, in this case, time it takes to transport from one node to another).
This is how my Map looks like in a class called ListGraph<N>
Map<N, List<Edge<N>>> all = new HashMap<N, List<Edge<N>>>();So first I put Cities into my Graph whith addNode method from main-method somewhere:
all.put(city, new ArrayList<Edge<N>>());Then I connect each node (City) with another node.
myGraph.connect("Universe", "Galaxy", "Train", 35);myGraph is a Graph myGraph in main-method
Now I want to print out my graph with toString() method
like
System.out.println(myGraph);How do I iterate over my Map and use toString so it looks like this:
from Universe: to Galaxy by Train(35)And if Universe has more edges they should also be printed out like
from Universe: to Galaxy by Train(35), to the Sun(85), to foodcourt(2)Someone?How do I iterate over my Map and use toString so it
looks like this:
from Universe: to Galaxy by Train(35)
A usual way to iterate over map is:
Map<A, B> map = new HashMap<A, B>();
// map.put(new A("a1"), new B("b1"));
// map.put(new A("a2"), new B("b2"));
for(A key : map.keySet()){
B val = map.get(key);
System.out.println(key + ": " + val);
} -
How to iterate the webservice Data control result set?
Hi all,
How to iterate the webservice Data control result set? I have an jsff page where I am displaying the single UserDetails by webservice DataContol. As per my design requirement I should iterate the DataControl resultSet to get the user details and push the same in to Managed bean. Please help me how to do this, any sample code please to iterate the resultset and get the data from it.
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<c:set var="uiBundle" value="#{adfBundle['edu.syr.oim.uiBundle']}"/>
<af:pageTemplate viewId="/templates/jsffTemplate.jspx">
<f:facet name="fTop"/>
<f:facet name="fCenter">
<af:panelGroupLayout layout="scroll" inlineStyle="width:100.0%;">
<af:panelTabbed id="pt1">
<af:showDetailItem text="#{uiBundle.PRIVACYFLAGS}" id="sdi4">
<af:panelGroupLayout id="pgl4" layout="scroll">
<af:spacer width="10" height="10" id="s3"/>
<af:panelFormLayout id="pfl6">
<af:panelLabelAndMessage label="#{uiBundle.STUDENTEMAIL}"
id="plam35">
<af:outputText value="#{bindings.stuEmail.inputValue}"
id="ot42"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{uiBundle.STUDENTHOMEADDRESS}"
id="plam39">
<af:outputText value="#{bindings.stuPermAddr.inputValue}"
id="ot35"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{uiBundle.STUDENTHOMEPHONE}"
id="plam40">
<af:outputText value="#{bindings.stuPermPhn.inputValue}"
id="ot37"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{uiBundle.STUDENTCURRENTPHONE}"
id="plam42">
<af:outputText value="#{bindings.stuCurrAddr.inputValue}"
id="ot40"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{uiBundle.STUDENTCURRENTPHONE}"
id="plam36">
<af:outputText value="#{bindings.stuCurrPhn.inputValue}"
id="ot38"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{uiBundle.STUDENTACAINFO}"
id="plam41">
<af:outputText value="#{bindings.stuAcad.inputValue}"
id="ot36"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{uiBundle.EMPHOMEADDRESS}"
id="plam38">
<af:outputText value="#{bindings.empPermAddr.inputValue}"
id="ot39"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{uiBundle.EMPHOMEPHONE}"
id="plam37">
<af:outputText value="#{bindings.empPermPhn.inputValue}"
id="ot41"/>
</af:panelLabelAndMessage>
</af:panelFormLayout>
</af:panelGroupLayout>
</af:showDetailItem>
</af:panelTabbed> Above is my jsff code. Here how/where to add the phase listener to paopulate the managed bean while page render. Do I need to iterate the DC to get and push the each parameter in to ManagedBean or is there any easy way to do this by EL mapping directly at jsff. Please clarify.
Thanks
klnThat is what exactly I am trying right now. I am binding each of my page fragment outputText item in to backing bean and by that way trying to populate the values.
But the issue here is, the backing bean method doesn't getting any value until I hit any of the link or the button in the fragment. While loading the page the bean set and get is null. If i hit any link or button it is filled up with the vaule. As per my design, I would like to populate the bean method along with page load before any user action. But cant able to do this!! :(
Below is my sample code what I am trying right now
<af:panelLabelAndMessage label="#{uiBundle.NETID}" id="plam13">
<af:outputText value="#{bindings.netid.inputValue}" id="ot4" binding="#{UserDataBean.netId}"/>
</af:panelLabelAndMessage>
backing bean ex:
private RichOutputText netId;
static String netidVal;
public void setNetId(RichOutputText netId) {
netidVal= netId.getValue() == null? "":netId.getValue().toString();
this.netId = netId;
public RichOutputText getNetId() {
return netId;
public String getNetIdVal() {
return netidVal;
}Thanks
kln -
Hi,
I would like to get values from a Map. This is my Map
courrierId659 = [Ljava.lang.String;@7e6f03,
nomModele = [Ljava.lang.String;@aa594b,
navigation = [Ljava.lang.String;@1cc67fd,
dateImpression = [Ljava.lang.String;@bf2fa9,
nomGestionnaire = [Ljava.lang.String;@1d2279c,
courrierId650 = [Ljava.lang.String;@64635b,
selection = [Ljava.lang.String;@1a93ff1
I want to get all the values whose keys start with courrierId, is possible to get these values in a effective way? or I have to iterate through the Map?
Thank you in advanceelsymenab wrote:
I want to get all the values whose keys start with courrierId, is possible to get these values in a effective way?Yes. Loop through the keys, and where the key meets your criteria, get the value.
or I have to iterate through the Map?That sounds pretty effective to me.
~ -
Error about Source Level only if 5.0? I'm using Java 1.6? Maps
Hello everyone. I was just trying to run some simple Source Code from my book here:
package mapa;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class MapTest
Map<String, String> phonebook = new HashMap<String, String>();
// constructor
public example2(String n[], String nums[]) {
for(int i=0; i< n.length; i++)
phonebook.put( n, nums[i] );
public static void main(String[] args) {
// data
String [] names = { "Lefty", "Guarav", "Wong", "Rupamay" };
String [] extns = { "4873", "4810", "3769", "0" };
// get an instance of this class
example2 ex = new example2( names, extns );
// dump out the map
System.out.println("map: " + ex.phonebook);
// get the mappings
Set<Map.Entry<String,String>> s = ex.phonebook.entrySet();
// iterate over the mappings
// for (Iterator i = s.iterator(); i.hasNext(); ) {
for (Map.Entry me : s) {
Object ok = me.getKey();
Object ov = me.getValue();
System.out.print("key=" + ok );
System.out.println(", value=" + ov );
and i'm getting the following errors when I run it in Eclipse:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
example2 cannot be resolved to a type
example2 cannot be resolved to a type
Syntax error, parameterized types are only available if source level is 5.0
The type Map.Entry is not generic; it cannot be parameterized with arguments <String, String>
Syntax error, 'for each' statements are only available if source level is 5.0
at mapa.MapTest.main(MapTest.java:24)Line 24 is:
example2 ex = new example2( names, extns );I've compiled things with Eclipse before such as Networking programs and they worked fine, not sure whats wrong with this example.
Thanks!Oops it looks like on that line they are using the Class itself, and they had it renamed to Example2 not MapTest. I changed the code to the following but still getting errros:
package mapa;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class MapTest
Map<String, String> phonebook = new HashMap<String, String>();
// constructor
public example2(String n[], String nums[]) {
for(int i=0; i< n.length; i++)
phonebook.put( n, nums[i] );
public static void main(String[] args) {
// data
String [] names = { "Lefty", "Guarav", "Wong", "Rupamay" };
String [] extns = { "4873", "4810", "3769", "0" };
// get an instance of this class
MapTest ex = new MapTest( names, extns );
// dump out the map
System.out.println("map: " + ex.phonebook);
// get the mappings
Set<Map.Entry<String,String>> s = ex.phonebook.entrySet();
// iterate over the mappings
// for (Iterator i = s.iterator(); i.hasNext(); ) {
for (Map.Entry me : s) {
Object ok = me.getKey();
Object ov = me.getValue();
System.out.print("key=" + ok );
System.out.println(", value=" + ov );
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The constructor MapTest(String[], String[]) is undefined
ex.phonebook cannot be resolved or is not a field
Syntax error, parameterized types are only available if source level is 5.0
The type Map.Entry is not generic; it cannot be parameterized with arguments <String, String>
ex.phonebook cannot be resolved or is not a field
Syntax error, 'for each' statements are only available if source level is 5.0
at mapa.MapTest.main(MapTest.java:24) -
What is the best way to store and iterate over lists of words?
Hi,
Im trying to create a naive bayesian classifier to attribute aurthorship to some texts. I have three text files in the form of a list of words (listA, listB and listC, where listA is a disputed text and listB, listC are those of known authors). I need to feed these into my program, than compare listA to listB (to check if listA has the same words as listB), perform the classification and do the same for listA and listC.
Im new to java and would like to know the best way of comparing the text files....could i store listA in an array....listB in a hashmap, iterate over the hashmap to check which words are also contained in listA and store the similar words in a seperate arraylist?
plz help.If you just want to check if one set of words contains another set of words then something implementing java.util.Set might be sufficient. Read the API docs, you don't need to write much code yourself. Maps are for looking up values based on keys; your problem statement doesn't mention that so you don't need them. Lists are for when the order of entries matters. Read this for more information:
http://java.sun.com/docs/books/tutorial/collections/index.html -
Error while displaying OBIEE maps in ADF
Hi,
I have integrated OBIEE dashboard with ADF. The maps are not being displayed on the jspx page.
The following display error shows up:
View Display Error
Malformed url '/Application/BIProxy?cid=OBI&RedirectURL=saw.dll%2f%2fmapviewer'.+
Error Details
Error Codes: YC9VC6XO
Location: saw.views.dashboard, saw.httpserver.processrequest, saw.rpc.server.responder, saw.rpc.server, saw.rpc.server.handleConnection, saw.rpc.server.dispatch, saw.threadpool, saw.threadpool, saw.threads
Is there a configuration to be done.
Can anybody please help me out with this?I am facing this problem too. Anyone could help please?
-
Passing a parameter from a map
I'm re-writing an old web-based application in ADF Faces. The old application had this on one of the pages called quickSearch:
<map name="FrontPagemap0">
<area shape="RECT" coords="22, 339, 214, 500"
href="addressSearch?state=AK"/>
<area shape="POLYGON"
coords="149, 195, 135, 266, 111, 259, 82, 239, 85, 227, 90, 220, 89, 199, 92, 194, 97, 193, 101, 183"
href="addressSearch?state=AZ"/>
<area shape="POLYGON"
coords="356, 209, 356, 214, 360, 214, 357, 223, 353, 232, 345, 248, 346, 252, 317, 250, 314, 246, 311, 244, 316, 209"
href="addressSearch?state=AR"/>
<area shape="POLYGON"
coords="50, 104, 44, 146, 88, 218, 79, 234, 79, 237, 51, 230, 49, 221, 36, 210, 25, 200, 21, 196, 17, 175, 4, 138, 4, 136, 4, 133, 11, 94, 13, 91"
href="addressSearch?state=CA"/>
<!-- more area tags here -->
</map>
<img src="/images/us_Imap4.gif" alt="US Map"
height="528" width="600" usemap="#FrontPagemap0"/>addressSearch in the original application was a PL/SQL web procedure that took state as a parameter and used it as the default value for a dropdown list. In the new application, addressSearch is addressSearch.jspx, and the dropdown list updates a property of a managed bean in session scope. If it was a commandLink component that led from the quickSearch page to the addressSearch page, I'd just use setActionListener.
But this is the equivalent of a goLink component. How do I get the value of the state code for the state that the user clicked into the managed bean property to serve as the default for the dropdown in addressSearch?
I know that I can reference the parameter to addressSearch.jspx as #{param.state}, but is there a way to get it into the managed bean before addressSearch is rendered?You marked the question answered, so I assume you found the solution.
If yes you should post it here, if not you should not mark the question answered ;-)
For web apps the normal way to handle this is to stream the data back to the browser and let the browser decide what to to with the data. The only thing you have to do is to set the content type of the response to i.e. application/pdf (for pdf ) or application/msword for Word. I'm not sure if application/dwg works on the fly, but if you define the file type .dwg to open AutoCAD it should work.
Timo -
Error in Running map from Jdeveloper Weblogic -MAPVIEWER-05523--06036
Hi,
I have deployed Mapviewer.ear on an integrated weblogic server and loaded mvdemo sample dataset into my db, and made required changes in map_data_source in mapViewerConfig.xml.
Now, I am able to run all the demo apps and tutorial. However, when I run the map code(basic map) in a jspx from Jdeveloper, I am getting the below error in a pop-up in the browser.
"[MVGlobalVariables.getMapCacheConfig]*MAPVIEWER-05523*:Cannot process response from MapViewer server.(MVDEMO.DEMO_MAP:MAPVIEWER-06036: MapTileServer is not read. Please try again later.)"
In the log, error is "<CacheInstanceConfig> <loadCacheStorageDef> Invalid cache root directory:/scrtach/mvdemomaps\. Cache root directory will be set to default root directory."
I am using Jdeveloper version 11.1.1.4.
What could be the issue, esp when demos are running successfully on the same server.Ok, so the error comes cause the application is trying to get the tile layer from the server while the Mapviewer server is not ready.
So make sure you run your application once mapviewer server is up and running.
Now, for the problem that you get a blank page it is propably a javascript error as mapviewer gives no errors.
I have made a mistake in the previous post in the HTML section of my code. Give it a try now.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>testMap1</title>
<script language="Javascript" type="text/javascript" src="/mapviewer/fsmc/jslib/oraclemaps.js"> </script>
<script type="text/javascript">
var basemap1 = new MVMapTileLayer("mvdemo.demo_map");
function showMap()
//maybe formating is taking away the plus symbols. just make sure the base url is formatted correctly
var baseURL = "http://" + document.location.host + "/mapviewer";
var mapCenterLon = -122.45;
var mapCenterLat = 37.6706;
var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,8307);
var mapZoom = 5;
var mapview = new MVMapView(document.getElementById("map"), baseURL);
mapview.addMapTileLayer(basemap1);
mapview.setCenter(mpoint);
mapview.setZoomLevel(mapZoom);
mapview.addNavigationPanel("EAST");
mapview.display();
</script>
</head>
<body onload="showMap()">
<div id="map"
</div>
</body>
</html>
if you still get a blank page. Try using firefox with firebug and see what errors rise up in firebug. You should be able to find out what goes wrong with javascript.
Edited by: P.T on 17 Μαϊ 2011 5:11 πμ
Edited by: P.T on 17 Μαϊ 2011 5:15 πμ
Edited by: P.T on 17 Μαϊ 2011 5:15 πμ -
Is there a way to overload the Map's toString() function?
Hello everyone. I was wondering if its possible to overload the toString() function of the Map datastructure supplied by java.
I looked it up and it says:
public class HashMapextends AbstractMapSo I looked up AbstractMap and it says:
public abstract class AbstractMapextends Objectimplements MapAnd I found a toString() function in the AbstractMap saying:
toString
public String toString() Returns a string representation of this map. The string representation consists of a list of key-value mappings in the order returned by the map's entrySet view's iterator, enclosed in braces ("{}"). Adjacent mappings are separated by the characters ", " (comma and space). Each key-value mapping is rendered as the key followed by an equals sign ("=") followed by the associated value. Keys and values are converted to strings as by String.valueOf(Object). This implementation creates an empty string buffer, appends a left brace, and iterates over the map's entrySet view, appending the string representation of each map.entry in turn. After appending each entry except the last, the string ", " is appended. Finally a right brace is appended. A string is obtained from the stringbuffer, and returned.
here: http://java.sun.com/j2se/1.3/docs/a...ml#toString()So I did the following:
package parse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.io.*;
//this class should store all the Messages or "Events" and
//you can access them based on their EntityID key.
public class MessageDB extends HashMap
//database to hold the information
// holds the Alerts/messages
public static Map<Integer, List<String>> AlertMap;
//Constructor
MessageDB()
AlertMap = new HashMap<Integer, List<String>>();
public String toString()
return ( )//not sure what to put here...
//print, outputs the contents of the hashMap
public static void print()
//want to print out the Key and all the Messages
//associated with that key
Set keys = AlertMap.keySet(); // The set of keys in the map.
Iterator keyIter = keys.iterator();
System.out.println("The map contains the following associations:");
while (keyIter.hasNext()) {
Object key = keyIter.next(); // Get the next key.
Object value = AlertMap.get(key); // Get the value for that key.
System.out.println( "EntityID: " + key + "\n"
+ "Message: " + value + "\n" );
//overloaded print to print to user screen.
public static void print(PrintWriter out)
//want to print out the Key and all the Messages
//associated with that key
Set keys = AlertMap.keySet(); // The set of keys in the map.
Iterator keyIter = keys.iterator();
out.println("The map contains the following associations:");
out.flush();
while (keyIter.hasNext()) {
Object key = keyIter.next(); // Get the next key.
Object value = AlertMap.get(key); // Get the value for that key.
//out.flush();
/* out.println( " (" + key + "," + value + ")" );
out.flush();*/
// out.println("------------------\n");
out.println("EntityID: " + key + "\n"
+ "Message: " + value + "\n");
//out.println("------------------\n");
out.flush();
void add(Message msg)
//getting the position of the List by EntityID if avaiable
List<String> Alert = AlertMap.get(msg.entityID);
//checking to see if there is a unique Key already in the Map.
if (Alert == null)
//if there isnt a key in the map, add a new key, and a new List mapping
//to the key EntityID;
Alert = new ArrayList<String>();
AlertMap.put(msg.entityID, Alert);
Alert.add(msg.message);
else
//adding message to List
Alert.add(msg.message);
}Right now the output is like this:
The map contains the following associations:
EntityID: 99999
Message: [a test ]
EntityID: 800
Message: [this is a test , again a test ]
EntityID: 801
Message: [again a test ]
EntityID: 111
Message: [a test again yes , a test once again ]You see how its automatically doing [message1, message2,...,message x]
By me calling this line of code:
out.println("EntityID: " + key + "\n"
+ "Message: " + value + "\n");Because I found out it implicity calls the toString() method when concatinating it to a string.
What I would like it to display would be:
EntityID: 800
Message:
This is a test
This is a test again
any ideas would be great!
Or is there a way to just iterate over the messages, rather than doing it my way?
Message was edited by:
lokieHi,
When you do a String concatenation in java, calls are implicitly done to #toString().
Means, you are doing this:
while (keyIter.hasNext()) {
Object key = keyIter.next(); /
Object value = AlertMap.get(key);
System.out.println( "EntityID: " + key.toString()+ "\n"
+ "Message: " + value.toString() + "\n" );
}The "[ [/b]... [b], ... , ... ]" you can see in your output is created by the implicit call to List#toString() method.
You can Override it in an anonymous class by doing:
if (Alert == null)
//if there isnt a key in the map, add a new key, and a new List mapping
//to the key EntityID;
Alert = new ArrayList<String>(){
@Override
public String toString(){
StringBuilder sb = new StringBuilder();
for(String s: this){
sb.append(s);
sb.append("\n");
return sb.toString();
};PS:
toString() is usually used for debbuging only... -
Issue with Mapping Spaces for Receiver Flat File Fixed Length
Hi Mapping experts,
my scenario is receiver FILE (fixed length)
so if a validation applied on a target field returns false then I need to pass the spaces having the number of characters defined for that field
example
targetField length = 8
using "IF" function to perform validation, if validation is true THEN = FIELD
if validation is false ELSE = "________" (underscore to represent 8 spaces)
the problem is the validation is of multiple occurences in one queue and if the "true" statement is on the 6th row, I get _________ which is the value of the 1st row (which is correct because rows 1 to 5 are all false therefore having the value of ELSE which is _______ mapped to it)
How can I get the value of the TRUE row regardless of what row it is located?
e.g. IF = input is 5 rows of validation, TRUE is in the 3rd row, i will get the 3rd row value
IF = input is 5 rows of validation, NO TRUE Value, return 8 spaces
right now when i Display Queue values are
iF:in0 iF:in1 iF:in2 iF:out
1111 false [_________] [_________]
2222 false [_________]
3333 true 3333
4444 false [_________]
5555 false [_________]
In above Queue i only get the value of the 1st row which is ________ --> because my target field occurrences definition in Data Type is 0....1
if I change Data Type occurrences to 1...unbounded I get 5 target fields generated --> WRONG because target file is fixed field, so only one occurence of that target field is requiredCan you give me the idea of what validation are you using so that anyone can help you with the UDF straightaway
because you need to have a UDf in place which will iterate the number of times the field occurs and then it will check the entire queue first ,where validation is true and only at the instant it will return the value
if the entire queue is value it will return the 8 underscores
I hope this is what you wanted
regards
ninad -
Mapping of Web App context root and the physical directory of the web app
I'm running Weblogic 7.0 on Windows2000.The physical directory of my web application
is D:\WL8\weblogic81\TestDeploy\build\TestWebApp and under these directory I have
my JSPS, static HTML and WEB-INF. I define the context path of this web app in
the weblogic.xml ;-
<weblogic-web-app>
<context-root>/testapp</context-root>
</weblogic-web-app>
As a result of deploying this web app in the server (or it may be created manually
also), the following entry gets inserted in the server's config.xml ,-
<Application Deployed="true" Name="TestWebApp"
Path="D:\WL8\weblogic81\TestDeploy\build" TwoPhase="true">
<WebAppComponent Name="TestWebApp" Targets="myserver" URI="TestWebApp"/>
</Application>
Now, whenever I make a request of the form "http://localhost:7001/testapp/..",
it's properly executing my web app. My question is, how does the container knows
that for any request for the web app with context path as 'testapp', it has to
server files from D:\WL8\weblogic81\TestDeploy\build\TestWebApp. In the above
process, nowhere such mapping is specified. I expected something like Tomcat's
server.xml, where in docbase we clearly specify this mapping between the context
path and the physical directory. Please help.Let me give some more details and hopefully this will make things clearer.
Say you deploy /foo/bar/myweb.war and in myweb.war you configure a
context-root of /rob
During deployment, the server creates an ApplicationMBean with a path of
/foo/bar/. It then creates a WebAppComponent with a uri of myweb.war.
Next, deployment calls back on the web container and tells it to deploy
the WebAppComponent. The web container reads the myweb.war, parses
descriptors etc. The web container then updates its data structures to
register that myweb.war has a context path of /rob. (It has to figure
out all the other servlet mappings as well.)
When a request for /rob/foo comes in, the web container consults its
data structures to determine which webapp and servlet receives the
request. This is not a linear search of all webapps and servlets.
There's much better ways to do pattern matching.
Hope this clears things up. Let me know if you still have questions.
-- Rob
Arindam Chandra wrote:
Thanks for the answer. Still one thing is not clear. Whatever context path I declare
for my web app as the value of <context-root> element in the weblogic.xml (in
my example it's "/testapp"), it is no where mapped with the "URI" attribute (or
any other attribute, sub-element whatsoever in the <Application> element).
Application Deployed="true" Name="TestWebApp"
Path="D:\WL8\weblogic81\TestDeploy\build" TwoPhase="true">
<WebAppComponent Name="TestWebApp" Targets="myserver" URI="TestWebApp"/>
</Application>
So when a request of the form http://myweblogic.com:7001/testapp/... arrives at
the server, how does the server knows that it has to serve this request with files
from D:\WL8\weblogic81\TestDeploy\build\TestWebApp ? It should not be like the
web container iterates thru all the web application entries in config.xml and
tries to match with one context-root declaration. I repeat, I expected some mapping
similar to Tomcat's server.xml, where in the <docbase> element u clearly specify
the mapping between the context path and the physical directory
Rob Woollen <[email protected]> wrote:
Arindam Chandra wrote:
I'm running Weblogic 7.0 on Windows2000.The physical directory of myweb application
is D:\WL8\weblogic81\TestDeploy\build\TestWebApp and under these directoryI have
my JSPS, static HTML and WEB-INF. I define the context path of thisweb app in
the weblogic.xml ;-
<weblogic-web-app>
<context-root>/testapp</context-root>
</weblogic-web-app>
As a result of deploying this web app in the server (or it may be createdmanually
also), the following entry gets inserted in the server's config.xml,-
<>So the server will look for your web application at the Application Path
(D:\WL8\weblogic81\TestDeploy\build|) + the web uri (TestWebApp). So
it
maps the context-root you've specified /testapp to that path.
It's a little clearer in the case where you had a full-fledged EAR.
Then you'r application path would map to the "root" of the EAR, and the
uris would point to the various modules (eg webapps.)
-- Rob
Now, whenever I make a request of the form "http://localhost:7001/testapp/..",
it's properly executing my web app. My question is, how does the containerknows
that for any request for the web app with context path as 'testapp',it has to
server files from D:\WL8\weblogic81\TestDeploy\build\TestWebApp. Inthe above
process, nowhere such mapping is specified. I expected something likeTomcat's
server.xml, where in docbase we clearly specify this mapping betweenthe context
path and the physical directory. Please help. -
Hello,
I am working on XSLT mapping, where i am trying to add similar values but when i upload the .xsl file i get a Java Null pointer Error, this is the error :-
*Cause: Unable to recognize the loaded document as valid XSD*
*Error when parsing XSD document com.sap.aii.utilxi.xsd.api.XsdException: A schema must start with the tag <schema> that belongs to "http://www.w3.org/2001/XMLSchema" namespace*
This is the complete XSLT file that m trying to upload.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<!-- Build a key to group item by itemDescription -->
<xsl:key name="itemDescription" match="salesOrder/item" use="itemDescription"/>
<xsl:template match="/">
<salesOrder>
<!-- iterate on each group -->
<xsl:for-each select="salesOrder/item[generate-id(.) = generate-id(key('itemDescription', itemDescription)[1]) ]">
<xsl:variable name="group" select="key('itemDescription', itemDescription)"/>
<xsl:variable name="itemDescription">
<xsl:value-of select="itemDescription"/>
</xsl:variable>
<xsl:variable name="itemRetailPrice">
<xsl:value-of select="sum($group/itemRetailPrice)"/>
</xsl:variable>
<xsl:variable name="itemSalePrice">
<xsl:value-of select="sum($group/itemSalePrice)"/>
</xsl:variable>
<!-- Generate the final XML file -->
<item>
<itemDescription>
<xsl:value-of select="$itemDescription"/>
</itemDescription>
<itemRetailPrice>
<xsl:value-of select="$itemRetailPrice"/>
</itemRetailPrice>
<itemSalePrice>
<xsl:value-of select="$itemSalePrice"/>
</itemSalePrice>
</item>
</xsl:for-each>
</salesOrder>
</xsl:template>
</xsl:stylesheet>
Thanks !!
HarpreetThe message was 1 related to some errors at External definition. That y i asked that question.
Are u getting any other error now?
This looks distorted after posting
Now for ur xsl file
Instead of
<xsl:for-each select="salesOrder/item[generate-id(.) = generate-id(key('itemDescription', itemDescription)1])">
Use
<xsl:for-each select="salesOrder/item[generate-id(.) = generate-id(key('itemDescription', itemDescription)[1]) ]">Regards,
Prateek
Maybe you are looking for
-
How to use array or type in "IN" criteria
Hi all, anybody knows how to use group of same datatype data ( array or type ) in SQL statement For example ls_dept[1] = 'abc'; ls_dept[2] = 'xyz'; ls_dept[10] = 'ppr'; i want to use this group of data in "IN" criteria like Select * from department w
-
CS4 auto resize document window?
In CS3, the document window abutted the palette (panel) stack and expanded automatically when I collapsed the stack. How do I make CS4 (Windows XP) do this?
-
Dear all, I need some advice on how to display results of an SQL query in Forms.My scenario is as follows: The use need to searchs for a First name in Table called Customers. Users enters User name need and press Search Button.I need to display all n
-
What has happened to the HISTORY in the latest FF?
I missed version 26 and went from 25 to 27. With the other problem I am having, I reloaded FF and went to my HISTORY to get back some pages which I was looking at. VOILA! History is EMPTY. Today, This week, This month, This YEAR! ALL EMPTY! I ONLY up
-
Backing up iPhoto Library, including "PROJECTS"
Hello - I have a problem with iChat, and Apple says I should back-up and reload from system discs (this question is about iPhoto...please read on...) I have an extensive iPhoto "project", which is a book that is approx. 80 pages (photos and written t