This week's book giveaway is in the Raspberry Pi forum.
We're giving away four copies of Getting started with Java on the Raspberry Pi and have Frank DelPorte on-line!
See this thread for details.
Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!

Abhijeet Vaidya

Greenhorn
+ Follow
since Apr 16, 2007
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 Abhijeet Vaidya

Hi,

I am looking for a java based solution for an application with online/offline capabilities. User should be able to work offline (client) and when he comes online on company network, he should be able to send data to the server.

Also need a functionality to send data from server to client. What all APIs can be used?

Can JMS be one solution?

Any suggestions are welcome.


Thank you.
Abhijeet
15 years ago
Hi,

When I keep scope of my managed bean as session, everything works fine but the moment I change it to request, error page is displayed. There is no error / exception in the server log. When I checked boot.log file , somewhere I found the first 2 lines & then it forwards control to error.jsp -

20:23:13,934 DEBUG [JspStateManagerImpl] Exiting restoreTreeStructure - No serialized view found in server session!
20:23:13,934 DEBUG [LifecycleImpl] exiting from lifecycle.execute in RESTORE_VIEW(1) because getRenderResponse is true from one of the after listeners
20:23:13,934 DEBUG [ApplicationDispatcher] servletPath=/pages/error.jsp, pathInfo=null, queryString=null, name=null


I just can not understand what is wrong in it.


Thanks,
Abhijeet
15 years ago
JSF
Hi,

As far as I understand, managed beans are normal POJOs registered in faces-config, instantiation is managed by framework. Properties of managed beans are bound to UIComponent properties.

e.g.
<h:inputText
value="#{ManagedBean.propertyName}"/>

Whereas, backing beans are special form of managed beans where instead of values, actual UIComponents are bound to bean properties.

e.g.

<h:inputText
binding="#{BackingBean.someUICommandInstance}"/>

uses binding attribute instead of value.


Cheers!!!
~Abhijeet
15 years ago
JSF
Thanks for your reply.

yeah, that's what it looks like. But won't it cause too much load on the server? if practically, backing beans (with domain objects) are same for data input and display and all are stored in session?

Also, if we do request.setAttribute() in java method, we can access those values in normal jsp, but it seems like that is not happening in case of JSF.

Correct me if I am wrong.


Thanks,
Abhijeet
[ June 02, 2008: Message edited by: Abhijeet Vaidya ]
15 years ago
JSF
Hi,

I am trying to implement a very simple example, where I am invoking one jsp from another using jsf and spring framework. given below are the code snippets -

web.xml contents -


<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<!--context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param-->

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>-1</load-on-startup>
</servlet>


<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

</web-app>

faces-config contents -

<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>

<application>
<variable-resolver>
org.springframework.web.jsf.DelegatingVariableResolver
</variable-resolver>
</application>

<managed-bean>
<description>
Backing bean that contains transaction information.
</description>
<managed-bean-name>firstBean</managed-bean-name>
<managed-bean-class>com.rnd.web.faces.backinbean.FirstBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

<navigation-rule>
<from-view-id>/pages/one.jsp</from-view-id>
<navigation-case>
<from-outcome>second</from-outcome>
<to-view-id>/pages/two.jsp </to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>

</faces-config>

application-context contents -


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

<bean id="firstBean" class="com.rnd.web.faces.backinbean.FirstBean" scope="request">
</bean>
</beans>

I am calling FirstBean.firstToSecondMethod from one.jsp, setting some values in the method and calling two.jsp -

public String firstToSecMethod(){
System.out.println("inside java method.. ");
firstProp = "prop set in FirstBean java";
secondProp = 10;
return "second";
}

but two.jsp does not display the values

<td><h:outputText value="#{firstBean.firstProp}"/></td>

after changing the bean scope to session values are getting displayed properly.

I am not sure why this is happening.

I think request scope should work fine. Please advise.


Thanks,
Abhijeet
15 years ago
JSF
Thanks for your prompt reply..

What I am trying to do is -

I have to validate dates entered in the JTable. So I have created a class as the editor for JTable cells. The formattedTextField I am getting, by calling the getComponent() method of the DefaultCellEditor. I want to validate the date entered by the user, when he leaves the cell.


Thanks,
Abhijeet
15 years ago
Hi,

I want to perform some action in editor of a JFormattedTextField. So I have added "Tab" and "Enter" in the input map and specified actionMap for it.



ftf.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), AppConstants.CHECK);

ftf.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), AppConstants.CHECK);

ftf.getActionMap().put(AppConstants.CHECK, new AbstractAction() {
public void actionPerformed(ActionEvent e) {

// custom code
}});


here ftf is JFormattedTextField.


How can I add mouse click to the input map the way I added Keystroke.getKeyStroke(KeyEvent.VK_TAB, 0)?

Right now when I enter the value and click the mouse button, ftf does not recognize it as valid input.



Thanks,
Abhijeet
15 years ago
yeah, I did that and it worked fine. Thanks.


Abhijeet
15 years ago
Hi,

I want to send an attachment of size around 150MB to web application deployed on jboss server. What all configurations do I need to work on? When I tried with as-is configuration for 37MB file it went, for 60MB file server threw OutofMemoryError.

Thanks.
Abhijeet
[ October 17, 2007: Message edited by: Abhijeet Vaidya ]
15 years ago
Hi,

Are there any size constraints when we use SAAJ for attachments with WS? What is the average size of attachment in MB which could be sent over the network using SAAJ?

Thanks
Abhijeet
15 years ago
Hi Rob,

Thanks for the code, but still things are not working for me. My scenario is like this: I have a swing screen with one JTable in the middle of the screen and a logo image below the JTable resulting in 2 pages (print wise). I am new to swing/printing, so cold you please help me with the multiple page thing? I am not getting how to use Doc or Book as you suggested. I am passing my entire JFrame as component to print(). Also as per my understanding graphics.translate() should rearrange the table according to page coordinates, but even it's not happening that way. Let me know if you want me to send a screen shot of the page am trying to print.

Thanks a lot!!
Abhijeet
16 years ago
Hi,

I want to print the entire swing screen (with content) using Java print API. How should I go about it? I tried calling print()/printAll() method on JFrame, but it's creating a problem in component alignment on the paper. Like only half JTable is getting printed etc. Do I need to override paintComponent(Graphics g) before printing the each component or is there any better way of doing it?

Thanks in advance.
Abhijeet
16 years ago
your showportal.jsp file uses JSTL (Java Standard Tag Library) tags. So you will require jstl.jar and standard.jar in your WEB-INF/lib.

required jars could be found here


Thanks and Regards,
Abhijeet
16 years ago
JSP
Thanks a lot Purushottaman.
16 years ago
Hi,

My problem is solved now. I can load the third party jars residing in WEB-INF/lib, using system classloader by dynamically modifying the class path. Credit goes to this.. I hope that System classloader behavior (extending URl ClassLoader) will be the same across platforms.

Thanks.
16 years ago