Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Rushabh Vashi

Greenhorn
+ Follow
since Apr 27, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rushabh Vashi

Dear All,

I have enabled multicast address in JBOSS 5 EAP cluster. I am trying to lookup using autodiscovery. I am getting connectionTimeout.

PFB is my client code.

Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
p.put("jnp.disableDiscovery", "false");
p.put("jnp.partitionName", "RushabhPartition");
p.put("jnp.discoveryGroup", "239.255.88.71");
p.put("jnp.discoveryPort", "1102");
InitialContext ctx = new InitialContext(p);

In my server too, autodiscovery is enabled.

Please help me.
6 years ago
Hi All,

I am using JBOSS 5 EAP application server for our product.
We have created two separate nodes for testing node1 and node2.

I have done following for enabling clustering,
-> Gave partition name in startup file
-> Gave same multicast address.

My node1 is running on 1699 (JNDI) and 1700 (HA-JNDI)
and node2 is running on 1799 (JNDI) and 1800 (HA-JNDI)

I want to achieve below scenario,

If node1 gets fail, all request coming to 1700 port should be diverted in cluster's node2 (means 1800 port) and vice versa for node2.

I can achieve this using giving two jndi properties list in lookup code,
i.e
"p.put(Context.PROVIDER_URL, "192.168.6.102:1700,192.168.6.102:1800");"

Is this the proper way?

I want to give only "192.168.6.102:1700" and if node1 is disabled, then request should be forwarded to node2, as both nodes were in same cluster.

Please help me.

Thanks,
Rushabh
6 years ago

Rushabh Vashi wrote:Hi friends I am creating my application using Struts2 and JasperReports.
I have created PDF files using Action class itself.

Here is my Struts.xml file




Here i want to save my PDF file on my dream destination.For that i am using exportParamMap.
http://struts.apache.org/2.x/docs/jasperreports-plugin.html
As per documentation we can use "JRExporterParameter" by passing values into Map.

In my Action class i am using following code to populate my Map.



By doing that my PDF is getting generated but i am not able to retrieve that file on destination i mentioned.
I am using the same parameters for creating conventionally and in that case it is getting generated at desired place.

I think there might be some issue while populating Map.

If you have any idea please let me know.

Thanks in advance
Rushabh

9 years ago
Hi friends I am creating my application using Struts2 and JasperReports.
I have created PDF files using Action class itself.

Here is my Struts.xml file




Here i want to save my PDF file on my dream destination.For that i am using exportParamMap.
http://struts.apache.org/2.x/docs/jasperreports-plugin.html
As per documentation we can use "JRExporterParameter" by passing values into Map.

In my Action class i am using following code to populate my Map.



By doing that my PDF is getting generated but i am not able to retrieve that file on destination i mentioned.
I am using the same parameters for creating conventionally and in that case it is getting generated at desired place.

I think there might be some issue while populating Map.

If you have any idea please let me know.

Thanks in advance
Rushabh
9 years ago
Hello friends,

Here i am using two action class

<action name="paramExampleAnotherAction" class="ParamExample.AnotherAction">
<result name="SUCCESS">/paramExample/result.jsp</result>
</action>

<action name="paramExampleAction" class="ParamExample.MyAction">
<param name="nameAction">Rushabh123456</param>
<result name="SUCCESS" type="redirectAction">paramExampleAnotherAction.action</result>
</action>


now i have created getter-setter of nameAction into both classes,now i want to retrive the value of nameAction into result.jsp page.

by simply writing <s:property value="nameAction"/> it is not getting the value,

My question is can we use the value of param which we have declared in 1st action declaration into another action class???if uyes then how?


Thanking you:
Rushabh
9 years ago
Hello friends,
I am working on one struts2 application,

My struts.xml file action mapping looks like this:

<action name="fileUpload" class="Upload.FileUpload">
<interceptor-ref name="fileUploadStack" />
<param name="hello">Rushabh</param>
<result name="input">/upload/upload.jsp</result>
<result name="success">/upload/upload-success.jsp</result>
<result name="SUCCESS">/common/update.jsp</result>
</action>

now i want to use the value of "hello" param in my FileUpload class...

What should i do friends???

I am stuck with these


Thank you:
Rushabh
9 years ago
Hey can you tell me how you are retriving values of these params in Action class??
9 years ago
Hi all.....

I am creating my application using struts2...
I have define variable parameters in my .properties file....

the code of properties file is:

ordercheckout.creditholdflagbusiness1.message1=The order total $ {0} exceeds this account's credit limit of $ {1}

Now i want to use this label in my JSP page....

I have written a code lyk this in JSP....

<s:text name="%{getText('ordercheckout.creditholdflagbusiness1.message1',{#session.openOrder.orderTotal,#session.selectedServiceLocation.businessId.creditLimit})}" />

but it is showing me output like this....

The order total $ 2,748,586.5 exceeds this accounts credit limit of $ {1}

what sholud i do???


Help me...
Thank you in advance....


9 years ago
Hello friends
I am facing some issues with result tags.....
can anybody tell me the exact meaning of
<result name="SUCCESS" type="dispatcher">location.jsp</result>
and
<result name="SUCCESS" type="redirect">location.jsp</result>
9 years ago
Hey...

I resolved that problem.
I actually called that servlet using its URL pattern in the struts.xml file only...

here is that code of action in struts.xml

<action name="ServletCallingAction" class="example.ServletCallingAction">
<result>/ServletCallingActionServlet</result>
</action>

and the servet is actully getting the input page as its previous page....

m happy...
9 years ago
yeah i do the same thing...and its working....thnx bro..
9 years ago
No i cant see my SOP...
but i found another way to get to know that interceptors are being called or not...
I just returned STATUS from intercept()...
and in struts.xml file i set <result=STATUS>somepage.jsp</result>

and its working....
yepiiiiiiiiii
9 years ago
Robin John

Thank you for replying...

I have tried your code also but still it is not working....

and bro as i am new to struts2, can you please tell me why it is not appropriate using servlets in application?

As i know in struts2 MVC architecture is achieved by Filter,Action and Results....
now i am doing all controlling related thing using Actions classes only which i have declared in struts.xml....
so what is exact use of Filters in Struts2???

In normal MVC architecture we are using Servlets as a controller then cant we use them in struts2???
9 years ago
Hello friends,

I am trying to create my application and need help of interceptors.

I have created Interceptor class named
InterceptorExample

package example;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class InterceptorExample implements Interceptor
{

private static final long serialVersionUID = 1L;

public String intercept(ActionInvocation in) throws Exception
{

String className = in.getAction().getClass().getName();
long startTime = System.currentTimeMillis();

System.out.println("Before calling action: " + className);

String result = in.invoke();

long endTime = System.currentTimeMillis();
System.out.println("After calling action: " + className + " Time taken: " + (endTime - startTime) + " ms");

return result;
}

public void destroy()
{
System.out.println("Destroying Interceptor...");
}
public void init()
{
System.out.println("Initializing Interceptor...");
}
}



My struts.xml file is:

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">;

<struts>
<package name="default" extends="struts-default">
<interceptors>
<interceptor name="interceptorTest" class="example.InterceptorExample">
</interceptor>
</interceptors>

<action name="HelloWorld" class="example.HelloWorld">
<interceptor-ref name="interceptorTest"></interceptor-ref>
<result>/example/HelloWorld.jsp</result>
</action>

</package>

</struts>



Now when i am trying to run my project on tomcat..it runs fine but I am not having any effects of interceptors.

What should i do to create workable from interceptors???

Is there any chances in struts.xml file or Interceptor class???

Please help me i m stuck
9 years ago
Robin John

Thank you for the reply...

i just want to know that how we can call servlet through JSP in Struts2 Application.

I have created simple web application.in that i create One JSP file and one Servlet. Now if i try to call servlet from JSP i can do using <form action="./UrlServlet">...but if i try to migrate this code with my application it shows following error

HTTP Status 404 - There is no Action mapped for namespace / and action name ServletTest.

i have pasted my web.xml as well as index.jsp file in my previous post.

Sugggest me what should i do...

Thank You in advance:
9 years ago