[JBoss Seam] - Re: Help on s:filleupload
by ghiormar
Is it normal behavior for the <s:fileUpload> to call the setter for byte[] twice? I'm mean first it calls it for the byte[] with the file data and then it calls it with a null. I used seam 1.2.1.GA on jboss 4.0.5.GA. The project was build with seam-gen.
package app.beans.entity;
|
| import javax.ejb.Remove;
| import javax.ejb.Stateful;
|
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Destroy;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.core.FacesMessages;
| import org.jboss.seam.log.Log;
|
| @Stateful
| @Name("uploadFile")
| @Scope(ScopeType.EVENT)
| public class UploadFile implements java.io.Serializable, UploadFileI {
| private static final long serialVersionUID = 940956938635067807L;
| @Logger
| private Log log;
| private byte[] byteArray;
| private String fileName;
| private String size;
| private static int count = 0;
| public UploadFile() {
| }
| public String getFileName() {
| return fileName;
| }
| public void setFileName(String fileName) {
| this.fileName = fileName;
| FacesMessages.instance().add("i'm here set File name = "+this.fileName);
| }
| public byte[] getByteArray() {
| return byteArray;
| }
| public void setByteArray(byte[] byteArray) {
| count++;
| //SUGESTED FIX
| // if (byteArray == null) {
| // FacesMessages.instance().add("i'm here setByteArray("+byteArray+");null count:"+count);
| // return;
| // }
| this.byteArray = byteArray;
| FacesMessages.instance().add("i'm here setByteArray("+byteArray+"); count:"+count);
| }
| public String getSize() {return size;}
| public void setSize(String size) {
| this.size = size;
| FacesMessages.instance().add("i'm here set File size = "+this.size);
| }
|
| @Remove @Destroy
| public void destroy() {
| }
| public void reset() {
| count=0;
| }
| }
the interface
| package app.beans.entity;
|
| import org.jboss.annotation.ejb.Local;
|
| @Local
| public interface UploadFileI {
| public String getFileName();
| public void setFileName(String fileName);
| public byte[] getByteArray();
| public void setByteArray(byte[] byteArray);
| public String getSize();
| public void setSize(String size);
| public void destroy();
| public void reset();
| }
|
the form
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:h="http://java.sun.com/jsf/html">
| <head>
| <title>Test Upload</title>
| </head>
| <body>
| <h:messages styleClass="message"/>
| <h:form id="form" enctype="multipart/form-data">
|
| <h:panelGrid columns="2">
| <h:outputText value="file name" />
| <h:outputText value="#{uploadFile.fileName}" />
|
| <h:outputText value="file size" />
| <h:outputText value="#{uploadFile.size}" />
|
|
| <h:outputText value="file size" />
| <h:inputTextarea value="#{uploadFile.byteArray}" />
|
| <s:fileUpload data="#{uploadFile.byteArray}" fileName="#{uploadFile.fileName}" fileSize="#{uploadFile.size}"/>
| <h:commandButton action="#{uploadFile.reset}" value="reset"></h:commandButton>
| </h:panelGrid>
| </h:form>
| </body>
| </html>
|
what to expect
| * i'm here setByteArray([B@12e0415); count:1
| * i'm here set File name = IMG_3332.jpg
| * i'm here set File size = 1647973
| * i'm here setByteArray(null); count:2
|
I was get NPE when trying to access the 'byteArray' an couldn't figure out why. Since the fileName and size where set ok.
Is this a bug ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034977#4034977
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034977
19 years
[JBoss AOP] - Re: JBOSS AOP on Websphere 6.1
by marimuthub
Kabir Khan,
Compile time aopc is working fine with websphere. But I have to use load time weaving as per the requirement
Kabir Khan\flavia rainone,
I also believe there is something wrong with class loader. There are two ways to apply classpath, javaagent and jboss aop path in websphere
First way
There is a server start up file (startserver.bat) under bin directory.
I have made following modifications in JVM settings
1. I have added jboss aop dependency jar files to classpath
2. I have added following javaagent variable.
-javaagent:D:\jboss-aop_1.5.5.GA\lib-50\jboss-aop-jdk50.jar
3. I have added following -X option
-Xbootclasspath/p:%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\jre\lib\core.jar
Now i am able to start the server without any error and exception. Application also running but aspect instrumentation is not happening
Second way:
There is configuration file (server.xml) for websphere server. In that XML file there is a tag called ?jvmEntries?.
I have made following modifications in the ?jvmEntries? tag
1. I have added jboss aop dependency jar files to classpath
2. I have added following jar files in bootclasspath and also in classpath
%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\jre\lib\core.jar
3. I have added
-javaagent:D:\jboss-aop_1.5.5.GA\lib-50\jboss-aop-jdk50.jar option under "genericJvmArguments" attribute.
The server is not starting properly it is giving same exception as mentioned earlier. If I remove javaagent option the server is starting successfully. But javaagent option is mandatory for Jboss aop application.
There is no strong documentation for all the JVM options in websphere documentation. So I have done above changes trial and error method.
Please help me
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034972#4034972
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034972
19 years
[JBoss AOP] - Re: JBOSS AOP on Websphere 6.1
by marimuthub
Kabir Khan,
Compile time aopc is working fine with websphere. But I have to use load time weaving as per the requirement
Kabir Khan\flavia rainone,
I also believe there is something wrong with class loader. There are two ways to apply classpath, javaagent and jboss aop path in websphere
First way
There is a server start up file (startserver.bat) under bin directory.
I have made following modifications in JVM settings
1. I have added jboss aop dependency jar files to classpath
2. I have added following javaagent variable.
-javaagent:D:\jboss-aop_1.5.5.GA\lib-50\jboss-aop-jdk50.jar
3. I have added following -X option
-Xbootclasspath/p:%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\jre\lib\core.jar
Now i am able to start the server without any error and exception and application also running but aspect instrumentation is not happening
Second way:
There is configuration file (server.xml) for websphere server. In that XML file there is a tag called ?jvmEntries?.
I have made following modifications in the ?jvmEntries? tag
1. I have added jboss aop dependency jar files to classpath
2. I have added following jar files in bootclasspath and also in classpath
%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\jre\lib\core.jar
3. I have added
-javaagent:D:\jboss-aop_1.5.5.GA\lib-50\jboss-aop-jdk50.jar option under "genericJvmArguments" attribute.
The server is not starting properly it is giving same exception as mentioned earlier. If I remove javaagent option the server is starting successfully. But javaagent option is mandatory for Jboss aop application.
There is no strong documentation for all the JVM options in websphere documentation. So I have done above changes trial and error method.
Please help me
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034971#4034971
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034971
19 years
[Installation, Configuration & Deployment] - Two War files
by kapils
I have a struts application
Before I put all the contents into the ROOT.war.
Now I want to make separate applications i.e. first.war and second.war and would like to put it into the deploy folder of jboss.
But my problem is ---
I was using the action path in the jsp's as following
<form action="/LoginAction.do"
and struts-config mapping as
<action
path="/LoginAction"
and it is not working now.
If i change it to <form action="/first/LoginAction.do"
in first appliation and <form action="/second/LoginAction.do" in the second application. , it is working perfectly fine.
Help---
I would like to know whether we can specify any mapping either in web.xml, struts-config.xml or jboss(to make two root folders) so that i need not to change my application' actions throughout. Plz help me . I m stuck.
Otherwise i have to change all the paths in two application. Hoping there could be a better solution
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034967#4034967
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034967
19 years