[Shale] Having a static HTML inside a dynamic HTML page

2005-09-23 Thread Siva Jagadeesan
I was wondering whether there is a way to instruct clay to ignore some tags
and just render them the way they are.

For example, I am using FORM based authentication. I dont want clay to
change anything in my login.html. What I did is I changed login.html to
login.htm and by passed Clay. It worked great. But now I want to add a
logout button in login.htm and tie to a listener. I am not sure how I could
do it.

Is there anyway I could do something like this,

span jfcid=bypass
!-- login form --
/span
input type=submit value=logout/ !-- This will be attached to the
listener --


Re: [Shale] Having a static HTML inside a dynamic HTML page

2005-09-23 Thread Gary VanMatre
I was wondering whether there is a way to instruct clay to ignore some tags
and just render them the way they are.


The comment !-- -- block is the only way to do this currently.   
I think this would be a good feature.  I'll try to get it in soon. 


For example, I am using FORM based authentication. I dont want clay to
change anything in my login.html. What I did is I changed login.html to
login.htm and by passed Clay. It worked great. But now I want to add a
logout button in login.htm and tie to a listener. I am not sure how I could
do it.


You can use an action listener method binding expression.  
input type=submit value=logout 
actionListener=#{managed-bean-name.saveAction} /


An action listener object can only be registred with a component using the XML 
config.  


input type=submit value=logout jsfid=mybutton  /


component jsfid=myListener componentType=com.acme.MyListener /
component jsfid=mybutton extends=commandButton 
actionListener jsfid=myListener/
/component

I added a third *extreme* HTML full view rolodex example last night.  It 
defines the page using HTML and the default component definitions (no extra XML 
required).


Gary








---BeginMessage---
I was wondering whether there is a way to instruct clay to ignore some tags
and just render them the way they are.

For example, I am using FORM based authentication. I dont want clay to
change anything in my login.html. What I did is I changed login.html to
login.htm and by passed Clay. It worked great. But now I want to add a
logout button in login.htm and tie to a listener. I am not sure how I could
do it.

Is there anyway I could do something like this,

span jfcid=bypass
!-- login form --
/span
input type=submit value=logout/ !-- This will be attached to the
listener --
---End Message---
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: [Shale] Having a static HTML inside a dynamic HTML page

2005-09-23 Thread Siva Jagadeesan
Gary thanks for ur reply.

The problem is I want LoginForm action to be j_acegi_security_check
form action=j_acegi_security_check method=POST
/form

The only I could make it render this way is my bypassing clay. But for my
logout button,
input type=submit value=logout jsfid=mybutton / I need to go thru Clay
:(


On 9/23/05, Gary VanMatre [EMAIL PROTECTED] wrote:

 I was wondering whether there is a way to instruct clay to ignore some
 tags
 and just render them the way they are.


 The comment !-- -- block is the only way to do this currently.
 I think this would be a good feature. I'll try to get it in soon.


 For example, I am using FORM based authentication. I dont want clay to
 change anything in my login.html. What I did is I changed login.html to
 login.htm and by passed Clay. It worked great. But now I want to add a
 logout button in login.htm and tie to a listener. I am not sure how I
 could
 do it.


 You can use an action listener method binding expression.
 input type=submit value=logout actionListener=#{
 managed-bean-name.saveAction} /


 An action listener object can only be registred with a component using the
 XML config.


 input type=submit value=logout jsfid=mybutton /


 component jsfid=myListener componentType=com.acme.MyListener /
 component jsfid=mybutton extends=commandButton 
 actionListener jsfid=myListener/
 /component

 I added a third *extreme* HTML full view rolodex example last night. It
 defines the page using HTML and the default component definitions (no extra
 XML required).


 Gary











 -- Forwarded message --
 From: Siva Jagadeesan [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Date: Fri, 23 Sep 2005 16:08:43 +
 Subject: [Shale] Having a static HTML inside a dynamic HTML page
 I was wondering whether there is a way to instruct clay to ignore some
 tags
 and just render them the way they are.

 For example, I am using FORM based authentication. I dont want clay to
 change anything in my login.html. What I did is I changed login.html to
 login.htm and by passed Clay. It worked great. But now I want to add a
 logout button in login.htm and tie to a listener. I am not sure how I
 could
 do it.

 Is there anyway I could do something like this,

 span jfcid=bypass
 !-- login form --
 /span
 input type=submit value=logout/ !-- This will be attached to the
 listener --





Re: [Shale] Having a static HTML inside a dynamic HTML page

2005-09-23 Thread Gary VanMatre
Gary thanks for ur reply.

The problem is I want LoginForm action to be j_acegi_security_check
form action=j_acegi_security_check method=POST
/form

The only I could make it render this way is my bypassing clay. But for my
logout button,
input type=submit value=logout jsfid=mybutton / I need to go thru Clay
:(

I like your idea about creating a bypass or clayIgnore block.  It would be 
a new feature.  I'll see if I can get that done. 

I can think of a way to handle today as a compromise.  You could load a 
document into a jsf outputText component using the shape validator.  Maybe 
something like this:

-- html
!-- inserting a vanilla form here -- 
span jsfid=clayInclude  url=/login.htm managedBeanName=mybean  
shapeValidator=#{managed-bean-name.includeLoginForm} /


-- xml def (metadata attributes that are not component properties end up in 
the attributes map)
component jsfid=clayInclude extends=clay
 attributes
 set name=url /
 /attributes
/component


-- managed bean
mybean:

public void includeLoginForm(FacesContext context, UIComponent clay, Object 
displayElement) {

  ComponentBea root = (ComponentBean) displayElement;
  
  //make the root a verbatim component
  root.setComponentType(javax.faces.HtmlOutputText);
  
  String url = (String) clay.getAttributes().get(url);


  //use the external context to load a file into a buffer
  StringBuffer buff = new StringBuffer();
  InputStream in = context.getExternalContext().getResourceAsStream(url);
   read file into buffer ...

  //include the payload as a value attribute
  AttributeBean attr = new AttributeBean();
  attr.setName(value);
  attr.setValue(buff.toString());
  root.addAttribute(attr);

  //leave the html special chars
  attr = new AttributeBean();
  attr.setName(escape);
  attr.setValue(Boolean.FALSE.toString());
  root.addAttribute(attr);

  //don't cache server side state for the monster
  attr = new AttributeBean();
  attr.setName(isTransient);
  attr.setValue(Boolean.TRUE.toString());
  root.addAttribute(attr);
}


I think that something simple like this might be good in the Clay baseline. 

Gary







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Shale] Having a static HTML inside a dynamic HTML page

2005-09-23 Thread Siva Jagadeesan
Thanx Gary for your help.
Yah bypass or clayignore block will be useful feature. Thanx for taking
the initiative.

About your other solution, I will try it tonite and let you know how it
goes.



On 9/23/05, Gary VanMatre [EMAIL PROTECTED] wrote:

 Gary thanks for ur reply.
 
 The problem is I want LoginForm action to be j_acegi_security_check
 form action=j_acegi_security_check method=POST
 /form
 
 The only I could make it render this way is my bypassing clay. But for my
 logout button,
 input type=submit value=logout jsfid=mybutton / I need to go thru
 Clay
 :(

 I like your idea about creating a bypass or clayIgnore block. It would
 be a new feature. I'll see if I can get that done.

 I can think of a way to handle today as a compromise. You could load a
 document into a jsf outputText component using the shape validator. Maybe
 something like this:

 -- html
 !-- inserting a vanilla form here --
 span jsfid=clayInclude url=/login.htm managedBeanName=mybean
 shapeValidator=#{managed-bean-name.includeLoginForm} /


 -- xml def (metadata attributes that are not component properties end up
 in the attributes map)
 component jsfid=clayInclude extends=clay
 attributes
 set name=url /
 /attributes
 /component


 -- managed bean
 mybean:

 public void includeLoginForm(FacesContext context, UIComponent clay,
 Object displayElement) {

 ComponentBea root = (ComponentBean) displayElement;

 //make the root a verbatim component
 root.setComponentType(javax.faces.HtmlOutputText);

 String url = (String) clay.getAttributes().get(url);


 //use the external context to load a file into a buffer
 StringBuffer buff = new StringBuffer();
 InputStream in = context.getExternalContext().getResourceAsStream(url);
  read file into buffer ...

 //include the payload as a value attribute
 AttributeBean attr = new AttributeBean();
 attr.setName(value);
 attr.setValue(buff.toString());
 root.addAttribute(attr);

 //leave the html special chars
 attr = new AttributeBean();
 attr.setName(escape);
 attr.setValue(Boolean.FALSE.toString());
 root.addAttribute(attr);

 //don't cache server side state for the monster
 attr = new AttributeBean();
 attr.setName(isTransient);
 attr.setValue(Boolean.TRUE.toString());
 root.addAttribute(attr);
 }


 I think that something simple like this might be good in the Clay
 baseline.

 Gary