[Installation, Configuration & Deployment] - Re: Jboss install
by jgayathri
/*
* SessionTestServlet.java
*
*/
package test.session;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
/**
* @author Deepak Kumar
* @Web http://www.roseindia.net
* @Email deepak(a)roseindia.net
*/
public class SessionTestServlet extends HttpServlet {
MyTestSessionHome testSessionBean;
public void init(ServletConfig config) throws ServletException{
//Look up home interface
try {
InitialContext ctx = new InitialContext();
Object objref = ctx.lookup("ejb/test/MyTestSessionBean");
testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref, MyTestSessionHome.class);
} catch (Exception NamingException) {
NamingException.printStackTrace();
}
}
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
PrintWriter out;
response.setContentType("text/html");
String title = "EJB Example";
out = response.getWriter();
out.println("");
out.println("");
out.println("Hello World Servlet!");
out.println("");
out.println("");
out.println("<p align=\"center\"><font size=\"4\" color=\"#000080\">Servlet Calling Session Bean");
try{
MyTestSession beanRemote;
beanRemote = testSessionBean.create();
out.println("<p align=\"center\"> Message from Session Bean is: " + beanRemote.SayHello() + "");
beanRemote.remove();
}catch(Exception CreateException){
CreateException.printStackTrace();
}
out.println("<p align=\"center\"><a href=\"javascript:history.back()\">Go to Home");
out.println("");
out.println("");
out.close();
}
public void destroy() {
System.out.println("Destroy");
}
}
deployment des:
<ejb-jar>
Example 3
<display-name>Example 3</display-name>
<enterprise-beans>
<!-- Session Beans -->
<display-name>My Test Session Bean</display-name>
<ejb-name>test/MyTestSession</ejb-name>
test.session.MyTestSessionHome
test.session.MyTestSession
<ejb-class>test.session.MyTestSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</enterprise-beans>
<assembly-descriptor>
</assembly-descriptor>
</ejb-jar>
jboss.xml:
<enterprise-beans>
<ejb-name>test/MyTestSession</ejb-name>
<jndi-name>ejb/test/MyTestSessionBean</jndi-name>
</enterprise-beans>
<resource-managers>
</resource-managers>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037419#4037419
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037419
19 years
[JBoss Seam] - Re: Seam enhanced EL expression fails in an Ajax4JSF tag
by fernando_jmt
"alexg79" wrote : According to my research, Ajax4JSF + Facelets = bust.
I disagree with you here. Facelets is a great technology to build the view on JSF applications, And Ajax4JSF is another one to AJAXify a JSF application.
I know sometimes when something does not work like we want, we look for something to blame. I absolutely think this is not the case.
Well, I download your example and configure it to Tomcat 5.5, which I'm using. I saw you had your project configured for JBoss 4.2, but I didn't care about it because the simplicity of your example.
Using simple JSP page it worked fine.
Using Facelets I got the exception you post here before (property instead action method). This was weird the first time, but then I found the cause for the problem was a simple 's'.
I mean, you had this:
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:a4j="http//ajax4jsf.dev.java.net/ajax"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| lang="en" xml:lang="en">
| ...
|
But, it should be:
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| lang="en" xml:lang="en">
| ...
|
Sorry, because I didn't see the error in the last code you post here. But sometimes to find this kind of errors one must have the code running.
So, take care with the xhtml namespaces next time ;-)
Regards.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037418#4037418
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037418
19 years
[JBoss Seam] - Re: Problems with extended EL syntax.
by Delphi's Ghost
Here's my take on it, I'm not a seam expert, but I have had my fair share of these types of problems. However, trying some or all of these ideas may help you out.
I believe that the standard JSF way of accessing a list (i.e. MyBean.myList) isn't good enough for the enhanced EL syntax, nor for the DataModelSelection, you need to make into a "seam variable".
You can see this in action in the UI demo in the examples directory, just look at the Factories.java code :
| @Name("factories")
| public class Factories
| {
| @Factory("honorifics")
| public Honorific[] getHonorifics() {
| return Honorific.values();
| }
|
| }
|
|
I'm guessing here, they provide a method which can be used to generate the honorifics array and provide it as a seam contexted variable called "honorifics"
So, in your action bean (you didn't say what datatype strings is (list, array etc), but assuming a list), you have :
|
| List<String> strings;
|
| @Factory("strings")
| public makeStrings() {
| strings = new List<String>();
| strings.add("Name1");
| strings.add("Name2");
| }
|
|
In your page, you use :
| <h:dataTable var="string" value="#{strings}>
|
Where strings is the name of your factory generated seam variable.
Alternatively, in your bean, you could just put :
| @DataModel
| List<String>strings;
|
and make your web page code the same as above. This essentially does the same thing, creating a seam variable with the name strings, which you can access from your page.
I'm sure someone with more knowledge and/or experience will correct me, but this might get you started on your way.
If you have no luck, post a bit more of your simple test (page and action bean code) and I'm sure I, or someone else will be able to find the answer.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037416#4037416
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037416
19 years