portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajiv balchandani <raji...@yahoo.com>
Subject Re: Need help using Struts with J2
Date Sat, 02 Jun 2007 03:11:54 GMT
Hi Philip 

Thanks a lot Below is my code.

If you look at my code there a method called
onchange="ChangePageSize();"

Now this method will submit the page.

I am currenly using struts bridge.  Can you please
what are the changes i need to do.

<%@ page contentType="text/html;charset=UTF-8"
session="true" %>

<%@ taglib uri="http://struts.apache.org/tags-bean"
prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-logic"
prefix="logic" %>
<%@ taglib
uri="http://portals.apache.org/bridges/struts/tags-portlet-html"
prefix="html" %>
<%@ taglib uri='/WEB-INF/portlet.tld'
prefix='portlet'%>

<%
//   String page_uri =
(String)session.getAttribute("Current_Page");
 //  String uri_prefix =
PageInfo.getPageName(page_uri) +"/";
%>

<portlet:defineObjects/>


<%


out.println("Server
Name=="+renderRequest.getServerName()+"<br>");
out.println("Portlet
Name=="+portletConfig.getPortletName()+"<br>");

javax.portlet.PortletContext context =
portletConfig.getPortletContext();
out.println("context=="+context.toString()+"<br>");
javax.portlet.PortletURL url =
renderResponse.createActionURL();
javax.portlet.PortletURL url1 =
renderResponse.createRenderURL();
out.println("url=="+url.toString()+"<br>");
out.println("url1=="+url1.toString()+"<br>");
%>


<%boolean flag=false;%>
<html:html>
<head>
<title><bean:message key="CompanyForm.title"/></title>
<link href="/struts-demo/include/defaultstyle.css"
type="text/css" rel=stylesheet>
<link href="/struts-demo/include/formstyle.css"
rel="stylesheet" type="text/css">
</head>
<body text=#000000 bgcolor=#ffffff leftmargin=0
topmargin=0 marginheight="0" marginwidth="0">
<html:form action="/jsp/CompanyList.do"
focus="txt_search_companyname">

<input type=text name=test
value="<%=url1.toString()%>" >
<html:text property="test11"
value="<%=url1.toString()%>" />


<table border=0 cellpadding=0 cellspacing=0
id="parent">
  <%@ include file="../include/admin_header.jsp" %>
  <tr> 
    <td valign="top"><table cellspacing=0
cellpadding=0 width="100%" border=0>
        
        <tr>
          <td width="803" valign=top><table
cellspacing=0 cellpadding=0 width=100% border=0>
              
               <tr>
                <td colspan="2" class="btnactbg">
				
<%=userAccess.checkAccess("add","CompanyForm.butAdd","submit","onclick","if(isAllowedToCreateMoreCompanyMaintenance()){Add_Record('CompanyAdd.do');}else{return
false;}","style.buttonStyleClass")%>
					
				
<%=userAccess.checkAccess("modify","CompanyForm.butModify","submit","onclick","return
Modify_Record('CompanyGetrecord.do');","style.buttonStyleClass")%>
				
<%=userAccess.checkAccess("delete","CompanyForm.butDelete","submit","onclick","return
Delete_Record('CompanyDelete.do');","style.buttonStyleClass")%>
					<!--				<img src="/struts-demo/media/btn_lt.gif"
valign="middle"><html:submit property="add"
styleClass="btnhtml"
onclick="Add_Record('CompanyAdd.do');"><bean:message
key="CompanyForm.butAdd"/></html:submit><img
src="/struts-demo/media/btn_rt.gif"><img
src="/struts-demo/media/btn_lt.gif"
valign="middle"><html:submit property="modify"
styleClass="btnhtml" onclick="return
Modify_Record('CompanyGetrecord.do');"><bean:message
key="CompanyForm.butModify"/></html:submit><img
src="/struts-demo/media/btn_rt.gif"><img
src="/struts-demo/media/btn_lt.gif"
valign="middle"><html:submit property="delete"
styleClass="btnhtml" onclick="return
Delete_Record('CompanyDelete.do');"><bean:message
key="CompanyForm.butDelete"/></html:submit><img
src="/struts-demo/media/btn_rt.gif">-->
					&nbsp;
				</td>
              </tr>              
              <tr>
                <td class="scrn_name"><bean:message
key="CompanyForm.listpageheader"/></td>
                <td align="right" class="scrn_name">
				<img src="/struts-demo/media/btn_lt.gif"
valign="middle"><html:button property="view history"
styleClass="btnhtml1"
onclick="Open_Aud_Trl_Win('WFMstAuditTrail.do','mstaudtrlwin','company_pk','CompanyAuditAction','Company
Maintenance');"><bean:message
key="CompanyForm.butViewHistory"/></html:button><img
src="/struts-demo/media/btn_rt.gif">
				<img src="/struts-demo/media/btn_lt.gif"
valign="middle"><html:submit property="search"
styleClass="btnhtml1"
onclick="Search_Record('CompanyList.do');"><bean:message
key="CompanyForm.butSearch"/></html:submit><img
src="/struts-demo/media/btn_rt.gif">
				<img src="/struts-demo/media/btn_lt.gif"
valign="middle"><html:submit property="default"
styleClass="btnhtml1"
onclick="document.forms[0].txt_search_companyname.value='';Default('CompanyList.do');"><bean:message
key="CompanyForm.butDefault"/></html:submit><img
src="/struts-demo/media/btn_rt.gif">
				&nbsp;</td>
              </table>
              <table width="100%" border="0"
cellpadding="2" cellspacing="0" id="content">
                <tr>             
                  <td colspan="6"><html:errors /></td>
                </tr>
				<!-Added->
				<tr>             
                  <td valign="top" width="50%">
		              <table width="100%" border="0"
cellpadding="2" cellspacing="0" id="left">
						<tr class="titles">             
						  <td colspan="2"><bean:message
key="CompanyForm.butSummary"/></td>							
						</tr>				
						
						<%
						
						
//out.println("summaryList=="+request.getAttribute("summaryList"));
						
						%>
						<logic:present name="summaryList">
							<logic:iterate id="summary" name="summaryList">
															
									<bean:define id="strName">
										<bean:write name="summary"
property="strName"/>
									</bean:define>					
									<tr>             
									  <td align="left"><bean:message
key="<%=strName%>"/>&nbsp;</td>
									  <td align="left"><bean:write name="summary"
property="strValue" filter="false"/>&nbsp;</td>
									</tr>						
							</logic:iterate>
						</logic:present>							
					  </table>
				  </td>
				  <td valign="top" width="50%">
		              <table width="100%" border="0"
cellpadding="2" cellspacing="0" id="left">
							<tr class="titles">             
							  <td colspan="2"><bean:message
key="CompanyForm.butSearch"/></td>
							</tr>
							<tr>  							
							  <td><bean:message
key="CompanyForm.txt_companyname.displayname"/>&nbsp;</td>
							  <td><html:text
property="txt_search_companyname"
styleClass="form_text form_200px"
maxlength="100"/>&nbsp;</td>
							</tr>
							<tr>             
							  <td>&nbsp;</td>
							  <td>&nbsp;</td>
							</tr>
							<tr>             
							  <td>&nbsp;</td>
							  <td>&nbsp;</td>
							</tr>
							<tr>             
							  <td>&nbsp;</td>
							  <td>&nbsp;</td>
							</tr>
							
					  </table>
				  </td>
                </tr>
              </table></td>
           <td width="200" valign="top"
class="rt-menu-bgcolor"><%@ include
file="../include/wf_right_menu.jsp" %></td>
		</tr>
        <tr>
          <td colspan=2 valign=top><table width="100%"
border="0" cellpadding="2" cellspacing="1"
id="listing">
            <tr class=listing_tbl_hdr_2x>
              <td width="5%" ><bean:message
key="CompanyForm.listpageColumn0"/><input
type="hidden" name="mode" value="delete"></td>
              <td width="13%"><bean:message
key="CompanyForm.listpageColumn1"/></td>
              <td width="12%"><bean:message
key="CompanyForm.listpageColumn2"/></td>
			  <td width="6%"><bean:message
key="CompanyForm.listpageColumn3"/></td>
			  <td width="6%"><bean:message
key="CompanyForm.listpageColumn4"/></td>
			  <td width="10%"><bean:message
key="CompanyForm.listpageColumn5"/></td>
			  <td width="12%"><bean:message
key="CompanyForm.listpageColumn6"/></td>
			  <td width="12%"><bean:message
key="CompanyForm.listpageColumn7"/></td>
			  <td width="12%"><bean:message
key="CompanyForm.listpageColumn8"/></td>
			  <td width="12%"><bean:message
key="CompanyForm.listpageColumn9"/></td>
            </tr>
            <logic:present name="companies">
				<logic:iterate id="company" name="companies"
indexId="listIndex">
				<% flag=true;%>
					<label for="<%=listIndex%>">
					<tr>
					  <td align="center" class="listing_row_col">
						  <input type="radio" name="company_pk"
id="<%=listIndex%>"  value="<bean:write name='company'
property='company_pk'/>"
<%=(listIndex.toString().equals("0")? "checked" :
"")%>>
					  </td>
					  <td class="listing_row_col"><bean:write
name="company" property="txt_companyname"/></td>
					  <td class="listing_row_col"><bean:write
name="company" property="txt_contact"/></td>
					  <td class="listing_row_col"><bean:write
name="company" property="txt_city"/></td>
					  <td class="listing_row_col"><bean:write
name="company" property="txt_state"/></td>
					  <td class="listing_row_col"><bean:write
name="company" property="txt_country"/></td>
					  <td class="listing_row_col"><bean:write
name="company" property="txt_created_by"/></td>
					  <td align="center"
class="listing_row_col"><bean:write name="company"
property="txt_created_date"/></td>
					  <td class="listing_row_col"><bean:write
name="company" property="txt_modified_by"/>&nbsp;</td>
					  <td align="center"
class="listing_row_col"><bean:write name="company"
property="txt_modified_date"/>&nbsp;</td>
					</tr>
					</label>
				</logic:iterate>
			</logic:present>
			<%
			if(!flag){%>
				<tr> <td align="center" colspan=10><bean:message
key="system.nodatafound"/></td></tr>
			<%}%>

            <tr>
              <td colspan=10><hr width="100%" size="1"
noshade color=#000000>
              </td>
            </tr>
            <tr>
              <td align=right colspan=10>
			  <table width="100%" border="0" cellpadding="0"
cellspacing="0" id="results"> 
				<tr>
					<td class="pers_alrt_txt_10px"><bean:message
key="system.resultsperpage"/>
						<html:select property="selectedPageSize" 
styleClass="pers_alrt_txt_10px" 
onchange="ChangePageSize();">
							<html:optionsCollection property="pageSizeList"
value="strValue" label="strName"/>
						</html:select>
					</td> 
					<td align="right" class="pers_alrt_txt_10px">				
					<logic:present name="pageLinks">
						<logic:iterate id="link" name="pageLinks">
							<bean:write name="link" property="strValue"
filter="false"/>
							<bean:write name="link" property="strName"
filter="false"/>
						</logic:iterate>
					</logic:present>			
					</td> 
				</tr> 
			  </table></td>
            </tr>
          </table></td>
        </tr>
    </table></td>
  </tr>
  <%@ include file="../include/footer.jsp" %>
</table>
<html:hidden property="selectedPageNumber" />

<html:hidden property="noOfCompanyMaintenanceAllowed"
/>
<html:hidden property="noOfCompanyMaintenanceCreated"
/>


<script>
var	noOfCompanyMaintenanceAllowed	=
"<%=jreport.util.PropFileReader.getProperty("NOOFCOMPANYMAINTENANCEALLOWED")%>";

var	msgNoOfCompanyMaintenanceAllowed = "<bean:message
key='CompanyForm.no.of.CompanyMaintenance.exceeded'/>";


</script>

</html:form>
</body>
</html:html>
<script
src="/struts-demo/include/wf_common_functions.js"
language="JavaScript" type="text/JavaScript"></script>
<script
src="/struts-demo/include/wf_functions_company.js"
language="JavaScript" type="text/JavaScript"></script>
<script src="/struts-demo/include/wf_aud_hist.js"
language="JavaScript" type="text/JavaScript"></script>





Thanks

Rajiv
--- Philip Mark Donaghy <pmd@apache.org> wrote:

> Hi,
> 
> On 6/1/07, Philip Mark Donaghy <pmd@apache.org>
> wrote:
> >
> > Are you using the struts bridge?
> >
> > There are a few required steps required to get a
> standard struts
> > application working as a portlet.
> >
> > 1. Use the PortletServlet as you action servlet
> > 2. Replace the struts taglib def with the struts
> bridge taglibs
> > 3. Configure bridges in you portlet.xml
> >
> >     <init-param>
> >       <name>ServletContextProvider</name>
> >      
>
<value>org.apache.jetspeed.portlet.ServletContextProviderImpl
> > </value>
> >     </init-param>
> >     <init-param>
> >       <name>ViewPage</name>
> >       <value>/Beverage/Manage.do</value>
> >     </init-param>
> >     <portlet-name>CRUD Portlet</portlet-name>
> >     <display-name>CRUD Portlet</display-name>
> >    
>
<portlet-class>org.apache.portals.bridges.struts.StrutsPortlet
> > </portlet-class>
> >
> > Philip
> >
> > On 5/31/07, rajiv balchandani <rajivnt@yahoo.com>
> wrote:
> > > Hi All
> > >
> > > I am using J2 and i am implementing with struts.
> > >
> > > I am facing problem in implementing struts with
> J2.
> > >
> > > My problem with that i don't get
> getAttribute("XXX")
> > > in my JSP page.. But while using <html:link
> > > action="/jsp/CompanyList" renderURL="true"
> > > ><bean:message
> > > key="CompanyForm.linkname"/></html:link>
> > >
> > > RenderURL=true i get all the attributes.
> > >
> > > Now when i using the submit() method , so i set
> > > <html:form action="/jsp/CompanyList.do"
> > > focus="txt_search_companyname">
> > >
> > > But whn i do submit again i loose all the
> attributes.
> > > i don't understand whyt i get null for
> getAttribute
> > > after submitting the form.
> >
> > I don't think getAttribute will ever work? You
> must use the portlet
> > api or the struts bridge tags to get attributes.
> >
> > >
> > > Can someone help me to resovle this issue
> please?
> > >
> > >
> > > Also can some give me some examples of
> implemting
> > > struts with J2 and SSO also.
> >
> > Use this guide:
>
http://portals.apache.org/jetspeed-2/guides/guide-sso.html
> 
> 
> This guide is better for your case.
> 
>
http://portals.apache.org/jetspeed-2/guides/guide-tomcat-sso-cross-context-j2-realm.html
> 
> But you can secure the portal without doing this.
> 
> Philip
> 
> >
> > > Thanks
> >
> > You welcome,
> >
> > Philip
> >
> > >
> > >
> > >
> > >
> > >
> >
>
____________________________________________________________________________________
> > > Luggage? GPS? Comic books?
> > > Check out fitting gifts for grads at Yahoo!
> Search
> > >
>
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
> > >
> > >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> jetspeed-dev-unsubscribe@portals.apache.org
> > > For additional commands, e-mail:
> jetspeed-dev-help@portals.apache.org
> > >
> > >
> >
> >
> > --
> > Philip Donaghy
> > Apache Portals (portals.apache.org) PMC member
> > Skype: philipmarkdonaghy
> > Office: +33 5 56 60 88 02
> > Mobile: +33 6 20 83 22 62
> >
> 
> 
> 
> -- 
> Philip Donaghy
> Apache Portals (portals.apache.org) PMC member
> Skype: philipmarkdonaghy
> Office: +33 5 56 60 88 02
> Mobile: +33 6 20 83 22 62
> 



      ____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay it on
us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message