how do i return to an actions input page/action? in struts1 there was the mapping.getInputForward() method, maybe i'm blind but i haven't found an equivalent in struts2.
thanks in advance.
Use a forward tag in the Strut config action. Like <forward
name="success" path=/"whateverActionYouNeed.do"/>
Take care
Bye
-----Original Message-----
From: wanginfo [mailto:wanginfo@(protected)]
Sent: Monday, August 18, 2008 3:01 PM
To: Struts Mail List
Subject: struts2 getInputForward()
how do i return to an actions input page/action? in struts1 there was
the mapping.getInputForward() method, maybe i'm blind but i haven't
found an equivalent in struts2.
thanks in advance.
look for Redirect (Action) Result.
/Stephan
> Maybe these resources can help:
>
> http://struts.apache.org/2.x/docs/bootstrap.html
> http://struts.apache.org/2.x/docs/selecting-results.html
> http://struts.apache.org/2.x/docs/result-configuration.html
> http://struts.apache.org/2.x/docs/result-types.html
>
> Nils-H
>
> On Mon, Aug 18, 2008 at 11:31 AM, wanginfo <wanginfo@(protected):
> > how do i return to an actions input page/action? in struts1 there was
> the mapping.getInputForward() method, maybe i'm blind but i haven't found an
> equivalent in struts2.
> >
> > thanks in advance.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
Annother middle way would be to use the "plain text result" and no separate class attribute like this
<action name="intro" >
<interceptor-ref name="myAuth"/>
<result type="plaintext">/intro.html</result>
</action>
Advantages:
-no own Action class (ActionSupport is used)
-your static resources don't get processed which should save time
-you can still your Security interceptors to check the Authentication and Authorization of the user
/Stephan
> >> Roger wrote:
> >> > Having followed this group for a while I know that the generally
> >> accepted
> >> > wisdom is that every page should be handled via an Action. However, I
> >> > have an application that is probably going to be 70% static pages
> with
> >> > 30% Strut-able actions to handle form entry etc etc. This means that
> >> I'm
> >> > going to have an awful lot of action classes that do nothing other
> than
> >> > display the next page which feels kludgy. How would people deal with
> >> > this?
> >> >
> >> > Regards
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@(protected)
Attachments aren't propagated to the mailing list. If you really think a screenshot is the best way to capture textual information you could post it to any of several free internet picture sites.
More information would be... helpful. Things like the configuration of the action that's throwing the exception.
Dave
--- On Mon, 8/18/08, Pranab <chinu.struts@(protected):
> From: Pranab <chinu.struts@(protected)>
> Subject: NullPointer Exception On IE7
> To: user@(protected)
> Cc: ayushverma@(protected)
> Date: Monday, August 18, 2008, 5:24 AM
> Hi Folks,
>
> We are facing NullPointer Exceptions in IE7, though such
> error are not coming in IE6, actually this error is coming
> at our client on IE7 only. We unable to recreate the same at
> our side even in IE7.
>
> Implementation-Version: 1.0
> Specification-Title: Struts Framework
> Specification-Version: 1.0
> Implementation-Title: Struts Framework
> Extension-Name: Struts Framework
> Created-By: Ant 1.4.1
> Internet Explorer: 7.0
> JRE: 1.4.x
> Plumtree Portal: version 4.5 WS1
> Deployment Server: Weblogic 8.1 SP5
>
> Also please find attached is the screen shot of error for
> your reference. We have implemented the Struts based web
> application on Plumtree portal.
>
> If checking log, only one session is showing for each
> nullpointer exceptions nothing else.
>
> Please let me know if you need anymore details on this.
>
> -
> Pranab---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)
Thanks Dave, if this violates the mailing list policy then I'm sorry for that.
But the amazing thing is that I'm not getting any sort of error in log with descriptive information. The application is working very fine at our end, also for most of the users only few people are getting NullPointer Exceptions.
Whenever they are trying to search a project, the application searches it in the database and open the result in a new window. And the error is displaying in that window.
Struts-config.xml
=================
Error:
<global-forwards type="
org.apache.struts.action.ActionForward">
...
<forward name="unexpectedError" path="/error/Error.jsp" />
...
</global-forwards>
.
.
.
.
<action path="/projectSearch"
type="com.myapp.projecttracking.search.ProjectSearch"
name="projectSearchForm"
input="/main/projectSearch.jsp"
validate="true"
scope="session">
<forward name="success" path="/main/projectSearchResults.jsp"/>
<forward name="newSearch" path="/setupProjectSearch.do"/>
</action>
====================
ProjectSearch.java
==================
public class ProjectSearch extends Action {
static Logger log = Logger.getLogger(ProjectSearch.class);
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
HttpSession session = request.getSession();
GSServices gs = (GSServices) (session.getServletContext().getAttribute(Constants.GSServices));
Properties props = gs.getAdminSettings();
log.debug("Propos: "+props);
ProjectSearchForm searchForm = (ProjectSearchForm) form;
session.setAttribute(Constants.SEARCHFORM,searchForm);
String memberID = (String) session.getAttribute("memberID");
/* Temporary Change to run the application --- Tarun Kumar
String memberID = gs.getGatewaySpecificConfig().getProperty(GSServices.PT_USER_NAME);
log.debug("User name="+memberID);
memberID = memberID.substring(memberID.lastIndexOf('\\') + 1);
*/
//Catchall if some page wants to redisplay search results but form is null
if (searchForm == null) {
return mapping.findForward("newSearch");
}
searchForm.setMemberID(memberID);
int pageSize = Constants.DEFAULT_PAGE_SIZE;
try {
int i=searchForm.getResultsPerPage();
if (i >= Constants.MIN_PAGE_SIZE || i <= Constants.MAX_PAGE_SIZE) {
pageSize = i;
}
} catch (NumberFormatException e) {
pageSize = Constants.DEFAULT_PAGE_SIZE;
}
searchForm.setPageSize(pageSize);
String pageRequested = request.getParameter(Constants.RK_PAGE_NUMBER);
if (pageRequested != null) {
try {
searchForm.setPageRequested(Integer.parseInt(pageRequested));
} catch(NumberFormatException e) {
//page number specified in the HTTP request was not a number, ignore
}
} else {
searchForm.setPageRequested(1);
}
String sortByField = request.getParameter(Constants.RK_SORT_BY_FIELD);
if (sortByField != null) {
try {
searchForm.setSortByField(Integer.parseInt(sortByField));
} catch(NumberFormatException e) {
//page number specified in the HTTP request was not a number, ignore
}
}
ActionErrors errors = new ActionErrors();
try {
SearchCommand search = new SearchCommand();
//ProjectSearchForm implements ISearchCriteria, so we can
//safely pass it to the business layer without tying the
//business layer to Struts or the Servlet API
log.debug("Before searching ");
log.debug("User's Adgroups are : "+(ArrayList)session.getAttribute(Constants.SK_ADGROUPS));
ArrayList arradgroups= (ArrayList)session.getAttribute(Constants.SK_ADGROUPS);
String adgroup;
boolean isGPCMember= false;
boolean isLPCMember= false;
if(arradgroups!=null){
Iterator iter = arradgroups.iterator();
while (iter.hasNext()) {
adgroup= (String) iter.next();
if(Constants.ROLE_GPC.equals(adgroup)){
isGPCMember=true;
}
if(Constants.ROLE_LPC.equals(adgroup)){
isLPCMember=true;
}
}
}
SearchResults results = search.execute(props, searchForm, false, isGPCMember, false, isLPCMember);
log.debug(".............After search.execute...........results.toString()===="+results.toString());
request.setAttribute(Constants.RK_SEARCH_RESULTS, results);
session.setAttribute(Constants.ISEDITABLE,Boolean.FALSE);
return mapping.findForward("success");
} catch (NullPointerException e) {
log.error(e);
//Another action was likely trying to redisplay search results, but the
//search criteria form is not in a valid state
return mapping.findForward("newSearch");
} catch (Exception e) {
try
{
SchedulerVO vo = new SchedulerVO();
//Properties props = ((GSServices) session.getServletContext().getAttribute(Constants.GSServices)).getAdminSettings();
TransactionContext tc = new TransactionContext(props, false);
vo.setDetailMessage(e.toString());
vo.setSpecificMessage("Error in getting search results");
vo.setFormData(searchForm.toString());
Util.errorTrack(tc, vo);
}
catch (Exception ex)
{
log.error("Exception in inserting Error in DB from ProjectSearch.");
}
log.error(e.getMessage());
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.message", e.getMessage()));
saveErrors(request, errors);
return mapping.findForward("unexpectedError");
}
}
}
==================
Error.jsp, timeout.jsp, and NotAuthorized.jsp are three error pages in my application.
Let me know if I'm wrong at any point.
- Pranab
On Mon, 18 Aug 2008 Dave Newton wrote :
>Attachments aren't propagated to the mailing list. If you really think a screenshot is the best way to capture textual information you could post it to any of several free internet picture sites.
>
>More information would be... helpful. Things like the configuration of the action that's throwing the exception.
>
>Dave
>
>
>--- On Mon, 8/18/08, Pranab <chinu.struts@(protected):
>
> > From: Pranab <chinu.struts@(protected)>
> > Subject: NullPointer Exception On IE7
> > To: user@(protected)
> > Cc: ayushverma@(protected)
> > Date: Monday, August 18, 2008, 5:24 AM
> > Hi Folks,
> >
> > We are facing NullPointer Exceptions in IE7, though such
> > error are not coming in IE6, actually this error is coming
> > at our client on IE7 only. We unable to recreate the same at
> > our side even in IE7.
> >
> > Implementation-Version: 1.0
> > Specification-Title: Struts Framework
> > Specification-Version: 1.0
> > Implementation-Title: Struts Framework
> > Extension-Name: Struts Framework
> > Created-By: Ant 1.4.1
> > Internet Explorer: 7.0
> > JRE: 1.4.x
> > Plumtree Portal: version 4.5 WS1
> > Deployment Server: Weblogic 8.1 SP5
> >
> > Also please find attached is the screen shot of error for
> > your reference. We have implemented the Struts based web
> > application on Plumtree portal.
> >
> > If checking log, only one session is showing for each
> > nullpointer exceptions nothing else.
> >
> > Please let me know if you need anymore details on this.
> >
> > -
> > Pranab---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail:
> > user-help@(protected)
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@(protected)
>For additional commands, e-mail: user-help@(protected)
>
Thank you.
Warm regards,
Muralidhar Y
muralidhary@(protected)
US Main: 877 KENSIUM (536.7486)
India Main: +91 9949495511
India Fax: +91 9949495522
Kensium
200 S Wacker Dr, Suite 3100
Chicago, IL 60606
Confidentiality Note:
-----------------------------
The information contained in this e-mail is strictly confidential and for
the intended use of the addressee only. Any disclosure, use or copying of
the information by anyone other than the intended recipient is prohibited.
If you have received this message in error, please notify the sender
immediately by return e-mail and securely discard this message.
________________________________
-----Original Message-----
From: Dave Newton [mailto:newton.dave@(protected)]
Sent: Monday, August 18, 2008 4:08 PM
To: Struts Users Mailing List
Subject: Re: problem with checkbox
--- On Mon, 8/18/08, Muralidhar Y wrote:
> Hi , when I typed the code in my jsp like the following
>
> <s:checkbox name="searchedPoP%{#stat.index}"
> value="one" />
>
> In the html file the following code is being shown. By
> default the attribute value is being true. Instead I want
> to give some other value. Kindly help.
>
> <input type="checkbox" name="searchedPoP0" value="true"
> id="addPalettePoP_searchedPoP0"/>
Do you have an action property named "one"? Value attributes are objects,
not strings:
http://struts.apache.org/2.x/docs/tag-syntax.html
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)
Hi friends I am facing the following error. I hope the execute method is not
working. This is working fine few minutes ago. Suddenly started this error.
No configuration found for the specified action: 'executePoPSearch.action'
in namespace: '/p'. Form action defaulting to 'action' attribute's literal
value.
My config in xml is
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="PoP-SearchConfig" namespace="/p" extends="PoP-default">
<default-interceptor-ref name="defaultStack" />
<action name="executePoPSearch"
class="org.paradigmpop.mypopproject.search.actions.ExecutePoPSearchAction">
<result name="success">/p/pop_search_results.jsp</result>
<result name="input">/p/pop_search_results.jsp</result>
<result name="error">/p/pop_search.jsp</result>
</action>
</package>
</struts>
Warm regards,
Muralidhar Y
muralidhary@(protected)
US Main: 877 KENSIUM (536.7486)
India Main: +91 9949495511
India Fax: +91 9949495522
Kensium
200 S Wacker Dr, Suite 3100
Chicago, IL 60606
Confidentiality Note:
-----------------------------
The information contained in this e-mail is strictly confidential and for
the intended use of the addressee only. Any disclosure, use or copying of
the information by anyone other than the intended recipient is prohibited.
If you have received this message in error, please notify the sender
immediately by return e-mail and securely discard this message.
_____