Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Main
TextFormattingRules
WhatIsWiki




JSPWiki v2.2.33

[RSS]


Hide Menu

SandBox


Difference between version 318 and version 277:

At line 1 changed 1 line.
Matt, You could try using the outputLink rather than the commandLink. The output link will generate a standard link. You might try adding a base tag. All JSF jsp must be dispached thur the faces servlet. It looks like your are using the /faces/* servlet mapping. I put togather a simple JSF component for this - like struts. I belive the the struts JSF baseline has one.
[this mailing list thread|http://nagoya.apache.org/eyebrowse/[email protected]&msgNo=451].
At line 3 changed 3 lines.
{{{
<h:dataTable value="#{viewcontroller.persons}" var="e" >
...
[What is this SandBox?|WhatIsThisSandBox]
At line 5 added 1 line.
[{Java2HtmlPlugin
At line 8 changed 5 lines.
<h:outputLink value="userProfile.jsp">
<f:param id="username" name="username" value="#{e.username}" />
<h:outputText value="#{e.username}" />
</sh:outputLink>
}}}
import javax.naming.Context;
import javax.naming.InitialContext;
At line 14 changed 1 line.
You might try using an EL in the managed bean for your detail page.
import junit.framework.TestCase;
At line 16 changed 11 lines.
{{{
<managed-bean>
<managed-bean-name>adduser</managed-bean-name>
<managed-bean-class>xxx.User</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>username</property-name>
<value>#{param['username']}</value>
</managed-property>
</managed-bean>
}}}
import org.mockejb.MockContainer;
import org.mockejb.SessionBeanDescriptor;
import org.mockejb.jndi.MockContextFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
At line 28 changed 1 line.
... or ....
/**
* Parent TestCase class for testing EJBs using MockEJB
*
* @author mraible
*
*/
public abstract class MockEJBTestCase extends TestCase {
At line 30 changed 1 line.
I might handle on the details page using the prerender callback of the script collector
/**
* This method sets up a MockContainer and allows you to deploy an EJB to
* it. Override <code>onSetUp()</code> to add custom set-up behavior.
*
* @see #onSetUp()
*/
protected final void setUp() throws Exception {
MockContextFactory.setAsInitial();
At line 32 changed 5 lines.
{{{
<hx:scriptCollector preRender="#{viewcontroller.load}">
public void load(FacesContext context) {
Context ctx = new InitialContext();
ApplicationContext appCtx =
new ClassPathXmlApplicationContext(getConfigLocations());
ctx.bind("java:comp/env/jdbc/appDS", appCtx.getBean("dataSource"));
MockContainer mc = new MockContainer(ctx);
SessionBeanDescriptor dd = getDeploymentDescriptor();
mc.deploy(dd);
onSetUp();
}
At line 38 changed 1 line.
// it looks like Shale is going to have a ViewController and BeanMapper to handle this kind of thing?
protected String[] getConfigLocations() {
return new String[] { "classpath:/applicationContext.xml" };
}
At line 40 changed 2 lines.
ValueBinding valuebinding = context.getApplication().createValueBinding("#{addUser}");
xxx.User user = (User) valuebinding.getValue(context);
protected void onSetUp() throws Exception {}
At line 43 changed 3 lines.
String userid = (String) context.getRequestParameterMap().get("username");
user.setUserid(userId);
protected abstract SessionBeanDescriptor getDeploymentDescriptor();
At line 47 removed 1 line.
}}}
At line 49 changed 1 line.
Base tag render example....
}]
At line 51 changed 2 lines.
{{{
public class OutputBaseRenderer extends HtmlBasicRenderer {
[CreateDAO_zh]
[CreateDAO_sp]
At line 54 changed 2 lines.
public void encodeEnd(FacesContext context, UIComponent uicomponent)
throws IOException {
[CreateManager_es]
At line 57 changed 4 lines.
ResponseWriter writer = context.getResponseWriter();
writer.write("<base href=\"");
writer.write(getActionURL(context, (OutputBase) uicomponent));
writer.write("\">");
[QuickStart Guide_es]
At line 62 changed 2 lines.
writer = null;
}
[SpringControllerUnitTest]
At line 65 removed 3 lines.
protected String getActionURL(
FacesContext context,
OutputBase uicomponent) {
At line 69 changed 40 lines.
String uri = context.getViewRoot().getViewId();
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
StringBuffer url = new StringBuffer();
url.append(request.getRequestURL());
// remove the Schema
for (int i = 4; i < 5; i++ ) {
if (url.charAt(i) == ':') {
url.delete(0, i);
break;
}
}
// remove all but the server name
for (int i = 3; i < url.length(); i++ ) {
if ((url.charAt(i) == ':') || (url.charAt(i) == '/')) {
url.setLength(i);
break;
}
}
if (uicomponent.isSecure()) {
url.insert(0, "https");
} else {
url.insert(0, "http");
}
url.append(":").append(uicomponent.getServerPort());
url.append(context.getApplication().getViewHandler().getActionURL(
context,
uri));
uri = null;
request = null;
return url.toString();
}
}
}}}
[δΈ­ζ–‡ζŒ‡ε—|Articles_zh]

Back to SandBox, or to the Page History.