Amit Nair

Greenhorn
+ Follow
since May 23, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amit Nair

Hello friends,

I have got over 5 Yrs of experience in Java/J2EE (working in India). I am looking for onsite opportunities in Singapore. Could anyone please let me know about salary expectation and cost of living there.

Regards
Amit
12 years ago
try these things
1. above the table put h:messages tag & see whats errors are coming there, try resolving by that
2. add attribute immediate=true in h:commandLink
3. check the scope of bean, if its request then try changing it to session
15 years ago
JSF
There is a built in component(rich:datatable) with the effect of change in row color on mouse over. This is ajaxified & support to nested tables is also provided.

http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?c=dataTable

Code Snippet:---

has attributes like onRowMouseOver, onRowMouseOut
15 years ago
JSF
Hi Harry

Could paste complete code of jsp.
btw what is the scope of your backing bean??
15 years ago
JSF
Hi,
iam developing an application using JSF , i wonder how can i alter the Default renderation behavior for CommandButtons , lets say for example , if the Text of the command is "xx" to be disabled ( by Renderer ) , is this applicable with the Existed renderer (i don't want to create a new rendrer for this) and how , Thanks in advance

Regards,
--------------------

OCP , SCJP 5.0



Hi

I am not sure whether I got your problem correctly, but as per my understanding I think that probaly you want to disable a command button if it's title is "xx". I am putting down the code of the backing bean along with that of JSP. Hope this is what you are looking for

=====Backing Bean=====

public class MyBean
{
private String text ="xx";

/**
* @return Returns the text.
*/
public String getText() {
return text;
}

/**
* @param text The text to set.
*/
public void setText(String text) {
this.text = text;
}
}

=====JSP=====
<h:commandButton value="#{myBean.text}" disabled="#{myBean.text eq 'xx'}"/>



Regards
Amit
15 years ago
JSF
Hi Team

I am stuck in a problem.
In my application I have got two menus. The one which is on the top[acts as a global menu through out the application] & one on the left side of the pages. The top menu is built using javascript & h:commandLink. Left menu is tomahawk t:panelNavigation2. So now my requirement is on the click of global menu some page should open & the same should be reflected in the left menu too ie left menu must expand or collapse accordingly. Since the user is not clicking the left panel so it is not expanding. So how can we expand or collapse t:panelNavigation2 programmatically�.

I have tried using the �active� attribute of t:commandNavigation2, but it is just showing the menu selected. The sub content of menu is not seen.

Thanks in Advance
Amit Nair
15 years ago
JSF
Hi Ray

It is possible to render a jnlp to client which is created dynamically.
First of all fetch the paramaters values from request which you want to pass dynamically in jnlp. Create a JSP like the one below

<%

String param1 = request.getParameter("paramNameInRequest");

response.setContentType("application/x-java-jnlp-file");
response.setHeader("Expires", "0");
response.setHeader("Content-disposition", "filename=myfile.jnlp");
response.addDateHeader("Date", java.util.Calendar.getInstance().getTime().getTime());
response.addDateHeader("Last-Modified", java.util.Calendar.getInstance().getTime().getTime());

%>



<?xml version="1.0" encoding="utf-8"?>
<jnlp codebase="http://localhost:8080/XXX/myResource" href="myfile.jnlp?param1=<%=param1%>">

<!-- Put your code for jnlp here-->

<application-desc main-class="org.eclipse.core.launcher.WebStartMain">
<argument><%=param1%></argument>
</application-desc>

</jnlp>

Hope this works for you.

Regards
Amit
16 years ago
JSF
Hi Team

I am trying to integrate the JSF & DWR.

In the jsp page I have got a dataTable which is iterating over a list of objects, based upon whose values the components are displayed inside DataTable. The final output of the dataTable is a series of questions against which there are various type of components which server as answer for the question. This comes fine.

But now my requirement is if I change certain value of component then it should trigger a server call & fetch some new questions & their answers. For this I am using DWR. Through DWR I am able to call a method of managed bean which return a List of Objects. Based upon the value of objects I am creating the components [text box, drop down etc] & adding it to the JSP. The components are coming on the page, but when the form is submitted these newly added components are not found in the view. On trying to find the value of component through java script I am getting the value. But since these newly added components are missing from the view root I am not able to save the correct data.

Could anyone through some light on this as where I am going wrong or what should I do to overcome this.

Thanks in Advance
Amit
16 years ago
JSF
Hi

I want to add some more information here. The database, WAR & JAR(EJb3) all are on the same machine. The code worked fine on my desktop, but it is failing when I do the deployment on the laptop.

I know it is strange but this is where I am getting stuck.

Can anyone provide me leads for the same.....

Thanks
Amit
16 years ago
JSF
Hi

Could you elabrate the exact scenario, as I am also having something similar

Regards
Amit
16 years ago
JSF
Hello Friends

I am stuck in a very strange kind of problem.
My application is having the following ejb3, jsf & JBoss-4.0.4.GA
I have got a jsp page which takes the user name & password of the user. The fields are binded to user object in the backing bean[scope is request]. When the user does a login the method in the backing bean is getting called. On doing a lookup[UserService userService = (UserService) context.lookup("UserServiceImpl/remote");] in the backing bean is throwing exception. But the same lookup works fine when tested in TestClass.


EXCEPTION:
javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: Deployment_5Dec/Delete/jboss-4.0.4.GA/server/default/deploy/Test.war/WEB-INF/classes/]

Code for doing the lookup

try
{
Hashtable <String,String> env = new Hashtable<String,String>();
env.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
env.put("java.naming.provider.url", "jnp://localhost:1099");
env.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
InitialContext context = new InitialContext(env);
UserService userService = (UserService)context.lookup("UserServiceImpl/remote");
user = userService.authenticateUser(user);
if(user != null && user.getUserId() != 0)
{
System.out.println("Logged in successfully");
}

}catch (Exception e)
{
e.printStackTrace();
}



The xml file of data source
mysql-ds.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- $Id: mysql-ds.xml,v 1.3.2.3 2006/02/07 14:23:00 acoliver Exp $ -->
<!-- Datasource config for MySQL using 3.0.9 available from:
http://www.mysql.com/downloads/api-jdbc-stable.html
-->

<datasources>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/test_db</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>hello</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<!-- should only be used on drivers after 3.22.1 with "ping" support
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
-->
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>


Thanks in Advance
Amit
16 years ago
JSF
Thanks a lot Richard for your reply !!!

I changed the scope of bean from request to session. Now the action method is getting called. But I found that both the beans(siteRequirementBean &
requirementDisplay) needs to be in session scope. But the command link is only calling the action method of requirementDisplay bean. So when only
requirementDisplay is kept in session scope, action method is not getting called. Also my whole application is built on the top of logic that the bean would be in request scope. So changing the scope of bean from request to session would be night mare & real problem. So can you please tell me is there any other way out of it� Also one of my page is having the data table with the bean in request scope & it's calling the action method without any problem. But I am unable to figure out as what is getting wrong here....

Thanks
Amit
16 years ago
JSF
Hi Friends

I am having trouble in calling the action method from command link inside datatable.

The code of the DataTable is

<h:dataTable id="siteDetailTable1" value="#{siteRequirementBean.detailHeadQuarterList}" var="details" cellpadding="1" cellspacing="1" width="100%">
<h:column>
<h:panelGrid columns="1" width="100%" columnClasses="none,tableRowOdd" rowClasses="tableRowEven,tableRowOdd">
<h:panelGroup>
<h:outputText value="Name: " />
<h:outputText value="#{details.name}" style="width: 55%" />
</h:panelGroup>
<h:panelGroup>
<h:outputText value="Location: " />
<h:outputText value="#{details.location}" style="width: 55%" />
</h:panelGroup>
<h:panelGroup>
<h:outputText value="Description: " />
<h:outputText value="#{details.description}" style="width: 55%" />
</h:panelGroup>
</h:panelGrid>
</h:column>
<h:column>
<h:commandLink action="#{requirementDisplay.viewDetailedRequirement}">
<h:outputText value="VDR" />
</h:commandLink>
</h:column>
</h:dataTable>

The managed beans siteRequirementBean & requirementDisplay both are in request scope.

The datatable has two columns. In the first column there 3 labels which displays some information. In the second column there is a command link. This command link is binded with an action method of managed bean. The page gets displayed with all the components including the commandlink , but on clicking the command link the action method is not getting called. The page gets refreshed & comes back again.

Infact I tried putting in arbitrary string in the action method�s name attribute of command link. There was no error & the page came back again on clicking the link.
If the same command link is kept outside data table then the action method gets called.

Command Button also shows the same behavior as command link.

Please give your valuable inputs�..

Thanks in Advance
Amit
16 years ago
JSF
Hi Ron

I never felt any prob in JSF - IE7. As of now i never hit across any problem. What problem are you facing?

Thanks,
Amit
16 years ago
JSF
Hi Team

I am having trouble in creating a correct way to login in my application. The problem is, if the user gives correct authentication in the first attempt then he is forwarded to the next page, on failure the same login page is shown. Now second time if the user gives correct username/password, the login doesn�t happen. Even the bean method is not called after the user hits submit.


The Login page is a simple JSP with two text field for user name & password .

<h:inputText id="userNameInput" value="#{authenticateAction.user.userName}" size="30" rendered="true" />

<h:inputSecret value="#{authenticateAction.user.password}" size="30" rendered="true" required="true" redisplay="false" id="password"/>

<h:commandLink id="login" action="#{authenticateAction.authenticate}">
<h:graphicImage id="loginGif" url="/images/trns_login_btn.gif" styleClass="greenbt" style="border-color: transparent; border-width: 0" />
</h:commandLink>


Code of bean
public class AuthenticateAction
{
private User user;

public AuthenticateAction() {
user = new User();
}
public String authenticate() {
// Code for authentication is done which return a User object

if (user != null) {
Map<String, User> sessionMap = context.getExternalContext().getSessionMap();
sessionMap.put("userLoggedIn", user);

return �SUCCESS�;
}
else
{
return �FAILURE�;
}
}
public User getUser() {
return user;
}

public void setUser(User user) {
this.user = user;
}

}
In the faces-config.xml the navigation for Login page is defined, �SUCCESS� takes the user to the next page & failure takes him back to the same page.

Please let me have your valuable input.

Thanks in advance

Amit
16 years ago
JSF