[JBoss Seam] - Re: Newbie Question on JSF/Seam
by pete.muirï¼ jboss.org
Page parameters are the best way to do this:
<s:link action="#{bean.select}" value="Select"/>
| <f:param name="clientId" value="#{foo.clientId}" />
| <f:param name="programId" value="#{foo.programId}" />
| </s:link>
Where foo is the var in the datatable.
<page view-id="/list.xhtml">
| <param name="clientId" value="#{client.id}" />
| <param name="clientId" value="#{program.id}" />
@In Client client;
| @In Program program;
|
| public void select() {
| }
You have injected the selected client and program (you need to make client and program available as contextual variables) - you can then put them in the session or whatever - watch out for LazyInitializationExceptions though. Read the SeamApplicationFramework chapter for more on this approach
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056778#4056778
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056778
18Â years, 10Â months
[JBossWS] - Re: Problem with inheritance and JBossWS
by hannes.koller
Ok I have managed to create a simple example of the behavior. Please note that I am pretty new to webservices and JBossWS (started using it a few days ago) so sorry if something is overly complicated. Feedback is highly appreciated.
I am using JBoss 4.2.0.GA and java version "1.5.0_08"
I started with the following WSDL (I have modified an echo tutorial I found on the web so please dont be confused by the namespace and other irregularities):
| <?xml version="1.0" encoding="UTF-8"?>
| <definitions name='EchoService' targetNamespace='http://echo/'
| xmlns='http://schemas.xmlsoap.org/wsdl/'
| xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
| xmlns:tns='http://echo/'
| xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types>
| <xs:schema targetNamespace='http://echo/' version='1.0'
| xmlns:tns='http://echo/'
| xmlns:xs='http://www.w3.org/2001/XMLSchema'>
|
| <xs:complexType name='Something'>
| <xs:sequence>
| <xs:element minOccurs='0' name='arg0' type='xs:string' />
| </xs:sequence>
| </xs:complexType>
|
| <xs:complexType name='A'>
| <xs:sequence>
| <xs:element minOccurs='0' name='arg0' type='xs:string' />
| </xs:sequence>
| </xs:complexType>
|
| <xs:complexType name='B'>
| <xs:complexContent>
| <xs:extension base="tns:A">
| <xs:sequence>
| <xs:element minOccurs='0' name='arg1' type='xs:string' />
| </xs:sequence>
| </xs:extension>
| </xs:complexContent>
| </xs:complexType>
| <xs:complexType name='C'>
| <xs:complexContent>
| <xs:extension base="tns:B">
| <xs:sequence>
| <xs:element minOccurs='0' name='arg2' type='xs:string' />
| </xs:sequence>
| </xs:extension>
| </xs:complexContent>
| </xs:complexType>
|
| <xs:complexType name="BResponse">
| <xs:sequence>
| <xs:element name="something" type="tns:Something" minOccurs="1" maxOccurs="1" nillable="true"/>
| <xs:element name="b" type="tns:B" minOccurs="1" maxOccurs="1" nillable="true"/>
| </xs:sequence>
| </xs:complexType>
|
| <xs:element name="bResponse" type="tns:BResponse"/>
| <xs:element name="something" type="tns:Something"/>
| </xs:schema>
| </types>
|
| <message name='GetB_Request' />
|
| <message name='GetB_GetBResponse'>
| <part name='para' element="tns:bResponse"/>
| </message>
|
| <portType name='GetB'>
| <operation name='getB' >
| <input message='tns:GetB_Request'/>
| <output message='tns:GetB_GetBResponse' />
| </operation>
| </portType>
| <binding name='GetBBinding' type='tns:GetB'>
| <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http' />
| <operation name='getB'>
| <soap:operation soapAction='' />
| <input>
| <soap:body use='literal' />
| </input>
| <output>
| <soap:body use='literal' />
| </output>
| </operation>
| </binding>
| <service name='GetBService'>
| <port binding='tns:GetBBinding' name='GetBPort'>
| <soap:address location='REPLACE_WITH_ACTUAL_URL' />
| </port>
| </service>
| </definitions>
|
We have an A->B->C Class Hierarchy here, and a BResponse Complex Type which consists of a "B" and a "Something". Note the "minOccurs=1 maxOccurs=1 nillable=true " . If I throw the file at wsconsume it creates a number of classes. The BResponse Class looks like this:
| @XmlAccessorType(XmlAccessType.FIELD)
| @XmlType(name = "BResponse", propOrder = {
| "something",
| "b"
| })
| public class BResponse {
|
| @XmlElement(required = true, nillable = true)
| protected Something something;
| @XmlElement(required = true, nillable = true)
| protected B b;
| ....}
|
I have written a very simple Server:
| @javax.jws.WebService(endpointInterface="echo.GetB", serviceName="GetBService", targetNamespace="http://echo/", portName="GetBPort" )
| public class DummyGetB implements GetB {
|
| public BResponse getB() {
|
| BResponse response = new BResponse();
|
| C c = new C();
| c.setArg0("1");
| c.setArg1("2");
| c.setArg2("3");
|
| response.setB(c);
|
| return response;
| }
|
| }
|
and a Client:
| public class Client {
|
| public static void main(String[] args) throws Exception {
| GetBService getB = new GetBService(new URL("http://127.0.0.1:8080/server?wsdl"),new QName("http://echo/", "GetBService"));
|
| GetB getBPort = getB.getGetBPort();
| BResponse bResponse = getBPort.getB();
|
| System.out.println(bResponse.getB().getClass());
| B b = bResponse.getB();
| System.out.println(b.getArg0());
| System.out.println(b.getArg1());
| C c = (C)bResponse.getB();
| System.out.println(c.getArg2());
| }
|
If I try this example I get:
| class echo.B
| 1
| 2
| Exception in thread "main" java.lang.ClassCastException: echo.B
| at at.ac.arsenal.Client.main(Client.java:53)
|
Only a "B" gets transmitted, although it should be a "C"
Now, to get the behavior I was talking about change the minOccurrs parameter of something element of BResponse to 0:
| ..............
| <xs:complexType name="BResponse">
| <xs:sequence>
| <xs:element name="something" type="tns:Something" minOccurs="0" maxOccurs="1" nillable="true"/>
| <xs:element name="b" type="tns:B" minOccurs="1" maxOccurs="1" nillable="true"/>
| </xs:sequence>
| </xs:complexType>
| ................
|
Then rerun wsconsume. The generated BResponse class now looks like this. Notice the JAXBElement type of variable something;
| @XmlAccessorType(XmlAccessType.FIELD)
| @XmlType(name = "BResponse", propOrder = {
| "something",
| "b"
| })
| public class BResponse {
|
| @XmlElementRef(name = "something", type = JAXBElement.class)
| protected JAXBElement<Something> something;
| @XmlElement(required = true, nillable = true)
| protected B b;
|
I Recompile and Redeploy the server then rerun the Client. The output is now:
| class echo.C
| 1
| 2
| 3
|
now C gets transmitted and the arg2 property has the correct value.
As I said before this is of course no solution to the original problem, but I think it might be useful in tracking down the source of it.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056777#4056777
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056777
18Â years, 10Â months
[JBoss Seam] - seam email unwanted text in email
by susnet
I wonder why my emails look like this:
------=_Part_8_21777063.1180128429593 Content-Type: multipart/alternative; boundary="----=_Part_9_28910288.1180128429609" ------=_Part_9_28910288.1180128429609 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline ------=_Part_9_28910288.1180128429609 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Name:sus
Email:s@s.se
Message:test
------=_Part_9_28910288.1180128429609-- ------=_Part_8_21777063.1180128429593--
-----
Why does this Part_X get printed out in the email? Is there some configuration that i have missed?
This is what my code looks like:
| <?xml version="1.0" encoding="ISO-8859-1" ?>
|
| <m:message xmlns="http://www.w3.org/1999/xhtml"
| xmlns:m="http://jboss.com/products/seam/mail"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core">
|
| <m:header name="Content-Transfer-Encoding" value="8bit"/>
| <m:header name="Content-Type" value="text/html; charset=iso-8859-1;" />
| <m:header name="Content-Disposition" value="inline" />
|
| <m:from name="Webmaster X.se" address="webmaster(a)X.se" />
| <m:to name="X" address="X(a)X.se" />
| <m:subject>Contakt: <h:outputText value="#{contact.subject}"/> </m:subject>
|
| <m:body type="html">
|
| <html>
| <p><b>Name:</b> <h:outputText value="#{contact.visitorName}"/></p>
| <p><b>Email:</b> <h:outputText value="#{contact.email}"/></p>
| <p><b>Message:</b> <h:outputText value="#{contact.message}"/></p>
| </html>
| <f:facet name="alternative">Sorry your emailprogram does not support HTML.</f:facet>
| </m:body>
|
| </m:message>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056773#4056773
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056773
18Â years, 10Â months
[JBoss Seam] - Re: How to extract the page id
by trekker880
Hi this is my simple code -
package example;
import java.io.FileInputStream;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.core.Jbpm;
import org.jboss.seam.core.Pageflow;
import org.jbpm.graph.def.ProcessDefinition;
//@Name("submit2")
//(a)Scope(ScopeType.PAGE)
public class UserTest {
@Create
@Begin(pageflow="submit2")
public void test() throws Exception{
//Jbpm jbpm = new Jbpm();
boolean b;
System.out.println("--Before the instance---");
ProcessDefinition pageflowDefinition =Jbpm.instance().getPageflowProcessDefinition("submit2");
if(pageflowDefinition == null){
System.out.println("----------pageflowDefinition is null-----------");
}else{
System.out.println("----------pageflowDefinition is not null entry-----------");
}
}
public static void main(String[] args) throws Exception{
UserTest test1 = new UserTest();
test1.test();
}
}
Here i am getting the IlligalStateException at the getpageflowProcessDefinition() method. Is there any sample code so that i can have a look and find out the procedure . Its urgent
**********
Exception in thread "main" java.lang.IllegalStateException: No application context active
at org.jboss.seam.core.Jbpm.instance(Jbpm.java:248)
at example.UserTest.test(UserTest.java:29)
at example.UserTest.main(UserTest.java:39)
****************
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056770#4056770
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056770
18Â years, 10Â months